@acorex-platform/module-software-management-client 1.0.2 → 2.0.0-beta.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 (70) hide show
  1. package/fesm2022/{acorex-platform-module-software-management-client-accept-software-suggestion.command-DVcM5TTv.mjs → acorex-platform-module-software-management-client-accept-software-suggestion.command-BzPDjIw0.mjs} +7 -6
  2. package/fesm2022/acorex-platform-module-software-management-client-accept-software-suggestion.command-BzPDjIw0.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-software-management-client-behavior-specification.commands-4rkD2uP9.mjs +212 -0
  4. package/fesm2022/acorex-platform-module-software-management-client-behavior-specification.commands-4rkD2uP9.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-software-management-client-behavior-task.activities-WmCC3-3L.mjs +79 -0
  6. package/fesm2022/acorex-platform-module-software-management-client-behavior-task.activities-WmCC3-3L.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C61GUc78.mjs +512 -0
  8. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C61GUc78.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-software-management-client-contracts-acceptance-criterion.entity-CHEusZ4z.mjs +62 -0
  10. package/fesm2022/acorex-platform-module-software-management-client-contracts-acceptance-criterion.entity-CHEusZ4z.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-software-management-client-contracts-business-rule.entity-Cew1yY4A.mjs +76 -0
  12. package/fesm2022/acorex-platform-module-software-management-client-contracts-business-rule.entity-Cew1yY4A.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-software-management-client-contracts-design-decision.entity-BDRnAUj9.mjs +94 -0
  14. package/fesm2022/acorex-platform-module-software-management-client-contracts-design-decision.entity-BDRnAUj9.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-software-management-client-contracts-discovery-item.entity-Ah5hlc5n.mjs +71 -0
  16. package/fesm2022/acorex-platform-module-software-management-client-contracts-discovery-item.entity-Ah5hlc5n.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-software-management-client-contracts-feature.entity-D9es0yAv.mjs +49 -0
  18. package/fesm2022/acorex-platform-module-software-management-client-contracts-feature.entity-D9es0yAv.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-software-management-client-contracts-module.entity-E9XKlo1v.mjs +26 -0
  20. package/fesm2022/acorex-platform-module-software-management-client-contracts-module.entity-E9XKlo1v.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-software-management-client-contracts-requirement.entity-DKr-En_J.mjs +86 -0
  22. package/fesm2022/acorex-platform-module-software-management-client-contracts-requirement.entity-DKr-En_J.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-software-management-client-contracts-scope-item.entity-D25tkUvi.mjs +73 -0
  24. package/fesm2022/acorex-platform-module-software-management-client-contracts-scope-item.entity-D25tkUvi.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-software-management-client-contracts-software-entity.util-sRHl21Jh.mjs +281 -0
  26. package/fesm2022/acorex-platform-module-software-management-client-contracts-software-entity.util-sRHl21Jh.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-software-management-client-contracts-software.entity-DfeM7KfF.mjs +751 -0
  28. package/fesm2022/acorex-platform-module-software-management-client-contracts-software.entity-DfeM7KfF.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-software-management-client-contracts-use-case.entity-dPBFz-xN.mjs +92 -0
  30. package/fesm2022/acorex-platform-module-software-management-client-contracts-use-case.entity-dPBFz-xN.mjs.map +1 -0
  31. package/fesm2022/acorex-platform-module-software-management-client-contracts.mjs +2709 -156
  32. package/fesm2022/acorex-platform-module-software-management-client-contracts.mjs.map +1 -1
  33. package/fesm2022/acorex-platform-module-software-management-client-delivery-plan.commands-ccrjppbE.mjs +212 -0
  34. package/fesm2022/acorex-platform-module-software-management-client-delivery-plan.commands-ccrjppbE.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-software-management-client-delivery-task.activities-L955X3RX.mjs +216 -0
  36. package/fesm2022/acorex-platform-module-software-management-client-delivery-task.activities-L955X3RX.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-software-management-client-design-document.commands-BDE3x0KG.mjs +212 -0
  38. package/fesm2022/acorex-platform-module-software-management-client-design-document.commands-BDE3x0KG.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-software-management-client-design-task.activities-Cra2LNal.mjs +79 -0
  40. package/fesm2022/acorex-platform-module-software-management-client-design-task.activities-Cra2LNal.mjs.map +1 -0
  41. package/fesm2022/{acorex-platform-module-software-management-client-discovery-kickoff.commands-gB0_htfF.mjs → acorex-platform-module-software-management-client-discovery-kickoff.commands-BZxzDJs9.mjs} +4 -2
  42. package/fesm2022/{acorex-platform-module-software-management-client-discovery-kickoff.commands-gB0_htfF.mjs.map → acorex-platform-module-software-management-client-discovery-kickoff.commands-BZxzDJs9.mjs.map} +1 -1
  43. package/fesm2022/{acorex-platform-module-software-management-client-discovery-report.commands-D2ricLpq.mjs → acorex-platform-module-software-management-client-discovery-report.commands-C9GKrnHs.mjs} +3 -2
  44. package/fesm2022/acorex-platform-module-software-management-client-discovery-report.commands-C9GKrnHs.mjs.map +1 -0
  45. package/fesm2022/acorex-platform-module-software-management-client-discovery-task.activities-PIJEUza7.mjs +228 -0
  46. package/fesm2022/acorex-platform-module-software-management-client-discovery-task.activities-PIJEUza7.mjs.map +1 -0
  47. package/fesm2022/{acorex-platform-module-software-management-client-introduction-exit-message.util-DShFM8MY.mjs → acorex-platform-module-software-management-client-introduction-exit-message.util-cYtN92HY.mjs} +1 -1
  48. package/fesm2022/{acorex-platform-module-software-management-client-introduction-exit-message.util-DShFM8MY.mjs.map → acorex-platform-module-software-management-client-introduction-exit-message.util-cYtN92HY.mjs.map} +1 -1
  49. package/fesm2022/{acorex-platform-module-software-management-client-introduction-task.activities-BOsJbeJe.mjs → acorex-platform-module-software-management-client-introduction-task.activities-DQPpsJaH.mjs} +78 -3
  50. package/fesm2022/acorex-platform-module-software-management-client-introduction-task.activities-DQPpsJaH.mjs.map +1 -0
  51. package/fesm2022/acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs +212 -0
  52. package/fesm2022/acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs.map +1 -0
  53. package/fesm2022/acorex-platform-module-software-management-client-scope-task.activities-BCSPq0eO.mjs +79 -0
  54. package/fesm2022/acorex-platform-module-software-management-client-scope-task.activities-BCSPq0eO.mjs.map +1 -0
  55. package/fesm2022/{acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs → acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs} +1 -1
  56. package/fesm2022/{acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs.map → acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs.map} +1 -1
  57. package/fesm2022/{acorex-platform-module-software-management-client-start-software-definition-flow.command-B0YCgv2V.mjs → acorex-platform-module-software-management-client-start-software-definition-flow.command-BfxtMIGb.mjs} +2 -2
  58. package/fesm2022/{acorex-platform-module-software-management-client-start-software-definition-flow.command-B0YCgv2V.mjs.map → acorex-platform-module-software-management-client-start-software-definition-flow.command-BfxtMIGb.mjs.map} +1 -1
  59. package/fesm2022/acorex-platform-module-software-management-client.mjs +400 -32
  60. package/fesm2022/acorex-platform-module-software-management-client.mjs.map +1 -1
  61. package/i18n/en-AU/software-management.json +473 -24
  62. package/i18n/en-US/software-management.json +473 -24
  63. package/i18n/fa-IR/software-management.json +474 -25
  64. package/package.json +1 -1
  65. package/types/acorex-platform-module-software-management-client-contracts.d.ts +640 -11
  66. package/fesm2022/acorex-platform-module-software-management-client-accept-software-suggestion.command-DVcM5TTv.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C56HhK20.mjs +0 -182
  68. package/fesm2022/acorex-platform-module-software-management-client-complete-software-phase.activity-C56HhK20.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-module-software-management-client-discovery-report.commands-D2ricLpq.mjs.map +0 -1
  70. package/fesm2022/acorex-platform-module-software-management-client-introduction-task.activities-BOsJbeJe.mjs.map +0 -1
