@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -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
- orgUnitMemberships: ['orgUnit'],
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
  /**