@masterteam/delegations 0.0.20 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/delegations",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -21,8 +21,8 @@
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
23
  "@masterteam/components": "^0.0.175",
24
- "@masterteam/icons": "^0.0.15",
25
- "@masterteam/forms": "^0.0.80"
24
+ "@masterteam/forms": "^0.0.80",
25
+ "@masterteam/icons": "^0.0.15"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -71,6 +71,10 @@ interface DelegationScopeTarget {
71
71
  applicationKey: string;
72
72
  targetType: string;
73
73
  targetKey: string;
74
+ parentTargetType?: string | null;
75
+ parentTargetKey?: string | null;
76
+ parentDisplayName?: DelegationDisplayValue;
77
+ parentLevelId?: number | null;
74
78
  legacyModuleId?: number | null;
75
79
  targetId?: number | null;
76
80
  levelId?: number | null;
@@ -79,6 +83,7 @@ interface DelegationScopeTarget {
79
83
  moduleKey?: string | null;
80
84
  permissionModuleType?: string | null;
81
85
  permissionTargetId?: number | null;
86
+ isDelegable?: boolean;
82
87
  displayName?: DelegationDisplayValue;
83
88
  displayLabel?: DelegationDisplayValue;
84
89
  label?: DelegationDisplayValue;
@@ -95,7 +100,9 @@ interface DelegationScopeAction {
95
100
  permissionCommand?: string | null;
96
101
  businessActionCode?: string | null;
97
102
  isHighRisk?: boolean;
103
+ isDelegable?: boolean;
98
104
  isDelegableSnapshot?: boolean;
105
+ sortOrder?: number | null;
99
106
  }
100
107
  interface DelegationScopeFact {
101
108
  key?: string | null;
@@ -131,10 +138,25 @@ interface DelegationScopeCombinationRule {
131
138
  [extra: string]: unknown;
132
139
  }
133
140
  /**
134
- * `scope/options` may come back either as legacy `grants[]` or as the newer
135
- * catalog facts (`targets + operations + combinationRules`).
141
+ * `scope/options` now prefers backend-owned `hierarchy` for FE rendering.
142
+ * Flat `grants[]` / `targets + operations + combinationRules` remain for
143
+ * compatibility and diagnostics while older environments catch up.
136
144
  */
145
+ interface DelegationScopeHierarchyTarget {
146
+ target: DelegationScopeTarget;
147
+ operations: DelegationScopeAction[];
148
+ sortOrder?: number | null;
149
+ }
150
+ interface DelegationScopeHierarchyGroup {
151
+ groupType: string;
152
+ groupKey: string;
153
+ displayName?: DelegationDisplayValue;
154
+ levelId?: number | null;
155
+ sortOrder?: number | null;
156
+ targets: DelegationScopeHierarchyTarget[];
157
+ }
137
158
  interface DelegationScopeOptions {
159
+ hierarchy?: DelegationScopeHierarchyGroup[] | null;
138
160
  grants?: DelegationGrant[] | null;
139
161
  metadata?: Record<string, unknown>;
140
162
  targets?: DelegationScopeTarget[] | null;
@@ -516,19 +538,29 @@ declare class DelegationDetailDrawer implements OnInit {
516
538
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
517
539
  }
518
540
 
519
- interface TargetGroup {
541
+ interface DelegationGrantableTargetGroup {
520
542
  key: string;
521
543
  target: DelegationScopeTarget;
522
544
  grants: DelegationGrant[];
545
+ sortOrder: number;
523
546
  }
547
+ interface DelegationGrantableHierarchyGroup {
548
+ key: string;
549
+ groupType: string;
550
+ displayName?: DelegationDisplayValue;
551
+ sortOrder: number;
552
+ targets: DelegationGrantableTargetGroup[];
553
+ }
554
+
524
555
  /**
525
- * Grants-based scope picker (doc 03). Driven entirely by `scope/options`:
526
- * - lists grantable target/action pairs returned by the backend,
527
- * - lets the user toggle each grant,
556
+ * Hierarchy-based scope picker (doc 03). Driven entirely by `scope/options`:
557
+ * - renders backend-owned Level -> Level Module -> operations hierarchy,
558
+ * - lets the user toggle each explicit grant,
528
559
  * - calls `scope/preview` (debounced) and surfaces summary / warnings / denied.
529
560
  *
530
561
  * `[(scope)]` two-way binds a `DelegationScopeSelection`. The component never
531
- * invents permission metadata — it only echoes grants returned by options.
562
+ * invents permission metadata — it only echoes targets/actions returned by
563
+ * options.
532
564
  */
533
565
  declare class ScopePicker {
534
566
  readonly scope: _angular_core.ModelSignal<DelegationScopeSelection>;
@@ -546,22 +578,24 @@ declare class ScopePicker {
546
578
  protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
547
579
  protected readonly isPreviewing: _angular_core.Signal<boolean>;
548
580
  protected readonly errorOptions: _angular_core.Signal<string | null>;
549
- /** Grantable options grouped by target. */
550
- protected readonly groups: _angular_core.Signal<TargetGroup[]>;
581
+ protected readonly groups: _angular_core.Signal<DelegationGrantableHierarchyGroup[]>;
551
582
  /** Selected grant keys for O(1) checkbox state. */
552
583
  protected readonly selectedKeys: _angular_core.Signal<Set<string>>;
553
584
  private readonly expanded;
554
585
  constructor();
555
- protected isExpanded(group: TargetGroup): boolean;
556
- protected toggleAccordion(group: TargetGroup): void;
586
+ protected isExpanded(group: DelegationGrantableHierarchyGroup): boolean;
587
+ protected toggleAccordion(group: DelegationGrantableHierarchyGroup): void;
557
588
  protected isSelected(grant: DelegationGrant): boolean;
589
+ protected getGroupLabel(group: DelegationGrantableHierarchyGroup): string;
558
590
  protected getTargetLabel(target: DelegationScopeTarget): string;
559
591
  protected getActionLabel(grant: DelegationGrant): string;
592
+ protected getTargetActions(targetGroup: DelegationGrantableTargetGroup): DelegationGrant[];
560
593
  protected getPreviewSummary(summary: DelegationDisplayValue | undefined): string;
561
594
  protected formatDeniedOperation(value?: string | null): string;
562
595
  protected formatDeniedTarget(value?: string | null): string;
563
596
  protected toggleGrant(grant: DelegationGrant): void;
564
- protected selectedCount(group: TargetGroup): number;
597
+ protected selectedCount(group: DelegationGrantableHierarchyGroup): number;
598
+ protected selectedTargetCount(targetGroup: DelegationGrantableTargetGroup): number;
565
599
  private currentLanguage;
566
600
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
567
601
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopePicker, "mt-scope-picker", never, { "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "delegatorUserId": { "alias": "delegatorUserId"; "required": false; "isSignal": true; }; }, { "scope": "scopeChange"; }, never, never, true, never>;
@@ -832,4 +866,4 @@ declare class DelegationSessionFacade {
832
866
  }
833
867
 
834
868
  export { ApproveDelegation, CancelDelegation, ClearDelegationDetail, ClearScopePreview, CreateDelegationLegacy, CreateDelegationV2, DelegationDetailDrawer, DelegationForm, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetActiveAssignedDelegations, GetAssignedDelegations, GetDelegationDetail, GetMyDelegations, GetScopeOptions, LoadDelegationCandidates, PreviewScope, RejectDelegation, RejectDelegationDialog, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
835
- export type { ActiveDelegationSession, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeOptions, DelegationScopePreview, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };
869
+ export type { ActiveDelegationSession, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeHierarchyGroup, DelegationScopeHierarchyTarget, DelegationScopeOptions, DelegationScopePreview, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };