@company-semantics/contracts 0.37.0 → 0.38.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 +1 -1
- package/src/index.ts +7 -0
- package/src/org/domain.ts +67 -0
- package/src/org/index.ts +10 -0
- package/src/org/types.ts +25 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -145,6 +145,13 @@ export type {
|
|
|
145
145
|
Phase3AuditAction,
|
|
146
146
|
// Workspace capability types (Phase 3)
|
|
147
147
|
WorkspaceCapability,
|
|
148
|
+
// Domain and multi-org types (Phase 4)
|
|
149
|
+
// @see ADR-CONT-032 for design rationale
|
|
150
|
+
DomainStatus,
|
|
151
|
+
DomainVerificationMethod,
|
|
152
|
+
OrgDomain,
|
|
153
|
+
Phase4AuditAction,
|
|
154
|
+
UserOrgMembership,
|
|
148
155
|
} from './org/index'
|
|
149
156
|
|
|
150
157
|
export { ROLE_DISPLAY_MAP, WORKSPACE_CAPABILITIES, ROLE_CAPABILITY_MAP } from './org/index'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Types (Phase 4)
|
|
3
|
+
*
|
|
4
|
+
* Vocabulary types for enterprise domain verification and trust.
|
|
5
|
+
* @see ADR-CONT-032 (Phase 4: Enterprise Identity, Domain Trust, Multi-Org)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Status of a domain claim within an organization.
|
|
10
|
+
* - 'pending': Domain claimed but not yet verified
|
|
11
|
+
* - 'verified': Domain ownership confirmed via DNS TXT record
|
|
12
|
+
* - 'revoked': Domain claim revoked by org owner
|
|
13
|
+
*
|
|
14
|
+
* INVARIANT: Only ONE org may have status='verified' for any domain globally.
|
|
15
|
+
*/
|
|
16
|
+
export type DomainStatus = 'pending' | 'verified' | 'revoked';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Method used to verify domain ownership.
|
|
20
|
+
* - 'dns_txt': DNS TXT record verification (primary method)
|
|
21
|
+
* - 'email': Email-based verification (reserved for future)
|
|
22
|
+
* - 'idp': IdP-based verification via SAML/OIDC (reserved for future)
|
|
23
|
+
*/
|
|
24
|
+
export type DomainVerificationMethod = 'dns_txt' | 'email' | 'idp';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Organization domain claim and verification status.
|
|
28
|
+
* Represents a domain that an org has claimed or verified ownership of.
|
|
29
|
+
*
|
|
30
|
+
* INVARIANT: Domain verification does not grant access.
|
|
31
|
+
* INVARIANT: Only one org can have a verified claim on any email domain.
|
|
32
|
+
*/
|
|
33
|
+
export interface OrgDomain {
|
|
34
|
+
id: string;
|
|
35
|
+
orgId: string;
|
|
36
|
+
domain: string;
|
|
37
|
+
status: DomainStatus;
|
|
38
|
+
verificationMethod: DomainVerificationMethod;
|
|
39
|
+
/** Verification token - only visible to org owner. */
|
|
40
|
+
verificationToken?: string;
|
|
41
|
+
/** ISO8601 timestamp when domain was verified, null if pending/revoked. */
|
|
42
|
+
verifiedAt: string | null;
|
|
43
|
+
/** ISO8601 timestamp when claim was created. */
|
|
44
|
+
createdAt: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// Phase 4 Audit Action Types
|
|
49
|
+
// =============================================================================
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Audit actions for Phase 4 enterprise identity features.
|
|
53
|
+
* These actions are emitted by the backend when domain/auth state changes.
|
|
54
|
+
*
|
|
55
|
+
* INVARIANT: All domain and auth policy mutations must emit audit events.
|
|
56
|
+
*/
|
|
57
|
+
export type Phase4AuditAction =
|
|
58
|
+
// Domain lifecycle
|
|
59
|
+
| 'org.domain.claimed'
|
|
60
|
+
| 'org.domain.verified'
|
|
61
|
+
| 'org.domain.revoked'
|
|
62
|
+
// Auth policy enforcement
|
|
63
|
+
| 'org.auth_policy.enforced'
|
|
64
|
+
| 'org.auth_policy.override_used' // Emergency SSO bypass succeeded
|
|
65
|
+
| 'org.auth_policy.override_attempted' // Emergency SSO bypass denied (incident review)
|
|
66
|
+
// Multi-org context
|
|
67
|
+
| 'user.active_org.switched';
|
package/src/org/index.ts
CHANGED
|
@@ -32,6 +32,8 @@ export type {
|
|
|
32
32
|
PromoteIntegrationRequest,
|
|
33
33
|
DemoteIntegrationRequest,
|
|
34
34
|
Phase3AuditAction,
|
|
35
|
+
// Multi-org membership types (Phase 4)
|
|
36
|
+
UserOrgMembership,
|
|
35
37
|
} from './types';
|
|
36
38
|
|
|
37
39
|
export { ROLE_DISPLAY_MAP } from './types';
|
|
@@ -39,3 +41,11 @@ export { ROLE_DISPLAY_MAP } from './types';
|
|
|
39
41
|
// Workspace capability types (Phase 3)
|
|
40
42
|
export type { WorkspaceCapability } from './capabilities';
|
|
41
43
|
export { WORKSPACE_CAPABILITIES, ROLE_CAPABILITY_MAP } from './capabilities';
|
|
44
|
+
|
|
45
|
+
// Domain types (Phase 4)
|
|
46
|
+
export type {
|
|
47
|
+
DomainStatus,
|
|
48
|
+
DomainVerificationMethod,
|
|
49
|
+
OrgDomain,
|
|
50
|
+
Phase4AuditAction,
|
|
51
|
+
} from './domain';
|
package/src/org/types.ts
CHANGED
|
@@ -304,3 +304,28 @@ export type Phase3AuditAction =
|
|
|
304
304
|
| 'integration.scope_demoted'
|
|
305
305
|
// Auth policy
|
|
306
306
|
| 'org.auth_policy.updated';
|
|
307
|
+
|
|
308
|
+
// =============================================================================
|
|
309
|
+
// Multi-Org Membership Types (Phase 4)
|
|
310
|
+
// @see ADR-CONT-032 for design rationale
|
|
311
|
+
// =============================================================================
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* User organization membership summary.
|
|
315
|
+
* Represents a user's membership in an organization for multi-org context switching.
|
|
316
|
+
*
|
|
317
|
+
* INVARIANT: role is DERIVED from RBAC at write-time (presentation only).
|
|
318
|
+
* INVARIANT: RBAC remains the authoritative source of truth for permissions.
|
|
319
|
+
*/
|
|
320
|
+
export interface UserOrgMembership {
|
|
321
|
+
userId: string;
|
|
322
|
+
orgId: string;
|
|
323
|
+
orgName: string;
|
|
324
|
+
orgSlug: string;
|
|
325
|
+
/** Display role derived from RBAC - presentation only, not for auth decisions. */
|
|
326
|
+
role: WorkspaceRole;
|
|
327
|
+
/** ISO8601 timestamp when user joined the organization. */
|
|
328
|
+
joinedAt: string;
|
|
329
|
+
/** Whether this membership is currently active. */
|
|
330
|
+
isActive: boolean;
|
|
331
|
+
}
|