@company-semantics/contracts 2.0.0 → 2.1.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": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1747,6 +1747,43 @@ export interface paths {
1747
1747
  patch?: never;
1748
1748
  trace?: never;
1749
1749
  };
1750
+ "/api/users/org-chart/import": {
1751
+ parameters: {
1752
+ query?: never;
1753
+ header?: never;
1754
+ path?: never;
1755
+ cookie?: never;
1756
+ };
1757
+ get?: never;
1758
+ put?: never;
1759
+ /**
1760
+ * Upload an org-chart artifact (PDF/DOCX/TXT/MD/CSV/XLSX/PNG/JPG/HEIC) for ingestion
1761
+ * @description Accepts a multipart file upload up to 10 MB. With `?dryRun=true` the operation only reaches the validated state and writes no live rows. Returns 202 with the operationId so the caller can poll.
1762
+ */
1763
+ post: operations["importOrgChart"];
1764
+ delete?: never;
1765
+ options?: never;
1766
+ head?: never;
1767
+ patch?: never;
1768
+ trace?: never;
1769
+ };
1770
+ "/api/users/org-chart/import/{operationId}/retry": {
1771
+ parameters: {
1772
+ query?: never;
1773
+ header?: never;
1774
+ path?: never;
1775
+ cookie?: never;
1776
+ };
1777
+ get?: never;
1778
+ put?: never;
1779
+ /** Retry a prior org-chart import operation (cap: 3 attempts) */
1780
+ post: operations["retryOrgChartImport"];
1781
+ delete?: never;
1782
+ options?: never;
1783
+ head?: never;
1784
+ patch?: never;
1785
+ trace?: never;
1786
+ };
1750
1787
  "/api/drive/files": {
1751
1788
  parameters: {
1752
1789
  query?: never;
@@ -3096,6 +3133,8 @@ export interface components {
3096
3133
  }[];
3097
3134
  /** @enum {string} */
3098
3135
  extractionStatus: "pending" | "extracting" | "complete" | "failed";
3136
+ errorClass?: string | null;
3137
+ errorReason?: string | null;
3099
3138
  createdAt: string;
3100
3139
  updatedAt: string;
3101
3140
  };
@@ -3175,7 +3214,7 @@ export interface components {
3175
3214
  name: string;
3176
3215
  description: string | null;
3177
3216
  typeTag: string;
3178
- classification: ("execution_unit" | "org_container" | "custom") | null;
3217
+ classification: ("execution_unit" | "org_container" | "leadership" | "custom") | null;
3179
3218
  orderKey: string;
3180
3219
  path: string;
3181
3220
  /** @enum {string} */
@@ -3200,7 +3239,7 @@ export interface components {
3200
3239
  name: string;
3201
3240
  description: string | null;
3202
3241
  typeTag: string;
3203
- classification: ("execution_unit" | "org_container" | "custom") | null;
3242
+ classification: ("execution_unit" | "org_container" | "leadership" | "custom") | null;
3204
3243
  orderKey: string;
3205
3244
  path: string;
3206
3245
  /** @enum {string} */
@@ -3227,7 +3266,7 @@ export interface components {
3227
3266
  name: string;
3228
3267
  description: string | null;
3229
3268
  typeTag: string;
3230
- classification: ("execution_unit" | "org_container" | "custom") | null;
3269
+ classification: ("execution_unit" | "org_container" | "leadership" | "custom") | null;
3231
3270
  orderKey: string;
3232
3271
  path: string;
3233
3272
  /** @enum {string} */
@@ -3261,7 +3300,7 @@ export interface components {
3261
3300
  name: string;
3262
3301
  description: string | null;
3263
3302
  typeTag: string;
3264
- classification: ("execution_unit" | "org_container" | "custom") | null;
3303
+ classification: ("execution_unit" | "org_container" | "leadership" | "custom") | null;
3265
3304
  orderKey: string;
3266
3305
  path: string;
3267
3306
  /** @enum {string} */
@@ -3288,7 +3327,7 @@ export interface components {
3288
3327
  name: string;
3289
3328
  description: string | null;
3290
3329
  typeTag: string;
3291
- classification: ("execution_unit" | "org_container" | "custom") | null;
3330
+ classification: ("execution_unit" | "org_container" | "leadership" | "custom") | null;
3292
3331
  orderKey: string;
3293
3332
  path: string;
3294
3333
  /** @enum {string} */
@@ -3374,7 +3413,7 @@ export interface components {
3374
3413
  name: string;
3375
3414
  description: string | null;
3376
3415
  typeTag: string;
3377
- classification: ("execution_unit" | "org_container" | "custom") | null;
3416
+ classification: ("execution_unit" | "org_container" | "leadership" | "custom") | null;
3378
3417
  orderKey: string;
3379
3418
  path: string;
3380
3419
  /** @enum {string} */
@@ -3424,7 +3463,7 @@ export interface components {
3424
3463
  /** Format: uuid */
3425
3464
  userId: string;
3426
3465
  /** @enum {string} */
3427
- membershipRole: "member" | "manager" | "owner";
3466
+ membershipRole: "member" | "l1_unit_owner" | "l2_unit_owner" | "l3_unit_owner" | "l4_unit_owner" | "l5_unit_owner";
3428
3467
  /** Format: uuid */
3429
3468
  inheritedFromUnitId: string;
3430
3469
  inheritedFromUnitName: string;
@@ -3443,7 +3482,7 @@ export interface components {
3443
3482
  /** Format: uuid */
3444
3483
  userId: string;
3445
3484
  /** @enum {string} */
3446
- membershipRole: "member" | "manager" | "owner";
3485
+ membershipRole: "member" | "l1_unit_owner" | "l2_unit_owner" | "l3_unit_owner" | "l4_unit_owner" | "l5_unit_owner";
3447
3486
  /** @enum {string} */
3448
3487
  status: "active" | "pending" | "removed";
3449
3488
  /** @enum {string} */
@@ -3464,7 +3503,7 @@ export interface components {
3464
3503
  /** Format: uuid */
3465
3504
  userId: string;
3466
3505
  /** @enum {string} */
3467
- membershipRole: "member" | "manager" | "owner";
3506
+ membershipRole: "member" | "l1_unit_owner" | "l2_unit_owner" | "l3_unit_owner" | "l4_unit_owner" | "l5_unit_owner";
3468
3507
  /** @enum {string} */
3469
3508
  status: "active" | "pending" | "removed";
3470
3509
  /** @enum {string} */
@@ -5956,7 +5995,7 @@ export interface operations {
5956
5995
  description?: string | null;
5957
5996
  typeTag: string;
5958
5997
  /** @enum {string} */
5959
- classification?: "execution_unit" | "org_container" | "custom";
5998
+ classification?: "execution_unit" | "org_container" | "leadership" | "custom";
5960
5999
  /** @enum {string} */
5961
6000
  syncMode?: "manual_only" | "synced_readonly" | "synced_with_overrides";
5962
6001
  /** @enum {string} */
@@ -6375,7 +6414,7 @@ export interface operations {
6375
6414
  /** Format: uuid */
6376
6415
  userId: string;
6377
6416
  /** @enum {string} */
6378
- role?: "member" | "manager" | "owner";
6417
+ role?: "member" | "l1_unit_owner" | "l2_unit_owner" | "l3_unit_owner" | "l4_unit_owner" | "l5_unit_owner";
6379
6418
  };
6380
6419
  };
6381
6420
  };
@@ -6405,7 +6444,7 @@ export interface operations {
6405
6444
  content: {
6406
6445
  "application/json": {
6407
6446
  /** @enum {string} */
6408
- role: "member" | "manager" | "owner";
6447
+ role: "member" | "l1_unit_owner" | "l2_unit_owner" | "l3_unit_owner" | "l4_unit_owner" | "l5_unit_owner";
6409
6448
  };
6410
6449
  };
6411
6450
  };
@@ -6462,6 +6501,78 @@ export interface operations {
6462
6501
  };
6463
6502
  };
6464
6503
  };
6504
+ importOrgChart: {
6505
+ parameters: {
6506
+ query?: never;
6507
+ header?: never;
6508
+ path?: never;
6509
+ cookie?: never;
6510
+ };
6511
+ requestBody: {
6512
+ content: {
6513
+ "multipart/form-data": {
6514
+ [key: string]: unknown;
6515
+ };
6516
+ };
6517
+ };
6518
+ responses: {
6519
+ /** @description Operation accepted; ingestion enqueued */
6520
+ 202: {
6521
+ headers: {
6522
+ [name: string]: unknown;
6523
+ };
6524
+ content?: never;
6525
+ };
6526
+ /** @description Upload exceeds the 10 MB size limit */
6527
+ 413: {
6528
+ headers: {
6529
+ [name: string]: unknown;
6530
+ };
6531
+ content?: never;
6532
+ };
6533
+ /** @description Unsupported MIME type or declared MIME contradicts server-side sniff */
6534
+ 415: {
6535
+ headers: {
6536
+ [name: string]: unknown;
6537
+ };
6538
+ content?: never;
6539
+ };
6540
+ };
6541
+ };
6542
+ retryOrgChartImport: {
6543
+ parameters: {
6544
+ query?: never;
6545
+ header?: never;
6546
+ path: {
6547
+ operationId: string;
6548
+ };
6549
+ cookie?: never;
6550
+ };
6551
+ requestBody?: never;
6552
+ responses: {
6553
+ /** @description Retry enqueued */
6554
+ 202: {
6555
+ headers: {
6556
+ [name: string]: unknown;
6557
+ };
6558
+ content?: never;
6559
+ };
6560
+ /** @description Operation not found */
6561
+ 404: {
6562
+ headers: {
6563
+ [name: string]: unknown;
6564
+ };
6565
+ content?: never;
6566
+ };
6567
+ /** @description Retry limit exceeded */
6568
+ 422: {
6569
+ headers: {
6570
+ [name: string]: unknown;
6571
+ };
6572
+ content?: never;
6573
+ };
6574
+ };
6575
+ };
6465
6576
  listDriveFiles: {
6466
6577
  parameters: {
6467
6578
  query?: never;
package/src/index.ts CHANGED
@@ -347,6 +347,28 @@ export { ROLE_DISPLAY_MAP, VIEW_SCOPE_MAP, getViewScope, TRANSFER_RESPONSIBILITI
347
347
  // View authorization types (Phase 5 - ADR-APP-013)
348
348
  export type { AuthorizableView } from './org/index'
349
349
 
350
+ // Authority & Delegation vocabulary (PRD-00622)
351
+ export {
352
+ AuthoritySourceSchema,
353
+ AuthorityOriginSchema,
354
+ AuthorityConfidenceSchema,
355
+ OwnerRecordSchema,
356
+ OrgUnitOwnersResponseSchema,
357
+ DelegationSchema,
358
+ CreateDelegationRequestSchema,
359
+ DelegationListResponseSchema,
360
+ } from './org/index'
361
+ export type {
362
+ AuthoritySource,
363
+ AuthorityOrigin,
364
+ AuthorityConfidence,
365
+ OwnerRecord,
366
+ OrgUnitOwnersResponse,
367
+ Delegation,
368
+ CreateDelegationRequest,
369
+ DelegationListResponse,
370
+ } from './org/index'
371
+
350
372
  // MCP tool discovery types
351
373
  // @see company-semantics-backend/src/interfaces/mcp/ for implementation
352
374
  export type {
package/src/org/index.ts CHANGED
@@ -269,3 +269,25 @@ export type {
269
269
  UpdateOrgUnitRequest,
270
270
  UpdateOrgUnitResponse,
271
271
  } from './schemas';
272
+
273
+ // Authority & Delegation vocabulary (PRD-00622)
274
+ export {
275
+ AuthoritySourceSchema,
276
+ AuthorityOriginSchema,
277
+ AuthorityConfidenceSchema,
278
+ OwnerRecordSchema,
279
+ OrgUnitOwnersResponseSchema,
280
+ DelegationSchema,
281
+ CreateDelegationRequestSchema,
282
+ DelegationListResponseSchema,
283
+ } from './schemas';
284
+ export type {
285
+ AuthoritySource,
286
+ AuthorityOrigin,
287
+ AuthorityConfidence,
288
+ OwnerRecord,
289
+ OrgUnitOwnersResponse,
290
+ Delegation,
291
+ CreateDelegationRequest,
292
+ DelegationListResponse,
293
+ } from './schemas';
@@ -758,6 +758,79 @@ export const OrgUnitMembershipSchema = z.object({
758
758
  updatedAt: z.string(),
759
759
  });
760
760
 
761
+ // ---------------------------------------------------------------------------
762
+ // Authority & Delegation vocabulary (PRD-00622)
763
+ //
764
+ // Models effective owner attribution across the org topology: structural
765
+ // membership (l1..l5 unit owner roles), delegated authority, manual
766
+ // membership, and administrative override (org_admin). The `authoritySource`
767
+ // + `authorityOrigin` pair lets UI explain *why* a user appears as an
768
+ // owner without re-running the resolver.
769
+ // ---------------------------------------------------------------------------
770
+
771
+ export const AuthoritySourceSchema = z.enum([
772
+ 'structural',
773
+ 'delegated',
774
+ 'manual_membership',
775
+ 'org_admin',
776
+ ]);
777
+ export type AuthoritySource = z.infer<typeof AuthoritySourceSchema>;
778
+
779
+ export const AuthorityOriginSchema = z.enum([
780
+ 'topology',
781
+ 'delegation',
782
+ 'administrative_override',
783
+ ]);
784
+ export type AuthorityOrigin = z.infer<typeof AuthorityOriginSchema>;
785
+
786
+ export const AuthorityConfidenceSchema = z.enum(['authoritative', 'inferred']);
787
+ export type AuthorityConfidence = z.infer<typeof AuthorityConfidenceSchema>;
788
+
789
+ export const OwnerRecordSchema = z.object({
790
+ userId: z.string().uuid(),
791
+ fullName: z.string().min(1),
792
+ jobTitle: z.string().nullable(),
793
+ slackAvatarUrl: z.string().nullable(),
794
+ authoritySource: AuthoritySourceSchema,
795
+ authorityOrigin: AuthorityOriginSchema,
796
+ isLocal: z.boolean(),
797
+ derivedFromUnitId: z.string().uuid(),
798
+ derivedFromUnitName: z.string().min(1).optional(),
799
+ derivedFromUserId: z.string().uuid().nullable().optional(),
800
+ derivationMetadata: z.record(z.string(), z.unknown()).optional(),
801
+ });
802
+ export type OwnerRecord = z.infer<typeof OwnerRecordSchema>;
803
+
804
+ export const OrgUnitOwnersResponseSchema = z.object({
805
+ owners: z.array(OwnerRecordSchema),
806
+ inherited: z.array(OwnerRecordSchema).optional(),
807
+ });
808
+ export type OrgUnitOwnersResponse = z.infer<typeof OrgUnitOwnersResponseSchema>;
809
+
810
+ export const DelegationSchema = z.object({
811
+ id: z.string().uuid(),
812
+ orgId: z.string().uuid(),
813
+ unitId: z.string().uuid(),
814
+ userId: z.string().uuid(),
815
+ grantedBy: z.string().uuid().nullable(),
816
+ grantedAt: z.string(),
817
+ revokedAt: z.string().nullable(),
818
+ status: z.enum(['active', 'revoked']),
819
+ note: z.string().nullable(),
820
+ });
821
+ export type Delegation = z.infer<typeof DelegationSchema>;
822
+
823
+ export const CreateDelegationRequestSchema = z.object({
824
+ userId: z.string().uuid(),
825
+ note: z.string().max(2000).optional(),
826
+ });
827
+ export type CreateDelegationRequest = z.infer<typeof CreateDelegationRequestSchema>;
828
+
829
+ export const DelegationListResponseSchema = z.object({
830
+ delegations: z.array(DelegationSchema),
831
+ });
832
+ export type DelegationListResponse = z.infer<typeof DelegationListResponseSchema>;
833
+
761
834
  export const OrgUnitRelationshipSchema = z.object({
762
835
  id: z.string().uuid(),
763
836
  orgId: z.string().uuid(),