@company-semantics/contracts 27.12.0 → 27.13.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": "27.12.0",
3
+ "version": "27.13.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,17 +2,25 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- TypeScript types and registry for transactional email kinds and their metadata.
5
+ Transactional email vocabulary **and** render layer: kind types, the subject
6
+ registry, and the shared component system (`render/`) that both the backend
7
+ (real sends) and the app (Ladle preview) compose. See ADR-CONTRACTS-077.
6
8
 
7
9
  ## Invariants
8
10
 
9
- - Types only; minimal runtime code (pure functions for registry lookup)
10
- - No external dependencies (contracts policy)
11
- - `EmailKind` union MUST match keys in `EMAIL_KINDS` registry
12
- - `EMAIL_KINDS` is the single source of truth for subjects and rendering rules
13
- - OTP values MUST NEVER appear in contracts (security: logged if leaked)
14
- - Subjects are owned by the registry, never duplicated in templates
15
- - Unknown email kinds MUST be rejected at API boundaries via `isValidEmailKind()`
11
+ - Types + **pure** render functions only no classes, no side effects, no
12
+ external imports beyond `zod` (vocabulary-guard enforced).
13
+ - `render/blocks.ts` owns all styled markup; templates supply only content text.
14
+ Editing a block restyles every email HTML and plain text in both repos.
15
+ - `renderEmail(kind, payload, options?)` is the single dispatcher; subject comes
16
+ from `EMAIL_KINDS`, never hardcoded in a template.
17
+ - `EmailKind` union MUST match keys in `EMAIL_KINDS` registry.
18
+ - OTP values MUST NEVER appear as literals in contracts (security: logged if
19
+ leaked) — they are runtime payload fields only.
20
+ - Every user-controlled field in an HTML variant MUST pass through `escapeHtml`.
21
+ - Rendered output is locked by `render/__tests__/render-snapshot.test.ts`
22
+ (production-parity markup — a snapshot change means a real email changed).
23
+ - Unknown email kinds MUST be rejected at API boundaries via `isValidEmailKind()`.
16
24
 
17
25
  <!-- BEGIN GENERATED: readme-public-api — derived from code by `pnpm readme-api`. Do not edit. -->
18
26
 
@@ -28,3 +28,9 @@ export {
28
28
  getEmailKindDefinition,
29
29
  isValidEmailKind,
30
30
  } from "./registry";
31
+
32
+ // =============================================================================
33
+ // Render Layer
34
+ // =============================================================================
35
+
36
+ export * from "./render";