@company-semantics/contracts 6.0.0 → 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.0",
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 = 'f8ecf637857f' as const;
3
- export const SPEC_HASH_FULL = 'f8ecf637857fded90a144d5a76bfa2919d3494bb0b5b78d4131e906ab4a6edf5' as const;
2
+ export const SPEC_HASH = '040afdc07507' as const;
3
+ export const SPEC_HASH_FULL = '040afdc07507321af65f848b48a5843c9a80b13017fbf62d22e134703cb3d10a' as const;
@@ -1743,8 +1743,8 @@ export interface paths {
1743
1743
  delete: operations["deleteOrgUnitDelegation"];
1744
1744
  options?: never;
1745
1745
  head?: never;
1746
- /** Update the scopes of an existing delegation */
1747
- patch: operations["updateOrgUnitDelegationScopes"];
1746
+ /** Change a delegation's expiry in place (extend / shorten / clear) */
1747
+ patch: operations["updateOrgUnitDelegation"];
1748
1748
  trace?: never;
1749
1749
  };
1750
1750
  "/api/orgs/{orgId}/admins": {
@@ -3991,7 +3991,7 @@ export interface components {
3991
3991
  };
3992
3992
  /** Format: uuid */
3993
3993
  delegationId?: string;
3994
- scopes: ("doc.edit" | "doc.acl" | "members.manage")[];
3994
+ expiresAt?: string | null;
3995
3995
  }[];
3996
3996
  }[];
3997
3997
  inherited?: {
@@ -4017,7 +4017,7 @@ export interface components {
4017
4017
  };
4018
4018
  /** Format: uuid */
4019
4019
  delegationId?: string;
4020
- scopes: ("doc.edit" | "doc.acl" | "members.manage")[];
4020
+ expiresAt?: string | null;
4021
4021
  }[];
4022
4022
  }[];
4023
4023
  };
@@ -4036,7 +4036,7 @@ export interface components {
4036
4036
  /** @enum {string} */
4037
4037
  status: "active" | "revoked";
4038
4038
  note: string | null;
4039
- scopes: ("doc.edit" | "doc.acl" | "members.manage")[];
4039
+ expiresAt: string | null;
4040
4040
  };
4041
4041
  OrgAdminGrantResponse: {
4042
4042
  /** Format: uuid */
@@ -7395,7 +7395,7 @@ export interface operations {
7395
7395
  /** Format: uuid */
7396
7396
  userId: string;
7397
7397
  note?: string;
7398
- scopes?: ("doc.edit" | "doc.acl" | "members.manage")[];
7398
+ expiresAt?: string | null;
7399
7399
  };
7400
7400
  };
7401
7401
  };
@@ -7432,7 +7432,7 @@ export interface operations {
7432
7432
  };
7433
7433
  };
7434
7434
  };
7435
- updateOrgUnitDelegationScopes: {
7435
+ updateOrgUnitDelegation: {
7436
7436
  parameters: {
7437
7437
  query?: never;
7438
7438
  header?: never;
@@ -7445,12 +7445,12 @@ export interface operations {
7445
7445
  requestBody: {
7446
7446
  content: {
7447
7447
  "application/json": {
7448
- scopes: ("doc.edit" | "doc.acl" | "members.manage")[];
7448
+ expiresAt: string | null;
7449
7449
  };
7450
7450
  };
7451
7451
  };
7452
7452
  responses: {
7453
- /** @description Delegation row with updated scopes */
7453
+ /** @description Updated delegation row */
7454
7454
  200: {
7455
7455
  headers: {
7456
7456
  [name: string]: unknown;
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
  });