@@ -0,0 +1,212 @@
1
+ import { AXToastService } from '@acorex/components/toast';
2
+ import { AXTranslationService } from '@acorex/core/translation';
3
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
4
+ import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';
5
+ import { AXPCommandExecutor } from '@acorex-platform/framework-client/runtime';
6
+ import { resolveMultiLanguageString, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
7
+ import { resolveEntityActionRef } from '@acorex-platform/framework-shared/runtime';
8
+ import { AXPSoftwareManagementCommandKeys, kickoffText, RootConfig, kickoffPlainTextFromVersion } from '@acorex-platform/module-software-management-client/contracts';
9
+ import * as i0 from '@angular/core';
10
+ import { inject, Injectable } from '@angular/core';
11
+ import { r as resolveSoftwareText } from './acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs';
12
+
13
+ //#region ----- Imports -----
14
+ //#endregion
15
+ //#region ----- Helpers -----
16
+ function resolveSoftwareId(input) {
17
+ const resolved = resolveEntityActionRef(input);
18
+ const fromRef = resolveSoftwareText(resolved?.refId);
19
+ if (fromRef) {
20
+ return fromRef;
21
+ }
22
+ if (!input || typeof input !== 'object') {
23
+ return '';
24
+ }
25
+ const row = input;
26
+ return resolveSoftwareText(row['softwareId']) || resolveSoftwareText(row['id']);
27
+ }
28
+ function messageText(result) {
29
+ return resolveMultiLanguageString(result?.message?.text, 'en-US').trim();
30
+ }
31
+ //#endregion
32
+ //#region ----- Remote scope commands -----
33
+ class ScopeDocumentRemoteCommand {
34
+ constructor() {
35
+ this.executor = inject(AXPCommandExecutor);
36
+ this.toast = inject(AXToastService);
37
+ this.i18n = inject(AXTranslationService);
38
+ }
39
+ async execute(input) {
40
+ const softwareId = resolveSoftwareId(input);
41
+ if (!softwareId) {
42
+ const text = await this.i18n.translateAsync('@software-management:messages.kickoff.id-required');
43
+ this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 5000 });
44
+ return { success: false, message: { text } };
45
+ }
46
+ const result = await this.executor.executeRemote(this.commandKey, {
47
+ softwareId,
48
+ locale: this.i18n.getActiveLang?.() ?? 'en-US',
49
+ });
50
+ const text = await this.translateMessage(messageText(result));
51
+ if (!result?.success) {
52
+ this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 6000 });
53
+ return { success: false, message: { text } };
54
+ }
55
+ await this.afterSuccess(runtimeCommandPayloadData(result) ?? undefined);
56
+ this.toast.show({ color: 'success', title: text, content: text, closeButton: true, timeOut: 6000 });
57
+ return result;
58
+ }
59
+ async afterSuccess(data) {
60
+ void data;
61
+ }
62
+ async translateMessage(text) {
63
+ if (!text) {
64
+ return this.i18n.translateAsync('@software-management:messages.scope.failed');
65
+ }
66
+ if (text.startsWith('@')) {
67
+ return this.i18n.translateAsync(text);
68
+ }
69
+ return text;
70
+ }
71
+ }
72
+ class GenerateScopeDocumentCommand extends ScopeDocumentRemoteCommand {
73
+ constructor() {
74
+ super(...arguments);
75
+ this.commandKey = AXPSoftwareManagementCommandKeys.Software.GenerateScopeDocument;
76
+ }
77
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GenerateScopeDocumentCommand, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
78
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GenerateScopeDocumentCommand, providedIn: 'root' }); }
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GenerateScopeDocumentCommand, decorators: [{
81
+ type: Injectable,
82
+ args: [{ providedIn: 'root' }]
83
+ }] });
84
+ class SubmitScopeDocumentCommand extends ScopeDocumentRemoteCommand {
85
+ constructor() {
86
+ super(...arguments);
87
+ this.commandKey = AXPSoftwareManagementCommandKeys.Software.SubmitScopeDocument;
88
+ }
89
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SubmitScopeDocumentCommand, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
90
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SubmitScopeDocumentCommand, providedIn: 'root' }); }
91
+ }
92
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SubmitScopeDocumentCommand, decorators: [{
93
+ type: Injectable,
94
+ args: [{ providedIn: 'root' }]
95
+ }] });
96
+ class ExportScopePdfCommand extends ScopeDocumentRemoteCommand {
97
+ constructor() {
98
+ super(...arguments);
99
+ this.commandKey = AXPSoftwareManagementCommandKeys.Software.ExportScopePdf;
100
+ }
101
+ async afterSuccess(data) {
102
+ const base64 = kickoffText(data?.['base64']);
103
+ if (!base64 || typeof document === 'undefined') {
104
+ return;
105
+ }
106
+ const binary = atob(base64);
107
+ const bytes = new Uint8Array(binary.length);
108
+ for (let index = 0; index < binary.length; index += 1) {
109
+ bytes[index] = binary.charCodeAt(index);
110
+ }
111
+ const blob = new Blob([bytes], { type: 'application/pdf' });
112
+ const url = URL.createObjectURL(blob);
113
+ const anchor = document.createElement('a');
114
+ anchor.href = url;
115
+ anchor.download = kickoffText(data?.['filename']) || 'first-version-scope.pdf';
116
+ anchor.click();
117
+ URL.revokeObjectURL(url);
118
+ }
119
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExportScopePdfCommand, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
120
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExportScopePdfCommand, providedIn: 'root' }); }
121
+ }
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExportScopePdfCommand, decorators: [{
123
+ type: Injectable,
124
+ args: [{ providedIn: 'root' }]
125
+ }] });
126
+ //#endregion
127
+ //#region ----- Read the pinned discovery and open the scope document -----
128
+ class ViewPinnedDiscoveryCommand {
129
+ constructor() {
130
+ this.entityService = inject(AXPEntityService);
131
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
132
+ this.toast = inject(AXToastService);
133
+ this.i18n = inject(AXTranslationService);
134
+ }
135
+ async execute(input) {
136
+ const softwareId = resolveSoftwareId(input);
137
+ const software = softwareId
138
+ ? (await this.entityService
139
+ .withEntity(RootConfig.module.name, RootConfig.entities.software.name)
140
+ .data()
141
+ .byKey(softwareId))
142
+ : null;
143
+ const versionId = kickoffText(software?.discoveryApprovedVersionId);
144
+ if (!versionId) {
145
+ const text = await this.i18n.translateAsync('@software-management:messages.scope.pinned-discovery-missing');
146
+ this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 5000 });
147
+ return { success: false, message: { text } };
148
+ }
149
+ const version = (await this.entityService
150
+ .withEntity('DocumentManagement', 'DocumentVersion')
151
+ .data()
152
+ .byKey(versionId));
153
+ const text = kickoffPlainTextFromVersion(version);
154
+ await this.layoutBuilder
155
+ .create()
156
+ .dialog((dialog) => {
157
+ dialog
158
+ .setTitle('@software-management:actions.view-pinned-discovery.title')
159
+ .setSize('lg')
160
+ .setCloseButton(true)
161
+ .setContext({ text })
162
+ .content((flex) => {
163
+ flex.customWidget('text-block-layout', { content: text || versionId });
164
+ })
165
+ .setActions((actions) => {
166
+ actions.cancel('@general:actions.cancel.title');
167
+ });
168
+ })
169
+ .show();
170
+ return { success: true, kind: 'object', data: { versionId } };
171
+ }
172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ViewPinnedDiscoveryCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
173
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ViewPinnedDiscoveryCommand, providedIn: 'root' }); }
174
+ }
175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ViewPinnedDiscoveryCommand, decorators: [{
176
+ type: Injectable,
177
+ args: [{ providedIn: 'root' }]
178
+ }] });
179
+ class OpenScopeDocumentCommand {
180
+ constructor() {
181
+ this.entityService = inject(AXPEntityService);
182
+ this.executor = inject(AXPCommandExecutor);
183
+ this.toast = inject(AXToastService);
184
+ this.i18n = inject(AXTranslationService);
185
+ }
186
+ async execute(input) {
187
+ const softwareId = resolveSoftwareId(input);
188
+ const software = softwareId
189
+ ? (await this.entityService
190
+ .withEntity(RootConfig.module.name, RootConfig.entities.software.name)
191
+ .data()
192
+ .byKey(softwareId))
193
+ : null;
194
+ const documentId = kickoffText(software?.scopeDocumentId);
195
+ if (!documentId) {
196
+ const text = await this.i18n.translateAsync('@software-management:messages.scope.missing-document');
197
+ this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 5000 });
198
+ return { success: false, message: { text } };
199
+ }
200
+ await this.executor.execute('DocumentManagement.Document:Open', { documentId });
201
+ return { success: true, kind: 'object', data: { documentId } };
202
+ }
203
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: OpenScopeDocumentCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
204
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: OpenScopeDocumentCommand, providedIn: 'root' }); }
205
+ }
206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: OpenScopeDocumentCommand, decorators: [{
207
+ type: Injectable,
208
+ args: [{ providedIn: 'root' }]
209
+ }] });
210
+
211
+ export { ExportScopePdfCommand, GenerateScopeDocumentCommand, OpenScopeDocumentCommand, SubmitScopeDocumentCommand, ViewPinnedDiscoveryCommand };
212
+ //# sourceMappingURL=acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs","sources":["../../../../libs/modules/software-management/client/src/lib/commands/scope-document.commands.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXPCommandExecutor } from '@acorex-platform/framework-client/runtime';\nimport { resolveMultiLanguageString, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPCommand,\n resolveEntityActionRef,\n type AXPCommandExecuteResultPromise,\n} from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPSoftwareManagementCommandKeys,\n kickoffPlainTextFromVersion,\n kickoffText,\n RootConfig,\n type AXMSoftwareManagementSoftwareEntityModel,\n} from '@acorex-platform/module-software-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { resolveSoftwareText } from './software-command.util';\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction resolveSoftwareId(input: unknown): string {\n const resolved = resolveEntityActionRef(input);\n const fromRef = resolveSoftwareText(resolved?.refId);\n if (fromRef) {\n return fromRef;\n }\n if (!input || typeof input !== 'object') {\n return '';\n }\n const row = input as Record<string, unknown>;\n return resolveSoftwareText(row['softwareId']) || resolveSoftwareText(row['id']);\n}\n\nfunction messageText(result: { message?: { text?: unknown } } | null | undefined): string {\n return resolveMultiLanguageString(result?.message?.text, 'en-US').trim();\n}\n\n//#endregion\n\n//#region ----- Remote scope commands -----\n\nabstract class ScopeDocumentRemoteCommand implements AXPCommand<unknown, unknown> {\n protected readonly executor = inject(AXPCommandExecutor);\n protected readonly toast = inject(AXToastService);\n protected readonly i18n = inject(AXTranslationService);\n\n protected abstract readonly commandKey: string;\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<unknown> {\n const softwareId = resolveSoftwareId(input);\n if (!softwareId) {\n const text = await this.i18n.translateAsync('@software-management:messages.kickoff.id-required');\n this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 5000 });\n return { success: false, message: { text } };\n }\n\n const result = await this.executor.executeRemote<unknown, Record<string, unknown>>(this.commandKey, {\n softwareId,\n locale: this.i18n.getActiveLang?.() ?? 'en-US',\n });\n const text = await this.translateMessage(messageText(result));\n if (!result?.success) {\n this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 6000 });\n return { success: false, message: { text } };\n }\n await this.afterSuccess(runtimeCommandPayloadData(result) ?? undefined);\n this.toast.show({ color: 'success', title: text, content: text, closeButton: true, timeOut: 6000 });\n return result;\n }\n\n protected async afterSuccess(data?: Record<string, unknown>): Promise<void> {\n void data;\n }\n\n private async translateMessage(text: string): Promise<string> {\n if (!text) {\n return this.i18n.translateAsync('@software-management:messages.scope.failed');\n }\n if (text.startsWith('@')) {\n return this.i18n.translateAsync(text);\n }\n return text;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class GenerateScopeDocumentCommand extends ScopeDocumentRemoteCommand {\n protected readonly commandKey = AXPSoftwareManagementCommandKeys.Software.GenerateScopeDocument;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class SubmitScopeDocumentCommand extends ScopeDocumentRemoteCommand {\n protected readonly commandKey = AXPSoftwareManagementCommandKeys.Software.SubmitScopeDocument;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ExportScopePdfCommand extends ScopeDocumentRemoteCommand {\n protected readonly commandKey = AXPSoftwareManagementCommandKeys.Software.ExportScopePdf;\n\n protected override async afterSuccess(data: Record<string, unknown> | undefined): Promise<void> {\n const base64 = kickoffText(data?.['base64']);\n if (!base64 || typeof document === 'undefined') {\n return;\n }\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n const blob = new Blob([bytes], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = kickoffText(data?.['filename']) || 'first-version-scope.pdf';\n anchor.click();\n URL.revokeObjectURL(url);\n }\n}\n\n//#endregion\n\n//#region ----- Read the pinned discovery and open the scope document -----\n\n@Injectable({ providedIn: 'root' })\nexport class ViewPinnedDiscoveryCommand implements AXPCommand<unknown, { versionId: string }> {\n private readonly entityService = inject(AXPEntityService);\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly toast = inject(AXToastService);\n private readonly i18n = inject(AXTranslationService);\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<{ versionId: string }> {\n const softwareId = resolveSoftwareId(input);\n const software = softwareId\n ? ((await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.software.name)\n .data()\n .byKey(softwareId)) as AXMSoftwareManagementSoftwareEntityModel | null)\n : null;\n const versionId = kickoffText(software?.discoveryApprovedVersionId);\n if (!versionId) {\n const text = await this.i18n.translateAsync('@software-management:messages.scope.pinned-discovery-missing');\n this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 5000 });\n return { success: false, message: { text } };\n }\n const version = (await this.entityService\n .withEntity('DocumentManagement', 'DocumentVersion')\n .data()\n .byKey(versionId)) as { metaDataForm?: unknown } | null;\n const text = kickoffPlainTextFromVersion(version);\n await this.layoutBuilder\n .create()\n .dialog((dialog) => {\n dialog\n .setTitle('@software-management:actions.view-pinned-discovery.title')\n .setSize('lg')\n .setCloseButton(true)\n .setContext({ text })\n .content((flex) => {\n flex.customWidget('text-block-layout', { content: text || versionId });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n });\n })\n .show();\n return { success: true, kind: 'object', data: { versionId } };\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OpenScopeDocumentCommand implements AXPCommand<unknown, { documentId: string }> {\n private readonly entityService = inject(AXPEntityService);\n private readonly executor = inject(AXPCommandExecutor);\n private readonly toast = inject(AXToastService);\n private readonly i18n = inject(AXTranslationService);\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<{ documentId: string }> {\n const softwareId = resolveSoftwareId(input);\n const software = softwareId\n ? ((await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.software.name)\n .data()\n .byKey(softwareId)) as AXMSoftwareManagementSoftwareEntityModel | null)\n : null;\n const documentId = kickoffText(software?.scopeDocumentId);\n if (!documentId) {\n const text = await this.i18n.translateAsync('@software-management:messages.scope.missing-document');\n this.toast.show({ color: 'warning', title: text, content: text, closeButton: true, timeOut: 5000 });\n return { success: false, message: { text } };\n }\n await this.executor.execute('DocumentManagement.Document:Open', { documentId });\n return { success: true, kind: 'object', data: { documentId } };\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAwBA;AAEA;AAEA,SAAS,iBAAiB,CAAC,KAAc,EAAA;AACvC,IAAA,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC;IAC9C,MAAM,OAAO,GAAG,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC;IACpD,IAAI,OAAO,EAAE;AACX,QAAA,OAAO,OAAO;IAChB;IACA,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACvC,QAAA,OAAO,EAAE;IACX;IACA,MAAM,GAAG,GAAG,KAAgC;AAC5C,IAAA,OAAO,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjF;AAEA,SAAS,WAAW,CAAC,MAA2D,EAAA;AAC9E,IAAA,OAAO,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE;AAC1E;AAEA;AAEA;AAEA,MAAe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 import { inject, Injectable } from '@angular/core';
4
+ import { GenerateScopeDocumentCommand, SubmitScopeDocumentCommand, ViewPinnedDiscoveryCommand, OpenScopeDocumentCommand } from './acorex-platform-module-software-management-client-scope-document.commands-oLGsbLoA.mjs';
5
+
6
+ //#endregion
7
+ //#region ----- Report from Scope task -----
8
+ class GenerateSoftwareScopeDocumentActivity {
9
+ constructor() {
10
+ this.generate = inject(GenerateScopeDocumentCommand);
11
+ }
12
+ async execute(input) {
13
+ return workflowOutcome(await this.generate.execute(input));
14
+ }
15
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GenerateSoftwareScopeDocumentActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
16
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GenerateSoftwareScopeDocumentActivity, providedIn: 'root' }); }
17
+ }
18
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GenerateSoftwareScopeDocumentActivity, decorators: [{
19
+ type: Injectable,
20
+ args: [{ providedIn: 'root' }]
21
+ }] });
22
+ class SubmitSoftwareScopeDocumentActivity {
23
+ constructor() {
24
+ this.submit = inject(SubmitScopeDocumentCommand);
25
+ }
26
+ async execute(input) {
27
+ return workflowOutcome(await this.submit.execute(input));
28
+ }
29
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SubmitSoftwareScopeDocumentActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
30
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SubmitSoftwareScopeDocumentActivity, providedIn: 'root' }); }
31
+ }
32
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SubmitSoftwareScopeDocumentActivity, decorators: [{
33
+ type: Injectable,
34
+ args: [{ providedIn: 'root' }]
35
+ }] });
36
+ class ViewSoftwarePinnedDiscoveryActivity {
37
+ constructor() {
38
+ this.view = inject(ViewPinnedDiscoveryCommand);
39
+ }
40
+ async execute(input) {
41
+ return workflowOutcome(await this.view.execute(input));
42
+ }
43
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ViewSoftwarePinnedDiscoveryActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
44
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ViewSoftwarePinnedDiscoveryActivity, providedIn: 'root' }); }
45
+ }
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ViewSoftwarePinnedDiscoveryActivity, decorators: [{
47
+ type: Injectable,
48
+ args: [{ providedIn: 'root' }]
49
+ }] });
50
+ class OpenSoftwareScopeDocumentActivity {
51
+ constructor() {
52
+ this.open = inject(OpenScopeDocumentCommand);
53
+ }
54
+ async execute(input) {
55
+ return workflowOutcome(await this.open.execute(input));
56
+ }
57
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: OpenSoftwareScopeDocumentActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
58
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: OpenSoftwareScopeDocumentActivity, providedIn: 'root' }); }
59
+ }
60
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: OpenSoftwareScopeDocumentActivity, decorators: [{
61
+ type: Injectable,
62
+ args: [{ providedIn: 'root' }]
63
+ }] });
64
+ //#endregion
65
+ //#region ----- Helpers -----
66
+ function workflowOutcome(result) {
67
+ if (!result.success) {
68
+ return Promise.resolve({
69
+ success: false,
70
+ metadata: { outcome: 'Failed' },
71
+ });
72
+ }
73
+ return Promise.resolve(runtimeCommandSuccessObject(result.data, {
74
+ metadata: { outcome: 'Done' },
75
+ }));
76
+ }
77
+
78
+ export { GenerateSoftwareScopeDocumentActivity, OpenSoftwareScopeDocumentActivity, SubmitSoftwareScopeDocumentActivity, ViewSoftwarePinnedDiscoveryActivity };
79
+ //# sourceMappingURL=acorex-platform-module-software-management-client-scope-task.activities-BCSPq0eO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-software-management-client-scope-task.activities-BCSPq0eO.mjs","sources":["../../../../libs/modules/software-management/client/src/lib/workflows/activities/scope-task.activities.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { runtimeCommandSuccessObject } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport {\n GenerateScopeDocumentCommand,\n OpenScopeDocumentCommand,\n SubmitScopeDocumentCommand,\n ViewPinnedDiscoveryCommand,\n} from '../../commands/scope-document.commands';\n\n//#endregion\n\n//#region ----- Report from Scope task -----\n\n@Injectable({ providedIn: 'root' })\nexport class GenerateSoftwareScopeDocumentActivity implements AXPCommand<unknown, unknown> {\n private readonly generate = inject(GenerateScopeDocumentCommand);\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<unknown> {\n return workflowOutcome(await this.generate.execute(input));\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class SubmitSoftwareScopeDocumentActivity implements AXPCommand<unknown, unknown> {\n private readonly submit = inject(SubmitScopeDocumentCommand);\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<unknown> {\n return workflowOutcome(await this.submit.execute(input));\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ViewSoftwarePinnedDiscoveryActivity implements AXPCommand<unknown, unknown> {\n private readonly view = inject(ViewPinnedDiscoveryCommand);\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<unknown> {\n return workflowOutcome(await this.view.execute(input));\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OpenSoftwareScopeDocumentActivity implements AXPCommand<unknown, unknown> {\n private readonly open = inject(OpenScopeDocumentCommand);\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<unknown> {\n return workflowOutcome(await this.open.execute(input));\n }\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction workflowOutcome(result: { success?: boolean; data?: unknown }): AXPCommandExecuteResultPromise<unknown> {\n if (!result.success) {\n return Promise.resolve({\n success: false,\n metadata: { outcome: 'Failed' },\n });\n }\n return Promise.resolve(\n runtimeCommandSuccessObject(result.data, {\n metadata: { outcome: 'Done' },\n }),\n );\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAaA;AAEA;MAGa,qCAAqC,CAAA;AADlD,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAKjE,IAAA;IAHC,MAAM,OAAO,CAAC,KAAc,EAAA;AAC1B,QAAA,OAAO,eAAe,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5D;8GALW,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArC,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,qCAAqC,cADxB,MAAM,EAAA,CAAA,CAAA;;2FACnB,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBADjD,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;MAUrB,mCAAmC,CAAA;AADhD,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAA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AE;;MAUrB,iCAAiC,CAAA;AAD9C,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAKzD,IAAA;IAHC,MAAM,OAAO,CAAC,KAAc,EAAA;AAC1B,QAAA,OAAO,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD;8GALW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,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,iCAAiC,cADpB,MAAM,EAAA,CAAA,CAAA;;2FACnB,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AASlC;AAEA;AAEA,SAAS,eAAe,CAAC,MAA6C,EAAA;AACpE,IAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,OAAO,OAAO,CAAC,OAAO,CAAC;AACrB,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;AAChC,SAAA,CAAC;IACJ;IACA,OAAO,OAAO,CAAC,OAAO,CACpB,2BAA2B,CAAC,MAAM,CAAC,IAAI,EAAE;AACvC,QAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;AAC9B,KAAA,CAAC,CACH;AACH;;"}
@@ -6,4 +6,4 @@ function asSoftwareRecord(value) {
6
6
  }
