@company-semantics/contracts 12.2.0 → 13.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
CHANGED
|
@@ -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'],
|
package/src/org/schemas.ts
CHANGED
|
@@ -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. '
|
|
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(),
|
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { z } from "zod";
|
|
24
24
|
|
|
25
|
-
export const ORG_CHART_ROLES = [
|
|
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
|
-
|
|
46
|
+
owner: "CEO",
|
|
36
47
|
leader: "Leader",
|
|
37
48
|
delegate: "Delegate",
|
|
38
49
|
admin: "Admin",
|
|
39
50
|
};
|
|
40
51
|
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
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
|
}
|