@company-semantics/contracts 26.0.0 → 27.0.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/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +268 -59
- package/src/generated/openapi-routes.ts +5 -1
- package/src/identity/README.md +0 -6
- package/src/identity/index.ts +0 -6
- package/src/identity/people-org-chart.ts +20 -84
- package/src/index.ts +0 -6
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
|
|
2
|
-
export const SPEC_HASH = '
|
|
3
|
-
export const SPEC_HASH_FULL = '
|
|
2
|
+
export const SPEC_HASH = '4471246b55aa' as const;
|
|
3
|
+
export const SPEC_HASH_FULL = '4471246b55aac3b38566bc16e44db735eacd94637c900db8c1727e1381539a5a' as const;
|
package/src/api/generated.ts
CHANGED
|
@@ -1593,6 +1593,75 @@ export interface paths {
|
|
|
1593
1593
|
patch?: never;
|
|
1594
1594
|
trace?: never;
|
|
1595
1595
|
};
|
|
1596
|
+
"/api/company-md/docs/{id}/access-requests": {
|
|
1597
|
+
parameters: {
|
|
1598
|
+
query?: never;
|
|
1599
|
+
header?: never;
|
|
1600
|
+
path?: never;
|
|
1601
|
+
cookie?: never;
|
|
1602
|
+
};
|
|
1603
|
+
/** List a node’s access requests (owner inbox) */
|
|
1604
|
+
get: operations["listCompanyMdAccessRequests"];
|
|
1605
|
+
put?: never;
|
|
1606
|
+
/** Request access to a locked company.md node */
|
|
1607
|
+
post: operations["createCompanyMdAccessRequest"];
|
|
1608
|
+
delete?: never;
|
|
1609
|
+
options?: never;
|
|
1610
|
+
head?: never;
|
|
1611
|
+
patch?: never;
|
|
1612
|
+
trace?: never;
|
|
1613
|
+
};
|
|
1614
|
+
"/api/company-md/access-requests/{id}/approve": {
|
|
1615
|
+
parameters: {
|
|
1616
|
+
query?: never;
|
|
1617
|
+
header?: never;
|
|
1618
|
+
path?: never;
|
|
1619
|
+
cookie?: never;
|
|
1620
|
+
};
|
|
1621
|
+
get?: never;
|
|
1622
|
+
put?: never;
|
|
1623
|
+
/** Approve an access request (first owner wins; mints a grant) */
|
|
1624
|
+
post: operations["approveCompanyMdAccessRequest"];
|
|
1625
|
+
delete?: never;
|
|
1626
|
+
options?: never;
|
|
1627
|
+
head?: never;
|
|
1628
|
+
patch?: never;
|
|
1629
|
+
trace?: never;
|
|
1630
|
+
};
|
|
1631
|
+
"/api/company-md/access-requests/{id}/deny": {
|
|
1632
|
+
parameters: {
|
|
1633
|
+
query?: never;
|
|
1634
|
+
header?: never;
|
|
1635
|
+
path?: never;
|
|
1636
|
+
cookie?: never;
|
|
1637
|
+
};
|
|
1638
|
+
get?: never;
|
|
1639
|
+
put?: never;
|
|
1640
|
+
/** Deny an access request (first owner wins) */
|
|
1641
|
+
post: operations["denyCompanyMdAccessRequest"];
|
|
1642
|
+
delete?: never;
|
|
1643
|
+
options?: never;
|
|
1644
|
+
head?: never;
|
|
1645
|
+
patch?: never;
|
|
1646
|
+
trace?: never;
|
|
1647
|
+
};
|
|
1648
|
+
"/api/company-md/context-bank/search": {
|
|
1649
|
+
parameters: {
|
|
1650
|
+
query?: never;
|
|
1651
|
+
header?: never;
|
|
1652
|
+
path?: never;
|
|
1653
|
+
cookie?: never;
|
|
1654
|
+
};
|
|
1655
|
+
/** Search org-wide context docs the caller may view */
|
|
1656
|
+
get: operations["searchCompanyMdContextDocs"];
|
|
1657
|
+
put?: never;
|
|
1658
|
+
post?: never;
|
|
1659
|
+
delete?: never;
|
|
1660
|
+
options?: never;
|
|
1661
|
+
head?: never;
|
|
1662
|
+
patch?: never;
|
|
1663
|
+
trace?: never;
|
|
1664
|
+
};
|
|
1596
1665
|
"/api/company-md/search": {
|
|
1597
1666
|
parameters: {
|
|
1598
1667
|
query?: never;
|
|
@@ -4375,6 +4444,20 @@ export interface components {
|
|
|
4375
4444
|
/** Format: uuid */
|
|
4376
4445
|
toUserId: string;
|
|
4377
4446
|
};
|
|
4447
|
+
AccessRequestCreate: {
|
|
4448
|
+
message?: string;
|
|
4449
|
+
};
|
|
4450
|
+
ApproveAccessRequest: {
|
|
4451
|
+
/** @enum {string} */
|
|
4452
|
+
accessLevel: "editor" | "commenter" | "viewer";
|
|
4453
|
+
};
|
|
4454
|
+
DenyAccessRequest: {
|
|
4455
|
+
reason?: string;
|
|
4456
|
+
};
|
|
4457
|
+
/** @description Org-wide context-doc discovery hits the caller may view. */
|
|
4458
|
+
SearchContextDocsResponse: {
|
|
4459
|
+
items: components["schemas"]["ContextDocDiscoveryHit"][];
|
|
4460
|
+
};
|
|
4378
4461
|
/** @description Ranked retrieval hits plus the source kinds actually searched. */
|
|
4379
4462
|
CompanyMdSearchResponse: {
|
|
4380
4463
|
hits: {
|
|
@@ -4943,65 +5026,6 @@ export interface components {
|
|
|
4943
5026
|
/** @enum {string} */
|
|
4944
5027
|
relationshipType: "solid" | "dotted";
|
|
4945
5028
|
}[];
|
|
4946
|
-
nodes: {
|
|
4947
|
-
/** Format: uuid */
|
|
4948
|
-
id: string;
|
|
4949
|
-
fullName: string;
|
|
4950
|
-
jobTitle: string | null;
|
|
4951
|
-
avatarUrl: string | null;
|
|
4952
|
-
primaryUnitId: string | null;
|
|
4953
|
-
ownedUnits: {
|
|
4954
|
-
/** Format: uuid */
|
|
4955
|
-
id: string;
|
|
4956
|
-
name: string;
|
|
4957
|
-
/** @enum {string} */
|
|
4958
|
-
mutability: "derived" | "user_managed";
|
|
4959
|
-
}[];
|
|
4960
|
-
}[];
|
|
4961
|
-
edges: {
|
|
4962
|
-
report: {
|
|
4963
|
-
/** @constant */
|
|
4964
|
-
kind: "member";
|
|
4965
|
-
/** Format: uuid */
|
|
4966
|
-
userId: string;
|
|
4967
|
-
} | {
|
|
4968
|
-
/** @constant */
|
|
4969
|
-
kind: "open-role";
|
|
4970
|
-
/** Format: uuid */
|
|
4971
|
-
openRoleId: string;
|
|
4972
|
-
};
|
|
4973
|
-
manager: {
|
|
4974
|
-
/** @constant */
|
|
4975
|
-
kind: "member";
|
|
4976
|
-
/** Format: uuid */
|
|
4977
|
-
userId: string;
|
|
4978
|
-
} | {
|
|
4979
|
-
/** @constant */
|
|
4980
|
-
kind: "open-role";
|
|
4981
|
-
/** Format: uuid */
|
|
4982
|
-
openRoleId: string;
|
|
4983
|
-
};
|
|
4984
|
-
/** @enum {string} */
|
|
4985
|
-
relationshipType: "solid" | "dotted";
|
|
4986
|
-
}[];
|
|
4987
|
-
openRoles: {
|
|
4988
|
-
/** Format: uuid */
|
|
4989
|
-
id: string;
|
|
4990
|
-
/** Format: uuid */
|
|
4991
|
-
unitId: string;
|
|
4992
|
-
title: string | null;
|
|
4993
|
-
reportsTo: ({
|
|
4994
|
-
/** @constant */
|
|
4995
|
-
kind: "member";
|
|
4996
|
-
/** Format: uuid */
|
|
4997
|
-
userId: string;
|
|
4998
|
-
} | {
|
|
4999
|
-
/** @constant */
|
|
5000
|
-
kind: "open-role";
|
|
5001
|
-
/** Format: uuid */
|
|
5002
|
-
openRoleId: string;
|
|
5003
|
-
}) | null;
|
|
5004
|
-
}[];
|
|
5005
5029
|
};
|
|
5006
5030
|
/** @description Polling snapshot of a generic ingestion operation. */
|
|
5007
5031
|
IngestionOperationPollResponse: {
|
|
@@ -5692,6 +5716,19 @@ export interface components {
|
|
|
5692
5716
|
userAgent: string;
|
|
5693
5717
|
} | null;
|
|
5694
5718
|
};
|
|
5719
|
+
/** @description An ACL-admitted context-doc discovery hit. */
|
|
5720
|
+
ContextDocDiscoveryHit: {
|
|
5721
|
+
id: string;
|
|
5722
|
+
slug: string;
|
|
5723
|
+
title: string;
|
|
5724
|
+
/** @enum {string} */
|
|
5725
|
+
visibility: "private" | "unit" | "org";
|
|
5726
|
+
updatedAt: string;
|
|
5727
|
+
score: number;
|
|
5728
|
+
distance?: number;
|
|
5729
|
+
/** @enum {string} */
|
|
5730
|
+
matchedVia: "fts" | "vector";
|
|
5731
|
+
};
|
|
5695
5732
|
};
|
|
5696
5733
|
responses: never;
|
|
5697
5734
|
parameters: never;
|
|
@@ -8129,6 +8166,178 @@ export interface operations {
|
|
|
8129
8166
|
};
|
|
8130
8167
|
};
|
|
8131
8168
|
};
|
|
8169
|
+
listCompanyMdAccessRequests: {
|
|
8170
|
+
parameters: {
|
|
8171
|
+
query?: never;
|
|
8172
|
+
header?: never;
|
|
8173
|
+
path: {
|
|
8174
|
+
id: string;
|
|
8175
|
+
};
|
|
8176
|
+
cookie?: never;
|
|
8177
|
+
};
|
|
8178
|
+
requestBody?: never;
|
|
8179
|
+
responses: {
|
|
8180
|
+
/** @description Access requests for the node, with requestor identity */
|
|
8181
|
+
200: {
|
|
8182
|
+
headers: {
|
|
8183
|
+
[name: string]: unknown;
|
|
8184
|
+
};
|
|
8185
|
+
content?: never;
|
|
8186
|
+
};
|
|
8187
|
+
/** @description Caller cannot manage sharing for this node */
|
|
8188
|
+
403: {
|
|
8189
|
+
headers: {
|
|
8190
|
+
[name: string]: unknown;
|
|
8191
|
+
};
|
|
8192
|
+
content?: never;
|
|
8193
|
+
};
|
|
8194
|
+
};
|
|
8195
|
+
};
|
|
8196
|
+
createCompanyMdAccessRequest: {
|
|
8197
|
+
parameters: {
|
|
8198
|
+
query?: never;
|
|
8199
|
+
header?: never;
|
|
8200
|
+
path: {
|
|
8201
|
+
id: string;
|
|
8202
|
+
};
|
|
8203
|
+
cookie?: never;
|
|
8204
|
+
};
|
|
8205
|
+
requestBody: {
|
|
8206
|
+
content: {
|
|
8207
|
+
"application/json": components["schemas"]["AccessRequestCreate"];
|
|
8208
|
+
};
|
|
8209
|
+
};
|
|
8210
|
+
responses: {
|
|
8211
|
+
/** @description Pending access request created (or the existing pending request) */
|
|
8212
|
+
201: {
|
|
8213
|
+
headers: {
|
|
8214
|
+
[name: string]: unknown;
|
|
8215
|
+
};
|
|
8216
|
+
content?: never;
|
|
8217
|
+
};
|
|
8218
|
+
/** @description Cannot request access (already a reader, or no-leak node) */
|
|
8219
|
+
403: {
|
|
8220
|
+
headers: {
|
|
8221
|
+
[name: string]: unknown;
|
|
8222
|
+
};
|
|
8223
|
+
content?: never;
|
|
8224
|
+
};
|
|
8225
|
+
};
|
|
8226
|
+
};
|
|
8227
|
+
approveCompanyMdAccessRequest: {
|
|
8228
|
+
parameters: {
|
|
8229
|
+
query?: never;
|
|
8230
|
+
header?: never;
|
|
8231
|
+
path: {
|
|
8232
|
+
id: string;
|
|
8233
|
+
};
|
|
8234
|
+
cookie?: never;
|
|
8235
|
+
};
|
|
8236
|
+
requestBody: {
|
|
8237
|
+
content: {
|
|
8238
|
+
"application/json": components["schemas"]["ApproveAccessRequest"];
|
|
8239
|
+
};
|
|
8240
|
+
};
|
|
8241
|
+
responses: {
|
|
8242
|
+
/** @description Approved; the requester gains a normal grant */
|
|
8243
|
+
200: {
|
|
8244
|
+
headers: {
|
|
8245
|
+
[name: string]: unknown;
|
|
8246
|
+
};
|
|
8247
|
+
content?: never;
|
|
8248
|
+
};
|
|
8249
|
+
/** @description Request not found */
|
|
8250
|
+
404: {
|
|
8251
|
+
headers: {
|
|
8252
|
+
[name: string]: unknown;
|
|
8253
|
+
};
|
|
8254
|
+
content?: never;
|
|
8255
|
+
};
|
|
8256
|
+
/** @description Already resolved by another owner */
|
|
8257
|
+
409: {
|
|
8258
|
+
headers: {
|
|
8259
|
+
[name: string]: unknown;
|
|
8260
|
+
};
|
|
8261
|
+
content?: never;
|
|
8262
|
+
};
|
|
8263
|
+
};
|
|
8264
|
+
};
|
|
8265
|
+
denyCompanyMdAccessRequest: {
|
|
8266
|
+
parameters: {
|
|
8267
|
+
query?: never;
|
|
8268
|
+
header?: never;
|
|
8269
|
+
path: {
|
|
8270
|
+
id: string;
|
|
8271
|
+
};
|
|
8272
|
+
cookie?: never;
|
|
8273
|
+
};
|
|
8274
|
+
requestBody: {
|
|
8275
|
+
content: {
|
|
8276
|
+
"application/json": components["schemas"]["DenyAccessRequest"];
|
|
8277
|
+
};
|
|
8278
|
+
};
|
|
8279
|
+
responses: {
|
|
8280
|
+
/** @description Denied */
|
|
8281
|
+
200: {
|
|
8282
|
+
headers: {
|
|
8283
|
+
[name: string]: unknown;
|
|
8284
|
+
};
|
|
8285
|
+
content?: never;
|
|
8286
|
+
};
|
|
8287
|
+
/** @description Request not found */
|
|
8288
|
+
404: {
|
|
8289
|
+
headers: {
|
|
8290
|
+
[name: string]: unknown;
|
|
8291
|
+
};
|
|
8292
|
+
content?: never;
|
|
8293
|
+
};
|
|
8294
|
+
/** @description Already resolved by another owner */
|
|
8295
|
+
409: {
|
|
8296
|
+
headers: {
|
|
8297
|
+
[name: string]: unknown;
|
|
8298
|
+
};
|
|
8299
|
+
content?: never;
|
|
8300
|
+
};
|
|
8301
|
+
};
|
|
8302
|
+
};
|
|
8303
|
+
searchCompanyMdContextDocs: {
|
|
8304
|
+
parameters: {
|
|
8305
|
+
query: {
|
|
8306
|
+
q?: string;
|
|
8307
|
+
parentId: string;
|
|
8308
|
+
limit?: number;
|
|
8309
|
+
};
|
|
8310
|
+
header?: never;
|
|
8311
|
+
path?: never;
|
|
8312
|
+
cookie?: never;
|
|
8313
|
+
};
|
|
8314
|
+
requestBody?: never;
|
|
8315
|
+
responses: {
|
|
8316
|
+
/** @description ACL-admitted context-doc discovery hits */
|
|
8317
|
+
200: {
|
|
8318
|
+
headers: {
|
|
8319
|
+
[name: string]: unknown;
|
|
8320
|
+
};
|
|
8321
|
+
content: {
|
|
8322
|
+
"application/json": components["schemas"]["SearchContextDocsResponse"];
|
|
8323
|
+
};
|
|
8324
|
+
};
|
|
8325
|
+
/** @description Invalid query parameters */
|
|
8326
|
+
400: {
|
|
8327
|
+
headers: {
|
|
8328
|
+
[name: string]: unknown;
|
|
8329
|
+
};
|
|
8330
|
+
content?: never;
|
|
8331
|
+
};
|
|
8332
|
+
/** @description Requires org.view_company_md scope */
|
|
8333
|
+
403: {
|
|
8334
|
+
headers: {
|
|
8335
|
+
[name: string]: unknown;
|
|
8336
|
+
};
|
|
8337
|
+
content?: never;
|
|
8338
|
+
};
|
|
8339
|
+
};
|
|
8340
|
+
};
|
|
8132
8341
|
searchCompanyMd: {
|
|
8133
8342
|
parameters: {
|
|
8134
8343
|
query?: never;
|
|
@@ -21,9 +21,11 @@ export const openApiRoutes = {
|
|
|
21
21
|
'/api/chats/{id}/messages': ['POST'],
|
|
22
22
|
'/api/chats/{id}/messages/{messageId}': ['DELETE'],
|
|
23
23
|
'/api/chats/{id}/pin': ['DELETE', 'POST'],
|
|
24
|
+
'/api/company-md/access-requests/{id}/approve': ['POST'],
|
|
25
|
+
'/api/company-md/access-requests/{id}/deny': ['POST'],
|
|
24
26
|
'/api/company-md/context-bank': ['POST'],
|
|
25
|
-
'/api/company-md/context-bank/search': ['GET'],
|
|
26
27
|
'/api/company-md/docs/{id}': ['GET'],
|
|
28
|
+
'/api/company-md/docs/{id}/access-requests': ['GET', 'POST'],
|
|
27
29
|
'/api/company-md/docs/{id}/content': ['PUT'],
|
|
28
30
|
'/api/company-md/docs/{id}/context-bank': ['GET'],
|
|
29
31
|
'/api/company-md/docs/{id}/context-bank/associate': ['POST'],
|
|
@@ -93,6 +95,8 @@ export const openApiRoutes = {
|
|
|
93
95
|
'/api/org-units/{unitId}/open-roles/{roleId}': ['PATCH'],
|
|
94
96
|
'/api/org-units/{unitId}/open-roles/{roleId}/fill': ['POST'],
|
|
95
97
|
'/api/org-units/{unitId}/open-roles/{roleId}/reports-to': ['PUT'],
|
|
98
|
+
'/api/org-units/{unitId}/open-roles/{roleId}/title': ['PUT'],
|
|
99
|
+
'/api/org-units/{unitId}/open-roles/{roleId}/unit': ['PUT'],
|
|
96
100
|
'/api/org-units/{unitId}/owners': ['GET'],
|
|
97
101
|
'/api/org-units/{unitId}/permissions': ['GET'],
|
|
98
102
|
'/api/org-units/{unitId}/relationships': ['GET', 'POST'],
|
package/src/identity/README.md
CHANGED
|
@@ -51,12 +51,6 @@ TypeScript types and functions for user identity and display name resolution.
|
|
|
51
51
|
- `NameSource` _(type)_ — Source of the user's name data.
|
|
52
52
|
- `OrgChartActorRef` _(type)_
|
|
53
53
|
- `OrgChartActorRefSchema`
|
|
54
|
-
- `PeopleOrgChartEdge` _(type)_
|
|
55
|
-
- `PeopleOrgChartEdgeSchema`
|
|
56
|
-
- `PeopleOrgChartNode` _(type)_
|
|
57
|
-
- `PeopleOrgChartNodeSchema`
|
|
58
|
-
- `PeopleOrgChartOpenRole` _(type)_
|
|
59
|
-
- `PeopleOrgChartOpenRoleSchema`
|
|
60
54
|
- `PeopleOrgChartOwnedUnit` _(type)_
|
|
61
55
|
- `PeopleOrgChartOwnedUnitSchema`
|
|
62
56
|
- `PeopleOrgChartResponse` _(type)_
|
package/src/identity/index.ts
CHANGED
|
@@ -65,10 +65,7 @@ export type {
|
|
|
65
65
|
export {
|
|
66
66
|
ReportingRelationshipTypeSchema,
|
|
67
67
|
OrgChartActorRefSchema,
|
|
68
|
-
PeopleOrgChartNodeSchema,
|
|
69
68
|
PeopleOrgChartOwnedUnitSchema,
|
|
70
|
-
PeopleOrgChartEdgeSchema,
|
|
71
|
-
PeopleOrgChartOpenRoleSchema,
|
|
72
69
|
PeopleOrgChartSeatStatusSchema,
|
|
73
70
|
PeopleOrgChartSeatOccupantSchema,
|
|
74
71
|
PeopleOrgChartSeatSchema,
|
|
@@ -78,10 +75,7 @@ export {
|
|
|
78
75
|
export type {
|
|
79
76
|
ReportingRelationshipType,
|
|
80
77
|
OrgChartActorRef,
|
|
81
|
-
PeopleOrgChartNode,
|
|
82
78
|
PeopleOrgChartOwnedUnit,
|
|
83
|
-
PeopleOrgChartEdge,
|
|
84
|
-
PeopleOrgChartOpenRole,
|
|
85
79
|
PeopleOrgChartSeatStatus,
|
|
86
80
|
PeopleOrgChartSeatOccupant,
|
|
87
81
|
PeopleOrgChartSeat,
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* Zod response schemas for GET /api/users/org-chart — the people-org-chart
|
|
5
5
|
* view rendered from the settings page Structure → Org chart drill-down.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* The chart is position-centric (ADR-CONT-093/094): every actor is a `seat`
|
|
8
|
+
* (a `positions` row) carrying its seat-scoped attributes plus an `occupants[]`
|
|
9
|
+
* array; reporting is expressed seat→seat in `seatEdges[]`. A VACANT seat (no
|
|
10
|
+
* occupants) is the old "open role"; an OCCUPIED seat is the old "member".
|
|
9
11
|
*
|
|
10
12
|
* Person-level reporting is intentionally distinct from
|
|
11
13
|
* `org_unit_relationships.type = 'reports_to'` (unit-to-unit graph overlay,
|
|
@@ -23,17 +25,16 @@ export type ReportingRelationshipType = z.infer<
|
|
|
23
25
|
typeof ReportingRelationshipTypeSchema
|
|
24
26
|
>;
|
|
25
27
|
|
|
26
|
-
// Actor reference
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
// here so the existing import site keeps working.
|
|
28
|
+
// Actor reference (member | open-role). Retained WRITE-ONLY: the set-manager
|
|
29
|
+
// request/response (`org/schemas`) still speaks this vocabulary; the read model
|
|
30
|
+
// is now seat→seat (ADR-CONT-094) and no longer references it. Defined in its
|
|
31
|
+
// own zero-dependency module to avoid a module-init cycle with `org/schemas`,
|
|
32
|
+
// and re-exported here so the existing barrel import site keeps working.
|
|
31
33
|
export { OrgChartActorRefSchema } from "./org-chart-actor";
|
|
32
34
|
export type { OrgChartActorRef } from "./org-chart-actor";
|
|
33
|
-
import { OrgChartActorRefSchema } from "./org-chart-actor";
|
|
34
35
|
|
|
35
36
|
// ---------------------------------------------------------------------------
|
|
36
|
-
//
|
|
37
|
+
// Owned unit — shared by the seat occupant (below)
|
|
37
38
|
// ---------------------------------------------------------------------------
|
|
38
39
|
|
|
39
40
|
// A unit this person is a *local structural owner* of — i.e. holds a grant with
|
|
@@ -58,61 +59,6 @@ export type PeopleOrgChartOwnedUnit = z.infer<
|
|
|
58
59
|
typeof PeopleOrgChartOwnedUnitSchema
|
|
59
60
|
>;
|
|
60
61
|
|
|
61
|
-
export const PeopleOrgChartNodeSchema = z.object({
|
|
62
|
-
id: z.string().uuid(),
|
|
63
|
-
fullName: z.string(),
|
|
64
|
-
jobTitle: z.string().nullable(),
|
|
65
|
-
avatarUrl: z.string().nullable(),
|
|
66
|
-
primaryUnitId: z.string().uuid().nullable(),
|
|
67
|
-
// Units this person is a local structural owner of. Empty ⇒ not a unit owner.
|
|
68
|
-
// Drives the chart's owner key + tooltip; the account owner (root-unit owner)
|
|
69
|
-
// is rendered with the org owner icon (crown) instead.
|
|
70
|
-
ownedUnits: z.array(PeopleOrgChartOwnedUnitSchema),
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export type PeopleOrgChartNode = z.infer<typeof PeopleOrgChartNodeSchema>;
|
|
74
|
-
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
|
-
// Edge — a reporting line between two people
|
|
77
|
-
// ---------------------------------------------------------------------------
|
|
78
|
-
|
|
79
|
-
export const PeopleOrgChartEdgeSchema = z.object({
|
|
80
|
-
// Either endpoint may be a member or an open-role seat. An edge whose
|
|
81
|
-
// `manager` is an open-role seat is "a person reports to a vacant role"
|
|
82
|
-
// (ADR-BE-312); whose `report` is an open-role seat is "an open role reports
|
|
83
|
-
// to someone" (ADR-BE-291) — both are now expressible symmetrically.
|
|
84
|
-
report: OrgChartActorRefSchema,
|
|
85
|
-
manager: OrgChartActorRefSchema,
|
|
86
|
-
relationshipType: ReportingRelationshipTypeSchema,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
export type PeopleOrgChartEdge = z.infer<typeof PeopleOrgChartEdgeSchema>;
|
|
90
|
-
|
|
91
|
-
// ---------------------------------------------------------------------------
|
|
92
|
-
// Open role — a persisted placeholder seat rendered as a dashed "Open role"
|
|
93
|
-
// card in its unit's sibling column. Only active roles (open + hiring) are
|
|
94
|
-
// included; filled/closed roles never appear here. `unitId` seats the card in
|
|
95
|
-
// the right column. `reportsTo` is the open role's OWN reporting edge
|
|
96
|
-
// (ADR-BE-291): it defaults to the role's creator and is editable/clearable, so
|
|
97
|
-
// a person-less seat is placed by reporting like everyone else (the chart owns
|
|
98
|
-
// placement, ADR-CTRL-159). Null → the role hangs in its unit's projection-only
|
|
99
|
-
// Unassigned bucket. This replaces the retired unit-head anchor (ADR-BE-284).
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
|
|
102
|
-
export const PeopleOrgChartOpenRoleSchema = z.object({
|
|
103
|
-
id: z.string().uuid(),
|
|
104
|
-
unitId: z.string().uuid(),
|
|
105
|
-
title: z.string().nullable(),
|
|
106
|
-
// The open role's OWN reporting edge (ADR-BE-291). An actor ref so an open
|
|
107
|
-
// role can report to a person OR to another open-role seat (ADR-BE-312). Null
|
|
108
|
-
// → the role hangs in its unit's projection-only Unassigned bucket.
|
|
109
|
-
reportsTo: OrgChartActorRefSchema.nullable(),
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
export type PeopleOrgChartOpenRole = z.infer<
|
|
113
|
-
typeof PeopleOrgChartOpenRoleSchema
|
|
114
|
-
>;
|
|
115
|
-
|
|
116
62
|
// ---------------------------------------------------------------------------
|
|
117
63
|
// Seat — the position-centric unification (ADR-CONT-093)
|
|
118
64
|
// ---------------------------------------------------------------------------
|
|
@@ -126,12 +72,11 @@ export type PeopleOrgChartOpenRole = z.infer<
|
|
|
126
72
|
// for a co-occupied seat — forward-compatible; live data is 0/1). Reporting is
|
|
127
73
|
// expressed seat→seat in `seatEdges[]`, NOT on the seat, so the edge list stays
|
|
128
74
|
// the single source of truth for placement (ADR-CTRL-159). `OrgChartActorRef`
|
|
129
|
-
// is retained write-only (set-manager request/response) and is
|
|
130
|
-
//
|
|
75
|
+
// is retained write-only (set-manager request/response) and is absent from this
|
|
76
|
+
// read model.
|
|
131
77
|
//
|
|
132
|
-
//
|
|
133
|
-
// `nodes`/`edges`/`openRoles`
|
|
134
|
-
// both from one position pass. A later breaking minor removes the legacy half.
|
|
78
|
+
// `seats[]` + `seatEdges[]` are now the ONLY shape — the legacy
|
|
79
|
+
// `nodes`/`edges`/`openRoles` half was removed in ADR-CONT-094 (breaking).
|
|
135
80
|
|
|
136
81
|
export const PeopleOrgChartSeatStatusSchema = z.enum([
|
|
137
82
|
"planned",
|
|
@@ -204,25 +149,16 @@ export type PeopleOrgChartSeatEdge = z.infer<
|
|
|
204
149
|
// GET /api/users/org-chart
|
|
205
150
|
// ---------------------------------------------------------------------------
|
|
206
151
|
//
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
152
|
+
// Position-centric (ADR-CONT-093/094): `seats[]` carries every chart actor
|
|
153
|
+
// (occupied or vacant) and `seatEdges[]` the seat→seat reporting graph — the
|
|
154
|
+
// single source of truth for placement (ADR-CTRL-159). A vacant seat with no
|
|
155
|
+
// edge hangs in its unit's projection-only Unassigned bucket.
|
|
211
156
|
|
|
212
157
|
export const PeopleOrgChartResponseSchema = z.object({
|
|
213
|
-
//
|
|
214
|
-
// actor (occupied or vacant) and `seatEdges[]` the seat→seat reporting graph.
|
|
215
|
-
// ADDITIVE alongside the legacy fields below during the transition; a later
|
|
216
|
-
// breaking minor removes the legacy half.
|
|
158
|
+
// Every chart actor (occupied or vacant), keyed by the stable positionId.
|
|
217
159
|
seats: z.array(PeopleOrgChartSeatSchema),
|
|
160
|
+
// The seat→seat reporting graph (one row per `position_reporting` row).
|
|
218
161
|
seatEdges: z.array(PeopleOrgChartSeatEdgeSchema),
|
|
219
|
-
// Legacy, transitional (ADR-CONT-093 supersedes). Derived from the same
|
|
220
|
-
// position pass as `seats`/`seatEdges`; consumers should migrate to the seat
|
|
221
|
-
// model. `nodes` = occupied actors, `openRoles` = vacant 'open' actors,
|
|
222
|
-
// `edges` = the same reporting graph keyed by person/open-role actor refs.
|
|
223
|
-
nodes: z.array(PeopleOrgChartNodeSchema),
|
|
224
|
-
edges: z.array(PeopleOrgChartEdgeSchema),
|
|
225
|
-
openRoles: z.array(PeopleOrgChartOpenRoleSchema),
|
|
226
162
|
});
|
|
227
163
|
|
|
228
164
|
export type PeopleOrgChartResponse = z.infer<
|
package/src/index.ts
CHANGED
|
@@ -176,10 +176,7 @@ export type {
|
|
|
176
176
|
export {
|
|
177
177
|
ReportingRelationshipTypeSchema,
|
|
178
178
|
OrgChartActorRefSchema,
|
|
179
|
-
PeopleOrgChartNodeSchema,
|
|
180
179
|
PeopleOrgChartOwnedUnitSchema,
|
|
181
|
-
PeopleOrgChartEdgeSchema,
|
|
182
|
-
PeopleOrgChartOpenRoleSchema,
|
|
183
180
|
PeopleOrgChartSeatStatusSchema,
|
|
184
181
|
PeopleOrgChartSeatOccupantSchema,
|
|
185
182
|
PeopleOrgChartSeatSchema,
|
|
@@ -189,10 +186,7 @@ export {
|
|
|
189
186
|
export type {
|
|
190
187
|
ReportingRelationshipType,
|
|
191
188
|
OrgChartActorRef,
|
|
192
|
-
PeopleOrgChartNode,
|
|
193
189
|
PeopleOrgChartOwnedUnit,
|
|
194
|
-
PeopleOrgChartEdge,
|
|
195
|
-
PeopleOrgChartOpenRole,
|
|
196
190
|
PeopleOrgChartSeatStatus,
|
|
197
191
|
PeopleOrgChartSeatOccupant,
|
|
198
192
|
PeopleOrgChartSeat,
|