@company-semantics/contracts 1.5.0 → 1.7.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": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -99,6 +99,7 @@
99
99
  "release": "npx tsx scripts/release.ts",
100
100
  "prepublishOnly": "echo 'ERROR: Publishing is CI-only via tag push. Use pnpm release instead.' && exit 1",
101
101
  "test": "vitest run",
102
+ "test:run": "vitest run",
102
103
  "generate:spec-hash": "tsx scripts/generate-spec-hash.ts",
103
104
  "generate:api": "pnpm generate:api-types && pnpm generate:spec-hash",
104
105
  "generate:api-types": "openapi-typescript openapi/backend.yaml -o src/api/generated.ts",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '9740ec13f6ea' as const;
3
- export const SPEC_HASH_FULL = '9740ec13f6ea493d93a5b3cf1e8d7f6b0a1130a0e85846a446fe74aaa7a40fde' as const;
2
+ export const SPEC_HASH = '6dcd4788f96e' as const;
3
+ export const SPEC_HASH_FULL = '6dcd4788f96e0955ff7b5fcc0fa336cbaa88d3e8fced75e9f1cce650f8f8c0d7' as const;
@@ -1501,6 +1501,23 @@ export interface paths {
1501
1501
  patch?: never;
1502
1502
  trace?: never;
1503
1503
  };
1504
+ "/api/org-units/{unitId}/reorder": {
1505
+ parameters: {
1506
+ query?: never;
1507
+ header?: never;
1508
+ path?: never;
1509
+ cookie?: never;
1510
+ };
1511
+ get?: never;
1512
+ put?: never;
1513
+ /** Reorder a unit within its current parent (sibling reorder) */
1514
+ post: operations["reorderOrgUnit"];
1515
+ delete?: never;
1516
+ options?: never;
1517
+ head?: never;
1518
+ patch?: never;
1519
+ trace?: never;
1520
+ };
1504
1521
  "/api/org-units/{unitId}/archive": {
1505
1522
  parameters: {
1506
1523
  query?: never;
@@ -1560,9 +1577,9 @@ export interface paths {
1560
1577
  path?: never;
1561
1578
  cookie?: never;
1562
1579
  };
1563
- /** List per-depth labels + allow_doc policy */
1580
+ /** List per-depth labels */
1564
1581
  get: operations["listOrgLevelConfig"];
1565
- /** Replace per-depth labels + allow_doc policy */
1582
+ /** Replace per-depth labels */
1566
1583
  put: operations["upsertOrgLevelConfig"];
1567
1584
  post?: never;
1568
1585
  delete?: never;
@@ -3096,7 +3113,6 @@ export interface components {
3096
3113
  orgId: string;
3097
3114
  depth: number;
3098
3115
  label: string;
3099
- allowDoc: boolean;
3100
3116
  createdAt: string;
3101
3117
  updatedAt: string;
3102
3118
  }[];
@@ -3107,7 +3123,6 @@ export interface components {
3107
3123
  orgId: string;
3108
3124
  depth: number;
3109
3125
  label: string;
3110
- allowDoc: boolean;
3111
3126
  createdAt: string;
3112
3127
  updatedAt: string;
3113
3128
  }[];
@@ -5598,6 +5613,36 @@ export interface operations {
5598
5613
  };
5599
5614
  };
5600
5615
  };
