@acorex-platform/module-application-management-client 0.0.15

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 (27) hide show
  1. package/fesm2022/acorex-platform-module-application-management-client-application-status.provider-DqPlbWuW.mjs +71 -0
  2. package/fesm2022/acorex-platform-module-application-management-client-application-status.provider-DqPlbWuW.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-application-management-client-assign-features.command-BheloAKT.mjs +151 -0
  4. package/fesm2022/acorex-platform-module-application-management-client-assign-features.command-BheloAKT.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-application-management-client-contracts.mjs +2027 -0
  6. package/fesm2022/acorex-platform-module-application-management-client-contracts.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-application-management-client-feature-definition.provider-Depetn50.mjs +22 -0
  8. package/fesm2022/acorex-platform-module-application-management-client-feature-definition.provider-Depetn50.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-application-management-client-features-editor.component-DNc_GH0v.mjs +548 -0
  10. package/fesm2022/acorex-platform-module-application-management-client-features-editor.component-DNc_GH0v.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-application-management-client-features-widget-column.component-CiBGmw6I.mjs +46 -0
  12. package/fesm2022/acorex-platform-module-application-management-client-features-widget-column.component-CiBGmw6I.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-application-management-client-features-widget-designer.component-nStj9BAw.mjs +20 -0
  14. package/fesm2022/acorex-platform-module-application-management-client-features-widget-designer.component-nStj9BAw.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-application-management-client-features-widget-edit.component-D1MzYI_s.mjs +42 -0
  16. package/fesm2022/acorex-platform-module-application-management-client-features-widget-edit.component-D1MzYI_s.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-application-management-client-features-widget-print.component-C6Z9uzRr.mjs +21 -0
  18. package/fesm2022/acorex-platform-module-application-management-client-features-widget-print.component-C6Z9uzRr.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-application-management-client-features-widget-view.component-ysM1jD08.mjs +128 -0
  20. package/fesm2022/acorex-platform-module-application-management-client-features-widget-view.component-ysM1jD08.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-application-management-client-permission-definition.provider-Dn5WiubC.mjs +32 -0
  22. package/fesm2022/acorex-platform-module-application-management-client-permission-definition.provider-Dn5WiubC.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-application-management-client.mjs +1030 -0
  24. package/fesm2022/acorex-platform-module-application-management-client.mjs.map +1 -0
  25. package/package.json +28 -0
  26. package/types/acorex-platform-module-application-management-client-contracts.d.ts +161 -0
  27. package/types/acorex-platform-module-application-management-client.d.ts +57 -0
