@company-semantics/contracts 27.11.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.11.0",
3
+ "version": "27.13.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '82dd95d10a7a' as const;
3
- export const SPEC_HASH_FULL = '82dd95d10a7ab91ce536889a823b6fb149634142227bedc4a68e012e1a48256d' as const;
2
+ export const SPEC_HASH = '43cd15935d12' as const;
3
+ export const SPEC_HASH_FULL = '43cd15935d1232049463ee9ed6c4e833b6e012906cfc46644157aaaa310b895b' as const;
@@ -4545,6 +4545,7 @@ export interface components {
4545
4545
  name: string;
4546
4546
  } | null;
4547
4547
  canEdit: boolean;
4548
+ canUploadContext?: boolean;
4548
4549
  inheritsFromId: string | null;
4549
4550
  inheritsFrom: string | null;
4550
4551
  sources: {
@@ -126,6 +126,15 @@ export const CompanyMdDocResponseSchema = z.object({
126
126
  owningUnitId: z.string().nullable(),
127
127
  owner: CompanyMdPersonSchema.nullable(),
128
128
  canEdit: z.boolean(),
129
+ /**
130
+ * UI capability signal (ADR-BE-382): whether the requesting actor holds
131
+ * `CompanyMd.CanUploadContext` on this doc — the SAME binding every
132
+ * context-bank mutation (upload/attach/remove/reorder/detach) enforces.
133
+ * The app hides bank-mutation affordances when false. Signal only;
134
+ * admittance and enforcement are unchanged. Optional for back-compat with
135
+ * doc shapes returned outside the single-doc read.
136
+ */
137
+ canUploadContext: z.boolean().optional(),
129
138
  // Stable id of the inherited-from doc — the resolution key (mirrors the
130
139
  // resolved parentId). `inheritsFrom` is presentation only (ADR-BE-315).
131
140
  inheritsFromId: z.string().nullable(),
@@ -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";