7
7
 
8
8
  export { resolveSoftwareText as r };
9
- //# sourceMappingURL=acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs.map
9
+ //# sourceMappingURL=acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs","sources":["../../../../libs/modules/software-management/client/src/lib/commands/software-command.util.ts"],"sourcesContent":["export function resolveSoftwareText(value: unknown): string {\n return typeof value === 'string' ? value.trim() : '';\n}\n\nexport function asSoftwareRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : null;\n}\n"],"names":[],"mappings":"AAAM,SAAU,mBAAmB,CAAC,KAAc,EAAA;AAChD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE;AACtD;AAEM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAI,KAAiC,GAAG,IAAI;AACvF;;"}
1
+ {"version":3,"file":"acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs","sources":["../../../../libs/modules/software-management/client/src/lib/commands/software-command.util.ts"],"sourcesContent":["export function resolveSoftwareText(value: unknown): string {\n return typeof value === 'string' ? value.trim() : '';\n}\n\nexport function asSoftwareRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : null;\n}\n"],"names":[],"mappings":"AAAM,SAAU,mBAAmB,CAAC,KAAc,EAAA;AAChD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE;AACtD;AAEM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAI,KAAiC,GAAG,IAAI;AACvF;;"}
@@ -8,7 +8,7 @@ import { resolveEntityActionRef } from '@acorex-platform/framework-shared/runtim
8
8
  import { RootConfig, introductionValueText, SOFTWARE_DEFINITION_WORKFLOW_NAME } from '@acorex-platform/module-software-management-client/contracts';
