@company-semantics/contracts 6.0.1 → 6.2.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": "6.0.1",
3
+ "version": "6.2.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = 'cebabbf604ec' as const;
3
- export const SPEC_HASH_FULL = 'cebabbf604eca92841bb1704c008a26709357ca85fb82664e7baad97a9840b85' as const;
2
+ export const SPEC_HASH = '22781c2b738f' as const;
3
+ export const SPEC_HASH_FULL = '22781c2b738fdbdb0833b50ceab729227eccb7c54176ee35a373cc903d536b6c' as const;
@@ -1198,6 +1198,23 @@ export interface paths {
1198
1198
  patch?: never;
1199
1199
  trace?: never;
1200
1200
  };
1201
+ "/api/capabilities": {
1202
+ parameters: {
1203
+ query?: never;
1204
+ header?: never;
1205
+ path?: never;
1206
+ cookie?: never;
1207
+ };
1208
+ /** Get the viewer resolved mutation capabilities */
1209
+ get: operations["getMutationCapabilities"];
1210
+ put?: never;
1211
+ post?: never;
1212
+ delete?: never;
1213
+ options?: never;
1214
+ head?: never;
1215
+ patch?: never;
1216
+ trace?: never;
1217
+ };
1201
1218
  "/api/company-md/tree": {
1202
1219
  parameters: {
1203
1220
  query?: never;
@@ -1743,7 +1760,8 @@ export interface paths {
1743
1760
  delete: operations["deleteOrgUnitDelegation"];
1744
1761
  options?: never;
1745
1762
  head?: never;
1746
- patch?: never;
1763
+ /** Change a delegation's expiry in place (extend / shorten / clear) */
1764
+ patch: operations["updateOrgUnitDelegation"];
1747
1765
  trace?: never;
1748
1766
  };
1749
1767
  "/api/orgs/{orgId}/admins": {
@@ -3550,6 +3568,63 @@ export interface components {
3550
3568
  /** @constant */
3551
3569
  status: "cancelled";
3552
3570
  };
3571
+ CapabilitiesResponse: {
3572
+ profile?: {
3573
+ fullName: {
3574
+ /** @enum {string} */
3575
+ state: "editable" | "locked";
3576
+ /** @enum {string} */
3577
+ reason?: "sso" | "rbac";
3578
+ requiredScope?: string;
3579
+ };
3580
+ preferredName: {
3581
+ /** @enum {string} */
3582
+ state: "editable" | "locked";
3583
+ /** @enum {string} */
3584
+ reason?: "sso" | "rbac";
3585
+ requiredScope?: string;
3586
+ };
3587
+ };
3588
+ org?: {
3589
+ name: {
3590
+ /** @enum {string} */
3591
+ state: "editable" | "locked";
3592
+ /** @enum {string} */
3593
+ reason?: "sso" | "rbac";
3594
+ requiredScope?: string;
3595
+ };
3596
+ };
3597
+ orgUnit?: {
3598
+ /** @enum {string} */
3599
+ manage: "allowed" | "blocked";
3600
+ };
3601
+ actions?: {
3602
+ members: {
3603
+ invite: {
3604
+ /** @enum {string} */
3605
+ state: "allowed" | "blocked";
3606
+ requiredScope?: string;
3607
+ };
3608
+ remove: {
3609
+ /** @enum {string} */
3610
+ state: "allowed" | "blocked";
3611
+ requiredScope?: string;
3612
+ };
3613
+ changeRole: {
3614
+ /** @enum {string} */
3615
+ state: "allowed" | "blocked";
3616
+ requiredScope?: string;
3617
+ };
3618
+ };
3619
+ orgAdmins: {
3620
+ manage: {
3621
+ /** @enum {string} */
3622
+ state: "allowed" | "blocked";
3623
+ requiredScope?: string;
3624
+ };
3625
+ };
3626
+ };
3627
+ };
3553
3628
  CompanyMdListResponse: {
3554
3629
  items: {
3555
3630
  id: string;
@@ -3990,6 +4065,7 @@ export interface components {
3990
4065
  };
3991
4066
  /** Format: uuid */
3992
4067
  delegationId?: string;
4068
+ expiresAt?: string | null;
3993
4069
  }[];
3994
4070
  }[];
3995
4071
  inherited?: {
@@ -4015,6 +4091,7 @@ export interface components {
4015
4091
  };
4016
4092
  /** Format: uuid */
4017
4093
  delegationId?: string;
4094
+ expiresAt?: string | null;
4018
4095
  }[];
4019
4096
  }[];
4020
4097
  };
@@ -4033,6 +4110,7 @@ export interface components {
4033
4110
  /** @enum {string} */
4034
4111
  status: "active" | "revoked";
4035
4112
  note: string | null;
4113
+ expiresAt: string | null;
4036
4114
  };
4037
4115
  OrgAdminGrantResponse: {
4038
4116
  /** Format: uuid */
@@ -6493,6 +6571,26 @@ export interface operations {
6493
6571
  };
6494
6572
  };
6495
6573
  };
