@company-semantics/contracts 6.0.1 → 6.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": "6.0.1",
3
+ "version": "6.1.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 = '040afdc07507' as const;
3
+ export const SPEC_HASH_FULL = '040afdc07507321af65f848b48a5843c9a80b13017fbf62d22e134703cb3d10a' as const;
@@ -1743,7 +1743,8 @@ export interface paths {
1743
1743
  delete: operations["deleteOrgUnitDelegation"];
1744
1744
  options?: never;
1745
1745
  head?: never;
1746
- patch?: never;
1746
+ /** Change a delegation's expiry in place (extend / shorten / clear) */
1747
+ patch: operations["updateOrgUnitDelegation"];
1747
1748
  trace?: never;
1748
1749
  };
1749
1750
  "/api/orgs/{orgId}/admins": {
@@ -3990,6 +3991,7 @@ export interface components {
3990
3991
  };
3991
3992
  /** Format: uuid */
3992
3993
  delegationId?: string;
3994
+ expiresAt?: string | null;
3993
3995
  }[];
3994
3996
  }[];
3995
3997
  inherited?: {
@@ -4015,6 +4017,7 @@ export interface components {
4015
4017
  };
4016
4018
  /** Format: uuid */
4017
4019
  delegationId?: string;
4020
+ expiresAt?: string | null;
4018
4021
  }[];
4019
4022
  }[];
4020
4023
  };
@@ -4033,6 +4036,7 @@ export interface components {
4033
4036
  /** @enum {string} */
4034
4037
  status: "active" | "revoked";
4035
4038
  note: string | null;
4039
+ expiresAt: string | null;
4036
4040
  };
4037
4041
  OrgAdminGrantResponse: {
4038
4042
  /** Format: uuid */
@@ -7391,6 +7395,7 @@ export interface operations {
7391
7395
  /** Format: uuid */
7392
7396
  userId: string;
7393
7397
  note?: string;
7398
+ expiresAt?: string | null;
7394
7399
  };
7395
7400
  };
7396
7401
  };
@@ -7427,6 +7432,35 @@ export interface operations {
7427
7432
  };
7428
7433
  };
7429
7434
  };
7435
+ updateOrgUnitDelegation: {
7436
+ parameters: {
7437
+ query?: never;
7438
+ header?: never;
7439
+ path: {
7440
+ unitId: string;
7441
+ id: string;
7442
+ };
7443
+ cookie?: never;
7444
+ };
7445
+ requestBody: {
7446
+ content: {
7447
+ "application/json": {
7448
+ expiresAt: string | null;
7449
+ };
7450
+ };
7451
+ };
7452
+ responses: {
7453
+ /** @description Updated delegation row */
7454
+ 200: {
7455
+ headers: {
7456
+ [name: string]: unknown;
7457
+ };
7458
+ content: {
7459
+ "application/json": components["schemas"]["Delegation"];
7460
+ };
7461
+ };
7462
+ };
7463
+ };
7430
7464
  grantOrgAdmin: {
7431
7465
  parameters: {
7432
7466
  query?: never;
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
  });