@company-semantics/contracts 0.32.0 → 0.34.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": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Auth domain contracts
3
+ *
4
+ * Shared types for authentication flows across Company Semantics codebases.
5
+ */
6
+
7
+ /**
8
+ * OTP verification error codes.
9
+ *
10
+ * Returned by the backend in the `errorCode` field of OTP verification errors.
11
+ * Frontend uses these to provide specific user messaging (e.g., expired vs invalid).
12
+ */
13
+ export enum OTPErrorCode {
14
+ InvalidCode = 'invalid_code',
15
+ Expired = 'expired',
16
+ AlreadyUsed = 'already_used',
17
+ NotFound = 'not_found',
18
+ }
package/src/index.ts CHANGED
@@ -109,6 +109,19 @@ export type { Compatibility, Deprecation } from './compatibility'
109
109
  export type { ISODateString, UserIdentity } from './identity/index'
110
110
  export { deriveFullName, resolveDisplayName } from './identity/index'
111
111
 
112
+ // Auth domain types
113
+ export { OTPErrorCode } from './auth/index'
114
+
115
+ // Organization domain types
116
+ // @see ADR-BE-XXX for design rationale (Personal vs Shared Organization Model)
117
+ export type {
118
+ OrgType,
119
+ ExecutionScope,
120
+ OrganizationInfo,
121
+ OwnershipTransferRequest,
122
+ OwnershipTransferStatus,
123
+ } from './org/index'
124
+
112
125
  // MCP tool discovery types
113
126
  // @see company-semantics-backend/src/interfaces/mcp/ for implementation
114
127
  export type {
@@ -0,0 +1,25 @@
1
+ # org/
2
+
3
+ Organization domain vocabulary types for the personal → shared organization model.
4
+
5
+ ## Purpose
6
+
7
+ Shared type vocabulary for organization ownership, type classification, and transfer workflows.
8
+
9
+ ## Invariants
10
+
11
+ - `OrgType` and `ExecutionScope` are exhaustive union types (no 'unknown' or catch-all)
12
+ - All types are vocabulary-only (no runtime behavior, no business logic)
13
+ - Structural details (like `ownerUserId`) remain in backend; only public-facing fields here
14
+
15
+ ## Public API
16
+
17
+ - `OrgType` - 'personal' | 'shared' organization classification
18
+ - `ExecutionScope` - 'self' | 'org' execution identity scope
19
+ - `OrganizationInfo` - Public organization details for API responses
20
+ - `OwnershipTransferRequest` - Transfer initiation payload
21
+ - `OwnershipTransferStatus` - Pending transfer status
22
+
23
+ ## Dependencies
24
+
25
+ None. This is a leaf vocabulary module.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Organization Types Barrel
3
+ *
4
+ * Re-exports organization vocabulary types.
5
+ * Import from '@company-semantics/contracts' (root).
6
+ */
7
+
8
+ export type {
9
+ OrgType,
10
+ ExecutionScope,
11
+ OrganizationInfo,
12
+ OwnershipTransferRequest,
13
+ OwnershipTransferStatus,
14
+ } from './types';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Organization Types
3
+ *
4
+ * Vocabulary types for the personal → shared organization model.
5
+ * @see ADR-BE-XXX (Personal vs Shared Organization Model)
6
+ */
7
+
8
+ /**
9
+ * Organization type distinguishes personal workspaces from shared organizations.
10
+ * - 'personal': Single-user workspace, owned by creator, claimable
11
+ * - 'shared': Multi-user organization, owned by one user, not claimable
12
+ */
13
+ export type OrgType = 'personal' | 'shared';
14
+
15
+ /**
16
+ * Execution scope determines whose identity is used when executing actions.
17
+ * - 'self': Actions execute under the connecting user's identity only
18
+ * - 'org': Actions execute on behalf of the organization (shared access)
19
+ */
20
+ export type ExecutionScope = 'self' | 'org';
21
+
22
+ /**
23
+ * Public organization information suitable for API responses.
24
+ * Does not include sensitive fields like ownerUserId.
25
+ */
26
+ export interface OrganizationInfo {
27
+ id: string;
28
+ name: string;
29
+ slug: string;
30
+ type: OrgType;
31
+ claimable: boolean;
32
+ }
33
+
34
+ /**
35
+ * Request payload for initiating ownership transfer.
36
+ */
37
+ export interface OwnershipTransferRequest {
38
+ newOwnerEmail: string;
39
+ }
40
+
41
+ /**
42
+ * Status of pending ownership transfer for an organization.
43
+ */
44
+ export interface OwnershipTransferStatus {
45
+ pending: boolean;
46
+ newOwnerEmail?: string;
47
+ requestedAt?: string;
48
+ expiresAt?: string;
49
+ }