@company-semantics/contracts 3.0.0 → 5.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 +7 -10
- package/src/index.ts +1 -2
- package/src/org/index.ts +3 -4
- package/src/org/org-units.ts +0 -3
- package/src/org/schemas.ts +14 -6
- package/src/org/types.ts +15 -22
- package/src/permissions/orgchart-roles.ts +23 -3
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 = 'f8ecf637857f' as const;
|
|
3
|
+
export const SPEC_HASH_FULL = 'f8ecf637857fded90a144d5a76bfa2919d3494bb0b5b78d4131e906ab4a6edf5' as const;
|
package/src/api/generated.ts
CHANGED
|
@@ -1859,7 +1859,7 @@ export interface paths {
|
|
|
1859
1859
|
};
|
|
1860
1860
|
get?: never;
|
|
1861
1861
|
/** Update a manual membership role */
|
|
1862
|
-
put: operations["
|
|
1862
|
+
put: operations["updateUnitMembershipRole"];
|
|
1863
1863
|
post?: never;
|
|
1864
1864
|
delete?: never;
|
|
1865
1865
|
options?: never;
|
|
@@ -3059,8 +3059,7 @@ export interface components {
|
|
|
3059
3059
|
name: string;
|
|
3060
3060
|
email: string;
|
|
3061
3061
|
jobTitle: string | null;
|
|
3062
|
-
|
|
3063
|
-
role: "owner" | "admin" | "member" | "auditor";
|
|
3062
|
+
role: ("ceo" | "leader" | "delegate" | "admin") | null;
|
|
3064
3063
|
roleNames: string[];
|
|
3065
3064
|
joinedAt: string;
|
|
3066
3065
|
lastActiveAt: string | null;
|
|
@@ -3248,8 +3247,7 @@ export interface components {
|
|
|
3248
3247
|
name: string;
|
|
3249
3248
|
email: string;
|
|
3250
3249
|
jobTitle: string | null;
|
|
3251
|
-
|
|
3252
|
-
role: "owner" | "admin" | "member" | "auditor";
|
|
3250
|
+
role: ("ceo" | "leader" | "delegate" | "admin") | null;
|
|
3253
3251
|
roleNames: string[];
|
|
3254
3252
|
joinedAt: string;
|
|
3255
3253
|
lastActiveAt: string | null;
|
|
@@ -3305,8 +3303,7 @@ export interface components {
|
|
|
3305
3303
|
orgId: string;
|
|
3306
3304
|
orgName: string;
|
|
3307
3305
|
orgSlug: string;
|
|
3308
|
-
|
|
3309
|
-
role: "owner" | "admin" | "member" | "auditor";
|
|
3306
|
+
role: ("ceo" | "leader" | "delegate" | "admin") | null;
|
|
3310
3307
|
joinedAt: string;
|
|
3311
3308
|
isActive: boolean;
|
|
3312
3309
|
/** @enum {string} */
|
|
@@ -3341,7 +3338,7 @@ export interface components {
|
|
|
3341
3338
|
orgId: string;
|
|
3342
3339
|
email: string;
|
|
3343
3340
|
/** @enum {string} */
|
|
3344
|
-
role: "
|
|
3341
|
+
role: "admin" | "member";
|
|
3345
3342
|
invitedBy: {
|
|
3346
3343
|
id: string;
|
|
3347
3344
|
name: string;
|
|
@@ -3364,7 +3361,7 @@ export interface components {
|
|
|
3364
3361
|
orgId: string;
|
|
3365
3362
|
email: string;
|
|
3366
3363
|
/** @enum {string} */
|
|
3367
|
-
role: "
|
|
3364
|
+
role: "admin" | "member";
|
|
3368
3365
|
invitedBy: {
|
|
3369
3366
|
id: string;
|
|
3370
3367
|
name: string;
|
|
@@ -7641,7 +7638,7 @@ export interface operations {
|
|
|
7641
7638
|
};
|
|
7642
7639
|
};
|
|
7643
7640
|
};
|
|
7644
|
-
|
|
7641
|
+
updateUnitMembershipRole: {
|
|
7645
7642
|
parameters: {
|
|
7646
7643
|
query?: never;
|
|
7647
7644
|
header?: never;
|
package/src/index.ts
CHANGED
|
@@ -263,7 +263,6 @@ export type {
|
|
|
263
263
|
OwnershipTransferStatus,
|
|
264
264
|
// Workspace visibility DTOs (Phase 2)
|
|
265
265
|
// @see ADR-CONT-030 for design rationale
|
|
266
|
-
WorkspaceRole,
|
|
267
266
|
WorkspaceOverview,
|
|
268
267
|
WorkspaceMember,
|
|
269
268
|
AuthMethodConfig,
|
|
@@ -342,7 +341,7 @@ export type {
|
|
|
342
341
|
PermissionAuditEntry,
|
|
343
342
|
} from './org/index'
|
|
344
343
|
|
|
345
|
-
export {
|
|
344
|
+
export { VIEW_SCOPE_MAP, getViewScope, TRANSFER_RESPONSIBILITIES, IDENTITY_TRUST_LEVEL_LABELS } from './org/index'
|
|
346
345
|
|
|
347
346
|
// View authorization types (Phase 5 - ADR-APP-013)
|
|
348
347
|
export type { AuthorizableView } from './org/index'
|
package/src/org/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ export type {
|
|
|
12
12
|
OwnershipTransferRequest,
|
|
13
13
|
OwnershipTransferStatus,
|
|
14
14
|
// Workspace visibility DTOs (Phase 2)
|
|
15
|
-
WorkspaceRole,
|
|
16
15
|
WorkspaceOverview,
|
|
17
16
|
WorkspaceMember,
|
|
18
17
|
WorkspaceMemberUnitSummary,
|
|
@@ -71,7 +70,7 @@ export type {
|
|
|
71
70
|
TransferMemberEligibility,
|
|
72
71
|
} from './types';
|
|
73
72
|
|
|
74
|
-
export {
|
|
73
|
+
export { TRANSFER_RESPONSIBILITIES, IDENTITY_TRUST_LEVEL_LABELS } from './types';
|
|
75
74
|
|
|
76
75
|
// Domain types (Phase 4)
|
|
77
76
|
export type {
|
|
@@ -209,7 +208,6 @@ export type {
|
|
|
209
208
|
OrgUnitVisibility,
|
|
210
209
|
OrgUnitRelationshipType,
|
|
211
210
|
OrgUnitRelationshipRole,
|
|
212
|
-
OrgUnitMembershipRole,
|
|
213
211
|
OrgUnitMembershipStatus,
|
|
214
212
|
OrgUnitMembershipSource,
|
|
215
213
|
OrgUnitErrorCode,
|
|
@@ -222,7 +220,7 @@ export {
|
|
|
222
220
|
OrgUnitVisibilitySchema,
|
|
223
221
|
OrgUnitRelationshipTypeSchema,
|
|
224
222
|
OrgUnitRelationshipRoleSchema,
|
|
225
|
-
|
|
223
|
+
UnitMembershipRoleSchema,
|
|
226
224
|
OrgUnitMembershipStatusSchema,
|
|
227
225
|
OrgUnitMembershipSourceSchema,
|
|
228
226
|
OrgUnitErrorCodeSchema,
|
|
@@ -248,6 +246,7 @@ export {
|
|
|
248
246
|
UpdateOrgUnitResponseSchema,
|
|
249
247
|
} from './schemas';
|
|
250
248
|
export type {
|
|
249
|
+
UnitMembershipRole,
|
|
251
250
|
OrgUnit,
|
|
252
251
|
OrgUnitTreeNode,
|
|
253
252
|
OrgUnitMembership,
|
package/src/org/org-units.ts
CHANGED
|
@@ -36,9 +36,6 @@ export type OrgUnitRelationshipType = 'collaborates_with' | 'reports_to' | 'depe
|
|
|
36
36
|
/** Edge role — refines the collaboration nature on a graph edge. */
|
|
37
37
|
export type OrgUnitRelationshipRole = 'owner' | 'participant' | 'supporting';
|
|
38
38
|
|
|
39
|
-
/** Per-unit user role. Privilege order: owner > manager > member. */
|
|
40
|
-
export type OrgUnitMembershipRole = 'member' | 'manager' | 'owner';
|
|
41
|
-
|
|
42
39
|
/** Active/pending/removed lifecycle for a unit membership. */
|
|
43
40
|
export type OrgUnitMembershipStatus = 'active' | 'pending' | 'removed';
|
|
44
41
|
|
package/src/org/schemas.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { z } from 'zod';
|
|
14
14
|
import { CursorPageSchema } from '../api/primitives';
|
|
15
|
+
import { OrgChartRoleSchema } from '../permissions/orgchart-roles';
|
|
15
16
|
|
|
16
17
|
// ---------------------------------------------------------------------------
|
|
17
18
|
// Sub-schemas
|
|
@@ -29,7 +30,7 @@ const WorkspaceMemberSchema = z.object({
|
|
|
29
30
|
name: z.string(),
|
|
30
31
|
email: z.string(),
|
|
31
32
|
jobTitle: z.string().nullable(),
|
|
32
|
-
role:
|
|
33
|
+
role: OrgChartRoleSchema.nullable(),
|
|
33
34
|
roleNames: z.array(z.string()),
|
|
34
35
|
joinedAt: z.string(),
|
|
35
36
|
lastActiveAt: z.string().nullable(),
|
|
@@ -357,7 +358,7 @@ const UserOrgMembershipSchema = z.object({
|
|
|
357
358
|
orgId: z.string(),
|
|
358
359
|
orgName: z.string(),
|
|
359
360
|
orgSlug: z.string(),
|
|
360
|
-
role:
|
|
361
|
+
role: OrgChartRoleSchema.nullable(),
|
|
361
362
|
joinedAt: z.string(),
|
|
362
363
|
isActive: z.boolean(),
|
|
363
364
|
orgType: z.enum(['personal', 'shared']),
|
|
@@ -419,7 +420,7 @@ const OrgInviteSchema = z.object({
|
|
|
419
420
|
id: z.string(),
|
|
420
421
|
orgId: z.string(),
|
|
421
422
|
email: z.string(),
|
|
422
|
-
role: z.enum(['
|
|
423
|
+
role: z.enum(['admin', 'member']),
|
|
423
424
|
invitedBy: z.object({ id: z.string(), name: z.string() }),
|
|
424
425
|
status: z.enum(['pending', 'accepted', 'expired', 'revoked']),
|
|
425
426
|
createdAt: z.string(),
|
|
@@ -676,7 +677,12 @@ export const OrgUnitRelationshipTypeSchema = z.enum([
|
|
|
676
677
|
|
|
677
678
|
export const OrgUnitRelationshipRoleSchema = z.enum(['owner', 'participant', 'supporting']);
|
|
678
679
|
|
|
679
|
-
|
|
680
|
+
/**
|
|
681
|
+
* Positional slot a member holds in the org-unit tree. ORTHOGONAL to the
|
|
682
|
+
* `OrgChartRole` policy vocabulary (this is an INPUT to authority resolution,
|
|
683
|
+
* not the derived policy role). Level is encoded in the value (l1…l5).
|
|
684
|
+
*/
|
|
685
|
+
export const UnitMembershipRoleSchema = z.enum([
|
|
680
686
|
'member',
|
|
681
687
|
'l1_unit_owner',
|
|
682
688
|
'l2_unit_owner',
|
|
@@ -685,6 +691,8 @@ export const OrgUnitMembershipRoleSchema = z.enum([
|
|
|
685
691
|
'l5_unit_owner',
|
|
686
692
|
]);
|
|
687
693
|
|
|
694
|
+
export type UnitMembershipRole = z.infer<typeof UnitMembershipRoleSchema>;
|
|
695
|
+
|
|
688
696
|
export const OrgUnitMembershipStatusSchema = z.enum(['active', 'pending', 'removed']);
|
|
689
697
|
|
|
690
698
|
export const OrgUnitMembershipSourceSchema = z.enum([
|
|
@@ -750,7 +758,7 @@ export const OrgUnitMembershipSchema = z.object({
|
|
|
750
758
|
orgId: z.string().uuid(),
|
|
751
759
|
unitId: z.string().uuid(),
|
|
752
760
|
userId: z.string().uuid(),
|
|
753
|
-
membershipRole:
|
|
761
|
+
membershipRole: UnitMembershipRoleSchema,
|
|
754
762
|
status: OrgUnitMembershipStatusSchema,
|
|
755
763
|
source: OrgUnitMembershipSourceSchema,
|
|
756
764
|
sourceRef: z.string().nullable(),
|
|
@@ -1012,7 +1020,7 @@ export const OrgUnitMembershipListResponseSchema = z.object({
|
|
|
1012
1020
|
*/
|
|
1013
1021
|
export const OrgUnitPermissionsEntrySchema = z.object({
|
|
1014
1022
|
userId: z.string().uuid(),
|
|
1015
|
-
membershipRole:
|
|
1023
|
+
membershipRole: UnitMembershipRoleSchema,
|
|
1016
1024
|
inheritedFromUnitId: z.string().uuid(),
|
|
1017
1025
|
inheritedFromUnitName: z.string().min(1),
|
|
1018
1026
|
});
|
package/src/org/types.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* @see ADR-BE-XXX (Personal vs Shared Organization Model)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type { OrgChartRole } from '../permissions/orgchart-roles';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Organization type distinguishes personal workspaces from shared organizations.
|
|
10
12
|
* - 'personal': Single-user workspace, owned by creator, claimable
|
|
@@ -53,22 +55,6 @@ export interface OwnershipTransferStatus {
|
|
|
53
55
|
// @see ADR-CONT-030 for design rationale
|
|
54
56
|
// =============================================================================
|
|
55
57
|
|
|
56
|
-
/**
|
|
57
|
-
* Display role for workspace members.
|
|
58
|
-
* Presentation-layer simplification of the internal RBAC roles.
|
|
59
|
-
*/
|
|
60
|
-
export type WorkspaceRole = 'owner' | 'admin' | 'member' | 'auditor';
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* RBAC → UI role mapping (presentation only).
|
|
64
|
-
* Maps internal system roles to user-facing display roles.
|
|
65
|
-
*/
|
|
66
|
-
export const ROLE_DISPLAY_MAP = {
|
|
67
|
-
org_owner: 'owner',
|
|
68
|
-
org_admin: 'admin',
|
|
69
|
-
org_auditor: 'auditor',
|
|
70
|
-
// All other roles → 'member'
|
|
71
|
-
} as const satisfies Partial<Record<string, WorkspaceRole>>;
|
|
72
58
|
|
|
73
59
|
/**
|
|
74
60
|
* Workspace overview for the control plane UI.
|
|
@@ -120,9 +106,12 @@ export interface WorkspaceMember {
|
|
|
120
106
|
email: string;
|
|
121
107
|
/** Free-text job title (`users.job_title`). Null when unset. */
|
|
122
108
|
jobTitle: string | null;
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Display role — the member's highest org-chart standing, or `null` for a
|
|
111
|
+
* plain member with no org-chart authority. Render via `orgChartRoleLabel`.
|
|
112
|
+
*/
|
|
113
|
+
role: OrgChartRole | null;
|
|
114
|
+
/** Raw RBAC role names (e.g. 'ceo', 'admin', 'delegate'). Superset of `role`. */
|
|
126
115
|
roleNames: string[];
|
|
127
116
|
joinedAt: string;
|
|
128
117
|
/** ISO timestamp of last activity; null if never recorded. */
|
|
@@ -424,7 +413,8 @@ export interface OrgInvite {
|
|
|
424
413
|
id: string;
|
|
425
414
|
orgId: string;
|
|
426
415
|
email: string;
|
|
427
|
-
role
|
|
416
|
+
/** Invite role — invites only grant the restricted {admin, member} domain. */
|
|
417
|
+
role: 'admin' | 'member';
|
|
428
418
|
invitedBy: {
|
|
429
419
|
id: string;
|
|
430
420
|
name: string;
|
|
@@ -555,8 +545,11 @@ export interface UserOrgMembership {
|
|
|
555
545
|
orgId: string;
|
|
556
546
|
orgName: string;
|
|
557
547
|
orgSlug: string;
|
|
558
|
-
/**
|
|
559
|
-
|
|
548
|
+
/**
|
|
549
|
+
* Display role — highest org-chart standing, or `null` for a plain member.
|
|
550
|
+
* Presentation only, not for auth decisions. Render via `orgChartRoleLabel`.
|
|
551
|
+
*/
|
|
552
|
+
role: OrgChartRole | null;
|
|
560
553
|
/** ISO8601 timestamp when user joined the organization. */
|
|
561
554
|
joinedAt: string;
|
|
562
555
|
/** Whether this membership is currently active. */
|
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Consumers: AUTH-006 policy registry (PRD-00674),
|
|
13
13
|
* AUTH-009 org-chart member CRUD UI (PRD-00677),
|
|
14
|
-
* AUTH-011C
|
|
14
|
+
* AUTH-011C convergence (PRD-00681) — the single role vocabulary after the
|
|
15
|
+
* legacy workspace display-role and per-unit membership-role enums were removed.
|
|
15
16
|
*
|
|
16
|
-
* The
|
|
17
|
-
*
|
|
17
|
+
* The org-level display badge collapses onto this vocabulary: an actor's
|
|
18
|
+
* highest org-chart standing, or `null` for a plain member with no authority.
|
|
19
|
+
* The positional slot (`UnitMembershipRole`, `member | l1_unit_owner | …`)
|
|
20
|
+
* remains a separate, orthogonal axis — it is an INPUT to authority
|
|
21
|
+
* resolution, not the derived policy role.
|
|
18
22
|
*/
|
|
19
23
|
import { z } from 'zod';
|
|
20
24
|
|
|
@@ -22,3 +26,19 @@ export const ORG_CHART_ROLES = ['ceo', 'leader', 'delegate', 'admin'] as const;
|
|
|
22
26
|
export type OrgChartRole = (typeof ORG_CHART_ROLES)[number];
|
|
23
27
|
|
|
24
28
|
export const OrgChartRoleSchema = z.enum(ORG_CHART_ROLES);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Human-readable labels for the org-chart role display badge. `null` (no
|
|
32
|
+
* org-chart standing) renders as "Member" via {@link orgChartRoleLabel}.
|
|
33
|
+
*/
|
|
34
|
+
export const ORG_CHART_ROLE_LABELS: Record<OrgChartRole, string> = {
|
|
35
|
+
ceo: 'CEO',
|
|
36
|
+
leader: 'Leader',
|
|
37
|
+
delegate: 'Delegate',
|
|
38
|
+
admin: 'Admin',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Display label for a (possibly null) org-chart role; `null` = plain member. */
|
|
42
|
+
export function orgChartRoleLabel(role: OrgChartRole | null): string {
|
|
43
|
+
return role === null ? 'Member' : ORG_CHART_ROLE_LABELS[role];
|
|
44
|
+
}
|