@company-semantics/contracts 0.130.0 → 0.132.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.130.0",
3
+ "version": "0.132.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,6 +60,10 @@
60
60
  "types": "./src/content/index.ts",
61
61
  "default": "./src/content/index.ts"
62
62
  },
63
+ "./impersonation": {
64
+ "types": "./src/impersonation/index.ts",
65
+ "default": "./src/impersonation/index.ts"
66
+ },
63
67
  "./schemas/guard-result.schema.json": "./schemas/guard-result.schema.json"
64
68
  },
65
69
  "types": "./src/index.ts",
@@ -15,15 +15,19 @@ import type { CheckResult, Soc2ControlArea } from './types';
15
15
  // =============================================================================
16
16
 
17
17
  /**
18
- * Three-tier size limit for a file role.
19
- * - target: Ideal maximum (for new code)
20
- * - warning: Soft limit (CI warns but passes)
21
- * - hard: Hard limit (CI fails)
18
+ * Role limit for the file-size guard, expressed as fractions of the repo's
19
+ * file-size envelope (envelope = universalLimit × (1 + overrideMaxOveragePct)).
20
+ *
21
+ * Only warnings are role-specific; the envelope is a single hard authority
22
+ * that applies to every file regardless of role.
23
+ *
24
+ * @field warnPct — Warning threshold as a fraction of envelope. Must be in (0, 1).
25
+ * @field targetPct — Optional ideal ceiling for new code in this role, as a
26
+ * fraction of envelope. Informational only — not enforced.
22
27
  */
23
28
  export interface RoleLimit {
24
- target: number;
25
- warning: number;
26
- hard: number;
29
+ warnPct: number;
30
+ targetPct?: number;
27
31
  }
28
32
 
29
33
  // =============================================================================
@@ -74,24 +78,6 @@ export interface GuardConfig {
74
78
  */
75
79
  universalWarningThreshold: number;
76
80
 
77
- /**
78
- * Export complexity thresholds.
79
- * Files with more exports than these limits are flagged.
80
- */
81
- exportLimits?: {
82
- warning: number;
83
- error: number;
84
- };
85
-
86
- /**
87
- * Import fanout thresholds.
88
- * Files with more imports than these limits are flagged.
89
- */
90
- importLimits?: {
91
- warning: number;
92
- error: number;
93
- };
94
-
95
81
  /**
96
82
  * Domain directories to check for READMEs.
97
83
  * Example: ['src/domain', 'src/providers', 'src/interfaces']
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Impersonation Domain Barrel
3
+ *
4
+ * Re-exports impersonation types and response schemas.
5
+ * Import from '@company-semantics/contracts/impersonation'.
6
+ */
7
+
8
+ // =============================================================================
9
+ // Core Types (from flat module)
10
+ // =============================================================================
11
+
12
+ export type {
13
+ AuthMode,
14
+ ImpersonationSession,
15
+ RestrictedImpersonationAction,
16
+ ImpersonationCapability,
17
+ ImpersonationSessionSummary,
18
+ ImpersonationAuditEventType,
19
+ } from '../impersonation'
20
+
21
+ export { RESTRICTED_IMPERSONATION_ACTIONS } from '../impersonation'
22
+
23
+ // =============================================================================
24
+ // HTTP Response Schemas (Zod)
25
+ // =============================================================================
26
+
27
+ export {
28
+ ImpersonationSessionSchema,
29
+ ImpersonationSessionResponseSchema,
30
+ ImpersonationSessionNullableResponseSchema,
31
+ EndImpersonationResponseSchema,
32
+ } from './schemas'
33
+
34
+ export type {
35
+ ImpersonationSessionResponse,
36
+ EndImpersonationResponse,
37
+ } from './schemas'
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Impersonation Response Schemas
3
+ *
4
+ * Zod schemas for impersonation HTTP endpoint responses.
5
+ * These schemas are used for runtime validation at API contract surfaces.
6
+ *
7
+ * Mirrors the ImpersonationSession interface in ../impersonation.ts.
8
+ * Both are maintained in parallel — Zod schema mirrors the TS interface.
9
+ */
10
+
11
+ import { z } from 'zod'
12
+
13
+ export const ImpersonationSessionSchema = z.object({
14
+ impersonationSessionId: z.string(),
15
+ adminUserId: z.string(),
16
+ targetUserId: z.string(),
17
+ reason: z.string(),
18
+ reasonHash: z.string(),
19
+ startedAt: z.string().datetime({ offset: true }),
20
+ expiresAt: z.string().datetime({ offset: true }),
21
+ endedAt: z.string().datetime({ offset: true }).nullable(),
22
+ ipAddress: z.string(),
23
+ userAgent: z.string(),
24
+ })
25
+
26
+ export const ImpersonationSessionResponseSchema = z.object({
27
+ session: ImpersonationSessionSchema,
28
+ })
29
+
30
+ export const ImpersonationSessionNullableResponseSchema = z.object({
31
+ session: ImpersonationSessionSchema.nullable(),
32
+ })
33
+
34
+ export const EndImpersonationResponseSchema = z.object({
35
+ success: z.literal(true),
36
+ ok: z.literal(true),
37
+ })
38
+
39
+ export type ImpersonationSessionResponse = z.infer<typeof ImpersonationSessionResponseSchema>
40
+ export type EndImpersonationResponse = z.infer<typeof EndImpersonationResponseSchema>