5616
+ reorderOrgUnit: {
5617
+ parameters: {
5618
+ query?: never;
5619
+ header?: never;
5620
+ path: {
5621
+ unitId: string;
5622
+ };
5623
+ cookie?: never;
5624
+ };
5625
+ requestBody: {
5626
+ content: {
5627
+ "application/json": {
5628
+ prevId: string | null;
5629
+ nextId: string | null;
5630
+ orderKey?: string;
5631
+ };
5632
+ };
5633
+ };
5634
+ responses: {
5635
+ /** @description Reordered unit */
5636
+ 200: {
5637
+ headers: {
5638
+ [name: string]: unknown;
5639
+ };
5640
+ content: {
5641
+ "application/json": components["schemas"]["OrgUnitResponse"];
5642
+ };
5643
+ };
5644
+ };
5645
+ };
5601
5646
  archiveOrgUnit: {
5602
5647
  parameters: {
5603
5648
  query?: never;
@@ -5742,7 +5787,6 @@ export interface operations {
5742
5787
  entries: {
5743
5788
  depth: number;
5744
5789
  label: string;
5745
- allowDoc: boolean;
5746
5790
  }[];
5747
5791
  };
5748
5792
  };
@@ -4,10 +4,11 @@
4
4
  export const openApiRoutes = {
5
5
  '/ai/chat': ['POST'],
6
6
  '/api/account/cancel-deletion': ['POST'],
7
+ '/api/account/confirm-deletion': ['POST'],
7
8
  '/api/account/delete': ['POST'],
9
+ '/api/account/deletion-eligibility': ['GET'],
8
10
  '/api/account/sessions': ['GET'],
9
11
  '/api/account/sessions/{sessionId}': ['DELETE'],
10
- '/api/capabilities/tools': ['GET'],
11
12
  '/api/chats': ['GET', 'POST'],
12
13
  '/api/chats/by-interaction/{interactionId}': ['GET'],
13
14
  '/api/chats/events': ['GET'],
@@ -17,9 +18,13 @@ export const openApiRoutes = {
17
18
  '/api/chats/{id}/messages': ['POST'],
18
19
  '/api/chats/{id}/messages/{messageId}': ['DELETE'],
19
20
  '/api/chats/{id}/pin': ['DELETE', 'POST'],
21
+ '/api/company-md/context-bank': ['POST'],
20
22
  '/api/company-md/docs/{slug}': ['GET'],
21
23
  '/api/company-md/docs/{slug}/content': ['PUT'],
22
24
  '/api/company-md/docs/{slug}/context-bank': ['GET'],
25
+ '/api/company-md/docs/{slug}/context-bank/associate': ['POST'],
26
+ '/api/company-md/docs/{slug}/context-bank/{contextDocSlug}': ['DELETE'],
27
+ '/api/company-md/docs/{slug}/context-bank/{id}/order': ['PATCH'],
23
28
  '/api/company-md/docs/{slug}/sharing': ['GET'],
24
29
  '/api/company-md/docs/{slug}/sharing/acl': ['POST'],
25
30
  '/api/company-md/docs/{slug}/sharing/acl/{aclId}': ['DELETE', 'PUT'],
@@ -27,10 +32,6 @@ export const openApiRoutes = {
27
32
  '/api/company-md/docs/{slug}/title': ['PUT'],
28
33
  '/api/company-md/extract': ['POST'],
29
34
  '/api/company-md/tree': ['GET'],
30
- '/api/departments': ['GET', 'POST'],
31
- '/api/departments/{id}': ['DELETE', 'GET', 'PATCH'],
32
- '/api/departments/{id}/members': ['GET', 'POST'],
33
- '/api/departments/{id}/members/{userId}': ['DELETE'],
34
35
  '/api/drive/files': ['GET'],
35
36
  '/api/drive/files/recent': ['GET'],
36
37
  '/api/drive/files/{fileId}/content': ['GET'],
@@ -41,8 +42,23 @@ export const openApiRoutes = {
41
42
  '/api/executions/{executionId}/summary': ['GET'],
42
43
  '/api/executions/{executionId}/timeline': ['GET'],
43
44
  '/api/executions/{executionId}/undo': ['POST'],
44
- '/api/integrations/status': ['GET'],
45
+ '/api/internal-admin/impersonate/end': ['POST'],
46
+ '/api/internal-admin/impersonate/session': ['GET'],
47
+ '/api/internal-admin/impersonate/start': ['POST'],
45
48
  '/api/me': ['GET'],
49
+ '/api/org-units': ['POST'],
50
+ '/api/org-units/{unitId}': ['GET'],
51
+ '/api/org-units/{unitId}/ancestors': ['GET'],
52
+ '/api/org-units/{unitId}/archive': ['POST'],
53
+ '/api/org-units/{unitId}/children': ['GET'],
54
+ '/api/org-units/{unitId}/descendants': ['GET'],
55
+ '/api/org-units/{unitId}/memberships': ['GET', 'POST'],
56
+ '/api/org-units/{unitId}/memberships/{userId}': ['DELETE'],
57
+ '/api/org-units/{unitId}/memberships/{userId}/role': ['PUT'],
58
+ '/api/org-units/{unitId}/permissions': ['GET'],
59
+ '/api/org-units/{unitId}/relationships': ['GET', 'POST'],
60
+ '/api/org-units/{unitId}/reorder': ['POST'],
61
+ '/api/org-units/{unitId}/reparent': ['POST'],
46
62
  '/api/org/cancel-deletion': ['POST'],
47
63
  '/api/org/delete': ['POST'],
48
64
  '/api/org/deletion-eligibility': ['GET'],
@@ -56,14 +72,12 @@ export const openApiRoutes = {
56
72
  '/api/orgs/{orgId}/ai-usage': ['GET'],
57
73
  '/api/orgs/{orgId}/billing': ['GET'],
58
74
  '/api/orgs/{orgId}/budget-config': ['GET', 'PUT'],
75
+ '/api/orgs/{orgId}/level-config': ['GET', 'PUT'],
76
+ '/api/orgs/{orgId}/tree': ['GET'],
77
+ '/api/scope/check': ['GET'],
59
78
  '/api/scope/check-batch': ['POST'],
60
79
  '/api/shared/{token}': ['GET'],
61
80
  '/api/shares/{shareId}': ['DELETE', 'PATCH'],
62
- '/api/teams': ['GET', 'POST'],
63
- '/api/teams/{teamId}': ['DELETE', 'GET', 'PUT'],
64
- '/api/teams/{teamId}/members': ['POST'],
65
- '/api/teams/{teamId}/members/{userId}': ['DELETE'],
66
- '/api/teams/{teamId}/members/{userId}/role': ['PUT'],
67
81
  '/api/timeline': ['GET'],
68
82
  '/api/user/active-org': ['POST'],
69
83
  '/api/user/orgs': ['GET'],
@@ -83,6 +97,7 @@ export const openApiRoutes = {
83
97
  '/api/workspace/domains': ['GET', 'POST'],
84
98
  '/api/workspace/domains/{id}': ['DELETE'],
85
99
  '/api/workspace/domains/{id}/verify': ['POST'],
100
+ '/api/workspace/handle': ['PATCH'],
86
101
  '/api/workspace/invites': ['GET', 'POST'],
87
102
  '/api/workspace/invites/accept': ['POST'],
88
103
  '/api/workspace/invites/validate': ['GET'],
@@ -100,8 +115,6 @@ export const openApiRoutes = {
100
115
  '/auth/start': ['POST'],
101
116
  '/auth/verify': ['POST'],
102
117
  '/connect/{provider}': ['GET'],
103
- '/healthz': ['GET'],
104
- '/healthz/details': ['GET'],
105
118
  '/oauth/{provider}/callback': ['GET'],
106
119
  } as const;
107
120
 
@@ -133,7 +133,6 @@ describe('OrgLevelConfigSchema', () => {
133
133
  orgId: UUID_B,
134
134
  depth: 2,
135
135
  label: 'Department',
136
- allowDoc: true,
137
136
  createdAt: '2026-04-17T00:00:00Z',
138
137
  updatedAt: '2026-04-17T00:00:00Z',
139
138
  };
@@ -168,7 +167,7 @@ describe('Response schemas', () => {
168
167
  });
169
168
 
170
169
  describe('Enum exhaustiveness', () => {
171
- it('OrgUnitErrorCodeSchema enumerates all 7 known codes', () => {
170
+ it('OrgUnitErrorCodeSchema enumerates all 10 known codes', () => {
172
171
  const codes = [
173
172
  'CYCLE_BLOCKED',
174
173
  'DEPTH_EXCEEDED',
@@ -177,6 +176,9 @@ describe('Enum exhaustiveness', () => {
177
176
  'PARENT_ARCHIVED',
178
177
  'SLUG_TAKEN',
179
178
  'CROSS_ORG_REPARENT',
179
+ 'ORDERKEY_CONFLICT',
180
+ 'SIBLING_NOT_FOUND',
181
+ 'SIBLINGS_DIFFERENT_PARENT',
180
182
  ];
181
183
  for (const code of codes) {
182
184
  expect(() => OrgUnitErrorCodeSchema.parse(code)).not.toThrow();
@@ -63,4 +63,10 @@ export type OrgUnitErrorCode =
63
63
  /** Slug already taken under the target parent. */
64
64
  | 'SLUG_TAKEN'
65
65
  /** Attempted to reparent across orgs (or create with mismatched orgId). */
66
- | 'CROSS_ORG_REPARENT';
66
+ | 'CROSS_ORG_REPARENT'
67
+ /** Reorder: computed order_key collided with an existing sibling; client should re-fetch neighbors and retry. */
68
+ | 'ORDERKEY_CONFLICT'
69
+ /** Reorder: prev or next sibling id does not resolve to a live unit. */
70
+ | 'SIBLING_NOT_FOUND'
71
+ /** Reorder: prev or next sibling belongs to a different parent than the moving unit. */
72
+ | 'SIBLINGS_DIFFERENT_PARENT';
@@ -652,6 +652,9 @@ export const OrgUnitErrorCodeSchema = z.enum([
652
652
  'PARENT_ARCHIVED',
653
653
  'SLUG_TAKEN',
654
654
  'CROSS_ORG_REPARENT',
655
+ 'ORDERKEY_CONFLICT',
656
+ 'SIBLING_NOT_FOUND',
657
+ 'SIBLINGS_DIFFERENT_PARENT',
655
658
  ]);
656
659
 
657
660
  export const OrgUnitSchema = z.object({
@@ -708,7 +711,6 @@ export const OrgLevelConfigSchema = z.object({
708
711
  orgId: z.string().uuid(),
709
712
  depth: z.number().int().min(1).max(5),
710
713
  label: z.string().min(1),
711
- allowDoc: z.boolean(),
712
714
  createdAt: z.string(),
713
715
  updatedAt: z.string(),
714
716
  });