@company-semantics/contracts 1.4.1 → 1.5.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.
- package/package.json +1 -1
- package/src/resource-keys.ts +7 -1
package/package.json
CHANGED
package/src/resource-keys.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type ResourceKey =
|
|
|
35
35
|
| { type: 'orgUnitChildren'; orgId: string; unitId: string }
|
|
36
36
|
| { type: 'orgUnitAncestors'; orgId: string; unitId: string }
|
|
37
37
|
| { type: 'orgUnitMemberships'; orgId: string; unitId: string }
|
|
38
|
+
| { type: 'orgUnitPermissions'; orgId: string; unitId: string }
|
|
38
39
|
// User-scoped
|
|
39
40
|
| { type: 'dismissedBanners'; userId: string }
|
|
40
41
|
| { type: 'userOrgs'; userId: string }
|
|
@@ -95,6 +96,7 @@ export function toQueryKey(key: ResourceKey): readonly string[] {
|
|
|
95
96
|
case 'orgUnitChildren':
|
|
96
97
|
case 'orgUnitAncestors':
|
|
97
98
|
case 'orgUnitMemberships':
|
|
99
|
+
case 'orgUnitPermissions':
|
|
98
100
|
return [key.type, key.orgId, key.unitId] as const;
|
|
99
101
|
|
|
100
102
|
// User-scoped
|
|
@@ -155,6 +157,7 @@ export function fromQueryKey(queryKey: readonly string[]): ResourceKey {
|
|
|
155
157
|
orgUnitChildren: 'unitId',
|
|
156
158
|
orgUnitAncestors: 'unitId',
|
|
157
159
|
orgUnitMemberships: 'unitId',
|
|
160
|
+
orgUnitPermissions: 'unitId',
|
|
158
161
|
};
|
|
159
162
|
|
|
160
163
|
if (type in identityFields) {
|
|
@@ -199,7 +202,10 @@ export const resourceRelationships: Record<string, string[]> = {
|
|
|
199
202
|
orgUnit: ['orgTree'],
|
|
200
203
|
orgUnitChildren: ['orgTree'],
|
|
201
204
|
orgUnitAncestors: ['orgTree'],
|
|
202
|
-
|
|
205
|
+
// Subtree manage is driven by memberships (ADR-BE-151); mutating memberships
|
|
206
|
+
// invalidates both the direct roster and the effective-managers read.
|
|
207
|
+
orgUnitMemberships: ['orgUnit', 'orgUnitPermissions'],
|
|
208
|
+
orgUnitPermissions: ['orgUnitMemberships'],
|
|
203
209
|
};
|
|
204
210
|
|
|
205
211
|
/**
|