@company-semantics/contracts 1.8.0 → 1.9.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/org/index.ts +2 -0
- package/src/org/org-units.ts +42 -0
package/package.json
CHANGED
package/src/org/index.ts
CHANGED
|
@@ -204,7 +204,9 @@ export type {
|
|
|
204
204
|
OrgUnitMembershipStatus,
|
|
205
205
|
OrgUnitMembershipSource,
|
|
206
206
|
OrgUnitErrorCode,
|
|
207
|
+
OrgTreeResponse,
|
|
207
208
|
} from './org-units';
|
|
209
|
+
export { ORG_UNITS_ROUTES } from './org-units';
|
|
208
210
|
export {
|
|
209
211
|
OrgUnitClassificationSchema,
|
|
210
212
|
OrgUnitSyncModeSchema,
|
package/src/org/org-units.ts
CHANGED
|
@@ -45,6 +45,48 @@ export type OrgUnitMembershipStatus = 'active' | 'pending' | 'removed';
|
|
|
45
45
|
/** External directory origin of a membership row. */
|
|
46
46
|
export type OrgUnitMembershipSource = 'manual' | 'google_groups' | 'scim' | 'hris';
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Canonical route path constants for the `/api/org-units` surface.
|
|
50
|
+
*
|
|
51
|
+
* Consumers (backend route handlers, app hooks, typed clients) MUST import
|
|
52
|
+
* these rather than inlining path literals so a single rename stays
|
|
53
|
+
* consistent across the system. Parameterised paths are exposed as
|
|
54
|
+
* functions so callers cannot forget to interpolate the id.
|
|
55
|
+
*
|
|
56
|
+
* `tree` returns an `OrgTreeResponse` (alias for `OrgUnitTreeResponse`,
|
|
57
|
+
* shape `{ nodes, levelConfig }` — see `./schemas`).
|
|
58
|
+
*
|
|
59
|
+
* Used by PRD-00511 to consolidate the legacy `/api/org-tree` handler
|
|
60
|
+
* into `/api/org-units/tree` without changing the response shape.
|
|
61
|
+
*/
|
|
62
|
+
export const ORG_UNITS_ROUTES = {
|
|
63
|
+
list: '/api/org-units',
|
|
64
|
+
tree: '/api/org-units/tree',
|
|
65
|
+
byId: (unitId: string) => `/api/org-units/${unitId}`,
|
|
66
|
+
children: (unitId: string) => `/api/org-units/${unitId}/children`,
|
|
67
|
+
ancestors: (unitId: string) => `/api/org-units/${unitId}/ancestors`,
|
|
68
|
+
descendants: (unitId: string) => `/api/org-units/${unitId}/descendants`,
|
|
69
|
+
archive: (unitId: string) => `/api/org-units/${unitId}/archive`,
|
|
70
|
+
reparent: (unitId: string) => `/api/org-units/${unitId}/reparent`,
|
|
71
|
+
reorder: (unitId: string) => `/api/org-units/${unitId}/reorder`,
|
|
72
|
+
relationships: (unitId: string) => `/api/org-units/${unitId}/relationships`,
|
|
73
|
+
memberships: (unitId: string) => `/api/org-units/${unitId}/memberships`,
|
|
74
|
+
membershipByUser: (unitId: string, userId: string) =>
|
|
75
|
+
`/api/org-units/${unitId}/memberships/${userId}`,
|
|
76
|
+
membershipRole: (unitId: string, userId: string) =>
|
|
77
|
+
`/api/org-units/${unitId}/memberships/${userId}/role`,
|
|
78
|
+
permissions: (unitId: string) => `/api/org-units/${unitId}/permissions`,
|
|
79
|
+
} as const;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Domain-level alias for the tree endpoint response type.
|
|
83
|
+
*
|
|
84
|
+
* The canonical schema lives in `./schemas` as `OrgUnitTreeResponseSchema`
|
|
85
|
+
* / `OrgUnitTreeResponse`. This alias gives consumers the shorter
|
|
86
|
+
* `OrgTreeResponse` name used by `GET /api/org-units/tree`.
|
|
87
|
+
*/
|
|
88
|
+
export type { OrgUnitTreeResponse as OrgTreeResponse } from './schemas';
|
|
89
|
+
|
|
48
90
|
/**
|
|
49
91
|
* Error codes returned by `POST /api/org-units/:id/reparent` and related
|
|
50
92
|
* mutation endpoints. Clients must handle these explicitly.
|