@acorex-platform/module-human-capital-management-client 0.0.21

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 (31) hide show
  1. package/fesm2022/acorex-platform-module-human-capital-management-client-acorex-platform-module-human-capital-management-client-DlWna0Lz.mjs +2297 -0
  2. package/fesm2022/acorex-platform-module-human-capital-management-client-acorex-platform-module-human-capital-management-client-DlWna0Lz.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-human-capital-management-client-approve-leave-request.command-Om_S0k9L.mjs +58 -0
  4. package/fesm2022/acorex-platform-module-human-capital-management-client-approve-leave-request.command-Om_S0k9L.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-human-capital-management-client-assign-position-assignment.command-2iHIogn6.mjs +111 -0
  6. package/fesm2022/acorex-platform-module-human-capital-management-client-assign-position-assignment.command-2iHIogn6.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-human-capital-management-client-cancel-leave-request.command-DGriRFiQ.mjs +58 -0
  8. package/fesm2022/acorex-platform-module-human-capital-management-client-cancel-leave-request.command-DGriRFiQ.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-human-capital-management-client-contracts.mjs +193 -0
  10. package/fesm2022/acorex-platform-module-human-capital-management-client-contracts.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-personal-info.command-DK947cW5.mjs +241 -0
  12. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-personal-info.command-DK947cW5.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-signature.command-CKrcMxqr.mjs +76 -0
  14. package/fesm2022/acorex-platform-module-human-capital-management-client-edit-signature.command-CKrcMxqr.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component-DrRuKQ6Q.mjs +87 -0
  16. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component-DrRuKQ6Q.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component.provider-DPH0YiDP.mjs +23 -0
  18. package/fesm2022/acorex-platform-module-human-capital-management-client-profile-documents-panel.component.provider-DPH0YiDP.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-human-capital-management-client-reject-leave-request.command-O9gipd8g.mjs +61 -0
  20. package/fesm2022/acorex-platform-module-human-capital-management-client-reject-leave-request.command-O9gipd8g.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-human-capital-management-client-revoke-position-assignment.command-DmVlDQ8_.mjs +108 -0
  22. package/fesm2022/acorex-platform-module-human-capital-management-client-revoke-position-assignment.command-DmVlDQ8_.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs +248 -0
  24. package/fesm2022/acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs +250 -0
  26. package/fesm2022/acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-human-capital-management-client.mjs +2 -0
  28. package/fesm2022/acorex-platform-module-human-capital-management-client.mjs.map +1 -0
  29. package/package.json +28 -0
  30. package/types/acorex-platform-module-human-capital-management-client-contracts.d.ts +331 -0
  31. package/types/acorex-platform-module-human-capital-management-client.d.ts +114 -0