@@ -0,0 +1,71 @@
1
+ import { AXPStatusProvider, AXPSystemStatusType, systemStatusToDefinition } from '@acorex-platform/framework-shared/core';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable } from '@angular/core';
4
+
5
+ //#region ---- Imports ----
6
+ //#endregion
7
+ //#region ---- Application Status Provider ----
8
+ /**
9
+ * Application status provider defining lifecycle states for applications.
10
+ * Used by the status plugin to manage application status transitions and metadata.
11
+ */
12
+ class AXMApplicationStatusProvider extends AXPStatusProvider {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.key = 'application-management.status.application';
16
+ this.defaultStatus = AXPSystemStatusType.Active;
17
+ this.statuses = [
18
+ systemStatusToDefinition(AXPSystemStatusType.Active, {
19
+ title: '@application-management:applications.states.active',
20
+ generateView: true,
21
+ }),
22
+ systemStatusToDefinition(AXPSystemStatusType.Inactive, {
23
+ title: '@application-management:applications.states.inactive',
24
+ generateView: true,
25
+ }),
26
+ systemStatusToDefinition(AXPSystemStatusType.Suspended, {
27
+ title: '@application-management:applications.states.suspended',
28
+ generateView: true,
29
+ }),
30
+ systemStatusToDefinition(AXPSystemStatusType.Pending, {
31
+ title: '@application-management:applications.states.pending',
32
+ generateView: true,
33
+ }),
34
+ ];
35
+ this.transitions = [
36
+ {
37
+ from: AXPSystemStatusType.Pending,
38
+ to: AXPSystemStatusType.Active,
39
+ title: '@application-management:applications.transitions.activate',
40
+ },
41
+ {
42
+ from: AXPSystemStatusType.Active,
43
+ to: AXPSystemStatusType.Inactive,
44
+ title: '@application-management:applications.transitions.deactivate',
45
+ },
46
+ {
47
+ from: AXPSystemStatusType.Active,
48
+ to: AXPSystemStatusType.Suspended,
49
+ title: '@application-management:applications.transitions.suspend',
50
+ },
51
+ {
52
+ from: AXPSystemStatusType.Suspended,
53
+ to: AXPSystemStatusType.Active,
54
+ title: '@application-management:applications.transitions.resume',
55
+ },
56
+ {
57
+ from: AXPSystemStatusType.Inactive,
58
+ to: AXPSystemStatusType.Active,
59
+ title: '@application-management:applications.transitions.activate',
60
+ },
61
+ ];
62
+ }
63
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMApplicationStatusProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
64
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMApplicationStatusProvider }); }
65
+ }
66
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMApplicationStatusProvider, decorators: [{
67
+ type: Injectable
68
+ }] });
69
+
70
+ export { AXMApplicationStatusProvider };
71
+ //# sourceMappingURL=acorex-platform-module-application-management-client-application-status.provider-DqPlbWuW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-application-management-client-application-status.provider-DqPlbWuW.mjs","sources":["../../../../libs/modules/application-management/client/src/lib/features/application-status.provider.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPStatusProvider, AXPStatusTransition, AXPSystemStatusType, systemStatusToDefinition } from '@acorex-platform/framework-shared/core';\nimport { Injectable } from '@angular/core';\n\n//#endregion\n\n//#region ---- Application Status Provider ----\n\n/**\n * Application status provider defining lifecycle states for applications.\n * Used by the status plugin to manage application status transitions and metadata.\n */\n@Injectable()\nexport class AXMApplicationStatusProvider extends AXPStatusProvider {\n readonly key = 'application-management.status.application';\n\n readonly defaultStatus = AXPSystemStatusType.Active;\n\n readonly statuses = [\n systemStatusToDefinition(AXPSystemStatusType.Active, {\n title: '@application-management:applications.states.active',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Inactive, {\n title: '@application-management:applications.states.inactive',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Suspended, {\n title: '@application-management:applications.states.suspended',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Pending, {\n title: '@application-management:applications.states.pending',\n generateView: true,\n }),\n ];\n\n readonly transitions: AXPStatusTransition[] = [\n {\n from: AXPSystemStatusType.Pending,\n to: AXPSystemStatusType.Active,\n title: '@application-management:applications.transitions.activate',\n },\n {\n from: AXPSystemStatusType.Active,\n to: AXPSystemStatusType.Inactive,\n title: '@application-management:applications.transitions.deactivate',\n },\n {\n from: AXPSystemStatusType.Active,\n to: AXPSystemStatusType.Suspended,\n title: '@application-management:applications.transitions.suspend',\n },\n {\n from: AXPSystemStatusType.Suspended,\n to: AXPSystemStatusType.Active,\n title: '@application-management:applications.transitions.resume',\n },\n {\n from: AXPSystemStatusType.Inactive,\n to: AXPSystemStatusType.Active,\n title: '@application-management:applications.transitions.activate',\n },\n ];\n}\n\n//#endregion\n\n"],"names":[],"mappings":";;;;AAAA;AAKA;AAEA;AAEA;;;AAGG;AAEG,MAAO,4BAA6B,SAAQ,iBAAiB,CAAA;AADnE,IAAA,WAAA,GAAA;;QAEa,IAAA,CAAA,GAAG,GAAG,2CAA2C;AAEjD,QAAA,IAAA,CAAA,aAAa,GAAG,mBAAmB,CAAC,MAAM;AAE1C,QAAA,IAAA,CAAA,QAAQ,GAAG;AAChB,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,MAAM,EAAE;AACjD,gBAAA,KAAK,EAAE,oDAAoD;AAC3D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EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;;;"}
@@ -0,0 +1,151 @@
1
+ import { AXPopupService } from '@acorex/components/popup';
2
+ import { AXToastService } from '@acorex/components/toast';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPSettingsService, AXPRefreshEvent, AXPCommonSettings } from '@acorex-platform/framework-client/common';
5
+ import { AXPEntityDefinitionRegistryService, AXPEntityModifyEvent } from '@acorex-platform/framework-client/layout/entity';
6
+ import { AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';
7
+ import { RootConfig } from '@acorex-platform/module-application-management-client/contracts';
8
+ import * as i0 from '@angular/core';
9
+ import { input, signal, Component, inject, Injectable } from '@angular/core';
10
+ import * as i4 from '@acorex/components/button';
11
+ import { AXButtonModule } from '@acorex/components/button';
12
+ import * as i3 from '@acorex/components/decorators';
13
+ import { AXDecoratorModule } from '@acorex/components/decorators';
14
+ import { AXBasePageComponent } from '@acorex/components/page';
15
+ import { A as AXPFeaturesEditorComponent } from './acorex-platform-module-application-management-client-features-editor.component-DNc_GH0v.mjs';
16
+
17
+ class AXPFeaturesEditorPopupComponent extends AXBasePageComponent {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.initialValue = input({}, ...(ngDevMode ? [{ debugName: "initialValue" }] : /* istanbul ignore next */ []));
21
+ this.latestValue = signal({
22
+ modules: [],
23
+ features: {},
24
+ }, ...(ngDevMode ? [{ debugName: "latestValue" }] : /* istanbul ignore next */ []));
25
+ }
26
+ ngOnInit() {
27
+ super.ngOnInit();
28
+ const initial = this.initialValue();
29
+ this.latestValue.set({
30
+ modules: initial.modules ?? [],
31
+ features: initial.features ?? {},
32
+ });
33
+ }
34
+ onValueChanged(value) {
35
+ this.latestValue.set(value);
36
+ }
37
+ save() {
38
+ this.close(this.latestValue());
39
+ }
40
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPFeaturesEditorPopupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
41
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: AXPFeaturesEditorPopupComponent, isStandalone: true, selector: "ng-component", inputs: { initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
42
+ <div class="flex flex-col h-full">
43
+ <ax-content class="flex-1 overflow-auto p-4">
44
+ <axm-features-editor
45
+ [initialValue]="initialValue()"
46
+ [readOnly]="false"
47
+ (valueChanged)="onValueChanged($event)"
48
+ />
49
+ </ax-content>
50
+ <ax-footer>
51
+ <ax-suffix>
52
+ <ax-button text="Cancel" (onClick)="close()"></ax-button>
53
+ <ax-button color="primary" text="Save" (onClick)="save()"></ax-button>
54
+ </ax-suffix>
55
+ </ax-footer>
56
+ </div>
57
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i4.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXPFeaturesEditorComponent, selector: "axm-features-editor", inputs: ["initialValue", "readOnly"], outputs: ["valueChanged"] }] }); }
58
+ }
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPFeaturesEditorPopupComponent, decorators: [{
60
+ type: Component,
61
+ args: [{
62
+ template: `
63
+ <div class="flex flex-col h-full">
64
+ <ax-content class="flex-1 overflow-auto p-4">
65
+ <axm-features-editor
66
+ [initialValue]="initialValue()"
67
+ [readOnly]="false"
68
+ (valueChanged)="onValueChanged($event)"
69
+ />
70
+ </ax-content>
71
+ <ax-footer>
72
+ <ax-suffix>
73
+ <ax-button text="Cancel" (onClick)="close()"></ax-button>
74
+ <ax-button color="primary" text="Save" (onClick)="save()"></ax-button>
75
+ </ax-suffix>
76
+ </ax-footer>
77
+ </div>
78
+ `,
79
+ imports: [AXDecoratorModule, AXButtonModule, AXPFeaturesEditorComponent],
80
+ }]
81
+ }], propDecorators: { initialValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValue", required: false }] }] } });
82
+
83
+ //#region ---- Imports ----
84
+ //#endregion
85
+ //#region ---- Assign features command ----
86
+ class AXMAssignFeaturesCommand {
87
+ constructor() {
88
+ this.popupService = inject(AXPopupService);
89
+ this.translationService = inject(AXTranslationService);
90
+ this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
91
+ this.toastService = inject(AXToastService);
92
+ this.settingsService = inject(AXPSettingsService);
93
+ this.workflowEventService = inject(AXPWorkflowEventService);
94
+ }
95
+ async execute(input = {}) {
96
+ const row = input.__context__?.data;
97
+ const id = row?.['id'];
98
+ if (!id) {
99
+ return { success: false, message: { text: 'Edition data with id is required.' } };
100
+ }
101
+ const title = await this.translationService.translateAsync('@application-management:features-widget.terms.features');
102
+ const entityTitle = row['title'] ?? row['name'] ?? id;
103
+ const modulesAndFeatures = row['modulesAndFeatures'] ?? { modules: [], features: {} };
104
+ const popupResult = await this.popupService.open(AXPFeaturesEditorPopupComponent, {
105
+ title: `${title} - ${entityTitle}`,
106
+ size: 'lg',
107
+ data: {
108
+ initialValue: modulesAndFeatures,
109
+ },
110
+ });
111
+ const nextValue = popupResult?.data;
112
+ if (!nextValue) {
113
+ return { success: true, data: null };
114
+ }
115
+ const entityKey = `${RootConfig.module.name}.${RootConfig.entities.edition.name}`;
116
+ const [moduleName, entityName] = entityKey.split('.');
117
+ const entityRef = await this.entityRegistry.resolve(moduleName, entityName);
118
+ const updatePayload = {
119
+ ...row,
120
+ modulesAndFeatures: nextValue,
121
+ };
122
+ const updated = await (entityRef.commands?.update?.execute)(updatePayload);
123
+ await this.showSuccessToast();
124
+ this.workflowEventService.dispatch(AXPEntityModifyEvent({ entity: entityKey, values: updated }));
125
+ this.workflowEventService.dispatch(AXPRefreshEvent({ entity: entityKey }));
126
+ return { success: true, data: nextValue };
127
+ }
128
+ async showSuccessToast() {
129
+ const enableOperationToasts = await this.settingsService.get(AXPCommonSettings.EnableOperationToasts);
130
+ if (!enableOperationToasts) {
131
+ return;
132
+ }
133
+ this.toastService.show({
134
+ color: 'success',
135
+ title: await this.translationService.translateAsync('@general:workflow.entity-modified-title'),
136
+ content: await this.translationService.translateAsync('@general:workflow.entity-modified-body'),
137
+ closeButton: true,
138
+ timeOut: 3000,
139
+ timeOutProgress: true,
140
+ });
141
+ }
142
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMAssignFeaturesCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
143
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMAssignFeaturesCommand, providedIn: 'root' }); }
144
+ }
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMAssignFeaturesCommand, decorators: [{
146
+ type: Injectable,
147
+ args: [{ providedIn: 'root' }]
148
+ }] });
149
+
150
+ export { AXMAssignFeaturesCommand };
151
+ //# sourceMappingURL=acorex-platform-module-application-management-client-assign-features.command-BheloAKT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-application-management-client-assign-features.command-BheloAKT.mjs","sources":["../../../../libs/modules/application-management/client/src/lib/features/features-widget/features-editor-popup.component.ts","../../../../libs/modules/application-management/client/src/lib/features/features-widget/commands/assign-features.command.ts"],"sourcesContent":["import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { Component, input, signal } from '@angular/core';\n\nimport { AXPFeaturesEditorComponent } from './features-editor.component';\n\n@Component({\n template: `\n <div class=\"flex flex-col h-full\">\n <ax-content class=\"flex-1 overflow-auto p-4\">\n <axm-features-editor\n [initialValue]=\"initialValue()\"\n [readOnly]=\"false\"\n (valueChanged)=\"onValueChanged($event)\"\n />\n </ax-content>\n <ax-footer>\n <ax-suffix>\n <ax-button text=\"Cancel\" (onClick)=\"close()\"></ax-button>\n <ax-button color=\"primary\" text=\"Save\" (onClick)=\"save()\"></ax-button>\n </ax-suffix>\n </ax-footer>\n </div>\n `,\n imports: [AXDecoratorModule, AXButtonModule, AXPFeaturesEditorComponent],\n})\nexport class AXPFeaturesEditorPopupComponent extends AXBasePageComponent {\n initialValue = input<{ modules?: string[]; features?: Record<string, unknown> }>({});\n\n private latestValue = signal<{ modules: string[]; features: Record<string, unknown> }>({\n modules: [],\n features: {},\n });\n\n override ngOnInit(): void {\n super.ngOnInit();\n const initial = this.initialValue();\n this.latestValue.set({\n modules: initial.modules ?? [],\n features: initial.features ?? {},\n });\n }\n\n protected onValueChanged(value: { modules: string[]; features: Record<string, unknown> }): void {\n this.latestValue.set(value);\n }\n\n protected save(): void {\n this.close(this.latestValue());\n }\n}\n","//#region ---- Imports ----\n\nimport { AXPopupService } from '@acorex/components/popup';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPCommonSettings,\n AXPRefreshEvent,\n AXPSettingsService,\n} from '@acorex-platform/framework-client/common';\nimport { AXPEntityDefinitionRegistryService, AXPEntityModifyEvent } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';\nimport { AXPExecuteCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { RootConfig } from '@acorex-platform/module-application-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPFeaturesEditorPopupComponent } from '../features-editor-popup.component';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface AXMAssignFeaturesCommandInput {\n __context__?: {\n data?: Record<string, unknown>;\n entity?: string;\n options?: unknown;\n };\n}\n\n//#endregion\n\n//#region ---- Assign features command ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMAssignFeaturesCommand implements AXPCommand<AXMAssignFeaturesCommandInput, AXPExecuteCommandResult> {\n private readonly popupService = inject(AXPopupService);\n private readonly translationService = inject(AXTranslationService);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly toastService = inject(AXToastService);\n private readonly settingsService = inject(AXPSettingsService);\n private readonly workflowEventService = inject(AXPWorkflowEventService);\n\n async execute(input: AXMAssignFeaturesCommandInput = {}): Promise<AXPExecuteCommandResult> {\n const row = input.__context__?.data;\n const id = row?.['id'];\n if (!id) {\n return { success: false, message: { text: 'Edition data with id is required.' } };\n }\n\n const title = await this.translationService.translateAsync(\n '@application-management:features-widget.terms.features',\n );\n const entityTitle = row['title'] ?? row['name'] ?? id;\n\n const modulesAndFeatures = (row['modulesAndFeatures'] as {\n modules?: string[];\n features?: Record<string, unknown>;\n }) ?? { modules: [], features: {} };\n\n const popupResult = await this.popupService.open(AXPFeaturesEditorPopupComponent, {\n title: `${title} - ${entityTitle}`,\n size: 'lg',\n data: {\n initialValue: modulesAndFeatures,\n },\n });\n\n const nextValue = popupResult?.data as { modules?: string[]; features?: Record<string, unknown> } | undefined;\n if (!nextValue) {\n return { success: true, data: null };\n }\n\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.edition.name}`;\n const [moduleName, entityName] = entityKey.split('.');\n const entityRef = await this.entityRegistry.resolve(moduleName, entityName);\n const updatePayload = {\n ...row,\n modulesAndFeatures: nextValue,\n };\n\n const updated = await (entityRef.commands?.update?.execute as (\n data: Record<string, unknown>,\n ) => Promise<Record<string, unknown>>)(updatePayload);\n\n await this.showSuccessToast();\n this.workflowEventService.dispatch(AXPEntityModifyEvent({ entity: entityKey, values: updated }));\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: entityKey }));\n\n return { success: true, data: nextValue };\n }\n\n private async showSuccessToast(): Promise<void> {\n const enableOperationToasts = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enableOperationToasts) {\n return;\n }\n\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync('@general:workflow.entity-modified-title'),\n content: await this.translationService.translateAsync('@general:workflow.entity-modified-body'),\n closeButton: true,\n timeOut: 3000,\n timeOutProgress: true,\n });\n }\n}\n\n//#endregion\n"],"names":["i1","i2"],"mappings":";;;;;;;;;;;;;;;;AA2BM,MAAO,+BAAgC,SAAQ,mBAAmB,CAAA;AApBxE,IAAA,WAAA,GAAA;;AAqBE,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAA6D,EAAE,mFAAC;QAE5E,IAAA,CAAA,WAAW,GAAG,MAAM,CAA2D;AACrF,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,QAAQ,EAAE,EAAE;AACb,SAAA,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;AAkBH,IAAA;IAhBU,QAAQ,GAAA;QACf,KAAK,CAAC,QAAQ,EAAE;AAChB,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE;AACnC,QAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;AACnB,YAAA,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;AAC9B,YAAA,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;AACjC,SAAA,CAAC;IACJ;AAEU,IAAA,cAAc,CAAC,KAA+D,EAAA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