@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 +1 -1
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +1 -0
- package/src/content/schemas.ts +9 -0
- package/src/email/README.md +16 -8
- package/src/email/index.ts +6 -0
- package/src/email/render/__tests__/__snapshots__/render-snapshot.test.ts.snap +973 -0
- package/src/email/render/__tests__/render-snapshot.test.ts +214 -0
- package/src/email/render/auth-otp.ts +91 -0
- package/src/email/render/base-text.ts +26 -0
- package/src/email/render/blocks.ts +308 -0
- package/src/email/render/chat-shared.ts +89 -0
- package/src/email/render/company-md-access-approved.ts +67 -0
- package/src/email/render/company-md-access-denied.ts +63 -0
- package/src/email/render/company-md-access-requested.ts +79 -0
- package/src/email/render/constants.ts +24 -0
- package/src/email/render/escape-html.ts +16 -0
- package/src/email/render/index.ts +90 -0
- package/src/email/render/org-invite.ts +61 -0
- package/src/email/render/ownership-transfer-completed.ts +31 -0
- package/src/email/render/ownership-transfer.ts +36 -0
- package/src/email/render/render-email.ts +166 -0
- package/src/email/render/security-alert.ts +62 -0
- package/src/email/render/share-granted.ts +95 -0
- package/src/email/render/unit-owner-granted.ts +79 -0
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
|
|
2
|
-
export const SPEC_HASH = '
|
|
3
|
-
export const SPEC_HASH_FULL = '
|
|
2
|
+
export const SPEC_HASH = '43cd15935d12' as const;
|
|
3
|
+
export const SPEC_HASH_FULL = '43cd15935d1232049463ee9ed6c4e833b6e012906cfc46644157aaaa310b895b' as const;
|
package/src/api/generated.ts
CHANGED
package/src/content/schemas.ts
CHANGED
|
@@ -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(),
|
package/src/email/README.md
CHANGED
|
@@ -2,17 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
|
|
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
|
|
10
|
-
|
|
11
|
-
- `
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
-
|
|
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
|
|
package/src/email/index.ts
CHANGED
|
@@ -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";
|