@@ -0,0 +1,248 @@
1
+ import { runtimeQueryCollectionData, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';
2
+ import { getRecordWorkflowInstanceId } from '@acorex-platform/framework-shared/entity';
3
+ import { AXDialogService } from '@acorex/components/dialog';
4
+ import { AXToastService } from '@acorex/components/toast';
5
+ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
6
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
7
+ import { AXPQueryService, AXPCommandService } from '@acorex-platform/framework-client/runtime';
8
+ import { ENTITY_QUERY_DEFAULT, ENTITY_UPDATE_DEFAULT } from '@acorex-platform/framework-shared/runtime';
9
+ import { AXPWorkflowManager, AXP_WORKFLOW_ENGINE } from '@acorex-platform/framework-client/workflow';
10
+ import * as i0 from '@angular/core';
11
+ import { inject, Injectable } from '@angular/core';
12
+ import { RootConfig, AXMLeaveRequestOpenStatusIds } from '@acorex-platform/module-human-capital-management-client/contracts';
13
+
14
+ //#endregion
15
+ /**
16
+ * Starts the leave request workflow after ensuring at most one pending request per employee and leave type.
17
+ */
18
+ class StartLeaveRequestFlowCommand {
19
+ constructor() {
20
+ //#region ---- Services & Dependencies ----
21
+ this.dialogService = inject(AXDialogService);
22
+ this.translationService = inject(AXTranslationService);
23
+ this.toastService = inject(AXToastService);
24
+ this.entityService = inject(AXPEntityService);
25
+ this.queryService = inject(AXPQueryService);
26
+ this.commandService = inject(AXPCommandService);
27
+ this.workflowManager = inject(AXPWorkflowManager);
28
+ this.workflowEngine = inject(AXP_WORKFLOW_ENGINE, { optional: true });
29
+ }
30
+ //#endregion
31
+ //#region ---- Command Implementation ----
32
+ async execute(input) {
33
+ const options = (input?.options ?? input);
34
+ const flowInput = options.input;
35
+ const workflowId = options.workflowId?.trim();
36
+ const leaveTypeId = flowInput?.leaveTypeId?.trim();
37
+ const employeeId = this.resolveFlowText(flowInput?.employeeId);
38
+ const employeeDisplayName = this.resolveFlowText(flowInput?.employeeDisplayName);
39
+ const leaveTypeTitleForWorkflow = this.coerceLeaveTypeTitleForWorkflow(flowInput?.leaveTypeTitle);
40
+ const leaveTypeTitleDisplay = this.resolveFlowText(flowInput?.leaveTypeTitle);
41
+ if (!workflowId || !leaveTypeId) {
42
+ return { success: false, message: { text: 'Missing workflow or leave type context.' } };
43
+ }
44
+ try {
45
+ const openRequests = employeeId
46
+ ? await this.findOpenLeaveRequests(employeeId, leaveTypeId)
47
+ : [];
48
+ const orphanInstanceIds = employeeId
49
+ ? await this.findOrphanRunningWorkflowInstanceIds(employeeId, leaveTypeId, workflowId, openRequests)
50
+ : [];
51
+ if (openRequests.length > 0 || orphanInstanceIds.length > 0) {
52
+ const confirmed = await this.confirmReplace(leaveTypeTitleDisplay);
53
+ if (!confirmed) {
54
+ return { success: false };
55
+ }
56
+ await this.closeOpenRuns(openRequests, orphanInstanceIds);
57
+ }
58
+ const correlationId = employeeId
59
+ ? this.buildCorrelationId(employeeId, leaveTypeId, workflowId)
60
+ : undefined;
61
+ const startResult = await this.workflowManager.start(workflowId, {
62
+ leaveTypeId,
63
+ ...(leaveTypeTitleForWorkflow != null ? { leaveTypeTitle: leaveTypeTitleForWorkflow } : {}),
64
+ ...(employeeId ? { employeeId, employeeDisplayName } : {}),
65
+ ...(employeeId
66
+ ? {
67
+ refId: employeeId,
68
+ refType: `${RootConfig.module.name}.Employee`,
69
+ correlationId,
70
+ }
71
+ : {}),
72
+ });
73
+ if (!startResult.success) {
74
+ this.toastService.show({
75
+ color: 'danger',
76
+ title: 'Workflow Execution Failed',
77
+ content: startResult.error ?? 'Unknown error',
78
+ closeButton: true,
79
+ timeOut: 5000,
80
+ });
81
+ return { success: false, message: { text: startResult.error ?? 'Unknown error' } };
82
+ }
83
+ return { success: true, kind: 'object', data: undefined };
84
+ }
85
+ catch (error) {
86
+ const message = error instanceof Error ? error.message : 'Unknown error';
87
+ console.error('[StartLeaveRequestFlowCommand]', error);
88
+ this.toastService.show({
89
+ color: 'danger',
90
+ title: 'Workflow Execution Error',
91
+ content: message,
92
+ closeButton: true,
93
+ timeOut: 5000,
94
+ });
95
+ return { success: false, message: { text: message } };
96
+ }
97
+ }
98
+ //#endregion
99
+ //#region ---- Open-run detection ----
100
+ async findOpenLeaveRequests(employeeId, leaveTypeId) {
101
+ const page = await this.entityService
102
+ .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)
103
+ .data()
104
+ .query({
105
+ skip: 0,
106
+ take: 10,
107
+ filter: {
108
+ logic: 'and',
109
+ filters: [
110
+ { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },
111
+ { field: 'leaveTypeId', operator: { type: 'equal' }, value: leaveTypeId },
112
+ {
113
+ field: 'statusId',
114
+ operator: { type: 'in' },
115
+ value: [...AXMLeaveRequestOpenStatusIds],
116
+ },
117
+ ],
118
+ },
119
+ });
120
+ return (page.items ?? []);
121
+ }
122
+ async findOrphanRunningWorkflowInstanceIds(employeeId, leaveTypeId, workflowId, openRequests) {
123
+ const linkedInstanceIds = new Set(openRequests
124
+ .map((row) => getRecordWorkflowInstanceId(row))
125
+ .filter((id) => !!id));
126
+ try {
127
+ const result = await this.queryService.fetch(ENTITY_QUERY_DEFAULT, {
128
+ entity: 'WorkflowManagement.WorkflowInstance',
129
+ skip: 0,
130
+ take: 50,
131
+ filter: {
132
+ logic: 'and',
133
+ filters: [
134
+ {
135
+ field: 'definitionId',
136
+ operator: { type: 'equal' },
137
+ value: workflowId,
138
+ },
139
+ { field: 'status', operator: { type: 'equal' }, value: 'Running' },
140
+ ],
141
+ },
142
+ });
143
+ const items = (runtimeQueryCollectionData(result)?.items ?? []);
144
+ return items
145
+ .filter((row) => {
146
+ const id = row.id?.trim();
147
+ if (!id || linkedInstanceIds.has(id)) {
148
+ return false;
149
+ }
150
+ const runInput = row.workflowInstance?.workflowState?.input ?? {};
151
+ return runInput['employeeId'] === employeeId && runInput['leaveTypeId'] === leaveTypeId;
152
+ })
153
+ .map((row) => row.id);
154
+ }
155
+ catch {
156
+ return [];
157
+ }
158
+ }
159
+ //#endregion
160
+ //#region ---- Close and replace ----
161
+ async confirmReplace(leaveTypeTitle) {
162
+ const title = await this.translationService.translateAsync('@human-capital-management:leave-requests.messages.replace-open.confirm.title');
163
+ const message = await this.translationService.translateAsync('@human-capital-management:leave-requests.messages.replace-open.confirm.message', {
164
+ params: {
165
+ leaveTypeTitle: String(leaveTypeTitle ?? '').trim() || '—',
166
+ },
167
+ });
168
+ const result = await this.dialogService.confirm(title, message, 'warning', 'horizontal', false, 'cancel');
169
+ return result.result === true;
170
+ }
171
+ async closeOpenRuns(openRequests, orphanInstanceIds) {
172
+ const data = this.entityService
173
+ .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)
174
+ .data();
175
+ const supersedeNote = 'Closed to start a new leave request run.';
176
+ for (const request of openRequests) {
177
+ await data.update(request.id, {
178
+ statusId: AXPSystemStatusType.Cancelled,
179
+ reason: supersedeNote,
180
+ });
181
+ const instanceId = getRecordWorkflowInstanceId(request);
182
+ if (instanceId) {
183
+ await this.cancelWorkflowInstance(instanceId);
184
+ }
185
+ }
186
+ for (const instanceId of orphanInstanceIds) {
187
+ await this.cancelWorkflowInstance(instanceId);
188
+ }
189
+ }
190
+ async cancelWorkflowInstance(instanceId) {
191
+ const engine = this.workflowEngine;
192
+ if (engine?.cancelInstance) {
193
+ await engine.cancelInstance(instanceId, 'superseded');
194
+ return;
195
+ }
196
+ const now = new Date().toISOString();
197
+ try {
198
+ await this.commandService.execute(ENTITY_UPDATE_DEFAULT, {
199
+ entity: 'WorkflowManagement.WorkflowInstance',
200
+ id: instanceId,
201
+ status: 'Finished',
202
+ subStatus: 'Cancelled',
203
+ finishedAt: now,
204
+ updatedAt: now,
205
+ });
206
+ }
207
+ catch (error) {
208
+ console.warn('[StartLeaveRequestFlowCommand] Failed to cancel workflow instance:', instanceId, error);
209
+ }
210
+ }
211
+ //#endregion
212
+ //#region ---- Helpers ----
213
+ resolveFlowText(value) {
214
+ if (value == null || value === false) {
215
+ return '';
216
+ }
217
+ if (typeof value === 'string') {
218
+ return value.trim();
219
+ }
220
+ if (typeof value === 'number' || typeof value === 'boolean') {
221
+ return String(value).trim();
222
+ }
223
+ return resolveMultiLanguageString(value, this.translationService.getActiveLang()).trim();
224
+ }
225
+ /** Preserves multi-language leave type titles on the workflow instance for locale-aware task labels. */
226
+ coerceLeaveTypeTitleForWorkflow(value) {
227
+ if (value == null) {
228
+ return undefined;
229
+ }
230
+ if (typeof value === 'object') {
231
+ return value;
232
+ }
233
+ const trimmed = value.trim();
234
+ return trimmed.length > 0 ? trimmed : undefined;
235
+ }
236
+ buildCorrelationId(employeeId, leaveTypeId, workflowId) {
237
+ return `${RootConfig.module.name}.Employee:${employeeId}:${leaveTypeId}:${workflowId}`;
238
+ }
239
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: StartLeaveRequestFlowCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
240
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: StartLeaveRequestFlowCommand, providedIn: 'root' }); }
241
+ }
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: StartLeaveRequestFlowCommand, decorators: [{
243
+ type: Injectable,
244
+ args: [{ providedIn: 'root' }]
245
+ }] });
246
+
247
+ export { StartLeaveRequestFlowCommand };
248
+ //# sourceMappingURL=acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-human-capital-management-client-start-leave-request-flow.command-BcyCI_vr.mjs","sources":["../../../../libs/modules/human-capital-management/client/src/lib/features/leave-request/commands/start-leave-request-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPRuntimeCommandResult,\n AXPSystemStatusType,\n runtimeQueryCollectionData,\n} from '@acorex-platform/framework-shared/core';\nimport { getRecordWorkflowInstanceId } from '@acorex-platform/framework-shared/entity';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXMultiLanguageString, AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService, AXPQueryService } from '@acorex-platform/framework-client/runtime';\nimport { ENTITY_QUERY_DEFAULT, ENTITY_UPDATE_DEFAULT } from '@acorex-platform/framework-shared/runtime';\n\nimport {\n AXP_WORKFLOW_ENGINE,\n AXPWorkflowEngine,\n AXPWorkflowManager,\n} from '@acorex-platform/framework-client/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-human-capital-management-client/contracts';\nimport { AXMLeaveRequestOpenStatusIds } from '@acorex-platform/module-human-capital-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartLeaveRequestFlowInput {\n workflowId?: string;\n employeeId?: string;\n employeeDisplayName?: string;\n leaveTypeId?: string;\n leaveTypeTitle?: AXMultiLanguageString | string;\n options?: StartLeaveRequestFlowOptions;\n}\n\nexport interface StartLeaveRequestFlowOptions {\n workflowId: string;\n input: {\n employeeId?: string;\n employeeDisplayName?: string;\n leaveTypeId: string;\n leaveTypeTitle?: AXMultiLanguageString | string;\n };\n}\n\ninterface OpenLeaveRequestRow {\n id: string;\n workflowInfo?: { instanceId?: string | null; correlationId?: string | null };\n leaveType?: { title?: AXMultiLanguageString | string };\n}\n\n//#endregion\n\n/**\n * Starts the leave request workflow after ensuring at most one pending request per employee and leave type.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartLeaveRequestFlowCommand implements AXPCommand<StartLeaveRequestFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly dialogService = inject(AXDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly entityService = inject(AXPEntityService);\n private readonly queryService = inject(AXPQueryService);\n private readonly commandService = inject(AXPCommandService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE, { optional: true });\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartLeaveRequestFlowInput): AXPCommandExecuteResultPromise<void> {\n const options = (input?.options ?? input) as StartLeaveRequestFlowOptions;\n const flowInput = options.input;\n const workflowId = options.workflowId?.trim();\n const leaveTypeId = flowInput?.leaveTypeId?.trim();\n const employeeId = this.resolveFlowText(flowInput?.employeeId);\n const employeeDisplayName = this.resolveFlowText(flowInput?.employeeDisplayName);\n const leaveTypeTitleForWorkflow = this.coerceLeaveTypeTitleForWorkflow(flowInput?.leaveTypeTitle);\n const leaveTypeTitleDisplay = this.resolveFlowText(flowInput?.leaveTypeTitle);\n\n if (!workflowId || !leaveTypeId) {\n return { success: false, message: { text: 'Missing workflow or leave type context.' } };\n }\n\n try {\n const openRequests = employeeId\n ? await this.findOpenLeaveRequests(employeeId, leaveTypeId)\n : [];\n const orphanInstanceIds = employeeId\n ? await this.findOrphanRunningWorkflowInstanceIds(\n employeeId,\n leaveTypeId,\n workflowId,\n openRequests,\n )\n : [];\n\n if (openRequests.length > 0 || orphanInstanceIds.length > 0) {\n const confirmed = await this.confirmReplace(leaveTypeTitleDisplay);\n if (!confirmed) {\n return { success: false };\n }\n await this.closeOpenRuns(openRequests, orphanInstanceIds);\n }\n\n const correlationId = employeeId\n ? this.buildCorrelationId(employeeId, leaveTypeId, workflowId)\n : undefined;\n\n const startResult = await this.workflowManager.start(workflowId, {\n leaveTypeId,\n ...(leaveTypeTitleForWorkflow != null ? { leaveTypeTitle: leaveTypeTitleForWorkflow } : {}),\n ...(employeeId ? { employeeId, employeeDisplayName } : {}),\n ...(employeeId\n ? {\n refId: employeeId,\n refType: `${RootConfig.module.name}.Employee`,\n correlationId,\n }\n : {}),\n });\n\n if (!startResult.success) {\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Failed',\n content: startResult.error ?? 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: startResult.error ?? 'Unknown error' } };\n }\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartLeaveRequestFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Error',\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Open-run detection ----\n\n private async findOpenLeaveRequests(\n employeeId: string,\n leaveTypeId: string,\n ): Promise<OpenLeaveRequestRow[]> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data()\n .query({\n skip: 0,\n take: 10,\n filter: {\n logic: 'and',\n filters: [\n { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },\n { field: 'leaveTypeId', operator: { type: 'equal' }, value: leaveTypeId },\n {\n field: 'statusId',\n operator: { type: 'in' },\n value: [...AXMLeaveRequestOpenStatusIds],\n },\n ],\n },\n });\n\n return (page.items ?? []) as OpenLeaveRequestRow[];\n }\n\n private async findOrphanRunningWorkflowInstanceIds(\n employeeId: string,\n leaveTypeId: string,\n workflowId: string,\n openRequests: OpenLeaveRequestRow[],\n ): Promise<string[]> {\n const linkedInstanceIds = new Set(\n openRequests\n .map((row) => getRecordWorkflowInstanceId(row))\n .filter((id): id is string => !!id),\n );\n\n try {\n const result = await this.queryService.fetch(ENTITY_QUERY_DEFAULT, {\n entity: 'WorkflowManagement.WorkflowInstance',\n skip: 0,\n take: 50,\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'definitionId',\n operator: { type: 'equal' },\n value: workflowId,\n },\n { field: 'status', operator: { type: 'equal' }, value: 'Running' },\n ],\n },\n });\n\n const items = (runtimeQueryCollectionData(result)?.items ?? []) as Array<{\n id?: string;\n workflowInstance?: { workflowState?: { input?: Record<string, unknown> } };\n }>;\n\n return items\n .filter((row) => {\n const id = row.id?.trim();\n if (!id || linkedInstanceIds.has(id)) {\n return false;\n }\n const runInput = row.workflowInstance?.workflowState?.input ?? {};\n return runInput['employeeId'] === employeeId && runInput['leaveTypeId'] === leaveTypeId;\n })\n .map((row) => row.id as string);\n } catch {\n return [];\n }\n }\n\n //#endregion\n\n //#region ---- Close and replace ----\n\n private async confirmReplace(leaveTypeTitle: string | undefined): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@human-capital-management:leave-requests.messages.replace-open.confirm.title',\n );\n const message = await this.translationService.translateAsync(\n '@human-capital-management:leave-requests.messages.replace-open.confirm.message',\n {\n params: {\n leaveTypeTitle: String(leaveTypeTitle ?? '').trim() || '—',\n },\n },\n );\n const result = await this.dialogService.confirm(title, message, 'warning', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private async closeOpenRuns(\n openRequests: OpenLeaveRequestRow[],\n orphanInstanceIds: string[],\n ): Promise<void> {\n const data = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.leaveRequest.name)\n .data();\n\n const supersedeNote = 'Closed to start a new leave request run.';\n\n for (const request of openRequests) {\n await data.update(request.id, {\n statusId: AXPSystemStatusType.Cancelled,\n reason: supersedeNote,\n } as never);\n\n const instanceId = getRecordWorkflowInstanceId(request);\n if (instanceId) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n for (const instanceId of orphanInstanceIds) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n private async cancelWorkflowInstance(instanceId: string): Promise<void> {\n const engine = this.workflowEngine as AXPWorkflowEngine | null;\n if (engine?.cancelInstance) {\n await engine.cancelInstance(instanceId, 'superseded');\n return;\n }\n\n const now = new Date().toISOString();\n try {\n await this.commandService.execute(ENTITY_UPDATE_DEFAULT, {\n entity: 'WorkflowManagement.WorkflowInstance',\n id: instanceId,\n status: 'Finished',\n subStatus: 'Cancelled',\n finishedAt: now,\n updatedAt: now,\n });\n } catch (error: unknown) {\n console.warn('[StartLeaveRequestFlowCommand] Failed to cancel workflow instance:', instanceId, error);\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private resolveFlowText(value: unknown): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value).trim();\n }\n return resolveMultiLanguageString(value as never, this.translationService.getActiveLang()).trim();\n }\n\n /** Preserves multi-language leave type titles on the workflow instance for locale-aware task labels. */\n private coerceLeaveTypeTitleForWorkflow(\n value: AXMultiLanguageString | string | undefined,\n ): AXMultiLanguageString | string | undefined {\n if (value == null) {\n return undefined;\n }\n if (typeof value === 'object') {\n return value;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n }\n\n private buildCorrelationId(employeeId: string, leaveTypeId: string, workflowId: string): string {\n return `${RootConfig.module.name}.Employee:${employeeId}:${leaveTypeId}:${workflowId}`;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuDA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC;AACtC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;QAC5C,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AA8QlF,IAAA;;;IAxQC,MAAM,OAAO,CAAC,KAAiC,EAAA;QAC7C,MAAM,OAAO,IAAI,KAAK,EAAE,OAAO,IAAI,KAAK,CAAiC;AACzE,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK;QAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE;QAC7C,MAAM,WAAW,GAAG,SAAS,EAAE,WAAW,EAAE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C,CAAC,IAAI,EAAE;IACnG;;AAGQ,IAAA,+BAA+B,CACrC,KAAiD,EAAA;AAEjD,QAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACjB,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,YAAA,OAAO,KAAK;QACd;AACA,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE;AAC5B,QAAA,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,SAAS;IACjD;AAEQ,IAAA,kBAAkB,CAAC,UAAkB,EAAE,WAAmB,EAAE,UAAkB,EAAA;AACpF,QAAA,OAAO,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,UAAA,EAAa,UAAU,CAAA,CAAA,EAAI,WAAW,CAAA,CAAA,EAAI,UAAU,EAAE;IACxF;8GArRW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,250 @@
1
+ import { runtimeQueryCollectionData, AXPSystemStatusType } from '@acorex-platform/framework-shared/core';
2
+ import { getRecordWorkflowInstanceId } from '@acorex-platform/framework-shared/entity';
3
+ import { AXDialogService } from '@acorex/components/dialog';
4
+ import { AXToastService } from '@acorex/components/toast';
5
+ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
6
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
7
+ import { AXPQueryService, AXPCommandService } from '@acorex-platform/framework-client/runtime';
8
+ import { ENTITY_QUERY_DEFAULT, ENTITY_UPDATE_DEFAULT } from '@acorex-platform/framework-shared/runtime';
9
+ import { AXPWorkflowManager, AXP_WORKFLOW_ENGINE } from '@acorex-platform/framework-client/workflow';
10
+ import * as i0 from '@angular/core';
11
+ import { inject, Injectable } from '@angular/core';
12
+ import { RootConfig, AXMLifecycleEventOpenStatusIds } from '@acorex-platform/module-human-capital-management-client/contracts';
13
+
14
+ //#endregion
15
+ /**
16
+ * Starts the guided lifecycle workflow after ensuring at most one in-progress event per employee and event type.
17
+ */
18
+ class StartLifecycleEventFlowCommand {
19
+ constructor() {
20
+ //#region ---- Services & Dependencies ----
21
+ this.dialogService = inject(AXDialogService);
22
+ this.translationService = inject(AXTranslationService);
23
+ this.toastService = inject(AXToastService);
24
+ this.entityService = inject(AXPEntityService);
25
+ this.queryService = inject(AXPQueryService);
26
+ this.commandService = inject(AXPCommandService);
27
+ this.workflowManager = inject(AXPWorkflowManager);
28
+ this.workflowEngine = inject(AXP_WORKFLOW_ENGINE, { optional: true });
29
+ }
30
+ //#endregion
31
+ //#region ---- Command Implementation ----
32
+ async execute(input) {
33
+ const options = (input?.options ?? input);
34
+ const flowInput = options.input;
35
+ const workflowId = options.workflowId?.trim();
36
+ const employeeId = this.resolveFlowText(flowInput?.employeeId);
37
+ const eventTypeId = flowInput?.eventTypeId?.trim();
38
+ const employeeDisplayName = this.resolveFlowText(flowInput?.employeeDisplayName);
39
+ const eventTypeTitleForWorkflow = this.coerceEventTypeTitleForWorkflow(flowInput?.eventTypeTitle);
40
+ const eventTypeTitleDisplay = this.resolveFlowText(flowInput?.eventTypeTitle);
41
+ const assessmentCaseTitle = this.resolveFlowText(flowInput?.assessmentCaseTitle) ||
42
+ this.buildAssessmentCaseTitle(eventTypeTitleDisplay, employeeDisplayName);
43
+ if (!workflowId || !employeeId || !eventTypeId) {
44
+ return { success: false, message: { text: 'Missing workflow or employee context.' } };
45
+ }
46
+ try {
47
+ const openEvents = await this.findOpenLifecycleEvents(employeeId, eventTypeId);
48
+ const orphanInstanceIds = await this.findOrphanRunningWorkflowInstanceIds(employeeId, eventTypeId, workflowId, openEvents);
49
+ if (openEvents.length > 0 || orphanInstanceIds.length > 0) {
50
+ const confirmed = await this.confirmReplace(eventTypeTitleDisplay);
51
+ if (!confirmed) {
52
+ return { success: false };
53
+ }
54
+ await this.closeOpenRuns(openEvents, orphanInstanceIds);
55
+ }
56
+ const startResult = await this.workflowManager.start(workflowId, {
57
+ employeeId,
58
+ employeeDisplayName,
59
+ eventTypeId: flowInput.eventTypeId,
60
+ ...(eventTypeTitleForWorkflow != null ? { eventTypeTitle: eventTypeTitleForWorkflow } : {}),
61
+ assessmentCaseTitle,
62
+ questionnaireId: flowInput.questionnaireId,
63
+ ...(flowInput.effectiveDate ? { effectiveDate: flowInput.effectiveDate } : {}),
64
+ refId: employeeId,
65
+ refType: `${RootConfig.module.name}.Employee`,
66
+ correlationId: this.buildCorrelationId(employeeId, eventTypeId, workflowId),
67
+ });
68
+ if (!startResult.success) {
69
+ this.toastService.show({
70
+ color: 'danger',
71
+ title: 'Workflow Execution Failed',
72
+ content: startResult.error ?? 'Unknown error',
73
+ closeButton: true,
74
+ timeOut: 5000,
75
+ });
76
+ return { success: false, message: { text: startResult.error ?? 'Unknown error' } };
77
+ }
78
+ return { success: true, kind: 'object', data: undefined };
79
+ }
80
+ catch (error) {
81
+ const message = error instanceof Error ? error.message : 'Unknown error';
82
+ console.error('[StartLifecycleEventFlowCommand]', error);
83
+ this.toastService.show({
84
+ color: 'danger',
85
+ title: 'Workflow Execution Error',
86
+ content: message,
87
+ closeButton: true,
88
+ timeOut: 5000,
89
+ });
90
+ return { success: false, message: { text: message } };
91
+ }
92
+ }
93
+ //#endregion
94
+ //#region ---- Open-run detection ----
95
+ async findOpenLifecycleEvents(employeeId, eventTypeId) {
96
+ const page = await this.entityService
97
+ .withEntity(RootConfig.module.name, RootConfig.entities.lifecycleEvent.name)
98
+ .data()
99
+ .query({
100
+ skip: 0,
101
+ take: 10,
102
+ filter: {
103
+ logic: 'and',
104
+ filters: [
105
+ { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },
106
+ { field: 'eventTypeId', operator: { type: 'equal' }, value: eventTypeId },
107
+ {
108
+ field: 'statusId',
109
+ operator: { type: 'in' },
110
+ value: [...AXMLifecycleEventOpenStatusIds],
111
+ },
112
+ ],
113
+ },
114
+ });
115
+ return (page.items ?? []);
116
+ }
117
+ async findOrphanRunningWorkflowInstanceIds(employeeId, eventTypeId, workflowId, openEvents) {
118
+ const linkedInstanceIds = new Set(openEvents
119
+ .map((row) => getRecordWorkflowInstanceId(row))
120
+ .filter((id) => !!id));
121
+ try {
122
+ const result = await this.queryService.fetch(ENTITY_QUERY_DEFAULT, {
123
+ entity: 'WorkflowManagement.WorkflowInstance',
124
+ skip: 0,
125
+ take: 50,
126
+ filter: {
127
+ logic: 'and',
128
+ filters: [
129
+ {
130
+ field: 'definitionId',
131
+ operator: { type: 'equal' },
132
+ value: workflowId,
133
+ },
134
+ { field: 'status', operator: { type: 'equal' }, value: 'Running' },
135
+ ],
136
+ },
137
+ });
138
+ const items = (runtimeQueryCollectionData(result)?.items ?? []);
139
+ return items
140
+ .filter((row) => {
141
+ const id = row.id?.trim();
142
+ if (!id || linkedInstanceIds.has(id)) {
143
+ return false;
144
+ }
145
+ const runInput = row.workflowInstance?.workflowState?.input ?? {};
146
+ return runInput['employeeId'] === employeeId && runInput['eventTypeId'] === eventTypeId;
147
+ })
148
+ .map((row) => row.id);
149
+ }
150
+ catch {
151
+ return [];
152
+ }
153
+ }
154
+ //#endregion
155
+ //#region ---- Close and replace ----
156
+ async confirmReplace(eventTypeTitle) {
157
+ const title = await this.translationService.translateAsync('@human-capital-management:lifecycle-events.messages.replace-open.confirm.title');
158
+ const message = await this.translationService.translateAsync('@human-capital-management:lifecycle-events.messages.replace-open.confirm.message', {
159
+ params: {
160
+ eventTypeTitle: String(eventTypeTitle ?? '').trim() || '—',
161
+ },
162
+ });
163
+ const result = await this.dialogService.confirm(title, message, 'warning', 'horizontal', false, 'cancel');
164
+ return result.result === true;
165
+ }
166
+ async closeOpenRuns(openEvents, orphanInstanceIds) {
167
+ const data = this.entityService
168
+ .withEntity(RootConfig.module.name, RootConfig.entities.lifecycleEvent.name)
169
+ .data();
170
+ const supersedeNote = 'Closed to start a new lifecycle run.';
171
+ for (const event of openEvents) {
172
+ await data.update(event.id, {
173
+ statusId: AXPSystemStatusType.Cancelled,
174
+ notes: supersedeNote,
175
+ });
176
+ const instanceId = getRecordWorkflowInstanceId(event);
177
+ if (instanceId) {
178
+ await this.cancelWorkflowInstance(instanceId);
179
+ }
180
+ }
181
+ for (const instanceId of orphanInstanceIds) {
182
+ await this.cancelWorkflowInstance(instanceId);
183
+ }
184
+ }
185
+ async cancelWorkflowInstance(instanceId) {
186
+ const engine = this.workflowEngine;
187
+ if (engine?.cancelInstance) {
188
+ await engine.cancelInstance(instanceId, 'superseded');
189
+ return;
190
+ }
191
+ const now = new Date().toISOString();
192
+ try {
193
+ await this.commandService.execute(ENTITY_UPDATE_DEFAULT, {
194
+ entity: 'WorkflowManagement.WorkflowInstance',
195
+ id: instanceId,
196
+ status: 'Finished',
197
+ subStatus: 'Cancelled',
198
+ finishedAt: now,
199
+ updatedAt: now,
200
+ });
201
+ }
202
+ catch (error) {
203
+ console.warn('[StartLifecycleEventFlowCommand] Failed to cancel workflow instance:', instanceId, error);
204
+ }
205
+ }
206
+ //#endregion
207
+ //#region ---- Helpers ----
208
+ /** Normalizes workflow start input that may be plain text, ML, or a failed expression (`false`). */
209
+ resolveFlowText(value) {
210
+ if (value == null || value === false) {
211
+ return '';
212
+ }
213
+ if (typeof value === 'string') {
214
+ return value.trim();
215
+ }
216
+ if (typeof value === 'number' || typeof value === 'boolean') {
217
+ return String(value).trim();
218
+ }
219
+ return resolveMultiLanguageString(value, this.translationService.getActiveLang()).trim();
220
+ }
221
+ /** Preserves multi-language event type titles on the workflow instance for locale-aware task labels. */
222
+ coerceEventTypeTitleForWorkflow(value) {
223
+ if (value == null) {
224
+ return undefined;
225
+ }
226
+ if (typeof value === 'object') {
227
+ return value;
228
+ }
229
+ const trimmed = value.trim();
230
+ return trimmed.length > 0 ? trimmed : undefined;
231
+ }
232
+ buildAssessmentCaseTitle(eventTypeTitle, employeeDisplayName) {
233
+ if (eventTypeTitle && employeeDisplayName) {
234
+ return `${eventTypeTitle} — ${employeeDisplayName}`;
235
+ }
236
+ return eventTypeTitle || employeeDisplayName;
237
+ }
238
+ buildCorrelationId(employeeId, eventTypeId, workflowId) {
239
+ return `${RootConfig.module.name}.Employee:${employeeId}:${eventTypeId}:${workflowId}`;
240
+ }
241
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: StartLifecycleEventFlowCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
242
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: StartLifecycleEventFlowCommand, providedIn: 'root' }); }
243
+ }
244
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: StartLifecycleEventFlowCommand, decorators: [{
245
+ type: Injectable,
246
+ args: [{ providedIn: 'root' }]
247
+ }] });
248
+
249
+ export { StartLifecycleEventFlowCommand };
250
+ //# sourceMappingURL=acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-human-capital-management-client-start-lifecycle-event-flow.command-Cp_7ZyWU.mjs","sources":["../../../../libs/modules/human-capital-management/client/src/lib/features/lifecycle-event/commands/start-lifecycle-event-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPRuntimeCommandResult,\n AXPSystemStatusType,\n runtimeQueryCollectionData,\n} from '@acorex-platform/framework-shared/core';\nimport { getRecordWorkflowInstanceId } from '@acorex-platform/framework-shared/entity';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService, resolveMultiLanguageString, type AXMultiLanguageString } from '@acorex/core/translation';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService, AXPQueryService } from '@acorex-platform/framework-client/runtime';\nimport { ENTITY_QUERY_DEFAULT, ENTITY_UPDATE_DEFAULT } from '@acorex-platform/framework-shared/runtime';\n\nimport {\n AXP_WORKFLOW_ENGINE,\n AXPWorkflowEngine,\n AXPWorkflowManager,\n} from '@acorex-platform/framework-client/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-human-capital-management-client/contracts';\nimport {\n AXMLifecycleEventOpenStatusIds,\n} from '@acorex-platform/module-human-capital-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartLifecycleEventFlowInput {\n workflowId?: string;\n employeeId?: string;\n employeeDisplayName?: string;\n eventTypeId?: string;\n eventTypeTitle?: AXMultiLanguageString | string;\n questionnaireId?: string;\n targetEmployeeStatusId?: string;\n effectiveDate?: string;\n options?: StartLifecycleEventFlowOptions;\n}\n\nexport interface StartLifecycleEventFlowOptions {\n workflowId: string;\n input: {\n employeeId: string;\n employeeDisplayName: string;\n eventTypeId: string;\n eventTypeTitle?: AXMultiLanguageString | string;\n questionnaireId: string;\n effectiveDate?: string;\n /** Precomposed case/popup title; computed by StartFlow when omitted. */\n assessmentCaseTitle?: string;\n };\n}\n\ninterface OpenLifecycleEventRow {\n id: string;\n workflowInfo?: { instanceId?: string | null; correlationId?: string | null };\n eventType?: { title?: unknown };\n}\n\n//#endregion\n\n/**\n * Starts the guided lifecycle workflow after ensuring at most one in-progress event per employee and event type.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartLifecycleEventFlowCommand implements AXPCommand<StartLifecycleEventFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly dialogService = inject(AXDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly entityService = inject(AXPEntityService);\n private readonly queryService = inject(AXPQueryService);\n private readonly commandService = inject(AXPCommandService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE, { optional: true });\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartLifecycleEventFlowInput): AXPCommandExecuteResultPromise<void> {\n const options = (input?.options ?? input) as StartLifecycleEventFlowOptions;\n const flowInput = options.input;\n const workflowId = options.workflowId?.trim();\n const employeeId = this.resolveFlowText(flowInput?.employeeId);\n const eventTypeId = flowInput?.eventTypeId?.trim();\n const employeeDisplayName = this.resolveFlowText(flowInput?.employeeDisplayName);\n const eventTypeTitleForWorkflow = this.coerceEventTypeTitleForWorkflow(flowInput?.eventTypeTitle);\n const eventTypeTitleDisplay = this.resolveFlowText(flowInput?.eventTypeTitle);\n const assessmentCaseTitle =\n this.resolveFlowText(flowInput?.assessmentCaseTitle) ||\n this.buildAssessmentCaseTitle(eventTypeTitleDisplay, employeeDisplayName);\n\n if (!workflowId || !employeeId || !eventTypeId) {\n return { success: false, message: { text: 'Missing workflow or employee context.' } };\n }\n\n try {\n const openEvents = await this.findOpenLifecycleEvents(employeeId, eventTypeId);\n const orphanInstanceIds = await this.findOrphanRunningWorkflowInstanceIds(\n employeeId,\n eventTypeId,\n workflowId,\n openEvents,\n );\n\n if (openEvents.length > 0 || orphanInstanceIds.length > 0) {\n const confirmed = await this.confirmReplace(eventTypeTitleDisplay);\n if (!confirmed) {\n return { success: false };\n }\n await this.closeOpenRuns(openEvents, orphanInstanceIds);\n }\n\n const startResult = await this.workflowManager.start(workflowId, {\n employeeId,\n employeeDisplayName,\n eventTypeId: flowInput.eventTypeId,\n ...(eventTypeTitleForWorkflow != null ? { eventTypeTitle: eventTypeTitleForWorkflow } : {}),\n assessmentCaseTitle,\n questionnaireId: flowInput.questionnaireId,\n ...(flowInput.effectiveDate ? { effectiveDate: flowInput.effectiveDate } : {}),\n refId: employeeId,\n refType: `${RootConfig.module.name}.Employee`,\n correlationId: this.buildCorrelationId(employeeId, eventTypeId, workflowId),\n });\n\n if (!startResult.success) {\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Failed',\n content: startResult.error ?? 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: startResult.error ?? 'Unknown error' } };\n }\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartLifecycleEventFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Error',\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Open-run detection ----\n\n private async findOpenLifecycleEvents(\n employeeId: string,\n eventTypeId: string,\n ): Promise<OpenLifecycleEventRow[]> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.lifecycleEvent.name)\n .data()\n .query({\n skip: 0,\n take: 10,\n filter: {\n logic: 'and',\n filters: [\n { field: 'employeeId', operator: { type: 'equal' }, value: employeeId },\n { field: 'eventTypeId', operator: { type: 'equal' }, value: eventTypeId },\n {\n field: 'statusId',\n operator: { type: 'in' },\n value: [...AXMLifecycleEventOpenStatusIds],\n },\n ],\n },\n });\n\n return (page.items ?? []) as OpenLifecycleEventRow[];\n }\n\n private async findOrphanRunningWorkflowInstanceIds(\n employeeId: string,\n eventTypeId: string,\n workflowId: string,\n openEvents: OpenLifecycleEventRow[],\n ): Promise<string[]> {\n const linkedInstanceIds = new Set(\n openEvents\n .map((row) => getRecordWorkflowInstanceId(row))\n .filter((id): id is string => !!id),\n );\n\n try {\n const result = await this.queryService.fetch(ENTITY_QUERY_DEFAULT, {\n entity: 'WorkflowManagement.WorkflowInstance',\n skip: 0,\n take: 50,\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'definitionId',\n operator: { type: 'equal' },\n value: workflowId,\n },\n { field: 'status', operator: { type: 'equal' }, value: 'Running' },\n ],\n },\n });\n\n const items = (runtimeQueryCollectionData(result)?.items ?? []) as Array<{\n id?: string;\n workflowInstance?: { workflowState?: { input?: Record<string, unknown> } };\n }>;\n\n return items\n .filter((row) => {\n const id = row.id?.trim();\n if (!id || linkedInstanceIds.has(id)) {\n return false;\n }\n const runInput = row.workflowInstance?.workflowState?.input ?? {};\n return runInput['employeeId'] === employeeId && runInput['eventTypeId'] === eventTypeId;\n })\n .map((row) => row.id as string);\n } catch {\n return [];\n }\n }\n\n //#endregion\n\n //#region ---- Close and replace ----\n\n private async confirmReplace(eventTypeTitle: string | undefined): Promise<boolean> {\n const title = await this.translationService.translateAsync(\n '@human-capital-management:lifecycle-events.messages.replace-open.confirm.title',\n );\n const message = await this.translationService.translateAsync(\n '@human-capital-management:lifecycle-events.messages.replace-open.confirm.message',\n {\n params: {\n eventTypeTitle: String(eventTypeTitle ?? '').trim() || '—',\n },\n },\n );\n const result = await this.dialogService.confirm(title, message, 'warning', 'horizontal', false, 'cancel');\n return result.result === true;\n }\n\n private async closeOpenRuns(\n openEvents: OpenLifecycleEventRow[],\n orphanInstanceIds: string[],\n ): Promise<void> {\n const data = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.lifecycleEvent.name)\n .data();\n\n const supersedeNote = 'Closed to start a new lifecycle run.';\n\n for (const event of openEvents) {\n await data.update(event.id, {\n statusId: AXPSystemStatusType.Cancelled,\n notes: supersedeNote,\n } as never);\n\n const instanceId = getRecordWorkflowInstanceId(event);\n if (instanceId) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n for (const instanceId of orphanInstanceIds) {\n await this.cancelWorkflowInstance(instanceId);\n }\n }\n\n private async cancelWorkflowInstance(instanceId: string): Promise<void> {\n const engine = this.workflowEngine as AXPWorkflowEngine | null;\n if (engine?.cancelInstance) {\n await engine.cancelInstance(instanceId, 'superseded');\n return;\n }\n\n const now = new Date().toISOString();\n try {\n await this.commandService.execute(ENTITY_UPDATE_DEFAULT, {\n entity: 'WorkflowManagement.WorkflowInstance',\n id: instanceId,\n status: 'Finished',\n subStatus: 'Cancelled',\n finishedAt: now,\n updatedAt: now,\n });\n } catch (error: unknown) {\n console.warn('[StartLifecycleEventFlowCommand] Failed to cancel workflow instance:', instanceId, error);\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /** Normalizes workflow start input that may be plain text, ML, or a failed expression (`false`). */\n private resolveFlowText(value: unknown): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value).trim();\n }\n return resolveMultiLanguageString(value as never, this.translationService.getActiveLang()).trim();\n }\n\n /** Preserves multi-language event type titles on the workflow instance for locale-aware task labels. */\n private coerceEventTypeTitleForWorkflow(\n value: AXMultiLanguageString | string | undefined,\n ): AXMultiLanguageString | string | undefined {\n if (value == null) {\n return undefined;\n }\n if (typeof value === 'object') {\n return value;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n }\n\n private buildAssessmentCaseTitle(eventTypeTitle: string, employeeDisplayName: string): string {\n if (eventTypeTitle && employeeDisplayName) {\n return `${eventTypeTitle} — ${employeeDisplayName}`;\n }\n return eventTypeTitle || employeeDisplayName;\n }\n\n private buildCorrelationId(employeeId: string, eventTypeId: string, workflowId: string): string {\n return `${RootConfig.module.name}.Employee:${employeeId}:${eventTypeId}:${workflowId}`;\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC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,CAAC,GAAG,OAAO,GAAG,SAAS;IACjD;IAEQ,wBAAwB,CAAC,cAAsB,EAAE,mBAA2B,EAAA;AAClF,QAAA,IAAI,cAAc,IAAI,mBAAmB,EAAE;AACzC,YAAA,OAAO,CAAA,EAAG,cAAc,CAAA,GAAA,EAAM,mBAAmB,EAAE;QACrD;QACA,OAAO,cAAc,IAAI,mBAAmB;IAC9C;AAEQ,IAAA,kBAAkB,CAAC,UAAkB,EAAE,WAAmB,EAAE,UAAkB,EAAA;AACpF,QAAA,OAAO,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,UAAA,EAAa,UAAU,CAAA,CAAA,EAAI,WAAW,CAAA,CAAA,EAAI,UAAU,EAAE;IACxF;8GAxRW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA9B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,cADjB,MAAM,EAAA,CAAA,CAAA;;2FACnB,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,2 @@
1
+ export { a as AXMHumanCapitalManagementModule, b as AXMLeaveRequestBadgeProvider, c as AXMLeaveRequestResourceAppointmentProvider, d as AXMLeaveRequestTaskPopoverComponent, e as AXPHumanCapitalManagementFeatureDefinitionProvider, f as AXPLeaveRequestDialogService, H as HumanCapitalManagementManifest } from './acorex-platform-module-human-capital-management-client-acorex-platform-module-human-capital-management-client-DlWna0Lz.mjs';
2
+ //# sourceMappingURL=acorex-platform-module-human-capital-management-client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-human-capital-management-client.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@acorex-platform/module-human-capital-management-client",
3
+ "version": "0.0.21",
4
+ "sideEffects": false,
5
+ "peerDependencies": {
6
+ "@angular/common": "^21.0.0",
7
+ "@angular/core": "^21.0.0"
8
+ },
9
+ "dependencies": {
10
+ "tslib": "^2.3.0"
11
+ },
12
+ "module": "fesm2022/acorex-platform-module-human-capital-management-client.mjs",
13
+ "typings": "types/acorex-platform-module-human-capital-management-client.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/acorex-platform-module-human-capital-management-client.d.ts",
20
+ "default": "./fesm2022/acorex-platform-module-human-capital-management-client.mjs"
21
+ },
22
+ "./contracts": {
23
+ "types": "./types/acorex-platform-module-human-capital-management-client-contracts.d.ts",
24
+ "default": "./fesm2022/acorex-platform-module-human-capital-management-client-contracts.mjs"
25
+ }
26
+ },
27
+ "type": "module"
28
+ }