@company-semantics/contracts 15.1.0 → 16.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "15.1.0",
3
+ "version": "16.0.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -109,7 +109,9 @@
109
109
  "generate:api-types": "openapi-typescript openapi/backend.yaml -o src/api/generated.ts",
110
110
  "generate:openapi-routes": "tsx scripts/generate-openapi-routes.ts",
111
111
  "generate:api-types:check": "openapi-typescript openapi/backend.yaml -o /tmp/cs-api-types-check.ts && diff -q src/api/generated.ts /tmp/cs-api-types-check.ts",
112
- "generate:current": "tsx ../company-semantics-ci/scripts/generate-current.ts"
112
+ "generate:current": "tsx ../company-semantics-ci/scripts/generate-current.ts",
113
+ "repo-map": "tsx ../company-semantics-ci/scripts/generate-repo-map.ts --roots src --name company-semantics-contracts --write",
114
+ "repo-map:check": "tsx ../company-semantics-ci/scripts/generate-repo-map.ts --roots src --name company-semantics-contracts --check"
113
115
  },
114
116
  "packageManager": "pnpm@10.25.0",
115
117
  "engines": {
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '575c0e0c7f6c' as const;
3
- export const SPEC_HASH_FULL = '575c0e0c7f6c7fdec000c8914101c527ed9e783b38bbfbe5aab536200d1b1da1' as const;
2
+ export const SPEC_HASH = 'bd74b6f7478d' as const;
3
+ export const SPEC_HASH_FULL = 'bd74b6f7478dcfb445d1e848ab3b65309f9b602b40c3fe2f0ce29b484e94943f' as const;
@@ -3415,7 +3415,7 @@ export interface components {
3415
3415
  email: string;
3416
3416
  avatarUrl?: string | null;
3417
3417
  jobTitle: string | null;
3418
- role: ("owner" | "leader" | "delegate" | "admin") | null;
3418
+ role: ("owner" | "unit_owner" | "delegate" | "admin") | null;
3419
3419
  roleNames: string[];
3420
3420
  joinedAt: string;
3421
3421
  lastActiveAt: string | null;
@@ -3427,11 +3427,11 @@ export interface components {
3427
3427
  /** @enum {string} */
3428
3428
  role: "owner" | "manager" | "member";
3429
3429
  }[];
3430
- manages: {
3430
+ unitDesignations: {
3431
3431
  unitId: string;
3432
3432
  unitName: string;
3433
3433
  /** @enum {string} */
3434
- designation: "whole_org" | "admin" | "leader" | "delegate" | "member";
3434
+ designation: "whole_org" | "admin" | "unit_owner" | "delegate" | "member";
3435
3435
  }[];
3436
3436
  unitMembershipsTruncated: boolean;
3437
3437
  inviteStatus: ("active" | "pending" | "expired") | null;
@@ -3610,7 +3610,7 @@ export interface components {
3610
3610
  email: string;
3611
3611
  avatarUrl?: string | null;
3612
3612
  jobTitle: string | null;
3613
- role: ("owner" | "leader" | "delegate" | "admin") | null;
3613
+ role: ("owner" | "unit_owner" | "delegate" | "admin") | null;
3614
3614
  roleNames: string[];
3615
3615
  joinedAt: string;
3616
3616
  lastActiveAt: string | null;
@@ -3622,11 +3622,11 @@ export interface components {
3622
3622
  /** @enum {string} */
3623
3623
  role: "owner" | "manager" | "member";
3624
3624
  }[];
3625
- manages: {
3625
+ unitDesignations: {
3626
3626
  unitId: string;
3627
3627
  unitName: string;
3628
3628
  /** @enum {string} */
3629
- designation: "whole_org" | "admin" | "leader" | "delegate" | "member";
3629
+ designation: "whole_org" | "admin" | "unit_owner" | "delegate" | "member";
3630
3630
  }[];
3631
3631
  unitMembershipsTruncated: boolean;
3632
3632
  inviteStatus: ("active" | "pending" | "expired") | null;
@@ -3698,7 +3698,7 @@ export interface components {
3698
3698
  orgId: string;
3699
3699
  orgName: string;
3700
3700
  orgSlug: string;
3701
- role: ("owner" | "leader" | "delegate" | "admin") | null;
3701
+ role: ("owner" | "unit_owner" | "delegate" | "admin") | null;
3702
3702
  joinedAt: string;
3703
3703
  isActive: boolean;
3704
3704
  /** @enum {string} */
@@ -3743,7 +3743,7 @@ export interface components {
3743
3743
  /** Format: uuid */
3744
3744
  homeUnitId?: string;
3745
3745
  /** @enum {string} */
3746
- homeUnitRole?: "member" | "leader";
3746
+ homeUnitRole?: "member" | "unit_owner";
3747
3747
  createdAt: string;
3748
3748
  expiresAt: string;
3749
3749
  acceptedAt?: string;
@@ -3757,7 +3757,7 @@ export interface components {
3757
3757
  /** Format: uuid */
3758
3758
  homeUnitId?: string;
3759
3759
  /** @enum {string} */
3760
- homeUnitRole?: "member" | "leader";
3760
+ homeUnitRole?: "member" | "unit_owner";
3761
3761
  };
3762
3762
  InviteListResponse: {
3763
3763
  id: string;
@@ -3774,7 +3774,7 @@ export interface components {
3774
3774
  /** Format: uuid */
3775
3775
  homeUnitId?: string;
3776
3776
  /** @enum {string} */
3777
- homeUnitRole?: "member" | "leader";
3777
+ homeUnitRole?: "member" | "unit_owner";
3778
3778
  createdAt: string;
3779
3779
  expiresAt: string;
3780
3780
  acceptedAt?: string;
@@ -4648,7 +4648,7 @@ export interface components {
4648
4648
  OrgUnitMyAuthorityResponse: {
4649
4649
  /** Format: uuid */
4650
4650
  unitId: string;
4651
- role: ("owner" | "leader" | "delegate" | "admin") | null;
4651
+ role: ("owner" | "unit_owner" | "delegate" | "admin") | null;
4652
4652
  canManageMembers: boolean;
4653
4653
  canAssignDelegate: boolean;
4654
4654
  canAssignAdmin: boolean;
package/src/org/index.ts CHANGED
@@ -141,8 +141,9 @@ export {
141
141
  WorkspaceOverviewSchema,
142
142
  WorkspaceMembersResponseSchema,
143
143
  WorkspaceMemberDetailSchema,
144
- WorkspaceMemberManagesEntrySchema,
144
+ WorkspaceMemberUnitDesignationEntrySchema,
145
145
  OrgUnitDesignationSchema,
146
+ HomeUnitRoleSchema,
146
147
  RoleCatalogEntrySchema,
147
148
  RoleCatalogResponseSchema,
148
149
  WorkspaceAuthConfigSchema,
@@ -168,8 +169,9 @@ export type {
168
169
  WorkspaceAccessResponse,
169
170
  WorkspaceOverview as WorkspaceOverviewDto,
170
171
  WorkspaceMembersResponse,
171
- WorkspaceMemberManagesEntry,
172
+ WorkspaceMemberUnitDesignationEntry,
172
173
  OrgUnitDesignation,
174
+ HomeUnitRole,
173
175
  WorkspaceAuthConfig as WorkspaceAuthConfigDto,
174
176
  WorkspaceAuditEvent as WorkspaceAuditEventDto,
175
177
  WorkspaceResolvePathResponse,
@@ -28,7 +28,7 @@ const WorkspaceMemberUnitSummarySchema = z.object({
28
28
  /**
29
29
  * Designation a member holds over a unit they manage (ADR-CTRL-112).
30
30
  *
31
- * Precedence, highest-first: whole_org > admin > leader > delegate > member.
31
+ * Precedence, highest-first: whole_org > admin > unit_owner > delegate > member.
32
32
  * The org-wide designations (`whole_org`, `admin`) anchor to the org root
33
33
  * unit. This vocabulary is DISPLAY-ONLY — it summarizes management reach for
34
34
  * UI surfaces and is NEVER an authorization input (authority resolution uses
@@ -37,19 +37,19 @@ const WorkspaceMemberUnitSummarySchema = z.object({
37
37
  export const OrgUnitDesignationSchema = z.enum([
38
38
  "whole_org",
39
39
  "admin",
40
- "leader",
40
+ "unit_owner",
41
41
  "delegate",
42
42
  "member",
43
43
  ]);
44
44
  export type OrgUnitDesignation = z.infer<typeof OrgUnitDesignationSchema>;
45
45
 
46
- export const WorkspaceMemberManagesEntrySchema = z.object({
46
+ export const WorkspaceMemberUnitDesignationEntrySchema = z.object({
47
47
  unitId: z.string(),
48
48
  unitName: z.string(),
49
49
  designation: OrgUnitDesignationSchema,
50
50
  });
51
- export type WorkspaceMemberManagesEntry = z.infer<
52
- typeof WorkspaceMemberManagesEntrySchema
51
+ export type WorkspaceMemberUnitDesignationEntry = z.infer<
52
+ typeof WorkspaceMemberUnitDesignationEntrySchema
53
53
  >;
54
54
 
55
55
  const WorkspaceMemberSchema = z.object({
@@ -87,11 +87,13 @@ const WorkspaceMemberSchema = z.object({
87
87
  /** OrgUnit memberships for this member, capped at a small number server-side. */
88
88
  unitMemberships: z.array(WorkspaceMemberUnitSummarySchema),
89
89
  /**
90
- * Per-unit org-chart designations the member holds where they manage
91
- * (ADR-CTRL-112). Display-only summary of management reach; never an
92
- * authorization input. Empty array when the member manages nothing.
90
+ * Per-unit org-chart designations the member holds (ADR-CTRL-112). Carries
91
+ * BOTH management-reach entries (whole_org/admin/unit_owner/delegate) and
92
+ * plain contributor entries (`member`); consumers split by designation.
93
+ * Display-only summary; never an authorization input. Empty array when the
94
+ * member holds no per-unit designation.
93
95
  */
94
- manages: z.array(WorkspaceMemberManagesEntrySchema),
96
+ unitDesignations: z.array(WorkspaceMemberUnitDesignationEntrySchema),
95
97
  /** True when server truncated `unitMemberships`; detail endpoint returns the full list. */
96
98
  unitMembershipsTruncated: z.boolean(),
97
99
  /** Invite lifecycle status. `null` for members without an invite record. */
@@ -595,6 +597,15 @@ export type ScopeCheckBatchResponse = z.infer<
595
597
  // Invite sub-schema
596
598
  // ---------------------------------------------------------------------------
597
599
 
600
+ /**
601
+ * Role the invitee takes in their home unit on acceptance. `unit_owner` is a
602
+ * deferred structural-leadership grant applied at accept time. Source of truth
603
+ * for the hand-mirrored `OrgInvite`/`CreateInviteRequest` interface unions in
604
+ * `org/types.ts` (enforced by the `schema-type-mirror` guard).
605
+ */
606
+ export const HomeUnitRoleSchema = z.enum(["member", "unit_owner"]);
607
+ export type HomeUnitRole = z.infer<typeof HomeUnitRoleSchema>;
608
+
598
609
  const OrgInviteSchema = z.object({
599
610
  id: z.string(),
600
611
  orgId: z.string(),
@@ -605,9 +616,10 @@ const OrgInviteSchema = z.object({
605
616
  // Home unit the invitee is placed in on acceptance (users.primary_unit_id).
606
617
  // Optional/nullable: legacy invites predate this field.
607
618
  homeUnitId: z.string().uuid().optional(),
608
- // Role the invitee takes in homeUnitId on acceptance ('leader' is a deferred
609
- // structural-leadership grant). Optional/'member' for legacy + unit-less invites.
610
- homeUnitRole: z.enum(["member", "leader"]).optional(),
619
+ // Role the invitee takes in homeUnitId on acceptance ('unit_owner' is a
620
+ // deferred structural-leadership grant). Optional/'member' for legacy +
621
+ // unit-less invites.
622
+ homeUnitRole: HomeUnitRoleSchema.optional(),
611
623
  createdAt: z.string(),
612
624
  expiresAt: z.string(),
613
625
  acceptedAt: z.string().optional(),
package/src/org/types.ts CHANGED
@@ -420,11 +420,11 @@ export interface OrgInvite {
420
420
  homeUnitId?: string;
421
421
  /**
422
422
  * Role the invitee takes in `homeUnitId` on acceptance — a plain team member,
423
- * or a structural leader of that unit (a *deferred* leadership grant applied
423
+ * or a unit owner of that unit (a *deferred* leadership grant applied
424
424
  * at acceptance time). Distinct from the org-level {@link role}. Optional:
425
425
  * legacy invites and unit-less invites have none (treated as `member`).
426
426
  */
427
- homeUnitRole?: "member" | "leader";
427
+ homeUnitRole?: "member" | "unit_owner";
428
428
  createdAt: string;
429
429
  expiresAt: string;
430
430
  acceptedAt?: string;
@@ -444,12 +444,12 @@ export interface CreateInviteRequest {
444
444
  homeUnitId?: string;
445
445
  /**
446
446
  * Role the invitee takes in `homeUnitId` on acceptance: a plain team member
447
- * (default), or a structural leader of that unit. `leader` is a *deferred*
447
+ * (default), or a unit owner of that unit. `unit_owner` is a *deferred*
448
448
  * grant — the invite is sent now and the leadership is assigned when the
449
449
  * invitee accepts. Only meaningful when `homeUnitId` is set; the backend
450
- * rejects `leader` without a home unit. Optional/`member` for older callers.
450
+ * rejects `unit_owner` without a home unit. Optional/`member` for older callers.
451
451
  */
452
- homeUnitRole?: "member" | "leader";
452
+ homeUnitRole?: "member" | "unit_owner";
453
453
  }
454
454
 
455
455
  /**
@@ -24,7 +24,7 @@ import { z } from "zod";
24
24
 
25
25
  export const ORG_CHART_ROLES = [
26
26
  "owner",
27
- "leader",
27
+ "unit_owner",
28
28
  "delegate",
29
29
  "admin",
30
30
  ] as const;
@@ -44,7 +44,7 @@ export const OrgChartRoleSchema = z.enum(ORG_CHART_ROLES);
44
44
  */
45
45
  export const ORG_CHART_ROLE_LABELS: Record<OrgChartRole, string> = {
46
46
  owner: "CEO",
47
- leader: "Unit owner",
47
+ unit_owner: "Unit owner",
48
48
  delegate: "Delegate",
49
49
  admin: "Admin",
50
50
  };