6574
+ getMutationCapabilities: {
6575
+ parameters: {
6576
+ query?: never;
6577
+ header?: never;
6578
+ path?: never;
6579
+ cookie?: never;
6580
+ };
6581
+ requestBody?: never;
6582
+ responses: {
6583
+ /** @description Resolved mutation capabilities for the current viewer + org */
6584
+ 200: {
6585
+ headers: {
6586
+ [name: string]: unknown;
6587
+ };
6588
+ content: {
6589
+ "application/json": components["schemas"]["CapabilitiesResponse"];
6590
+ };
6591
+ };
6592
+ };
6593
+ };
6496
6594
  getCompanyMdTree: {
6497
6595
  parameters: {
6498
6596
  query?: {
@@ -7391,6 +7489,7 @@ export interface operations {
7391
7489
  /** Format: uuid */
7392
7490
  userId: string;
7393
7491
  note?: string;
7492
+ expiresAt?: string | null;
7394
7493
  };
7395
7494
  };
7396
7495
  };
@@ -7427,6 +7526,35 @@ export interface operations {
7427
7526
  };
7428
7527
  };
7429
7528
  };
7529
+ updateOrgUnitDelegation: {
7530
+ parameters: {
7531
+ query?: never;
7532
+ header?: never;
7533
+ path: {
7534
+ unitId: string;
7535
+ id: string;
7536
+ };
7537
+ cookie?: never;
7538
+ };
7539
+ requestBody: {
7540
+ content: {
7541
+ "application/json": {
7542
+ expiresAt: string | null;
7543
+ };
7544
+ };
7545
+ };
7546
+ responses: {
7547
+ /** @description Updated delegation row */
7548
+ 200: {
7549
+ headers: {
7550
+ [name: string]: unknown;
7551
+ };
7552
+ content: {
7553
+ "application/json": components["schemas"]["Delegation"];
7554
+ };
7555
+ };
7556
+ };
7557
+ };
7430
7558
  grantOrgAdmin: {
7431
7559
  parameters: {
7432
7560
  query?: never;
@@ -10,6 +10,7 @@ export const openApiRoutes = {
10
10
  '/api/account/sessions': ['GET'],
11
11
  '/api/account/sessions/{sessionId}': ['DELETE'],
12
12
  '/api/auth/consent/grant': ['POST'],
13
+ '/api/capabilities': ['GET'],
13
14
  '/api/chats': ['GET', 'POST'],
14
15
  '/api/chats/by-interaction/{interactionId}': ['GET'],
15
16
  '/api/chats/events': ['GET'],
package/src/org/index.ts CHANGED
@@ -282,6 +282,7 @@ export {
282
282
  OrgUnitOwnersResponseSchema,
283
283
  DelegationSchema,
284
284
  CreateDelegationRequestSchema,
285
+ UpdateDelegationRequestSchema,
285
286
  DelegationListResponseSchema,
286
287
  } from './schemas';
287
288
  export type {
@@ -296,5 +297,6 @@ export type {
296
297
  OrgUnitOwnersResponse,
297
298
  Delegation,
298
299
  CreateDelegationRequest,
300
+ UpdateDelegationRequest,
299
301
  DelegationListResponse,
300
302
  } from './schemas';
@@ -844,6 +844,14 @@ export const OwnerAuthoritySchema = z.object({
844
844
  * the revoke action.
845
845
  */
846
846
  delegationId: z.string().uuid().optional(),
847
+ /**
848
+ * Delegation expiry as an ISO-8601 timestamp when `mechanism === 'delegated'`
849
+ * and the delegation is time-boxed; `null` for a permanent delegation; omitted
850
+ * for non-delegated mechanisms. Expired delegations never reach this surface —
851
+ * the projection read filters `expires_at > now()` — so a present value is
852
+ * always in the future.
853
+ */
854
+ expiresAt: z.string().datetime().nullable().optional(),
847
855
  });
848
856
  export type OwnerAuthority = z.infer<typeof OwnerAuthoritySchema>;
849
857
 
@@ -886,15 +894,37 @@ export const DelegationSchema = z.object({
886
894
  revokedAt: z.string().nullable(),
887
895
  status: z.enum(['active', 'revoked']),
888
896
  note: z.string().nullable(),
897
+ /**
898
+ * ISO-8601 timestamp at which the delegation stops conferring authority, or
899
+ * `null` for a permanent delegation. Enforcement is read-time (the projection
900
+ * read filters `expires_at > now()`); the row itself stays `status='active'`
901
+ * until explicitly revoked.
902
+ */
903
+ expiresAt: z.string().nullable(),
889
904
  });
890
905
  export type Delegation = z.infer<typeof DelegationSchema>;
891
906
 
892
907
  export const CreateDelegationRequestSchema = z.object({
893
908
  userId: z.string().uuid(),
894
909
  note: z.string().max(2000).optional(),
910
+ /**
911
+ * Optional ISO-8601 expiry. Omitted or `null` ⇒ a permanent delegation. The
912
+ * UI captures a date and sends end-of-day in the user's timezone.
913
+ */
914
+ expiresAt: z.string().datetime().nullable().optional(),
895
915
  });
896
916
  export type CreateDelegationRequest = z.infer<typeof CreateDelegationRequestSchema>;
897
917
 
918
+ /**
919
+ * Change a delegation's expiry without revoking it: extend, shorten, or clear
920
+ * (set `expiresAt: null` to make it permanent). Used by the inline expiry edit
921
+ * on an existing delegate row.
922
+ */
923
+ export const UpdateDelegationRequestSchema = z.object({
924
+ expiresAt: z.string().datetime().nullable(),
925
+ });
926
+ export type UpdateDelegationRequest = z.infer<typeof UpdateDelegationRequestSchema>;
927
+
898
928
  export const DelegationListResponseSchema = z.object({
899
929
  delegations: z.array(DelegationSchema),
900
930
  });