@company-semantics/contracts 1.1.0 → 1.3.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 +0 -90
- package/src/content/index.ts +0 -2
- package/src/content/schemas.ts +0 -12
- package/src/org/company-md.ts +0 -19
- package/src/org/index.ts +0 -5
- package/src/resource-keys.ts +29 -0
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 = '2378a6034349' as const;
|
|
3
|
+
export const SPEC_HASH_FULL = '2378a6034349f4280d4f9aa3536002db130f8a1c03911b6f2513e14e036d85c4' as const;
|
package/src/api/generated.ts
CHANGED
|
@@ -1330,40 +1330,6 @@ export interface paths {
|
|
|
1330
1330
|
patch: operations["reorderCompanyMdContextBankItem"];
|
|
1331
1331
|
trace?: never;
|
|
1332
1332
|
};
|
|
1333
|
-
"/api/company-md/settings": {
|
|
1334
|
-
parameters: {
|
|
1335
|
-
query?: never;
|
|
1336
|
-
header?: never;
|
|
1337
|
-
path?: never;
|
|
1338
|
-
cookie?: never;
|
|
1339
|
-
};
|
|
1340
|
-
/** Get company.md settings for the org */
|
|
1341
|
-
get: operations["getCompanyMdSettings"];
|
|
1342
|
-
put?: never;
|
|
1343
|
-
post?: never;
|
|
1344
|
-
delete?: never;
|
|
1345
|
-
options?: never;
|
|
1346
|
-
head?: never;
|
|
1347
|
-
patch?: never;
|
|
1348
|
-
trace?: never;
|
|
1349
|
-
};
|
|
1350
|
-
"/api/company-md/settings/level-labels": {
|
|
1351
|
-
parameters: {
|
|
1352
|
-
query?: never;
|
|
1353
|
-
header?: never;
|
|
1354
|
-
path?: never;
|
|
1355
|
-
cookie?: never;
|
|
1356
|
-
};
|
|
1357
|
-
get?: never;
|
|
1358
|
-
/** Update company.md level labels */
|
|
1359
|
-
put: operations["updateCompanyMdLevelLabels"];
|
|
1360
|
-
post?: never;
|
|
1361
|
-
delete?: never;
|
|
1362
|
-
options?: never;
|
|
1363
|
-
head?: never;
|
|
1364
|
-
patch?: never;
|
|
1365
|
-
trace?: never;
|
|
1366
|
-
};
|
|
1367
1333
|
"/api/company-md/docs/{slug}/sharing": {
|
|
1368
1334
|
parameters: {
|
|
1369
1335
|
query?: never;
|
|
@@ -2869,18 +2835,6 @@ export interface components {
|
|
|
2869
2835
|
AssociateContextDocRequest: {
|
|
2870
2836
|
contextDocSlug: string;
|
|
2871
2837
|
};
|
|
2872
|
-
CompanyMdSettingsResponse: {
|
|
2873
|
-
levelLabels: {
|
|
2874
|
-
root: string;
|
|
2875
|
-
department: string;
|
|
2876
|
-
team: string;
|
|
2877
|
-
};
|
|
2878
|
-
};
|
|
2879
|
-
UpdateCompanyMdLevelLabelsRequest: {
|
|
2880
|
-
root?: string;
|
|
2881
|
-
department?: string;
|
|
2882
|
-
team?: string;
|
|
2883
|
-
};
|
|
2884
2838
|
CompanyMdShareResponse: {
|
|
2885
2839
|
/** @enum {string} */
|
|
2886
2840
|
sharingPolicy: "restricted" | "org_read" | "org_comment" | "org_edit";
|
|
@@ -5341,50 +5295,6 @@ export interface operations {
|
|
|
5341
5295
|
};
|
|
5342
5296
|
};
|
|
5343
5297
|
};
|
|
5344
|
-
getCompanyMdSettings: {
|
|
5345
|
-
parameters: {
|
|
5346
|
-
query?: never;
|
|
5347
|
-
header?: never;
|
|
5348
|
-
path?: never;
|
|
5349
|
-
cookie?: never;
|
|
5350
|
-
};
|
|
5351
|
-
requestBody?: never;
|
|
5352
|
-
responses: {
|
|
5353
|
-
/** @description Company.md settings */
|
|
5354
|
-
200: {
|
|
5355
|
-
headers: {
|
|
5356
|
-
[name: string]: unknown;
|
|
5357
|
-
};
|
|
5358
|
-
content: {
|
|
5359
|
-
"application/json": components["schemas"]["CompanyMdSettingsResponse"];
|
|
5360
|
-
};
|
|
5361
|
-
};
|
|
5362
|
-
};
|
|
5363
|
-
};
|
|
5364
|
-
updateCompanyMdLevelLabels: {
|
|
5365
|
-
parameters: {
|
|
5366
|
-
query?: never;
|
|
5367
|
-
header?: never;
|
|
5368
|
-
path?: never;
|
|
5369
|
-
cookie?: never;
|
|
5370
|
-
};
|
|
5371
|
-
requestBody: {
|
|
5372
|
-
content: {
|
|
5373
|
-
"application/json": components["schemas"]["UpdateCompanyMdLevelLabelsRequest"];
|
|
5374
|
-
};
|
|
5375
|
-
};
|
|
5376
|
-
responses: {
|
|
5377
|
-
/** @description Updated settings */
|
|
5378
|
-
200: {
|
|
5379
|
-
headers: {
|
|
5380
|
-
[name: string]: unknown;
|
|
5381
|
-
};
|
|
5382
|
-
content: {
|
|
5383
|
-
"application/json": components["schemas"]["CompanyMdSettingsResponse"];
|
|
5384
|
-
};
|
|
5385
|
-
};
|
|
5386
|
-
};
|
|
5387
|
-
};
|
|
5388
5298
|
getCompanyMdDocSharing: {
|
|
5389
5299
|
parameters: {
|
|
5390
5300
|
query?: never;
|
package/src/content/index.ts
CHANGED
|
@@ -11,14 +11,12 @@ export {
|
|
|
11
11
|
CompanyMdDocResponseSchema,
|
|
12
12
|
CompanyMdShareResponseSchema,
|
|
13
13
|
CompanyMdContextBankResponseSchema,
|
|
14
|
-
CompanyMdSettingsResponseSchema,
|
|
15
14
|
} from './schemas';
|
|
16
15
|
export type {
|
|
17
16
|
CompanyMdListResponse,
|
|
18
17
|
CompanyMdDocResponse,
|
|
19
18
|
CompanyMdShareResponse,
|
|
20
19
|
CompanyMdContextBankResponse,
|
|
21
|
-
CompanyMdSettingsResponse,
|
|
22
20
|
} from './schemas';
|
|
23
21
|
|
|
24
22
|
// Drive response schemas (PRD-00448)
|
package/src/content/schemas.ts
CHANGED
|
@@ -125,17 +125,6 @@ export const CompanyMdContextBankResponseSchema = z.object({
|
|
|
125
125
|
items: z.array(CompanyMdContextBankItemSchema),
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
const CompanyMdLevelLabelsSchema = z.object({
|
|
129
|
-
root: z.string(),
|
|
130
|
-
department: z.string(),
|
|
131
|
-
team: z.string(),
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
/** Response for GET /api/company-md/settings */
|
|
135
|
-
export const CompanyMdSettingsResponseSchema = z.object({
|
|
136
|
-
levelLabels: CompanyMdLevelLabelsSchema,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
128
|
// ---------------------------------------------------------------------------
|
|
140
129
|
// Drive Sub-schemas
|
|
141
130
|
// ---------------------------------------------------------------------------
|
|
@@ -182,6 +171,5 @@ export type CompanyMdListResponse = z.infer<typeof CompanyMdListResponseSchema>;
|
|
|
182
171
|
export type CompanyMdDocResponse = z.infer<typeof CompanyMdDocResponseSchema>;
|
|
183
172
|
export type CompanyMdShareResponse = z.infer<typeof CompanyMdShareResponseSchema>;
|
|
184
173
|
export type CompanyMdContextBankResponse = z.infer<typeof CompanyMdContextBankResponseSchema>;
|
|
185
|
-
export type CompanyMdSettingsResponse = z.infer<typeof CompanyMdSettingsResponseSchema>;
|
|
186
174
|
export type DriveFileListResponse = z.infer<typeof DriveFileListResponseSchema>;
|
|
187
175
|
export type DriveFileContentResponse = z.infer<typeof DriveFileContentResponseSchema>;
|
package/src/org/company-md.ts
CHANGED
|
@@ -68,25 +68,6 @@ export interface CompanyMdDocRelations {
|
|
|
68
68
|
|
|
69
69
|
export type CompanyMdDoc = CompanyMdDocCore & CompanyMdDocCollaborators & CompanyMdDocRelations;
|
|
70
70
|
|
|
71
|
-
export interface CompanyMdLevelLabels {
|
|
72
|
-
/** L1 label — defaults to org name */
|
|
73
|
-
readonly root: string;
|
|
74
|
-
/** L2 label — defaults to 'Department' */
|
|
75
|
-
readonly department: string;
|
|
76
|
-
/** L3 label — defaults to 'Team' */
|
|
77
|
-
readonly team: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface CompanyMdSettings {
|
|
81
|
-
readonly levelLabels: CompanyMdLevelLabels;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** System defaults for level labels. L1 (root) is set per-org at read time. */
|
|
85
|
-
export const DEFAULT_LEVEL_LABELS: Omit<CompanyMdLevelLabels, 'root'> = {
|
|
86
|
-
department: 'Department',
|
|
87
|
-
team: 'Team',
|
|
88
|
-
} as const;
|
|
89
|
-
|
|
90
71
|
/**
|
|
91
72
|
* A context bank item — a company.md doc associated with one or more parent nodes.
|
|
92
73
|
* Context bank files can belong to company, department, or team levels.
|
package/src/org/index.ts
CHANGED
|
@@ -94,13 +94,8 @@ export type {
|
|
|
94
94
|
CompanyMdDocRelations,
|
|
95
95
|
CompanyMdDoc,
|
|
96
96
|
CompanyMdContextBankItem,
|
|
97
|
-
// Level labels settings types (PRD-00453)
|
|
98
|
-
CompanyMdLevelLabels,
|
|
99
|
-
CompanyMdSettings,
|
|
100
97
|
} from './company-md';
|
|
101
98
|
|
|
102
|
-
export { DEFAULT_LEVEL_LABELS } from './company-md';
|
|
103
|
-
|
|
104
99
|
// Sharing and ACL types (PRD-00306)
|
|
105
100
|
export type {
|
|
106
101
|
AccessLevel,
|
package/src/resource-keys.ts
CHANGED
|
@@ -28,6 +28,13 @@ export type ResourceKey =
|
|
|
28
28
|
| { type: 'deletionEligibility'; orgId: string }
|
|
29
29
|
| { type: 'transferOwnership'; orgId: string }
|
|
30
30
|
| { type: 'companyMdDocs'; orgId: string }
|
|
31
|
+
// OrgUnit canonical model (ADR-BE-120) — Phase 2 Wave 4
|
|
32
|
+
| { type: 'orgTree'; orgId: string }
|
|
33
|
+
| { type: 'orgLevelConfig'; orgId: string }
|
|
34
|
+
| { type: 'orgUnit'; orgId: string; unitId: string }
|
|
35
|
+
| { type: 'orgUnitChildren'; orgId: string; unitId: string }
|
|
36
|
+
| { type: 'orgUnitAncestors'; orgId: string; unitId: string }
|
|
37
|
+
| { type: 'orgUnitMemberships'; orgId: string; unitId: string }
|
|
31
38
|
// User-scoped
|
|
32
39
|
| { type: 'dismissedBanners'; userId: string }
|
|
33
40
|
| { type: 'userOrgs'; userId: string }
|
|
@@ -54,6 +61,7 @@ const ORG_SCOPED_TYPES = [
|
|
|
54
61
|
'members', 'departments', 'chats', 'teams', 'integrations', 'invites',
|
|
55
62
|
'auditEvents', 'timeline', 'workspace', 'workspaceDomains', 'authSettings',
|
|
56
63
|
'billing', 'aiUsage', 'deletionEligibility', 'transferOwnership', 'companyMdDocs',
|
|
64
|
+
'orgTree', 'orgLevelConfig',
|
|
57
65
|
] as const;
|
|
58
66
|
|
|
59
67
|
const USER_SCOPED_TYPES = ['dismissedBanners', 'userOrgs', 'sessions', 'viewer'] as const;
|
|
@@ -82,6 +90,13 @@ export function toQueryKey(key: ResourceKey): readonly string[] {
|
|
|
82
90
|
case 'companyMdContextBank':
|
|
83
91
|
return [key.type, key.orgId, key.slug] as const;
|
|
84
92
|
|
|
93
|
+
// OrgUnit identity keys (ADR-BE-120)
|
|
94
|
+
case 'orgUnit':
|
|
95
|
+
case 'orgUnitChildren':
|
|
96
|
+
case 'orgUnitAncestors':
|
|
97
|
+
case 'orgUnitMemberships':
|
|
98
|
+
return [key.type, key.orgId, key.unitId] as const;
|
|
99
|
+
|
|
85
100
|
// User-scoped
|
|
86
101
|
case 'dismissedBanners':
|
|
87
102
|
case 'userOrgs':
|
|
@@ -106,6 +121,8 @@ export function toQueryKey(key: ResourceKey): readonly string[] {
|
|
|
106
121
|
case 'deletionEligibility':
|
|
107
122
|
case 'transferOwnership':
|
|
108
123
|
case 'companyMdDocs':
|
|
124
|
+
case 'orgTree':
|
|
125
|
+
case 'orgLevelConfig':
|
|
109
126
|
return [key.type, key.orgId] as const;
|
|
110
127
|
|
|
111
128
|
default: {
|
|
@@ -134,6 +151,10 @@ export function fromQueryKey(queryKey: readonly string[]): ResourceKey {
|
|
|
134
151
|
chat: 'chatId',
|
|
135
152
|
companyMdDoc: 'slug',
|
|
136
153
|
companyMdContextBank: 'slug',
|
|
154
|
+
orgUnit: 'unitId',
|
|
155
|
+
orgUnitChildren: 'unitId',
|
|
156
|
+
orgUnitAncestors: 'unitId',
|
|
157
|
+
orgUnitMemberships: 'unitId',
|
|
137
158
|
};
|
|
138
159
|
|
|
139
160
|
if (type in identityFields) {
|
|
@@ -172,6 +193,13 @@ export const resourceRelationships: Record<string, string[]> = {
|
|
|
172
193
|
team: ['teams'],
|
|
173
194
|
companyMdDocs: ['companyMdDoc'],
|
|
174
195
|
companyMdDoc: ['companyMdDocs'],
|
|
196
|
+
// OrgUnit: reparent/create/archive invalidates the tree view of the whole org;
|
|
197
|
+
// membership mutations invalidate the unit + its memberships list.
|
|
198
|
+
orgTree: ['orgUnit', 'orgUnitChildren', 'orgUnitAncestors'],
|
|
199
|
+
orgUnit: ['orgTree'],
|
|
200
|
+
orgUnitChildren: ['orgTree'],
|
|
201
|
+
orgUnitAncestors: ['orgTree'],
|
|
202
|
+
orgUnitMemberships: ['orgUnit'],
|
|
175
203
|
};
|
|
176
204
|
|
|
177
205
|
/**
|
|
@@ -200,6 +228,7 @@ export function matchesResourceKey(queryKey: readonly unknown[], targetKey: Reso
|
|
|
200
228
|
if ('departmentId' in parsed && 'departmentId' in targetKey && parsed.departmentId !== targetKey.departmentId) return false;
|
|
201
229
|
if ('chatId' in parsed && 'chatId' in targetKey && parsed.chatId !== targetKey.chatId) return false;
|
|
202
230
|
if ('slug' in parsed && 'slug' in targetKey && parsed.slug !== targetKey.slug) return false;
|
|
231
|
+
if ('unitId' in parsed && 'unitId' in targetKey && parsed.unitId !== targetKey.unitId) return false;
|
|
203
232
|
|
|
204
233
|
return true;
|
|
205
234
|
}
|