@company-semantics/contracts 1.23.0 → 1.24.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.23.0",
3
+ "version": "1.24.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -115,15 +115,15 @@
115
115
  "zod": "^4.4.3"
116
116
  },
117
117
  "devDependencies": {
118
- "@types/node": "^25.6.0",
118
+ "@types/node": "^25.7.0",
119
119
  "husky": "^9.1.7",
120
- "lint-staged": "^16.4.0",
120
+ "lint-staged": "^17.0.4",
121
121
  "markdownlint-cli2": "^0.22.1",
122
122
  "openapi-typescript": "^7.13.0",
123
123
  "tsx": "^4.21.0",
124
124
  "typescript": "^5",
125
- "vitest": "^4.1.5",
126
- "yaml": "^2.8.4"
125
+ "vitest": "^4.1.6",
126
+ "yaml": "^2.9.0"
127
127
  },
128
128
  "pnpm": {
129
129
  "overrides": {
@@ -60,3 +60,17 @@ export type {
60
60
  BannerDismissedListResponse,
61
61
  BannerDismissResponse,
62
62
  } from './schemas';
63
+
64
+ // People Org Chart (GET /api/users/org-chart)
65
+ export {
66
+ ReportingRelationshipTypeSchema,
67
+ PeopleOrgChartNodeSchema,
68
+ PeopleOrgChartEdgeSchema,
69
+ PeopleOrgChartResponseSchema,
70
+ } from './people-org-chart';
71
+ export type {
72
+ ReportingRelationshipType,
73
+ PeopleOrgChartNode,
74
+ PeopleOrgChartEdge,
75
+ PeopleOrgChartResponse,
76
+ } from './people-org-chart';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * People Org Chart Response Schemas
3
+ *
4
+ * Zod response schemas for GET /api/users/org-chart — the people-org-chart
5
+ * view rendered from the settings page Structure → Org chart drill-down.
6
+ *
7
+ * Nodes are users (with optional avatar + job title); edges encode
8
+ * person-to-person reporting lines from the `user_reporting` table.
9
+ *
10
+ * Person-level reporting is intentionally distinct from
11
+ * `org_unit_relationships.type = 'reports_to'` (unit-to-unit graph overlay,
12
+ * ADR-BE-120). Tree traversal must never consult either.
13
+ */
14
+ import { z } from 'zod';
15
+
16
+ // ---------------------------------------------------------------------------
17
+ // Reporting Relationship Type
18
+ // ---------------------------------------------------------------------------
19
+
20
+ export const ReportingRelationshipTypeSchema = z.enum(['solid', 'dotted']);
21
+ export type ReportingRelationshipType = z.infer<typeof ReportingRelationshipTypeSchema>;
22
+
23
+ // ---------------------------------------------------------------------------
24
+ // Node — a person in the chart
25
+ // ---------------------------------------------------------------------------
26
+
27
+ export const PeopleOrgChartNodeSchema = z.object({
28
+ id: z.string().uuid(),
29
+ fullName: z.string(),
30
+ jobTitle: z.string().nullable(),
31
+ slackAvatarUrl: z.string().nullable(),
32
+ primaryUnitId: z.string().uuid().nullable(),
33
+ });
34
+
35
+ export type PeopleOrgChartNode = z.infer<typeof PeopleOrgChartNodeSchema>;
36
+
37
+ // ---------------------------------------------------------------------------
38
+ // Edge — a reporting line between two people
39
+ // ---------------------------------------------------------------------------
40
+
41
+ export const PeopleOrgChartEdgeSchema = z.object({
42
+ reportUserId: z.string().uuid(),
43
+ managerUserId: z.string().uuid(),
44
+ relationshipType: ReportingRelationshipTypeSchema,
45
+ });
46
+
47
+ export type PeopleOrgChartEdge = z.infer<typeof PeopleOrgChartEdgeSchema>;
48
+
49
+ // ---------------------------------------------------------------------------
50
+ // GET /api/users/org-chart
51
+ // ---------------------------------------------------------------------------
52
+
53
+ export const PeopleOrgChartResponseSchema = z.object({
54
+ nodes: z.array(PeopleOrgChartNodeSchema),
55
+ edges: z.array(PeopleOrgChartEdgeSchema),
56
+ });
57
+
58
+ export type PeopleOrgChartResponse = z.infer<typeof PeopleOrgChartResponseSchema>;
@@ -66,6 +66,12 @@ export type UserIdentity = {
66
66
  */
67
67
  nameSource: NameSource;
68
68
 
69
+ /**
70
+ * Free-text job title displayed in the people org chart and team views.
71
+ * Optional; not authoritative for role/RBAC.
72
+ */
73
+ jobTitle?: string | null;
74
+
69
75
  /** When the identity was created */
70
76
  createdAt: ISODateString;
71
77