@company-semantics/contracts 12.2.0 → 13.0.1

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": "12.2.0",
3
+ "version": "13.0.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '256c847768b8' as const;
3
- export const SPEC_HASH_FULL = '256c847768b815079ad97a8b75438b3e3162e1caa223c7d8a97ac33285316192' as const;
2
+ export const SPEC_HASH = 'dd85c63b3fd6' as const;
3
+ export const SPEC_HASH_FULL = 'dd85c63b3fd6d351429bf5f601815dea1e6b22e52f31f467c7d1df4616d0b03f' as const;
@@ -3247,6 +3247,7 @@ export interface components {
3247
3247
  name: string;
3248
3248
  email: string;
3249
3249
  };
3250
+ ownerTitle: string;
3250
3251
  createdAt: string;
3251
3252
  memberCount: number;
3252
3253
  claimable: boolean;
@@ -3258,7 +3259,8 @@ export interface components {
3258
3259
  handle: string;
3259
3260
  };
3260
3261
  OrgRenameRequest: {
3261
- name: string;
3262
+ name?: string;
3263
+ ownerTitle?: string | null;
3262
3264
  };
3263
3265
  WorkspaceMembersResponse: {
3264
3266
  items: {
@@ -3267,7 +3269,7 @@ export interface components {
3267
3269
  email: string;
3268
3270
  avatarUrl?: string | null;
3269
3271
  jobTitle: string | null;
3270
- role: ("ceo" | "leader" | "delegate" | "admin") | null;
3272
+ role: ("owner" | "leader" | "delegate" | "admin") | null;
3271
3273
  roleNames: string[];
3272
3274
  joinedAt: string;
3273
3275
  lastActiveAt: string | null;
@@ -3462,7 +3464,7 @@ export interface components {
3462
3464
  email: string;
3463
3465
  avatarUrl?: string | null;
3464
3466
  jobTitle: string | null;
3465
- role: ("ceo" | "leader" | "delegate" | "admin") | null;
3467
+ role: ("owner" | "leader" | "delegate" | "admin") | null;
3466
3468
  roleNames: string[];
3467
3469
  joinedAt: string;
3468
3470
  lastActiveAt: string | null;
@@ -3535,7 +3537,7 @@ export interface components {
3535
3537
  orgId: string;
3536
3538
  orgName: string;
3537
3539
  orgSlug: string;
3538
- role: ("ceo" | "leader" | "delegate" | "admin") | null;
3540
+ role: ("owner" | "leader" | "delegate" | "admin") | null;
3539
3541
  joinedAt: string;
3540
3542
  isActive: boolean;
3541
3543
  /** @enum {string} */
@@ -4380,7 +4382,7 @@ export interface components {
4380
4382
  OrgUnitMyAuthorityResponse: {
4381
4383
  /** Format: uuid */
4382
4384
  unitId: string;
4383
- role: ("ceo" | "leader" | "delegate" | "admin") | null;
4385
+ role: ("owner" | "leader" | "delegate" | "admin") | null;
4384
4386
  canManageMembers: boolean;
4385
4387
  canAssignDelegate: boolean;
4386
4388
  canAssignAdmin: boolean;
@@ -145,6 +145,7 @@ export const openApiRoutes = {
145
145
  '/api/workspace/invites/{id}': ['DELETE'],
146
146
  '/api/workspace/members': ['GET'],
147
147
  '/api/workspace/members/{id}': ['DELETE', 'GET'],
148
+ '/api/workspace/members/{id}/manager': ['DELETE', 'PATCH'],
148
149
  '/api/workspace/members/{id}/role': ['PATCH'],
149
150
  '/api/workspace/name': ['PATCH'],
150
151
  '/api/workspace/organization': ['PATCH'],
@@ -73,7 +73,7 @@ const WorkspaceMemberSchema = z.object({
73
73
  * plain member with no org-chart authority. Render via `orgChartRoleLabel`.
74
74
  */
75
75
  role: OrgChartRoleSchema.nullable(),
76
- /** Raw RBAC role names (e.g. 'ceo', 'admin', 'delegate'). Superset of `role`. */
76
+ /** Raw RBAC role names (e.g. 'owner', 'admin', 'delegate'). Superset of `role`. */
77
77
  roleNames: z.array(z.string()),
78
78
  joinedAt: z.string(),
79
79
  /** ISO timestamp of last activity; null if never recorded. */
@@ -165,6 +165,14 @@ export const WorkspaceOverviewSchema = z.object({
165
165
  type: z.enum(["personal", "shared"]),
166
166
  logoUrl: z.string().nullable(),
167
167
  owner: WorkspaceOwnerSchema,
168
+ /**
169
+ * Org-configured display title for the `owner` org-chart role
170
+ * (ADR-CONTRACTS-061). Server-resolved: `orgs.owner_title` when set,
171
+ * otherwise the default "CEO". Always present; pass to
172
+ * `orgChartRoleLabel(role, { ownerTitle })` wherever the owner badge or
173
+ * section heading renders. Presentation only — never an authorization input.
174
+ */
175
+ ownerTitle: z.string(),
168
176
  createdAt: z.string(),
169
177
  memberCount: z.number(),
170
178
  claimable: z.boolean(),
package/src/org/types.ts CHANGED
@@ -72,6 +72,12 @@ export interface WorkspaceOverview {
72
72
  name: string;
73
73
  email: string;
74
74
  };
75
+ /**
76
+ * Org-configured display title for the `owner` org-chart role
77
+ * (ADR-CONTRACTS-061). Server-resolved (`orgs.owner_title` else "CEO").
78
+ * Mirror of `WorkspaceOverviewSchema.ownerTitle` — keep in lockstep.
79
+ */
80
+ ownerTitle: string;
75
81
  createdAt: string;
76
82
  memberCount: number;
77
83
  claimable: boolean;
@@ -22,7 +22,12 @@
22
22
  */
23
23
  import { z } from "zod";
24
24
 
25
- export const ORG_CHART_ROLES = ["ceo", "leader", "delegate", "admin"] as const;
25
+ export const ORG_CHART_ROLES = [
26
+ "owner",
27
+ "leader",
28
+ "delegate",
29
+ "admin",
30
+ ] as const;
26
31
  export type OrgChartRole = (typeof ORG_CHART_ROLES)[number];
27
32
 
28
33
  export const OrgChartRoleSchema = z.enum(ORG_CHART_ROLES);
@@ -30,15 +35,32 @@ export const OrgChartRoleSchema = z.enum(ORG_CHART_ROLES);
30
35
  /**
31
36
  * Human-readable labels for the org-chart role display badge. `null` (no
32
37
  * org-chart standing) renders as "Member" via {@link orgChartRoleLabel}.
38
+ *
39
+ * `owner` is the organization's highest-authority individual (the account
40
+ * owner, or a structural leader of the root unit). Its DEFAULT label is
41
+ * "CEO" — what every new org sees — and is org-renamable via the
42
+ * `owner_title` org setting (ADR-CONTRACTS-061); pass the org's resolved
43
+ * title through {@link orgChartRoleLabel}'s `ownerTitle` option to apply it.
33
44
  */
34
45
  export const ORG_CHART_ROLE_LABELS: Record<OrgChartRole, string> = {
35
- ceo: "CEO",
46
+ owner: "CEO",
36
47
  leader: "Leader",
37
48
  delegate: "Delegate",
38
49
  admin: "Admin",
39
50
  };
40
51
 
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];
52
+ /**
53
+ * Display label for a (possibly null) org-chart role; `null` = plain member.
54
+ *
55
+ * `ownerTitle` is the org's configured owner display title
56
+ * (`WorkspaceOverview.ownerTitle`, server-resolved, default "CEO"); it
57
+ * overrides the static label for the `owner` role only.
58
+ */
59
+ export function orgChartRoleLabel(
60
+ role: OrgChartRole | null,
61
+ opts?: { ownerTitle?: string },
62
+ ): string {
63
+ if (role === null) return "Member";
64
+ if (role === "owner" && opts?.ownerTitle) return opts.ownerTitle;
65
+ return ORG_CHART_ROLE_LABELS[role];
44
66
  }