@company-semantics/contracts 87.0.0 → 88.0.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 +7 -3
- package/src/guards/README.md +0 -1
- package/src/guards/config.ts +0 -9
- package/src/guards/evolution-config.ts +1 -18
- package/src/guards/index.ts +0 -1
- package/src/index.ts +15 -1277
- package/src/org/README.md +0 -212
- package/src/org/authority-schemas.ts +242 -0
- package/src/org/index.ts +26 -249
- package/src/org/invite-schemas.ts +596 -0
- package/src/org/org-governance-schemas.ts +198 -0
- package/src/org/org-unit-api-schemas.ts +226 -0
- package/src/org/org-unit-schemas.ts +223 -0
- package/src/org/ownership-transfer-types.ts +51 -0
- package/src/org/schemas.ts +18 -1658
- package/src/org/sso-stepper-types.ts +81 -0
- package/src/org/types.ts +15 -115
- package/src/org/workspace-admin-schemas.ts +240 -0
- package/src/root-exports/README.md +91 -0
- package/src/root-exports/agent-runtime.ts +213 -0
- package/src/root-exports/collaboration.ts +247 -0
- package/src/root-exports/delivery.ts +218 -0
- package/src/root-exports/org-structure.ts +214 -0
- package/src/root-exports/org-workspace.ts +254 -0
- package/src/root-exports/platform.ts +205 -0
package/src/org/README.md
CHANGED
|
@@ -17,10 +17,8 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
17
17
|
## Public API
|
|
18
18
|
|
|
19
19
|
- `AcceptInviteRequest` _(type)_ — Request payload for accepting an organization invite.
|
|
20
|
-
- `AccessLevel` _(type)_ — Document access level.
|
|
21
20
|
- `AcknowledgeSystemEventResponse` _(type)_
|
|
22
21
|
- `AcknowledgeSystemEventResponseSchema`
|
|
23
|
-
- `AclEntry` _(type)_
|
|
24
22
|
- `ActionCapability` _(type)_
|
|
25
23
|
- `ActionCapabilitySchema` — An action's gate: allowed, or blocked with the scope that would unlock it.
|
|
26
24
|
- `AuthMethodConfig` _(type)_ — Authentication method configuration.
|
|
@@ -36,7 +34,6 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
36
34
|
- `AuthorityOriginSchema`
|
|
37
35
|
- `AuthoritySource` _(type)_
|
|
38
36
|
- `AuthoritySourceSchema` — Engine-internal authority source.
|
|
39
|
-
- `AuthorizableView` _(type)_ — Type for views that can be checked against VIEWSCOPEMAP.
|
|
40
37
|
- `BATCH_INVITE_PERSONS_MAX` — Cap on one batch.
|
|
41
38
|
- `BATCH_INVITE_SKIP_REASONS` — Why one person in a batch did not receive an invite. - `already-member` — holds an account in this org…
|
|
42
39
|
- `BatchInviteRequest` _(type)_
|
|
@@ -45,74 +42,11 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
45
42
|
- `BatchInviteResponseSchema`
|
|
46
43
|
- `BatchInviteSkipReason` _(type)_
|
|
47
44
|
- `BatchInviteSkipReasonSchema`
|
|
48
|
-
- `COMPANY_MD_COLLAB_MAX_DOC_TEXT_BYTES` — Cap on the MATERIALIZED document text, in UTF-8 bytes of the expanded result.
|
|
49
|
-
- `COMPANY_MD_COLLAB_MAX_PRESENCE_POSITION_CHARS` — Cap on ONE presence position blob (`anchor` or `head`), in base64 chars.
|
|
50
|
-
- `COMPANY_MD_COLLAB_MAX_UPDATE_B64_CHARS` — Cap on ONE encoded update, measured on the base64 payload as it is sent.
|
|
51
|
-
- `COMPANY_MD_COLLAB_PRESENCE_HEARTBEAT_MS` — The cadence clients must re-POST presence at.
|
|
52
|
-
- `COMPANY_MD_COLLAB_PRESENCE_TTL_MS` — How long the server keeps a presence entry alive with no fresh signal.
|
|
53
|
-
- `COMPANY_MD_COLLAB_TEXT_KEY` — The Y.Doc root key holding the document body — a CONTRACT, not a detail.
|
|
54
|
-
- `CanonicalFacts` _(type)_
|
|
55
|
-
- `CanonicalFactsSchema` — The full normalized batch an external-source adapter emits in one pass: every person, org unit, position…
|
|
56
|
-
- `CanonicalOccupancy` _(type)_
|
|
57
|
-
- `CanonicalOccupancySchema` — An occupancy (a person holds a seat) as reported by an external source.
|
|
58
|
-
- `CanonicalOrgUnit` _(type)_
|
|
59
|
-
- `CanonicalOrgUnitSchema` — An org unit as reported by an external source.
|
|
60
|
-
- `CanonicalPerson` _(type)_
|
|
61
|
-
- `CanonicalPersonSchema` — A person as reported by an external source, keyed by external identity.
|
|
62
|
-
- `CanonicalPosition` _(type)_
|
|
63
|
-
- `CanonicalPositionSchema` — A position (seat) as reported by an external source, placed in a unit by external reference…
|
|
64
|
-
- `CanonicalPositionStatus` _(type)_
|
|
65
|
-
- `CanonicalPositionStatusSchema` — Seat-existence as the SOURCE reported it.
|
|
66
|
-
- `CanonicalReportingEdge` _(type)_
|
|
67
|
-
- `CanonicalReportingEdgeSchema` — A reporting edge (a seat reports to a manager seat) as reported by an external source.
|
|
68
|
-
- `CanonicalUnresolvedManager` _(type)_
|
|
69
|
-
- `CanonicalUnresolvedManagerResolution` _(type)_
|
|
70
|
-
- `CanonicalUnresolvedManagerResolutionSchema` — Why a supervisory reference could not be resolved to a seat in this batch.
|
|
71
|
-
- `CanonicalUnresolvedManagerSchema` — A supervisory reference the source reported that we could NOT resolve to a seat in this batch.
|
|
72
45
|
- `CapabilitiesResponse` _(type)_
|
|
73
46
|
- `CapabilitiesResponseSchema` — The single validated capability surface the UI reads.
|
|
74
47
|
- `ChangeMemberRoleRequest` _(type)_ — Request payload for changing a member's role.
|
|
75
48
|
- `ChangeMemberRoleResponse` _(type)_
|
|
76
49
|
- `ChangeMemberRoleResponseSchema`
|
|
77
|
-
- `CompanyMdClassification` _(type)_ — Information classification for a Company.md node — what the document is, for governance, NOT permissions.
|
|
78
|
-
- `CompanyMdCollabAccessRevokedEvent` _(type)_
|
|
79
|
-
- `CompanyMdCollabAccessRevokedEventSchema` — `event: access-revoked` — the actor's read grant went away mid-stream.
|
|
80
|
-
- `CompanyMdCollabConnectedEvent` _(type)_
|
|
81
|
-
- `CompanyMdCollabConnectedEventSchema` — `event: connected` — the stream is open.
|
|
82
|
-
- `CompanyMdCollabPresenceEvent` _(type)_
|
|
83
|
-
- `CompanyMdCollabPresenceEventSchema` — `event: collab-presence` — one participant's presence signal, either live or replayed from the roster right…
|
|
84
|
-
- `CompanyMdCollabResetEvent` _(type)_
|
|
85
|
-
- `CompanyMdCollabResetEventSchema` — `event: collab-reset` — the client's cursor was unusable (a superseded generation, older than what compaction…
|
|
86
|
-
- `CompanyMdCollabServerDrainEvent` _(type)_
|
|
87
|
-
- `CompanyMdCollabServerDrainEventSchema` — `event: server_drain` — the server is shutting the stream down deliberately (a rolling restart, not a…
|
|
88
|
-
- `CompanyMdCollabSseEvent` _(type)_
|
|
89
|
-
- `CompanyMdCollabSseEventSchema` — Every frame the collaboration stream emits, discriminated on the `type` the client stamps from the SSE…
|
|
90
|
-
- `CompanyMdCollabSyncLimits` _(type)_
|
|
91
|
-
- `CompanyMdCollabSyncLimitsSchema` — Protocol limits the client needs BEFORE it sends anything.
|
|
92
|
-
- `CompanyMdCollabSyncResponse` _(type)_
|
|
93
|
-
- `CompanyMdCollabSyncResponseSchema` — `GET /collab/sync` response body — merged collaboration state plus the cursor the stream resumes from.
|
|
94
|
-
- `CompanyMdCollabUpdateAccepted` _(type)_
|
|
95
|
-
- `CompanyMdCollabUpdateAcceptedSchema` — `POST /collab/updates` response body.
|
|
96
|
-
- `CompanyMdCollabUpdateEvent` _(type)_
|
|
97
|
-
- `CompanyMdCollabUpdateEventSchema` — `event: collab-update` — one durable collaboration update.
|
|
98
|
-
- `CompanyMdContextBankItem` _(type)_ — A context bank item — a company.md doc associated with one or more parent nodes.
|
|
99
|
-
- `CompanyMdDependency` _(type)_
|
|
100
|
-
- `CompanyMdDiscoverabilityPolicy` _(type)_ — Discoverability policy for a Company.md node — who knows it exists, orthogonal to who may read it (authority…
|
|
101
|
-
- `CompanyMdDoc` _(type)_
|
|
102
|
-
- `CompanyMdDocCollaborators` _(type)_
|
|
103
|
-
- `CompanyMdDocCore` _(type)_
|
|
104
|
-
- `CompanyMdDocKind` _(type)_ — Structural discriminator for a Company.md document. - `'root'`: the single org-wide doc (one per org). -…
|
|
105
|
-
- `CompanyMdDocLevel` _(type)_
|
|
106
|
-
- `CompanyMdDocRelations` _(type)_
|
|
107
|
-
- `CompanyMdNodeIdentity` _(type)_
|
|
108
|
-
- `CompanyMdNodeType` _(type)_ — Semantic node type used by the Company.md tree.
|
|
109
|
-
- `CompanyMdSource` _(type)_
|
|
110
|
-
- `CompanyMdTreeNode` _(type)_
|
|
111
|
-
- `CompanyMdVisibility` _(type)_ — Visibility band for a Company.md document — the canonical AUTH `entity_visibility` vocabulary (, backend ). -…
|
|
112
|
-
- `ConflictRecord` _(type)_
|
|
113
|
-
- `ConflictRecordSchema`
|
|
114
|
-
- `ConstraintViolation` _(type)_
|
|
115
|
-
- `ConstraintViolationSchema` — One constraint the transformation engine evaluated and found violated.
|
|
116
50
|
- `CreateDelegationRequest` _(type)_
|
|
117
51
|
- `CreateDelegationRequestSchema`
|
|
118
52
|
- `CreateInviteBatchRequest` _(type)_
|
|
@@ -126,38 +60,15 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
126
60
|
- `DelegationListResponse` _(type)_
|
|
127
61
|
- `DelegationListResponseSchema`
|
|
128
62
|
- `DelegationSchema`
|
|
129
|
-
- `DismissStructureFindingRequest` _(type)_
|
|
130
|
-
- `DismissStructureFindingRequestSchema`
|
|
131
63
|
- `DomainListResponse` _(type)_
|
|
132
64
|
- `DomainListResponseSchema`
|
|
133
65
|
- `DomainResponse` _(type)_
|
|
134
66
|
- `DomainResponseSchema`
|
|
135
|
-
- `DomainStatus` _(type)_ — Status of a domain claim within an organization. - 'pending': Domain claimed but not yet verified -…
|
|
136
|
-
- `DomainVerificationMethod` _(type)_ — Method used to verify domain ownership. - 'dnstxt': DNS TXT record verification (primary method) - 'email'…
|
|
137
|
-
- `ExecutionContext` _(type)_
|
|
138
|
-
- `ExecutionContextSchema` — ExecutionContext — the RUN in which an intent was produced or applied.
|
|
139
67
|
- `ExecutionScope` _(type)_ — Execution scope determines whose identity is used when executing actions. - 'self': Actions execute under the…
|
|
140
|
-
- `ExistingPlacementFact` _(type)_
|
|
141
|
-
- `ExistingPlacementFactSchema` — Where a person already sits, and on whose authority they sit there.
|
|
142
|
-
- `ExistingUnitFact` _(type)_
|
|
143
|
-
- `ExistingUnitFactSchema` — An org unit that already exists, with the license the engine has over it.
|
|
144
|
-
- `FACT_SOURCE_TIER_PRECEDENCE` — Truth hierarchy, highest precedence first.
|
|
145
|
-
- `FactMutation` _(type)_
|
|
146
|
-
- `FactMutationSchema` — A single atomic fact change the engine applies to the live org graph.
|
|
147
|
-
- `FactProvenance` _(type)_
|
|
148
|
-
- `FactProvenanceSchema` — Provenance envelope attached to a structural fact (reporting edge, org unit, membership, home assignment).
|
|
149
|
-
- `FactSourceTier` _(type)_
|
|
150
|
-
- `FactSourceTierSchema` — The precedence axis for a fact.
|
|
151
68
|
- `FieldCapability` _(type)_
|
|
152
69
|
- `FieldCapabilitySchema` — A mutable field's gate: editable, or locked with attribution (sso vs rbac).
|
|
153
70
|
- `FillOpenRoleRequest` _(type)_
|
|
154
71
|
- `FillOpenRoleRequestSchema` — Fill an open role by seating an existing org member (`userId`) or inviting a new person by email.
|
|
155
|
-
- `Finding` _(type)_
|
|
156
|
-
- `FindingSchema` — A single diagnostic the system emits about the org graph — the GENERAL model of which {@link…
|
|
157
|
-
- `FindingSeverity` _(type)_
|
|
158
|
-
- `FindingSeveritySchema` — Severity of a {@link FindingSchema}.
|
|
159
|
-
- `HomeAssignment` _(type)_
|
|
160
|
-
- `HomeAssignmentSchema` — A person's single structural home unit — at most one per person per org.
|
|
161
72
|
- `HomeUnitRole` _(type)_
|
|
162
73
|
- `HomeUnitRoleSchema` — Role the invitee takes in their home unit on acceptance.
|
|
163
74
|
- `IDENTITY_TRUST_LEVEL_LABELS`
|
|
@@ -194,14 +105,8 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
194
105
|
- `MemberRecentAction` _(type)_ — Recent audit action attached to a member-detail response.
|
|
195
106
|
- `MissingAtNextLevel` _(type)_
|
|
196
107
|
- `MissingAtNextLevelSchema` — Active users home directly at this unit who have no level-(depth+1) home assignment within its subtree.
|
|
197
|
-
- `ORG_SHARED_TRANSITION_TRIGGERS` — WHY an org stopped being personal.
|
|
198
|
-
- `ORG_UNITS_ROUTES` — Canonical route path constants for the `/api/org-units` surface.
|
|
199
108
|
- `ORG_UNIT_ABSOLUTE_MAX_DEPTH` — Hard ceiling mirrored by the `org_units_depth_max` CHECK; ingest-only past designed.
|
|
200
109
|
- `ORG_UNIT_DESIGNED_MAX_DEPTH` — Depth a human may build from scratch; the UI ceiling for a fresh org.
|
|
201
|
-
- `Occupancy` _(type)_
|
|
202
|
-
- `OccupancySchema`
|
|
203
|
-
- `OccupancyStatus` _(type)_
|
|
204
|
-
- `OccupancyStatusSchema` — Lifecycle of a single occupancy of a position.
|
|
205
110
|
- `OidcValidationResult` _(type)_ — Result of validating an OIDC discovery URL.
|
|
206
111
|
- `OidcValidationResultDto` _(type)_ — Result of validating an OIDC discovery URL.
|
|
207
112
|
- `OidcValidationResultSchema`
|
|
@@ -211,7 +116,6 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
211
116
|
- `OpenRoleResponse` _(type)_
|
|
212
117
|
- `OpenRoleResponseSchema`
|
|
213
118
|
- `OpenRoleSchema` — An open role — a persisted placeholder for the person who will sit in a unit.
|
|
214
|
-
- `OpenRoleStatus` _(type)_ — Hiring lifecycle of an open role — a persisted placeholder for the person who will sit in an org unit (PRD…
|
|
215
119
|
- `OpenRoleStatusSchema` — Hiring lifecycle of an open role.
|
|
216
120
|
- `OrgAuthPolicy` _(type)_ — Organization authentication policy.
|
|
217
121
|
- `OrgAuthPolicyDto` _(type)_ — Organization authentication policy.
|
|
@@ -222,13 +126,6 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
222
126
|
- `OrgDirectoryPersonSchema`
|
|
223
127
|
- `OrgDirectoryResponse` _(type)_
|
|
224
128
|
- `OrgDirectoryResponseSchema`
|
|
225
|
-
- `OrgDivergence` _(type)_
|
|
226
|
-
- `OrgDivergenceResolution` _(type)_
|
|
227
|
-
- `OrgDivergenceResolutionSchema` — What resolving a divergence means today.
|
|
228
|
-
- `OrgDivergenceSchema`
|
|
229
|
-
- `OrgDomain` _(type)_ — Organization domain claim and verification status.
|
|
230
|
-
- `OrgIntent` _(type)_
|
|
231
|
-
- `OrgIntentSchema` — A requested org-graph change expressed as intent.
|
|
232
129
|
- `OrgInvite` _(type)_ — Organization invite for the workspace invites list.
|
|
233
130
|
- `OrgInviteStatus` _(type)_ — Status of an organization invite.
|
|
234
131
|
- `OrgLevelConfig` _(type)_
|
|
@@ -241,26 +138,20 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
241
138
|
- `OrgLogosSchema` — An org's stored marks.
|
|
242
139
|
- `OrgOwnerIcon` _(type)_
|
|
243
140
|
- `OrgOwnerIconSchema` — Icon options for the `owner` org-chart role.
|
|
244
|
-
- `OrgReconciliationLedger` _(type)_
|
|
245
|
-
- `OrgReconciliationLedgerSchema`
|
|
246
141
|
- `OrgScopedContext` _(type)_ — Validated organization-scoped context for policy implementations.
|
|
247
|
-
- `OrgSharedTransitionTrigger` _(type)_
|
|
248
142
|
- `OrgSystemEventsList` _(type)_
|
|
249
143
|
- `OrgSystemEventsListSchema`
|
|
250
|
-
- `OrgTreeResponse` _(type)_
|
|
251
144
|
- `OrgType` _(type)_ — Organization type distinguishes personal workspaces from shared organizations. - 'personal': Single-user…
|
|
252
145
|
- `OrgUnit` _(type)_
|
|
253
146
|
- `OrgUnitAncestorsResponse` _(type)_
|
|
254
147
|
- `OrgUnitAncestorsResponseSchema`
|
|
255
148
|
- `OrgUnitChildrenResponse` _(type)_
|
|
256
149
|
- `OrgUnitChildrenResponseSchema`
|
|
257
|
-
- `OrgUnitClassification` _(type)_ — Semantic classification — projection-only, never drives traversal.
|
|
258
150
|
- `OrgUnitClassificationSchema`
|
|
259
151
|
- `OrgUnitDescendantsResponse` _(type)_
|
|
260
152
|
- `OrgUnitDescendantsResponseSchema`
|
|
261
153
|
- `OrgUnitDesignation` _(type)_
|
|
262
154
|
- `OrgUnitDesignationSchema` — Designation a member holds over a unit they manage.
|
|
263
|
-
- `OrgUnitErrorCode` _(type)_ — Error codes returned by `POST /api/org-units/:id/reparent` and related mutation endpoints.
|
|
264
155
|
- `OrgUnitErrorCodeSchema`
|
|
265
156
|
- `OrgUnitMembership` _(type)_
|
|
266
157
|
- `OrgUnitMembershipListResponse` _(type)_
|
|
@@ -268,9 +159,7 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
268
159
|
- `OrgUnitMembershipResponse` _(type)_
|
|
269
160
|
- `OrgUnitMembershipResponseSchema`
|
|
270
161
|
- `OrgUnitMembershipSchema`
|
|
271
|
-
- `OrgUnitMembershipSource` _(type)_ — External directory origin of a membership row.
|
|
272
162
|
- `OrgUnitMembershipSourceSchema`
|
|
273
|
-
- `OrgUnitMembershipStatus` _(type)_ — Active/pending/removed lifecycle for a unit membership.
|
|
274
163
|
- `OrgUnitMembershipStatusSchema`
|
|
275
164
|
- `OrgUnitOwner` _(type)_
|
|
276
165
|
- `OrgUnitOwnerSchema`
|
|
@@ -279,23 +168,19 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
279
168
|
- `OrgUnitPermissionsEntry` _(type)_
|
|
280
169
|
- `OrgUnitPermissionsEntrySchema` — Effective manager of an org unit — a user whose membership (direct or inherited from an ancestor) grants the…
|
|
281
170
|
- `OrgUnitRelationship` _(type)_
|
|
282
|
-
- `OrgUnitRelationshipRole` _(type)_ — Edge role — refines the collaboration nature on a graph edge.
|
|
283
171
|
- `OrgUnitRelationshipRoleSchema`
|
|
284
172
|
- `OrgUnitRelationshipSchema`
|
|
285
|
-
- `OrgUnitRelationshipType` _(type)_ — Edge classification for `org_unit_relationships`.
|
|
286
173
|
- `OrgUnitRelationshipTypeSchema`
|
|
287
174
|
- `OrgUnitRelationshipsResponse` _(type)_
|
|
288
175
|
- `OrgUnitRelationshipsResponseSchema`
|
|
289
176
|
- `OrgUnitResponse` _(type)_
|
|
290
177
|
- `OrgUnitResponseSchema`
|
|
291
178
|
- `OrgUnitSchema`
|
|
292
|
-
- `OrgUnitSyncMode` _(type)_ — External directory reconciliation policy for a unit.
|
|
293
179
|
- `OrgUnitSyncModeSchema`
|
|
294
180
|
- `OrgUnitTreeNode` _(type)_
|
|
295
181
|
- `OrgUnitTreeNodeSchema`
|
|
296
182
|
- `OrgUnitTreeResponse` _(type)_
|
|
297
183
|
- `OrgUnitTreeResponseSchema`
|
|
298
|
-
- `OrgUnitVisibility` _(type)_ — Default visibility inherited by new docs under this unit.
|
|
299
184
|
- `OrgUnitVisibilitySchema`
|
|
300
185
|
- `OrgUsageResponse` _(type)_
|
|
301
186
|
- `OrgUsageResponseSchema`
|
|
@@ -311,62 +196,25 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
311
196
|
- `OwnershipTransferStatus` _(type)_ — Status of pending ownership transfer for an organization.
|
|
312
197
|
- `PendingUnitOwner` _(type)_
|
|
313
198
|
- `PendingUnitOwnerSchema` — A lead the structure review chose who is NOT YET an owner, because they have no account to grant to.
|
|
314
|
-
- `PermissionAuditEntry` _(type)_ — Single entry in the permission change audit log.
|
|
315
|
-
- `PersonStructureOutcome` _(type)_
|
|
316
|
-
- `PersonStructureOutcomeSchema` — EXACTLY ONE outcome per person in the snapshot. "Zero or one placement" would accept a proposal that simply…
|
|
317
199
|
- `Phase3AuditAction` _(type)_ — Audit actions for Phase 3 workspace expansion features.
|
|
318
|
-
- `Phase4AuditAction` _(type)_ — Audit actions for Phase 4 enterprise identity features.
|
|
319
|
-
- `Position` _(type)_
|
|
320
|
-
- `PositionReporting` _(type)_
|
|
321
|
-
- `PositionReportingRelationshipType` _(type)_
|
|
322
|
-
- `PositionReportingRelationshipTypeSchema` — The kind of reporting line.
|
|
323
|
-
- `PositionReportingSchema`
|
|
324
|
-
- `PositionSchema`
|
|
325
|
-
- `PositionStatus` _(type)_
|
|
326
|
-
- `PositionStatusSchema` — Lifecycle of a seat's EXISTENCE — distinct from a hiring pipeline.
|
|
327
|
-
- `ProposedOrgUnit` _(type)_
|
|
328
|
-
- `ProposedOrgUnitSchema` — A unit the proposal wants the org to have.
|
|
329
|
-
- `Provenance` _(type)_
|
|
330
|
-
- `ProvenanceSchema` — Provenance — WHO/WHAT generated an intent.
|
|
331
200
|
- `ProviderStatus` _(type)_ — Provider-level configuration lifecycle.
|
|
332
201
|
- `ProviderSuggestion` _(type)_ — MX-based provider suggestion for SSO setup.
|
|
333
|
-
- `Recommendation` _(type)_
|
|
334
|
-
- `RecommendationSchema`
|
|
335
202
|
- `RemoveMemberRequest` _(type)_ — Request payload for removing a member from the workspace.
|
|
336
203
|
- `RemoveMemberResponse` _(type)_
|
|
337
204
|
- `RemoveMemberResponseSchema`
|
|
338
|
-
- `ReportingEdgeProvenance` _(type)_
|
|
339
|
-
- `ReportingEdgeProvenanceSchema` — The provenance of a reporting edge a change would supersede, as the operator must see it before confirming…
|
|
340
|
-
- `ReportingErrorCode` _(type)_
|
|
341
|
-
- `ReportingErrorCodeSchema` — Structured codes for reporting-line mutation rejections, surfaced as `ErrorResponse.meta.reportingCode` by…
|
|
342
|
-
- `ReportingLineAnomalyFacts` _(type)_
|
|
343
|
-
- `ReportingLineAnomalyFactsSchema`
|
|
344
|
-
- `ReportingLineAnomalyReport` _(type)_
|
|
345
|
-
- `ReportingLineAnomalyReportSchema` — One report parked on the pivot, and who actually leads their department.
|
|
346
|
-
- `ResolveOrgDivergenceResult` _(type)_
|
|
347
|
-
- `ResolveOrgDivergenceResultSchema`
|
|
348
205
|
- `RoleCatalogEntry` _(type)_ — Entry in the RBAC roles catalog (GET /api/rbac/roles).
|
|
349
206
|
- `RoleCatalogEntrySchema`
|
|
350
207
|
- `RoleCatalogResponseSchema`
|
|
351
|
-
- `STRUCTURE_FINDING_KINDS`
|
|
352
|
-
- `STRUCTURE_FINDING_STATUSES`
|
|
353
|
-
- `STRUCTURE_REVIEW_ITEM_KINDS` — A question the engine is asking a human, with the competing signals attached.
|
|
354
208
|
- `ScopeCheckBatchResponse` _(type)_
|
|
355
209
|
- `ScopeCheckBatchResponseSchema`
|
|
356
210
|
- `ScopeCheckResponse` _(type)_
|
|
357
211
|
- `ScopeCheckResponseSchema`
|
|
358
|
-
- `SelectionRationale` _(type)_
|
|
359
|
-
- `SelectionRationaleSchema`
|
|
360
212
|
- `SendInviteBatchRequest` _(type)_
|
|
361
213
|
- `SendInviteBatchRequestSchema` — `expectedRevision` is REQUIRED and has no default.
|
|
362
214
|
- `SetActiveOrgResponse` _(type)_
|
|
363
215
|
- `SetActiveOrgResponseSchema`
|
|
364
216
|
- `SetSeatManagerResponse` _(type)_
|
|
365
217
|
- `SetSeatManagerResponseSchema` — Response for the one idempotent set-or-clear of a seat's solid-line manager — the reporting edge the org…
|
|
366
|
-
- `SharePolicy` _(type)_ — Document sharing policy. - restricted: Only explicit ACL + owning unit + org admins - orgread: All org…
|
|
367
|
-
- `ShareState` _(type)_ — Complete sharing state for a document.
|
|
368
|
-
- `SourceAuthority` _(type)_
|
|
369
|
-
- `SourceAuthoritySchema`
|
|
370
218
|
- `SsoCredentialStatus` _(type)_ — Boolean credential presence indicators (never expose actual values).
|
|
371
219
|
- `SsoDiscoveryConfig` _(type)_ — OIDC discovery configuration for the SSO provider.
|
|
372
220
|
- `SsoEnforcementStatus` _(type)_ — SSO enforcement status for the workspace.
|
|
@@ -377,51 +225,8 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
377
225
|
- `SsoStepperStep` _(type)_ — Backend-authoritative stepper step.
|
|
378
226
|
- `StagedPlacement` _(type)_ — Staged member placement: the fuller org position an invitee is slotted into, applied as deferred grants when…
|
|
379
227
|
- `StagedPlacementSchema` — Staged member placement: the fuller org position an invitee is slotted into, applied as deferred grants when…
|
|
380
|
-
- `StructureAcceptedBy` _(type)_
|
|
381
|
-
- `StructureAcceptedBySchema` — WHO accepted the fact.
|
|
382
|
-
- `StructureAuthority` _(type)_
|
|
383
|
-
- `StructureAuthoritySchema` — The authority axis — the ONLY axis precedence runs on: `human_confirmed` `ai_inferred` `hris_source`.
|
|
384
|
-
- `StructureEvidence` _(type)_
|
|
385
|
-
- `StructureEvidenceSchema` — TYPED evidence.
|
|
386
|
-
- `StructureFinding` _(type)_
|
|
387
|
-
- `StructureFindingDismissal` _(type)_
|
|
388
|
-
- `StructureFindingDismissalSchema` — Who said a finding is intentional, when, and about which content.
|
|
389
|
-
- `StructureFindingKind` _(type)_
|
|
390
|
-
- `StructureFindingKindSchema`
|
|
391
|
-
- `StructureFindingListResponse` _(type)_
|
|
392
|
-
- `StructureFindingListResponseSchema`
|
|
393
|
-
- `StructureFindingListStatus` _(type)_
|
|
394
|
-
- `StructureFindingListStatusSchema` — Which findings a list read returns.
|
|
395
|
-
- `StructureFindingResponse` _(type)_
|
|
396
|
-
- `StructureFindingResponseSchema`
|
|
397
|
-
- `StructureFindingSchema`
|
|
398
|
-
- `StructureFindingStatus` _(type)_
|
|
399
|
-
- `StructureFindingStatusSchema`
|
|
400
|
-
- `StructureInferenceSnapshot` _(type)_
|
|
401
|
-
- `StructureInferenceSnapshotSchema` — The inference INPUT: a point-in-time view of the PERSISTED canonical graph.
|
|
402
|
-
- `StructurePersonFact` _(type)_
|
|
403
|
-
- `StructurePersonFactSchema` — A person as the inference engine sees them.
|
|
404
|
-
- `StructureProposal` _(type)_
|
|
405
|
-
- `StructureProposalOrigin` _(type)_
|
|
406
|
-
- `StructureProposalOriginSchema` — How a structural fact came to be PROPOSED.
|
|
407
|
-
- `StructureProposalSchema` — A proposed desired state for one org.
|
|
408
|
-
- `StructureProvenance` _(type)_
|
|
409
|
-
- `StructureProvenanceSchema` — The three axes together, as one accepted structural fact records them. - v1 — AI proposes, an admin clicks…
|
|
410
|
-
- `StructureReportingFact` _(type)_
|
|
411
|
-
- `StructureReportingFactSchema` — One reporting edge, at person granularity.
|
|
412
|
-
- `StructureReviewItem` _(type)_
|
|
413
|
-
- `StructureReviewItemSchema` — A review item IS a {@link DecisionQuestion}, plus the addressing that says what the question is about.
|
|
414
|
-
- `StructureUnitAuthority` _(type)_
|
|
415
|
-
- `StructureUnitAuthoritySchema` — How much license the engine has over an EXISTING unit or placement.
|
|
416
228
|
- `SubmitInteractiveTaskResponse` _(type)_
|
|
417
229
|
- `SubmitInteractiveTaskResponseSchema` — Response for submitting a filled-in interactive chat task surface (e.g. the editable "change reporting…
|
|
418
|
-
- `SubunitCandidateFacts` _(type)_
|
|
419
|
-
- `SubunitCandidateFactsSchema`
|
|
420
|
-
- `SupersededReportingEdge` _(type)_
|
|
421
|
-
- `SupersededReportingEdgeSchema`
|
|
422
|
-
- `SyncRunSummary` _(type)_
|
|
423
|
-
- `SyncRunSummarySchema`
|
|
424
|
-
- `TOPOLOGY_ONLY_EVIDENCE_KINDS` — Evidence kinds that alone are NOT sufficient to justify a unit boundary.
|
|
425
230
|
- `TRANSFER_RESPONSIBILITIES` — Responsibility checklist items shown on the acceptance page.
|
|
426
231
|
- `TestSsoInitiation` _(type)_ — Initiation payload for a test SSO login attempt.
|
|
427
232
|
- `TestSsoInitiationDto` _(type)_ — Initiation payload for a test SSO login attempt.
|
|
@@ -435,20 +240,10 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
435
240
|
- `TransferMemberEligibility` _(type)_ — Per-member eligibility for transfer recipient picker
|
|
436
241
|
- `TransferResponsibility` _(type)_
|
|
437
242
|
- `TransferStatusResponse` _(type)_ — Response for transfer status queries — extends existing OwnershipTransferStatus.
|
|
438
|
-
- `TransformStrategy` _(type)_
|
|
439
|
-
- `TransformStrategySchema`
|
|
440
|
-
- `TransformationOrigin` _(type)_
|
|
441
|
-
- `TransformationOriginSchema` — Where a transformation originated.
|
|
442
|
-
- `TransformationPreview` _(type)_
|
|
443
|
-
- `TransformationPreviewSchema`
|
|
444
|
-
- `TransformationRequest` _(type)_
|
|
445
|
-
- `TransformationRequestSchema`
|
|
446
|
-
- `TreeOrderableNode` _(type)_ — Canonical per-parent sibling ordering for OrgUnit trees.
|
|
447
243
|
- `UnitLeadCleared` _(type)_
|
|
448
244
|
- `UnitLeadClearedSchema` — "No lead for now": the latest `unit_head` review answer for the unit was an explicit clear, and no later…
|
|
449
245
|
- `UnitMembershipRole` _(type)_
|
|
450
246
|
- `UnitMembershipRoleSchema` — Positional slot a member holds in the org-unit tree.
|
|
451
|
-
- `UnitRouteLevel` _(type)_ — One level of the org's chart as the route needs it: `OrgLevelConfig` satisfies this, and so does a plainer `{…
|
|
452
247
|
- `UpdateAuthPolicyRequest` _(type)_ — Request payload for updating organization auth policy.
|
|
453
248
|
- `UpdateDelegationRequest` _(type)_
|
|
454
249
|
- `UpdateDelegationRequestSchema` — Change a delegation's expiry without revoking it: extend, shorten, or clear (set `expiresAt: null` to make it…
|
|
@@ -463,7 +258,6 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
463
258
|
- `UserOrgMembership` _(type)_ — User organization membership summary.
|
|
464
259
|
- `UserOrgsResponse` _(type)_
|
|
465
260
|
- `UserOrgsResponseSchema`
|
|
466
|
-
- `VIEW_SCOPE_MAP` — View-to-scope mapping for frontend authorization. - Views with string values require that scope for access -…
|
|
467
261
|
- `WorkspaceAccessResponse` _(type)_
|
|
468
262
|
- `WorkspaceAccessResponseSchema`
|
|
469
263
|
- `WorkspaceAuditEvent` _(type)_ — Audit event for the workspace audit log.
|
|
@@ -493,12 +287,6 @@ Shared type vocabulary for organization ownership, type classification, and tran
|
|
|
493
287
|
- `WorkspaceSettingsOverview` _(type)_ — Full workspace overview for the Settings surface.
|
|
494
288
|
- `WorkspaceSsoState` _(type)_ — Workspace SSO state derived from provider status + policy.
|
|
495
289
|
- `WorkspaceSurface` _(type)_ — Discriminator for workspace surface routing. - 'info': Read-only surface, any member, org.view capabilities -…
|
|
496
|
-
- `getViewScope` — Get the required scope for a view, or null if public.
|
|
497
|
-
- `levelSlugForDepth` — The level segment for a depth: the configured label slugified, else `level-<depth>`.
|
|
498
|
-
- `mayOverrideAuthority` — True when `incoming` may overwrite a fact currently held at `existing`.
|
|
499
|
-
- `orderTreeNodes`
|
|
500
|
-
- `slugifyLevelLabel` — A level label's URL form: lowercased, runs of non-alphanumerics collapsed to one hyphen, hyphens trimmed.
|
|
501
|
-
- `unitRouteSegments` — The route segments one unit contributes at its depth: `[]` at the root, `[levelSlug, unitSlug]` below it.
|
|
502
290
|
|
|
503
291
|
<!-- END GENERATED: readme-public-api -->
|
|
504
292
|
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authority & Delegation Schemas
|
|
3
|
+
*
|
|
4
|
+
* Authority axes (mechanism × locality × mutability), unit owners, pending
|
|
5
|
+
* owners and delegations.
|
|
6
|
+
*
|
|
7
|
+
* Split out of `./schemas.ts`, which re-exports this module unchanged — import
|
|
8
|
+
* from `./schemas` (or the `./org` entry), not from this file directly.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { IsoDateTime } from "../api/primitives";
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Authority & Delegation vocabulary
|
|
15
|
+
//
|
|
16
|
+
// The API expresses authority as orthogonal axes (mechanism × locality ×
|
|
17
|
+
// mutability) instead of a single overloaded `source` enum, so future
|
|
18
|
+
// combinations like inherited-delegated or hris-delegated compose by
|
|
19
|
+
// construction rather than forcing each consumer to add a new switch case.
|
|
20
|
+
// The engine's internal AuthoritySource enum stays narrower than the wire
|
|
21
|
+
// shape — it's debug/audit vocabulary, not API vocabulary.
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Engine-internal authority source. Used by the projection storage layer for
|
|
26
|
+
* debugging and drift records; not part of the public API response shape.
|
|
27
|
+
* `manual_membership` was removed when the legacy `l{N}_unit_owner` track was
|
|
28
|
+
* canonicalized onto delegations.
|
|
29
|
+
*/
|
|
30
|
+
export const AuthoritySourceSchema = z.enum([
|
|
31
|
+
"structural",
|
|
32
|
+
"delegated",
|
|
33
|
+
"org_admin",
|
|
34
|
+
]);
|
|
35
|
+
export type AuthoritySource = z.infer<typeof AuthoritySourceSchema>;
|
|
36
|
+
|
|
37
|
+
export const AuthorityOriginSchema = z.enum([
|
|
38
|
+
"topology",
|
|
39
|
+
"delegation",
|
|
40
|
+
"administrative_override",
|
|
41
|
+
]);
|
|
42
|
+
export type AuthorityOrigin = z.infer<typeof AuthorityOriginSchema>;
|
|
43
|
+
|
|
44
|
+
export const AuthorityConfidenceSchema = z.enum(["authoritative", "inferred"]);
|
|
45
|
+
export type AuthorityConfidence = z.infer<typeof AuthorityConfidenceSchema>;
|
|
46
|
+
|
|
47
|
+
/** How the authority arose. */
|
|
48
|
+
export const AuthorityMechanismSchema = z.enum([
|
|
49
|
+
"structural",
|
|
50
|
+
"delegated",
|
|
51
|
+
"rbac",
|
|
52
|
+
]);
|
|
53
|
+
export type AuthorityMechanism = z.infer<typeof AuthorityMechanismSchema>;
|
|
54
|
+
|
|
55
|
+
/** Whether the grant lives on the target unit or is inherited from an ancestor. */
|
|
56
|
+
export const AuthorityLocalitySchema = z.enum(["local", "inherited"]);
|
|
57
|
+
export type AuthorityLocality = z.infer<typeof AuthorityLocalitySchema>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Whether the user can change this authority from this surface.
|
|
61
|
+
* - `derived`: change the upstream source instead (the org chart, RBAC roles).
|
|
62
|
+
* - `user_managed`: removable from this UI.
|
|
63
|
+
*
|
|
64
|
+
* Consumed by {@link OwnerAuthoritySchema} and by the per-unit
|
|
65
|
+
* `WorkspaceMemberUnitDesignationEntrySchema` in `./schemas`.
|
|
66
|
+
*/
|
|
67
|
+
export const AuthorityMutabilitySchema = z.enum(["derived", "user_managed"]);
|
|
68
|
+
export type AuthorityMutability = z.infer<typeof AuthorityMutabilitySchema>;
|
|
69
|
+
|
|
70
|
+
export const OwnerAuthoritySchema = z.object({
|
|
71
|
+
mechanism: AuthorityMechanismSchema,
|
|
72
|
+
locality: AuthorityLocalitySchema,
|
|
73
|
+
mutability: AuthorityMutabilitySchema,
|
|
74
|
+
derivedFromUnitId: z.string().uuid(),
|
|
75
|
+
derivedFromUnitName: z.string().min(1).optional(),
|
|
76
|
+
/**
|
|
77
|
+
* True when this authority derives from the org ROOT unit — i.e. the holder
|
|
78
|
+
* is a CEO (a unit owner of the org root, observed locally on the root
|
|
79
|
+
* or as inherited authority on a descendant). Lets consumers classify CEO
|
|
80
|
+
* without a separate org-tree lookup, the same way `mechanism === 'rbac'`
|
|
81
|
+
* identifies an org admin. Omitted (falsy) for non-root derivations.
|
|
82
|
+
*/
|
|
83
|
+
derivedFromRoot: z.boolean().optional(),
|
|
84
|
+
derivedFromUserId: z.string().uuid().nullable().optional(),
|
|
85
|
+
/**
|
|
86
|
+
* Human-readable reason this authority applies, built at serialize time from
|
|
87
|
+
* the strategy's derivation metadata. Foundation for trust UI, debugging,
|
|
88
|
+
* AI explainability, governance reports, and audits.
|
|
89
|
+
*/
|
|
90
|
+
explanation: z.string(),
|
|
91
|
+
/**
|
|
92
|
+
* Strategy-specific structured metadata, preserved verbatim for tooling that
|
|
93
|
+
* needs more than the explanation string (drift detection, audits).
|
|
94
|
+
*/
|
|
95
|
+
derivationMetadata: z.record(z.string(), z.unknown()).optional(),
|
|
96
|
+
/**
|
|
97
|
+
* `org_unit_delegations.id` when `mechanism === 'delegated'`. Surfaced
|
|
98
|
+
* separately so the UI doesn't need to inspect derivationMetadata to render
|
|
99
|
+
* the revoke action.
|
|
100
|
+
*/
|
|
101
|
+
delegationId: z.string().uuid().optional(),
|
|
102
|
+
/**
|
|
103
|
+
* Delegation expiry as an ISO-8601 timestamp when `mechanism === 'delegated'`
|
|
104
|
+
* and the delegation is time-boxed; `null` for a permanent delegation; omitted
|
|
105
|
+
* for non-delegated mechanisms. Expired delegations never reach this surface —
|
|
106
|
+
* the projection read filters `expires_at > now()` — so a present value is
|
|
107
|
+
* always in the future.
|
|
108
|
+
*/
|
|
109
|
+
expiresAt: IsoDateTime.nullable().optional(),
|
|
110
|
+
});
|
|
111
|
+
export type OwnerAuthority = z.infer<typeof OwnerAuthoritySchema>;
|
|
112
|
+
|
|
113
|
+
export const OrgUnitOwnerSchema = z.object({
|
|
114
|
+
userId: z.string().uuid(),
|
|
115
|
+
fullName: z.string().min(1),
|
|
116
|
+
jobTitle: z.string().nullable(),
|
|
117
|
+
avatarUrl: z.string().nullable(),
|
|
118
|
+
/** All authority grants this user holds for the unit. At least one entry. */
|
|
119
|
+
authorities: z.array(OwnerAuthoritySchema).min(1),
|
|
120
|
+
});
|
|
121
|
+
export type OrgUnitOwner = z.infer<typeof OrgUnitOwnerSchema>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A lead the structure review chose who is NOT YET an owner, because they have
|
|
125
|
+
* no account to grant to. Mirrors one `staged` row of the backend's lead → owner
|
|
126
|
+
* bridge ledger (ADR-BE-734): the grant is minted the moment the person links an
|
|
127
|
+
* account, attributed to the reviewer who decided it. Person-keyed on purpose —
|
|
128
|
+
* an owner is user-keyed and this person has no user.
|
|
129
|
+
*
|
|
130
|
+
* DISPLAY ONLY. Never an authorization input: a pending owner holds nothing
|
|
131
|
+
* until the grant exists, and consumers must not derive a capability from it.
|
|
132
|
+
*/
|
|
133
|
+
export const PendingUnitOwnerSchema = z.object({
|
|
134
|
+
personId: z.string().uuid(),
|
|
135
|
+
fullName: z.string().min(1),
|
|
136
|
+
jobTitle: z.string().nullable(),
|
|
137
|
+
/** When the reviewer decided it — the answer's time, not the row's. */
|
|
138
|
+
decidedAt: IsoDateTime,
|
|
139
|
+
/** Why it is pending. One reason today; a closed enum so a second is a decision. */
|
|
140
|
+
reason: z.enum(["no_account"]),
|
|
141
|
+
});
|
|
142
|
+
export type PendingUnitOwner = z.infer<typeof PendingUnitOwnerSchema>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* "No lead for now" (ADR-BE-733): the latest `unit_head` review answer for the
|
|
146
|
+
* unit was an explicit clear, and no later answer superseded it. Distinct from
|
|
147
|
+
* "never had one" — an absence a person recorded, not a default. Display only.
|
|
148
|
+
*/
|
|
149
|
+
export const UnitLeadClearedSchema = z.object({
|
|
150
|
+
decidedAt: IsoDateTime,
|
|
151
|
+
});
|
|
152
|
+
export type UnitLeadCleared = z.infer<typeof UnitLeadClearedSchema>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Contract-level invariant: each owner list contains each userId at most once.
|
|
156
|
+
* Duplicate userIds are a serializer bug, not a presentation concern, so we
|
|
157
|
+
* fail Zod parse at the API boundary on both server and client.
|
|
158
|
+
*/
|
|
159
|
+
const uniqueByUserId = (arr: ReadonlyArray<{ userId: string }>): boolean =>
|
|
160
|
+
new Set(arr.map((o) => o.userId)).size === arr.length;
|
|
161
|
+
const uniqueByPersonId = (arr: ReadonlyArray<{ personId: string }>): boolean =>
|
|
162
|
+
new Set(arr.map((o) => o.personId)).size === arr.length;
|
|
163
|
+
|
|
164
|
+
export const OrgUnitOwnersResponseSchema = z.object({
|
|
165
|
+
owners: z
|
|
166
|
+
.array(OrgUnitOwnerSchema)
|
|
167
|
+
.refine(uniqueByUserId, { message: "duplicate userId in owners" }),
|
|
168
|
+
inherited: z
|
|
169
|
+
.array(OrgUnitOwnerSchema)
|
|
170
|
+
.refine(uniqueByUserId, { message: "duplicate userId in inherited" })
|
|
171
|
+
.optional(),
|
|
172
|
+
/**
|
|
173
|
+
* Leads chosen in the structure review who become owners once they have an
|
|
174
|
+
* account. Always present (`[]` when none) — the server knows, so the client
|
|
175
|
+
* never has to guess between "none" and "not asked".
|
|
176
|
+
*/
|
|
177
|
+
pending: z
|
|
178
|
+
.array(PendingUnitOwnerSchema)
|
|
179
|
+
.refine(uniqueByPersonId, { message: "duplicate personId in pending" }),
|
|
180
|
+
/** The recorded "no lead for now", or null when no such answer stands. */
|
|
181
|
+
leadCleared: UnitLeadClearedSchema.nullable(),
|
|
182
|
+
});
|
|
183
|
+
export type OrgUnitOwnersResponse = z.infer<typeof OrgUnitOwnersResponseSchema>;
|
|
184
|
+
|
|
185
|
+
export const DelegationSchema = z.object({
|
|
186
|
+
id: z.string().uuid(),
|
|
187
|
+
orgId: z.string().uuid(),
|
|
188
|
+
unitId: z.string().uuid(),
|
|
189
|
+
userId: z.string().uuid(),
|
|
190
|
+
grantedBy: z.string().uuid().nullable(),
|
|
191
|
+
grantedAt: z.string(),
|
|
192
|
+
revokedAt: z.string().nullable(),
|
|
193
|
+
status: z.enum(["active", "revoked"]),
|
|
194
|
+
note: z.string().nullable(),
|
|
195
|
+
/**
|
|
196
|
+
* ISO-8601 timestamp at which the delegation stops conferring authority, or
|
|
197
|
+
* `null` for a permanent delegation. Enforcement is read-time (the projection
|
|
198
|
+
* read filters `expires_at > now()`); the row itself stays `status='active'`
|
|
199
|
+
* until explicitly revoked.
|
|
200
|
+
*/
|
|
201
|
+
expiresAt: z.string().nullable(),
|
|
202
|
+
});
|
|
203
|
+
export type Delegation = z.infer<typeof DelegationSchema>;
|
|
204
|
+
|
|
205
|
+
export const CreateDelegationRequestSchema = z.object({
|
|
206
|
+
userId: z.string().uuid(),
|
|
207
|
+
note: z.string().max(2000).optional(),
|
|
208
|
+
/**
|
|
209
|
+
* Optional ISO-8601 expiry. Omitted or `null` ⇒ a permanent delegation. The
|
|
210
|
+
* UI captures a date and sends end-of-day in the user's timezone.
|
|
211
|
+
*/
|
|
212
|
+
expiresAt: IsoDateTime.nullable().optional(),
|
|
213
|
+
/**
|
|
214
|
+
* When true, the granted user is emailed a notification (carrying `note` as
|
|
215
|
+
* the message). Not persisted — it only gates the side-effect email. Omitted
|
|
216
|
+
* is treated as false; left without a default so the inferred request type
|
|
217
|
+
* keeps `notify` optional rather than forcing every caller to pass it.
|
|
218
|
+
*/
|
|
219
|
+
notify: z.boolean().optional(),
|
|
220
|
+
});
|
|
221
|
+
export type CreateDelegationRequest = z.infer<
|
|
222
|
+
typeof CreateDelegationRequestSchema
|
|
223
|
+
>;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Change a delegation's expiry without revoking it: extend, shorten, or clear
|
|
227
|
+
* (set `expiresAt: null` to make it permanent). Used by the inline expiry edit
|
|
228
|
+
* on an existing delegate row.
|
|
229
|
+
*/
|
|
230
|
+
export const UpdateDelegationRequestSchema = z.object({
|
|
231
|
+
expiresAt: IsoDateTime.nullable(),
|
|
232
|
+
});
|
|
233
|
+
export type UpdateDelegationRequest = z.infer<
|
|
234
|
+
typeof UpdateDelegationRequestSchema
|
|
235
|
+
>;
|
|
236
|
+
|
|
237
|
+
export const DelegationListResponseSchema = z.object({
|
|
238
|
+
delegations: z.array(DelegationSchema),
|
|
239
|
+
});
|
|
240
|
+
export type DelegationListResponse = z.infer<
|
|
241
|
+
typeof DelegationListResponseSchema
|
|
242
|
+
>;
|