9
9
  import * as i0 from '@angular/core';
10
10
  import { inject, Injectable } from '@angular/core';
11
- import { r as resolveSoftwareText } from './acorex-platform-module-software-management-client-software-command.util-BsoKQCX5.mjs';
11
+ import { r as resolveSoftwareText } from './acorex-platform-module-software-management-client-software-command.util-CvlYk7tC.mjs';
12
12
 
13
13
  //#region ---- Imports ----
14
14
  //#endregion
@@ -121,4 +121,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
121
121
  }] });
122
122
 
123
123
  export { StartSoftwareDefinitionFlowCommand };
124
- //# sourceMappingURL=acorex-platform-module-software-management-client-start-software-definition-flow.command-B0YCgv2V.mjs.map
124
+ //# sourceMappingURL=acorex-platform-module-software-management-client-start-software-definition-flow.command-BfxtMIGb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-software-management-client-start-software-definition-flow.command-B0YCgv2V.mjs","sources":["../../../../libs/modules/software-management/client/src/lib/commands/start-software-definition-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport {\n AXPEntityService,\n buildAXPRecordWorkflowInfo,\n getRecordWorkflowInstanceId,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { AXP_WORKFLOW_ENGINE, type AXPWorkflowEngine } from '@acorex-platform/framework-client/workflow';\nimport { AXPCommand, resolveEntityActionRef, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n introductionValueText,\n RootConfig,\n SOFTWARE_DEFINITION_WORKFLOW_NAME,\n type AXMSoftwareManagementSoftwareEntityModel,\n} from '@acorex-platform/module-software-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { resolveSoftwareText } from './software-command.util';\n\n//#endregion\n\n@Injectable({ providedIn: 'root' })\nexport class StartSoftwareDefinitionFlowCommand implements AXPCommand<unknown, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE) as AXPWorkflowEngine;\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly eventService = inject(AXPBroadcastEventService);\n private readonly sessionService = inject(AXPSessionService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<void> {\n const resolved = resolveEntityActionRef(input);\n const softwareId = resolveSoftwareText(resolved?.refId);\n if (!softwareId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.id-required',\n ),\n },\n };\n }\n\n const software = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.software.name)\n .data()\n .byKey(softwareId)) as AXMSoftwareManagementSoftwareEntityModel | null;\n\n if (!software) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.not-found',\n ),\n },\n };\n }\n\n if (getRecordWorkflowInstanceId(software as never)) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.already-started',\n ),\n },\n };\n }\n\n const ownerId =\n introductionValueText(software.ownerId) ||\n introductionValueText(software.owner) ||\n resolveSoftwareText(this.sessionService.user?.id);\n const correlationId = `${RootConfig.entities.software.source}:${softwareId}:${SOFTWARE_DEFINITION_WORKFLOW_NAME}`;\n\n try {\n const startResponse = await this.workflowEngine.start({\n workflowId: SOFTWARE_DEFINITION_WORKFLOW_NAME,\n input: {\n softwareId,\n softwareTitle: resolveSoftwareText(software.title),\n ownerId,\n refId: softwareId,\n refType: RootConfig.entities.software.source,\n correlationId,\n },\n });\n\n const instanceId = startResponse.instanceId;\n if (!instanceId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n },\n };\n }\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.software.name)\n .data()\n .update(softwareId, {\n workflowInfo: buildAXPRecordWorkflowInfo({\n instanceId,\n definitionId: SOFTWARE_DEFINITION_WORKFLOW_NAME,\n correlationId,\n }),\n } as never);\n\n this.eventService.publish('task-board.refresh', { provider: SOFTWARE_DEFINITION_WORKFLOW_NAME });\n\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync('@general:messages.generic.success.title'),\n content: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.started',\n ),\n closeButton: true,\n timeOut: 6000,\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 this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAuBA;MAGa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,mBAAmB,CAAsB;AACjE,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAC/C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAkH5D,IAAA;;;IA5GC,MAAM,OAAO,CAAC,KAAc,EAAA;AAC1B,QAAA,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC;QAC9C,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC;QACv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AO,EAAE,IAAI;AACd,aAAA,CAAC;AAEF,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;QAC3D;QAAE,OAAO,KAAc,EAAE;AACvB,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,eAAe;AACxE,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,gBAAA,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AAC5F,gBAAA,OAAO,EAAE,OAAO;AAChB,gBAAA,WAAW,EAAE,IAAI;AACjB,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA,CAAC;AACF,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QACvD;IACF;8GAvHW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,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,kCAAkC,cADrB,MAAM,EAAA,CAAA,CAAA;;2FACnB,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
1
+ {"version":3,"file":"acorex-platform-module-software-management-client-start-software-definition-flow.command-BfxtMIGb.mjs","sources":["../../../../libs/modules/software-management/client/src/lib/commands/start-software-definition-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport {\n AXPEntityService,\n buildAXPRecordWorkflowInfo,\n getRecordWorkflowInstanceId,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { AXP_WORKFLOW_ENGINE, type AXPWorkflowEngine } from '@acorex-platform/framework-client/workflow';\nimport { AXPCommand, resolveEntityActionRef, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n introductionValueText,\n RootConfig,\n SOFTWARE_DEFINITION_WORKFLOW_NAME,\n type AXMSoftwareManagementSoftwareEntityModel,\n} from '@acorex-platform/module-software-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { resolveSoftwareText } from './software-command.util';\n\n//#endregion\n\n@Injectable({ providedIn: 'root' })\nexport class StartSoftwareDefinitionFlowCommand implements AXPCommand<unknown, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE) as AXPWorkflowEngine;\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly eventService = inject(AXPBroadcastEventService);\n private readonly sessionService = inject(AXPSessionService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: unknown): AXPCommandExecuteResultPromise<void> {\n const resolved = resolveEntityActionRef(input);\n const softwareId = resolveSoftwareText(resolved?.refId);\n if (!softwareId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.id-required',\n ),\n },\n };\n }\n\n const software = (await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.software.name)\n .data()\n .byKey(softwareId)) as AXMSoftwareManagementSoftwareEntityModel | null;\n\n if (!software) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.not-found',\n ),\n },\n };\n }\n\n if (getRecordWorkflowInstanceId(software as never)) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.already-started',\n ),\n },\n };\n }\n\n const ownerId =\n introductionValueText(software.ownerId) ||\n introductionValueText(software.owner) ||\n resolveSoftwareText(this.sessionService.user?.id);\n const correlationId = `${RootConfig.entities.software.source}:${softwareId}:${SOFTWARE_DEFINITION_WORKFLOW_NAME}`;\n\n try {\n const startResponse = await this.workflowEngine.start({\n workflowId: SOFTWARE_DEFINITION_WORKFLOW_NAME,\n input: {\n softwareId,\n softwareTitle: resolveSoftwareText(software.title),\n ownerId,\n refId: softwareId,\n refType: RootConfig.entities.software.source,\n correlationId,\n },\n });\n\n const instanceId = startResponse.instanceId;\n if (!instanceId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n },\n };\n }\n\n await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.software.name)\n .data()\n .update(softwareId, {\n workflowInfo: buildAXPRecordWorkflowInfo({\n instanceId,\n definitionId: SOFTWARE_DEFINITION_WORKFLOW_NAME,\n correlationId,\n }),\n } as never);\n\n this.eventService.publish('task-board.refresh', { provider: SOFTWARE_DEFINITION_WORKFLOW_NAME });\n\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync('@general:messages.generic.success.title'),\n content: await this.translationService.translateAsync(\n '@software-management:messages.start-flow.started',\n ),\n closeButton: true,\n timeOut: 6000,\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 this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAuBA;MAGa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB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