@elytracms/studio 0.0.86 → 0.0.88

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.
Files changed (248) hide show
  1. package/convex/asset-revalidate.test.ts +186 -0
  2. package/convex/assets.ts +53 -19
  3. package/convex/cms.ts +22 -0
  4. package/convex/delivery.ts +33 -116
  5. package/convex/functions.ts +3 -3
  6. package/convex/rail-write-parity.test.ts +180 -0
  7. package/convex/redirects.ts +33 -11
  8. package/convex/revalidate.ts +7 -5
  9. package/convex/triggers.ts +53 -3
  10. package/dist/components/ai/ai-chat-panel.js +8 -1
  11. package/dist/components/ai/ai-chat-panel.js.map +1 -1
  12. package/dist/components/app-views/default-modules.d.ts +20 -20
  13. package/dist/components/app-views/default-modules.js +27 -48
  14. package/dist/components/app-views/default-modules.js.map +1 -1
  15. package/dist/components/app-views/studio-config.d.ts +5 -6
  16. package/dist/components/app-views/studio-config.js.map +1 -1
  17. package/dist/components/assets/asset-metadata.d.ts +28 -19
  18. package/dist/components/assets/asset-metadata.js +24 -31
  19. package/dist/components/assets/asset-metadata.js.map +1 -1
  20. package/dist/components/assets/asset-selection.d.ts +24 -5
  21. package/dist/components/assets/asset-selection.js +39 -9
  22. package/dist/components/assets/asset-selection.js.map +1 -1
  23. package/dist/components/assets/assets-collection-view-source.d.ts +17 -14
  24. package/dist/components/assets/assets-collection-view-source.js +25 -31
  25. package/dist/components/assets/assets-collection-view-source.js.map +1 -1
  26. package/dist/components/assets/assets-store.d.ts +11 -1
  27. package/dist/components/assets/assets-store.js +10 -0
  28. package/dist/components/assets/assets-store.js.map +1 -1
  29. package/dist/components/assets/focal-point.d.ts +0 -7
  30. package/dist/components/assets/focal-point.js +0 -10
  31. package/dist/components/assets/focal-point.js.map +1 -1
  32. package/dist/components/builder/blocks-panel.js +3 -3
  33. package/dist/components/builder/blocks-panel.js.map +1 -1
  34. package/dist/components/builder/builder-store.d.ts +25 -1
  35. package/dist/components/builder/builder-store.js +3 -2
  36. package/dist/components/builder/builder-store.js.map +1 -1
  37. package/dist/components/builder/canvas-chrome-css.js +0 -17
  38. package/dist/components/builder/canvas-chrome-css.js.map +1 -1
  39. package/dist/components/builder/canvas-chrome.d.ts +10 -12
  40. package/dist/components/builder/canvas-chrome.js +12 -13
  41. package/dist/components/builder/canvas-chrome.js.map +1 -1
  42. package/dist/components/builder/canvas-dnd.d.ts +8 -0
  43. package/dist/components/builder/canvas-dnd.js +5 -3
  44. package/dist/components/builder/canvas-dnd.js.map +1 -1
  45. package/dist/components/builder/canvas-render-context.d.ts +23 -24
  46. package/dist/components/builder/canvas-render-context.js +35 -60
  47. package/dist/components/builder/canvas-render-context.js.map +1 -1
  48. package/dist/components/builder/canvas.js +5 -11
  49. package/dist/components/builder/canvas.js.map +1 -1
  50. package/dist/components/builder/clipboard-actions.d.ts +14 -6
  51. package/dist/components/builder/clipboard-actions.js +29 -20
  52. package/dist/components/builder/clipboard-actions.js.map +1 -1
  53. package/dist/components/builder/composition-field-editor.d.ts +19 -26
  54. package/dist/components/builder/composition-field-editor.js +30 -52
  55. package/dist/components/builder/composition-field-editor.js.map +1 -1
  56. package/dist/components/builder/insert-context.d.ts +3 -1
  57. package/dist/components/builder/insert-context.js +15 -10
  58. package/dist/components/builder/insert-context.js.map +1 -1
  59. package/dist/components/builder/page-tree.d.ts +29 -0
  60. package/dist/components/builder/page-tree.js +56 -58
  61. package/dist/components/builder/page-tree.js.map +1 -1
  62. package/dist/components/builder/reuse.js +5 -2
  63. package/dist/components/builder/reuse.js.map +1 -1
  64. package/dist/components/cms/asset-field.d.ts +2 -1
  65. package/dist/components/cms/asset-field.js +39 -83
  66. package/dist/components/cms/asset-field.js.map +1 -1
  67. package/dist/components/cms/asset-picker-core.d.ts +77 -40
  68. package/dist/components/cms/asset-picker-core.js +73 -46
  69. package/dist/components/cms/asset-picker-core.js.map +1 -1
  70. package/dist/components/cms/asset-picker.d.ts +48 -19
  71. package/dist/components/cms/asset-picker.js +69 -30
  72. package/dist/components/cms/asset-picker.js.map +1 -1
  73. package/dist/components/cms/cell-edit.d.ts +3 -1
  74. package/dist/components/cms/cell-edit.js +2 -2
  75. package/dist/components/cms/cell-edit.js.map +1 -1
  76. package/dist/components/cms/cms-composition-validators.js +11 -2
  77. package/dist/components/cms/cms-composition-validators.js.map +1 -1
  78. package/dist/components/cms/cms-store.js +15 -23
  79. package/dist/components/cms/cms-store.js.map +1 -1
  80. package/dist/components/cms/editable-cell.js +3 -3
  81. package/dist/components/cms/editable-cell.js.map +1 -1
  82. package/dist/components/cms/gate-validation.d.ts +27 -2
  83. package/dist/components/cms/gate-validation.js +19 -1
  84. package/dist/components/cms/gate-validation.js.map +1 -1
  85. package/dist/components/cms/rich-text/editor.js +2 -2
  86. package/dist/components/cms/rich-text/editor.js.map +1 -1
  87. package/dist/components/cms/rich-text/insert.d.ts +7 -0
  88. package/dist/components/cms/rich-text/insert.js +7 -0
  89. package/dist/components/cms/rich-text/insert.js.map +1 -1
  90. package/dist/components/cms/use-document-versions.js +1 -0
  91. package/dist/components/cms/use-document-versions.js.map +1 -1
  92. package/dist/components/cms/versions-model.d.ts +0 -12
  93. package/dist/components/cms/versions-model.js +3 -15
  94. package/dist/components/cms/versions-model.js.map +1 -1
  95. package/dist/components/components/component-detail.js +1 -1
  96. package/dist/components/components/component-detail.js.map +1 -1
  97. package/dist/components/components/transfer-dialog.js +2 -4
  98. package/dist/components/components/transfer-dialog.js.map +1 -1
  99. package/dist/components/components/transfer.d.ts +13 -10
  100. package/dist/components/components/transfer.js +21 -19
  101. package/dist/components/components/transfer.js.map +1 -1
  102. package/dist/components/nav-issues.d.ts +23 -3
  103. package/dist/components/nav-issues.js +38 -2
  104. package/dist/components/nav-issues.js.map +1 -1
  105. package/dist/components/project-session.d.ts +9 -0
  106. package/dist/components/project-session.js +1 -1
  107. package/dist/components/project-session.js.map +1 -1
  108. package/dist/components/redirects/redirects-collection-view-source.d.ts +17 -2
  109. package/dist/components/redirects/redirects-collection-view-source.js +20 -6
  110. package/dist/components/redirects/redirects-collection-view-source.js.map +1 -1
  111. package/dist/components/section-nav.js +26 -2
  112. package/dist/components/section-nav.js.map +1 -1
  113. package/dist/components/section-surface.js +3 -2
  114. package/dist/components/section-surface.js.map +1 -1
  115. package/dist/components/settings-form.js +1 -2
  116. package/dist/components/settings-form.js.map +1 -1
  117. package/dist/components/studio-context.js +1 -18
  118. package/dist/components/studio-context.js.map +1 -1
  119. package/dist/components/studio-project-screen.js +3 -5
  120. package/dist/components/studio-project-screen.js.map +1 -1
  121. package/dist/lib/ai/apply-content.js +73 -29
  122. package/dist/lib/ai/apply-content.js.map +1 -1
  123. package/dist/lib/ai/constraints.d.ts +35 -0
  124. package/dist/lib/ai/constraints.js +104 -4
  125. package/dist/lib/ai/constraints.js.map +1 -1
  126. package/dist/lib/ai/route.js +4 -1
  127. package/dist/lib/ai/route.js.map +1 -1
  128. package/dist/lib/ai/shape.d.ts +3 -2
  129. package/dist/lib/ai/shape.js +16 -24
  130. package/dist/lib/ai/shape.js.map +1 -1
  131. package/dist/lib/ai/tools.d.ts +10 -4
  132. package/dist/lib/ai/tools.js +12 -4
  133. package/dist/lib/ai/tools.js.map +1 -1
  134. package/dist/lib/ai/types.d.ts +8 -0
  135. package/dist/lib/ai/types.js.map +1 -1
  136. package/dist/lib/ai/update-fields.js +33 -12
  137. package/dist/lib/ai/update-fields.js.map +1 -1
  138. package/dist/lib/assets/asset-placements.d.ts +35 -0
  139. package/dist/lib/assets/asset-placements.js +74 -0
  140. package/dist/lib/assets/asset-placements.js.map +1 -0
  141. package/dist/lib/assets/backfill-thumbs.d.ts +9 -8
  142. package/dist/lib/assets/backfill-thumbs.js +13 -25
  143. package/dist/lib/assets/backfill-thumbs.js.map +1 -1
  144. package/dist/lib/clipboard/paste-issues.d.ts +17 -15
  145. package/dist/lib/clipboard/paste-issues.js +8 -45
  146. package/dist/lib/clipboard/paste-issues.js.map +1 -1
  147. package/dist/lib/clipboard/paste-target.d.ts +25 -1
  148. package/dist/lib/clipboard/paste-target.js +13 -6
  149. package/dist/lib/clipboard/paste-target.js.map +1 -1
  150. package/dist/lib/cms/published-documents.js +1 -0
  151. package/dist/lib/cms/published-documents.js.map +1 -1
  152. package/dist/lib/cms-views/view-model.d.ts +3 -3
  153. package/dist/lib/data/collection-content.d.ts +22 -1
  154. package/dist/lib/data/collection-content.js +15 -0
  155. package/dist/lib/data/collection-content.js.map +1 -1
  156. package/dist/lib/data/index.d.ts +0 -3
  157. package/dist/lib/data/index.js +4 -6
  158. package/dist/lib/data/index.js.map +1 -1
  159. package/dist/lib/dnd/drop-rules.d.ts +45 -2
  160. package/dist/lib/dnd/drop-rules.js +64 -9
  161. package/dist/lib/dnd/drop-rules.js.map +1 -1
  162. package/dist/lib/engine-version.d.ts +3 -3
  163. package/dist/lib/engine-version.js +3 -3
  164. package/dist/lib/engine-version.js.map +1 -1
  165. package/dist/lib/i18n/messages.de.js +9 -56
  166. package/dist/lib/i18n/messages.de.js.map +1 -1
  167. package/dist/lib/i18n/messages.en.d.ts +8 -53
  168. package/dist/lib/i18n/messages.en.js +14 -57
  169. package/dist/lib/i18n/messages.en.js.map +1 -1
  170. package/dist/lib/locale/fallback.js +8 -2
  171. package/dist/lib/locale/fallback.js.map +1 -1
  172. package/dist/lib/locale/index.d.ts +0 -1
  173. package/dist/lib/locale/index.js +0 -1
  174. package/dist/lib/locale/index.js.map +1 -1
  175. package/dist/lib/locale/locale-store.d.ts +10 -3
  176. package/dist/lib/locale/locale-store.js +12 -5
  177. package/dist/lib/locale/locale-store.js.map +1 -1
  178. package/dist/lib/operations/session-hydration.d.ts +24 -22
  179. package/dist/lib/operations/session-hydration.js +15 -53
  180. package/dist/lib/operations/session-hydration.js.map +1 -1
  181. package/dist/lib/persistence/convex-adapter.js +63 -75
  182. package/dist/lib/persistence/convex-adapter.js.map +1 -1
  183. package/dist/lib/persona/labels.d.ts +0 -2
  184. package/dist/lib/persona/labels.js +1 -7
  185. package/dist/lib/persona/labels.js.map +1 -1
  186. package/dist/lib/registry/index.d.ts +4 -2
  187. package/dist/lib/registry/index.js +26 -21
  188. package/dist/lib/registry/index.js.map +1 -1
  189. package/dist/lib/registry/project-components.js +0 -3
  190. package/dist/lib/registry/project-components.js.map +1 -1
  191. package/dist/lib/routes/route-issues.js +4 -5
  192. package/dist/lib/routes/route-issues.js.map +1 -1
  193. package/dist/lib/theme.js +3 -2
  194. package/dist/lib/theme.js.map +1 -1
  195. package/dist/lib/webhooks/tags.js +11 -14
  196. package/dist/lib/webhooks/tags.js.map +1 -1
  197. package/dist/lib/workspace/config-issues.d.ts +6 -0
  198. package/dist/lib/workspace/config-issues.js +8 -4
  199. package/dist/lib/workspace/config-issues.js.map +1 -1
  200. package/dist/lib/workspace/index.d.ts +2 -2
  201. package/dist/lib/workspace/index.js +2 -2
  202. package/dist/lib/workspace/index.js.map +1 -1
  203. package/dist/previews/enumerate.d.ts +27 -9
  204. package/dist/previews/enumerate.js +27 -6
  205. package/dist/previews/enumerate.js.map +1 -1
  206. package/dist/previews/manifest-format.d.ts +9 -0
  207. package/dist/previews/manifest-format.js.map +1 -1
  208. package/dist/router/match.d.ts +0 -2
  209. package/dist/router/match.js +0 -2
  210. package/dist/router/match.js.map +1 -1
  211. package/dist/router/navigate-once.d.ts +19 -4
  212. package/dist/router/navigate-once.js +22 -5
  213. package/dist/router/navigate-once.js.map +1 -1
  214. package/dist/ui/badge.d.ts +1 -1
  215. package/package.json +3 -3
  216. package/src/styles/studio.css +5 -4
  217. package/src/styles/tokens.css +72 -55
  218. package/convex/content.ts +0 -291
  219. package/dist/components/collab/collab-context.d.ts +0 -27
  220. package/dist/components/collab/collab-context.js +0 -39
  221. package/dist/components/collab/collab-context.js.map +0 -1
  222. package/dist/components/collab/collab-seed.d.ts +0 -15
  223. package/dist/components/collab/collab-seed.js +0 -20
  224. package/dist/components/collab/collab-seed.js.map +0 -1
  225. package/dist/components/extensions/extensions-view.d.ts +0 -7
  226. package/dist/components/extensions/extensions-view.js +0 -127
  227. package/dist/components/extensions/extensions-view.js.map +0 -1
  228. package/dist/lib/bindings/section-bindings.d.ts +0 -24
  229. package/dist/lib/bindings/section-bindings.js +0 -9
  230. package/dist/lib/bindings/section-bindings.js.map +0 -1
  231. package/dist/lib/data/data-store.d.ts +0 -98
  232. package/dist/lib/data/data-store.js +0 -211
  233. package/dist/lib/data/data-store.js.map +0 -1
  234. package/dist/lib/data/providers.d.ts +0 -143
  235. package/dist/lib/data/providers.js +0 -255
  236. package/dist/lib/data/providers.js.map +0 -1
  237. package/dist/lib/data/sample-capture.d.ts +0 -30
  238. package/dist/lib/data/sample-capture.js +0 -70
  239. package/dist/lib/data/sample-capture.js.map +0 -1
  240. package/dist/lib/data/sources-store.d.ts +0 -42
  241. package/dist/lib/data/sources-store.js +0 -120
  242. package/dist/lib/data/sources-store.js.map +0 -1
  243. package/dist/lib/locale/binding-fallback.d.ts +0 -35
  244. package/dist/lib/locale/binding-fallback.js +0 -73
  245. package/dist/lib/locale/binding-fallback.js.map +0 -1
  246. package/dist/lib/starters/kit-session.d.ts +0 -5
  247. package/dist/lib/starters/kit-session.js +0 -17
  248. package/dist/lib/starters/kit-session.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"labels.js","sourceRoot":"","sources":["../../../src/lib/persona/labels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMvD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAiC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,iBAAiB,EAAE,2BAA2B;IAC9C,oBAAoB,EAAE,8BAA8B;IACpD,2BAA2B,EAAE,qCAAqC;IAClE,sBAAsB,EA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AC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,WAAmB;IACzC,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AACjE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,WAAmB,EACnB,QAAwC,EACxC,MAAe;IAEf,MAAM,QAAQ,GACZ,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IACxG,OAAO,QAAQ,IAAI,YAAY,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import type { CmsIssueCode, CmsIssueSeverity, CmsValidationIssue } from '@elytracms/core/cms-core'\nimport { resolveLabel } from '@elytracms/core/cms-core'\nimport type { OperationError, OperationErrorCode, OperationIssue } from '@elytracms/core/operations'\nimport type { BuildFragmentError, FragmentParseError } from '@elytracms/core/clipboard'\nimport type { ContentQueryError } from '@elytracms/core/content'\nimport type { CustomizationIssue } from '@elytracms/core/studio-core'\nimport type { ComponentManifest } from '@elytracms/core/component-registry'\nimport { localizedLabel, translate } from '@elytracms/studio/lib/i18n'\nimport { humanizeName } from '../utils'\n\n/**\n * Persona-aware labels (EC-192 item 2, Milestone B promise).\n *\n * A non-technical editor must never see a manifest/binding/path-token/validation\n * identifier on — or one click off — the editor path. The engine speaks in stable\n * machine codes (`cmsIssueCodeSchema`, `operationErrorCodeSchema`) and machine ids\n * (`base.Heading`, `r-blog-slug-en`); this module is the single translation layer the\n * editor-facing surfaces route through.\n *\n * The maps are exhaustive `Record<…Code, string>` over the Zod enums, so adding a\n * code in `@elytracms/core/cms-core` or `@elytracms/core/operations`\n * fails typecheck here until it is given an editor-facing label — the persona\n * boundary cannot silently regress. A table is only worth that guard while something\n * renders it: EC-509 deleted two that nothing did (see below). Engineers keep the raw\n * code: every surface that\n * shows a label also carries the code in a `title=`/`data-*` attribute (inspectable\n * via hover/devtools, never rendered as visible copy).\n */\n\n/**\n * EC-509 — two label tables were DELETED here rather than localized, because measuring\n * first showed nothing rendered them.\n *\n * `GRAPH_ISSUE_LABELS`/`graphIssueLabel` (16 entries, project-graph `IssueCode`) and\n * `CONDITION_OPERATOR_LABELS`/`conditionOperatorLabel` (8, `ConditionOperator`) had\n * **zero call sites** outside this file and its own test — measured by grep over\n * `packages/` + `apps/`, with `cmsIssueLabel` (4 sites) and `operationErrorLabel` (1)\n * as the known-positive control that the search finds a render site when one exists.\n *\n * The graph table was unreachable structurally, not just unused: the ONE live path from\n * graph validation into the studio is `cms-composition-validators.ts`, which maps a\n * graph issue to `CompositionIssue` — a type with `message`/`severity`/`nodePath` and\n * **no `code` field at all** (`cms-core/validate-document.ts:809`). The code an\n * exhaustiveness guard exists to force a label for cannot reach an editor surface.\n * `ConditionOperator` is live in the runtime renderer's condition gate\n * (`runtime-renderer/render.tsx:48`) but has no studio surface: v1 canvas is static\n * props, editor bindings parked, so no inspector ever shows an operator to name.\n *\n * **This overturns an EC-210 decision** (2026-06-17), which kept `graphIssueLabel` when\n * the validation panel was removed, on the rationale that it was \"the EC-192 boundary's\n * exhaustiveness guard, not panel code\". That was right then and its premise is false\n * now — the guard guards a boundary with no traffic, so it only forced editor copy for\n * strings no editor can see. Localizing them would have added 24 keys to the same\n * effect. If a surface ever renders these codes it needs labels written for it, and\n * will write them localized from the start.\n *\n * Neither symbol is referenced by either consumer repo (measured read-only) and neither\n * appears in docs.\n */\n\n/**\n * EC-443: the CMS issue titles live in the EC-241 message catalog\n * (`cms.issue.<code>`, EN source + shipped de), so the Issues pane / for-review\n * lane localize with the rest of the chrome. This map stays the exhaustive\n * `Record` over the Zod enum — a new code still fails typecheck here until it\n * gets an editor-facing catalog key (the persona boundary cannot silently\n * regress); {@link cmsIssueLabel} resolves it through `translate`.\n */\nconst CMS_ISSUE_LABEL_KEYS: Record<CmsIssueCode, string> = {\n 'duplicate-collection': 'cms.issue.duplicate-collection',\n 'duplicate-field': 'cms.issue.duplicate-field',\n 'unknown-collection': 'cms.issue.unknown-collection',\n 'invalid-collection-config': 'cms.issue.invalid-collection-config',\n 'invalid-field-config': 'cms.issue.invalid-field-config',\n 'reserved-field-name': 'cms.issue.reserved-field-name',\n 'missing-required-field': 'cms.issue.missing-required-field',\n 'invalid-field-value': 'cms.issue.invalid-field-value',\n 'unknown-relation-target': 'cms.issue.unknown-relation-target',\n 'unpublished-relation-target': 'cms.issue.unpublished-relation-target',\n 'cardinality-violation': 'cms.issue.cardinality-violation',\n 'unknown-asset': 'cms.issue.unknown-asset',\n 'duplicate-document': 'cms.issue.duplicate-document',\n 'unknown-locale': 'cms.issue.unknown-locale',\n 'missing-localized-value': 'cms.issue.missing-localized-value',\n 'route-conflict': 'cms.issue.route-conflict',\n 'redirect-loop': 'cms.issue.redirect-loop',\n 'unknown-route-target': 'cms.issue.unknown-route-target',\n 'hierarchy-cycle': 'cms.issue.hierarchy-cycle',\n 'document-nesting-depth': 'cms.issue.document-nesting-depth',\n 'singleton-document-drift': 'cms.issue.singleton-document-drift',\n 'duplicate-alias': 'cms.issue.duplicate-alias',\n 'unknown-alias': 'cms.issue.unknown-alias',\n 'unfilled-slot': 'cms.issue.unfilled-slot',\n 'custom-validation': 'cms.issue.custom-validation',\n 'unaddressable-url': 'cms.issue.unaddressable-url',\n 'unknown-version': 'cms.issue.unknown-version',\n}\n\n/**\n * EC-507 rider — the few codes whose TITLE overstates at `warning` severity.\n *\n * `invalid-field-value` reads \"Invalid value\", which is right when the value is\n * rejected (wrong type, not among its options) and wrong when it is not: EC-472\n * deliberately STORES `0202-09-18` as a legal ISO date and merely flags the year as\n * probably unintended. A title calling that invalid contradicts the value the editor\n * can plainly see was accepted, on all three surfaces at once.\n *\n * Keyed on SEVERITY rather than on the implausible-year case specifically, because\n * the overstatement belongs to the severity: any future warning under this code has\n * the same property (the value was kept), and the fix then needs no new entry. A\n * sparse `Partial` on purpose — a code with no entry keeps one title for both\n * severities, which is the correct default and keeps\n * {@link CMS_ISSUE_LABEL_KEYS} the single exhaustive map.\n */\nconst CMS_ISSUE_WARNING_LABEL_KEYS: Partial<Record<CmsIssueCode, string>> = {\n 'invalid-field-value': 'cms.issue.invalid-field-value.warning',\n}\n\n/**\n * EC-494: the badge titles live in the EC-241 catalog (`operations.errorLabel.<code>`),\n * exactly as EC-443 moved the CMS issue titles. **Measured before changing it:** this\n * map was a hard-coded English `Record`, so once the EC-494 bodies localized the banner\n * rendered a German sentence under an English badge — the inverse of the bug this\n * ticket exists for, and not what the ticket said was there. Still the exhaustive\n * `Record` over the Zod enum, so a new code fails typecheck until it has a key.\n */\nconst OPERATION_ERROR_LABEL_KEYS: Record<OperationErrorCode, string> = {\n validation: 'operations.errorLabel.validation',\n 'not-found': 'operations.errorLabel.not-found',\n conflict: 'operations.errorLabel.conflict',\n 'backend-unavailable': 'operations.errorLabel.backend-unavailable',\n unauthorized: 'operations.errorLabel.unauthorized',\n unknown: 'operations.errorLabel.unknown',\n}\n\nconst EXPORT_TARGET_LABELS: Record<string, string> = {\n nextjs: 'Next.js',\n}\n\n/**\n * Plain-language title for a CMS validation issue code — localized against the\n * active studio-UI locale (EC-443). A runtime-unknown code (impossible typewise;\n * a cast could smuggle one) degrades to its humanized form, never the raw enum.\n *\n * `severity` is optional and additive (EC-507): pass the issue's own severity and a\n * code with a softer warning title (see {@link CMS_ISSUE_WARNING_LABEL_KEYS}) uses\n * it; omit it, or pass `'error'`, and nothing changes. Every render site passes it —\n * the parameter is optional so that a pure/unit caller naming only a code still\n * compiles, not because a surface may skip it.\n */\nexport function cmsIssueLabel(code: CmsIssueCode, severity?: CmsIssueSeverity): string {\n const key =\n (severity === 'warning' ? CMS_ISSUE_WARNING_LABEL_KEYS[code] : undefined) ??\n (CMS_ISSUE_LABEL_KEYS[code] as string | undefined)\n return key !== undefined ? translate(key) : humanizeName(code)\n}\n\n/**\n * The localized text of a {@link CustomizationIssue} (EC-478) — the ONE place the\n * studio turns a config-level finding into rendered prose.\n *\n * The producing layer (`studio-core/customization.ts`, `app-views/default-modules.tsx`,\n * `builder/reuse.ts`) cannot own the wording: the EC-236 seam lives in `packages/core`,\n * a leaf of the DAG that may not import this catalog. So it emits a\n * `CustomizationMessageRef` — a stable key plus its interpolation values, all of\n * which are IDENTIFIERS (entry ids, extension points, component ids) and therefore the\n * same in every language — and this resolves it against the active UI locale. Same\n * shape as {@link cmsIssueLabel}, one layer down: the engine speaks codes and keys, the\n * studio speaks the editor's language.\n *\n * `messageRef.reason` fills the `{reason}` slot of `invalid-override`, whose detail is\n * itself prose (a `validate` rejection) and so carries its own key. A ref-less issue —\n * a third-party producer of this published type — degrades to its English\n * `issue.message`, which is honest: a visible English sentence beats a missing key.\n */\nexport function customizationIssueMessage(issue: CustomizationIssue): string {\n const ref = issue.messageRef\n if (!ref) return issue.message\n const vars = { ...ref.vars }\n if (ref.reason) vars.reason = translate(ref.reason.key, ref.reason.vars)\n return translate(ref.key, vars)\n}\n\n/**\n * The localized BODY of a {@link CmsValidationIssue} (EC-487) — the ONE place the\n * studio turns a CMS validation finding into rendered prose, exactly as\n * {@link customizationIssueMessage} does one layer up.\n *\n * EC-443 localized the issue TITLES ({@link cmsIssueLabel}); the bodies stayed English\n * because their producers live in `packages/core`, below this catalog in the DAG. So\n * the producer emits a `CmsMessageRef` — a stable key plus its interpolation values,\n * all of which are IDENTIFIERS (field/collection/route ids, locales, patterns, counts)\n * and therefore the same in every language — and this resolves it against the active\n * UI locale.\n *\n * `messageRef.details` fill placeholders whose text is itself prose, keyed by\n * placeholder name. A placeholder with no entry keeps whatever the producer put in\n * `vars` — the honest outcome for prose the engine did not author (a config-as-code\n * `validate` message, a composition finding), which then stays in its original\n * language rather than vanishing. A ref-less issue — a third-party producer of this\n * published type — degrades to its English `issue.message`: a visible English sentence\n * beats a missing key.\n */\nexport function cmsValidationIssueMessage(issue: CmsValidationIssue): string {\n return resolveMessageRef(issue.messageRef, issue.message)\n}\n\n/**\n * EC-494 — the ONE resolver every carried message ref goes through.\n *\n * Four published types now carry the same `{ key, vars?, details? }` reference —\n * `CmsValidationIssue` (EC-487), `CustomizationIssue` (EC-478, via its own `reason`\n * slot), and now `OperationIssue`/`OperationError` and the clipboard + content-query\n * errors. They are separate declarations only because the EC-265 DAG forbids the\n * lower subpaths from importing `cms-core`; the RESOLUTION is one rule, so it lives\n * in one function.\n *\n * `fallback` is the producer's prebuilt English, rendered whenever there is no ref —\n * a third-party producer, a Zod diagnostic, a persistence-layer message, a\n * config-authored `validate` string. A visible English sentence beats a missing key\n * (EC-443).\n */\nfunction resolveMessageRef(\n ref:\n | {\n readonly key: string\n readonly vars?: Readonly<Record<string, string | number>>\n readonly details?: Readonly<\n Record<string, { readonly key: string; readonly vars?: Readonly<Record<string, string | number>> }>\n >\n }\n | undefined,\n fallback: string,\n): string {\n if (!ref) return fallback\n const vars: Record<string, string | number> = { ...ref.vars }\n for (const [placeholder, nested] of Object.entries(ref.details ?? {})) {\n vars[placeholder] = translate(nested.key, nested.vars)\n }\n return translate(ref.key, vars)\n}\n\n/**\n * The localized text of ONE {@link OperationIssue} line in the error banner (EC-494).\n *\n * These issues cross a process boundary: `operations/documents.ts` rebuilds a\n * `CmsValidationIssue` as an `OperationIssue` **server-side, with no locale**, so the\n * producer cannot translate and the catalog key rides on the wire instead. A ref-less\n * issue — a Zod input diagnostic, a persistence-layer message, a third-party producer\n * of this published type — keeps its English.\n */\nexport function operationIssueMessage(issue: OperationIssue): string {\n return resolveMessageRef(issue.messageRef, issue.message)\n}\n\n/**\n * The localized ENVELOPE sentence of an {@link OperationError} (EC-494) — the line\n * beside the localized badge in `OperationErrorBanner`. Localizing only the issue\n * lines would have left exactly one English sentence under a German badge.\n */\nexport function operationErrorMessage(error: OperationError): string {\n return resolveMessageRef(error.messageRef, error.message)\n}\n\n/**\n * The localized text of a clipboard fragment failure (EC-494) — parse (`corrupt-json`,\n * `foreign-format`, `unsupported-version`, `invalid-payload`) or build\n * (`node-not-found`, `fixture-not-found`), rendered by the builder's paste notice.\n */\nexport function clipboardErrorMessage(error: FragmentParseError | BuildFragmentError): string {\n return resolveMessageRef(error.messageRef, error.message)\n}\n\n/**\n * The localized text of a {@link ContentQueryError} (EC-494) — the filter builder's\n * per-clause line and the canvas listing notice, both of which render errors built by\n * `core/content`'s `validateWhere`/`validateSort`/`validateLimit`.\n */\nexport function contentQueryErrorMessage(error: ContentQueryError): string {\n return resolveMessageRef(error.messageRef, error.message)\n}\n\n/**\n * Plain-language title for an operation failure code — localized against the active\n * studio-UI locale. A runtime-unknown code (impossible typewise; a cast could smuggle\n * one) degrades to the generic title, never the raw enum.\n */\nexport function operationErrorLabel(code: OperationErrorCode): string {\n const key = OPERATION_ERROR_LABEL_KEYS[code] as string | undefined\n return translate(key ?? OPERATION_ERROR_LABEL_KEYS.unknown)\n}\n\n/** Friendly name for a project export target (`nextjs` → `Next.js`). */\nexport function exportTargetLabel(target: string): string {\n return EXPORT_TARGET_LABELS[target] ?? humanizeName(target)\n}\n\n/** The leaf of a component id, namespace stripped (`base.Heading` → `Heading`). */\nexport function componentLeafId(componentId: string): string {\n const dot = componentId.lastIndexOf('.')\n return dot === -1 ? componentId : componentId.slice(dot + 1)\n}\n\n/**\n * Strip the `base.`/`project.` namespace prefix from a component id for compact,\n * editor-facing labels (`base.Heading` → `Heading`). Unlike {@link componentLeafId}\n * it removes only those two known prefixes, so a dotted custom id keeps its shape.\n */\nexport function shortId(componentId: string): string {\n return componentId.replace('base.', '').replace('project.', '')\n}\n\n/**\n * The human display name of a component TYPE for editor-facing surfaces: the\n * manifest's authored `title` (EC-407: resolved through {@link resolveLabel}, so a\n * `{ en, de }` localized title renders in the active studio-UI locale) when present,\n * else the humanized leaf of its id (`base.Heading` → `Heading`,\n * `project.MarketingHero` → `Marketing hero`). Never the raw namespaced id.\n *\n * `locale` is optional: omit it (the render-site default) to resolve against the\n * active studio-UI locale non-reactively; pass it explicitly for pure/unit callers.\n */\nexport function componentDisplayName(\n componentId: string,\n manifest?: ComponentManifest | undefined,\n locale?: string,\n): string {\n const resolved =\n locale === undefined ? localizedLabel(manifest?.title) : (resolveLabel(manifest?.title, locale) ?? '')\n return resolved || humanizeName(componentLeafId(componentId))\n}\n"]}
1
+ {"version":3,"file":"labels.js","sourceRoot":"","sources":["../../../src/lib/persona/labels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMvD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAiC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,iBAAiB,EAAE,2BAA2B;IAC9C,oBAAoB,EAAE,8BAA8B;IACpD,2BAA2B,EAAE,qCAAqC;IAClE,sBAAsB,EAAE,gCAAgC;IACxD,qBAAqB,EAAE,+BAA+B;IACtD,wBAAwB,EAAE,kCAAkC;IAC5D,qBAAqB,EAAE,+BAA+B;IACtD,yBAAyB,EAAE,mCAAmC;IAC9D,6BAA6B,EAAE,uCAAuC;IACtE,uBAAuB,EAAE,iCAAiC;IAC1D,eAAe,EAAE,yBAAyB;IAC1C,oBAAoB,EAAE,8BAA8B;IACpD,gBAAgB,EAAE,0BAA0B;IAC5C,yBAAyB,EAAE,mCAAmC;IAC9D,gBAAgB,EAAE,0BAA0B;IAC5C,eAAe,EAAE,yBAAyB;IAC1C,sBAAsB,EAAE,gCAAgC;IACxD,iBAAiB,EAAE,2BAA2B;IAC9C,wBAAwB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CmsIssueCode, CmsIssueSeverity, CmsValidationIssue } from '@elytracms/core/cms-core'\nimport { resolveLabel } from '@elytracms/core/cms-core'\nimport type { OperationError, OperationErrorCode, OperationIssue } from '@elytracms/core/operations'\nimport type { BuildFragmentError, FragmentParseError } from '@elytracms/core/clipboard'\nimport type { ContentQueryError } from '@elytracms/core/content'\nimport type { CustomizationIssue } from '@elytracms/core/studio-core'\nimport type { ComponentManifest } from '@elytracms/core/component-registry'\nimport { localizedLabel, translate } from '@elytracms/studio/lib/i18n'\nimport { humanizeName } from '../utils'\n\n/**\n * Persona-aware labels (EC-192 item 2, Milestone B promise).\n *\n * A non-technical editor must never see a manifest/binding/path-token/validation\n * identifier on — or one click off — the editor path. The engine speaks in stable\n * machine codes (`cmsIssueCodeSchema`, `operationErrorCodeSchema`) and machine ids\n * (`base.Heading`, `r-blog-slug-en`); this module is the single translation layer the\n * editor-facing surfaces route through.\n *\n * The maps are exhaustive `Record<…Code, string>` over the Zod enums, so adding a\n * code in `@elytracms/core/cms-core` or `@elytracms/core/operations`\n * fails typecheck here until it is given an editor-facing label — the persona\n * boundary cannot silently regress. A table is only worth that guard while something\n * renders it: EC-509 deleted two that nothing did (see below). Engineers keep the raw\n * code: every surface that\n * shows a label also carries the code in a `title=`/`data-*` attribute (inspectable\n * via hover/devtools, never rendered as visible copy).\n */\n\n/**\n * EC-509 — two label tables were DELETED here rather than localized, because measuring\n * first showed nothing rendered them.\n *\n * `GRAPH_ISSUE_LABELS`/`graphIssueLabel` (16 entries, project-graph `IssueCode`) and\n * `CONDITION_OPERATOR_LABELS`/`conditionOperatorLabel` (8, `ConditionOperator`) had\n * **zero call sites** outside this file and its own test — measured by grep over\n * `packages/` + `apps/`, with `cmsIssueLabel` (4 sites) and `operationErrorLabel` (1)\n * as the known-positive control that the search finds a render site when one exists.\n *\n * The graph table was unreachable structurally, not just unused: the ONE live path from\n * graph validation into the studio is `cms-composition-validators.ts`, which maps a\n * graph issue to `CompositionIssue` — a type with `message`/`severity`/`nodePath` and\n * **no `code` field at all** (`cms-core/validate-document.ts:809`). The code an\n * exhaustiveness guard exists to force a label for cannot reach an editor surface.\n * `ConditionOperator` is live in the runtime renderer's condition gate\n * (`runtime-renderer/render.tsx:48`) but has no studio surface: v1 canvas is static\n * props, editor bindings parked, so no inspector ever shows an operator to name.\n *\n * **This overturns an EC-210 decision** (2026-06-17), which kept `graphIssueLabel` when\n * the validation panel was removed, on the rationale that it was \"the EC-192 boundary's\n * exhaustiveness guard, not panel code\". That was right then and its premise is false\n * now — the guard guards a boundary with no traffic, so it only forced editor copy for\n * strings no editor can see. Localizing them would have added 24 keys to the same\n * effect. If a surface ever renders these codes it needs labels written for it, and\n * will write them localized from the start.\n *\n * Neither symbol is referenced by either consumer repo (measured read-only) and neither\n * appears in docs.\n */\n\n/**\n * EC-443: the CMS issue titles live in the EC-241 message catalog\n * (`cms.issue.<code>`, EN source + shipped de), so the Issues pane / for-review\n * lane localize with the rest of the chrome. This map stays the exhaustive\n * `Record` over the Zod enum — a new code still fails typecheck here until it\n * gets an editor-facing catalog key (the persona boundary cannot silently\n * regress); {@link cmsIssueLabel} resolves it through `translate`.\n */\nconst CMS_ISSUE_LABEL_KEYS: Record<CmsIssueCode, string> = {\n 'duplicate-collection': 'cms.issue.duplicate-collection',\n 'duplicate-field': 'cms.issue.duplicate-field',\n 'unknown-collection': 'cms.issue.unknown-collection',\n 'invalid-collection-config': 'cms.issue.invalid-collection-config',\n 'invalid-field-config': 'cms.issue.invalid-field-config',\n 'reserved-field-name': 'cms.issue.reserved-field-name',\n 'missing-required-field': 'cms.issue.missing-required-field',\n 'invalid-field-value': 'cms.issue.invalid-field-value',\n 'unknown-relation-target': 'cms.issue.unknown-relation-target',\n 'unpublished-relation-target': 'cms.issue.unpublished-relation-target',\n 'cardinality-violation': 'cms.issue.cardinality-violation',\n 'unknown-asset': 'cms.issue.unknown-asset',\n 'duplicate-document': 'cms.issue.duplicate-document',\n 'unknown-locale': 'cms.issue.unknown-locale',\n 'missing-localized-value': 'cms.issue.missing-localized-value',\n 'route-conflict': 'cms.issue.route-conflict',\n 'redirect-loop': 'cms.issue.redirect-loop',\n 'unknown-route-target': 'cms.issue.unknown-route-target',\n 'hierarchy-cycle': 'cms.issue.hierarchy-cycle',\n 'document-nesting-depth': 'cms.issue.document-nesting-depth',\n 'singleton-document-drift': 'cms.issue.singleton-document-drift',\n 'duplicate-alias': 'cms.issue.duplicate-alias',\n 'unknown-alias': 'cms.issue.unknown-alias',\n 'unfilled-slot': 'cms.issue.unfilled-slot',\n 'custom-validation': 'cms.issue.custom-validation',\n 'hidden-predicate-error': 'cms.issue.hidden-predicate-error',\n 'unaddressable-url': 'cms.issue.unaddressable-url',\n 'unknown-version': 'cms.issue.unknown-version',\n}\n\n/**\n * EC-507 rider — the few codes whose TITLE overstates at `warning` severity.\n *\n * `invalid-field-value` reads \"Invalid value\", which is right when the value is\n * rejected (wrong type, not among its options) and wrong when it is not: EC-472\n * deliberately STORES `0202-09-18` as a legal ISO date and merely flags the year as\n * probably unintended. A title calling that invalid contradicts the value the editor\n * can plainly see was accepted, on all three surfaces at once.\n *\n * Keyed on SEVERITY rather than on the implausible-year case specifically, because\n * the overstatement belongs to the severity: any future warning under this code has\n * the same property (the value was kept), and the fix then needs no new entry. A\n * sparse `Partial` on purpose — a code with no entry keeps one title for both\n * severities, which is the correct default and keeps\n * {@link CMS_ISSUE_LABEL_KEYS} the single exhaustive map.\n */\nconst CMS_ISSUE_WARNING_LABEL_KEYS: Partial<Record<CmsIssueCode, string>> = {\n 'invalid-field-value': 'cms.issue.invalid-field-value.warning',\n}\n\n/**\n * EC-494: the badge titles live in the EC-241 catalog (`operations.errorLabel.<code>`),\n * exactly as EC-443 moved the CMS issue titles. **Measured before changing it:** this\n * map was a hard-coded English `Record`, so once the EC-494 bodies localized the banner\n * rendered a German sentence under an English badge — the inverse of the bug this\n * ticket exists for, and not what the ticket said was there. Still the exhaustive\n * `Record` over the Zod enum, so a new code fails typecheck until it has a key.\n */\nconst OPERATION_ERROR_LABEL_KEYS: Record<OperationErrorCode, string> = {\n validation: 'operations.errorLabel.validation',\n 'not-found': 'operations.errorLabel.not-found',\n conflict: 'operations.errorLabel.conflict',\n 'backend-unavailable': 'operations.errorLabel.backend-unavailable',\n unauthorized: 'operations.errorLabel.unauthorized',\n unknown: 'operations.errorLabel.unknown',\n}\n\n/**\n * Plain-language title for a CMS validation issue code — localized against the\n * active studio-UI locale (EC-443). A runtime-unknown code (impossible typewise;\n * a cast could smuggle one) degrades to its humanized form, never the raw enum.\n *\n * `severity` is optional and additive (EC-507): pass the issue's own severity and a\n * code with a softer warning title (see {@link CMS_ISSUE_WARNING_LABEL_KEYS}) uses\n * it; omit it, or pass `'error'`, and nothing changes. Every render site passes it —\n * the parameter is optional so that a pure/unit caller naming only a code still\n * compiles, not because a surface may skip it.\n */\nexport function cmsIssueLabel(code: CmsIssueCode, severity?: CmsIssueSeverity): string {\n const key =\n (severity === 'warning' ? CMS_ISSUE_WARNING_LABEL_KEYS[code] : undefined) ??\n (CMS_ISSUE_LABEL_KEYS[code] as string | undefined)\n return key !== undefined ? translate(key) : humanizeName(code)\n}\n\n/**\n * The localized text of a {@link CustomizationIssue} (EC-478) — the ONE place the\n * studio turns a config-level finding into rendered prose.\n *\n * The producing layer (`studio-core/customization.ts`, `app-views/default-modules.tsx`,\n * `builder/reuse.ts`) cannot own the wording: the EC-236 seam lives in `packages/core`,\n * a leaf of the DAG that may not import this catalog. So it emits a\n * `CustomizationMessageRef` — a stable key plus its interpolation values, all of\n * which are IDENTIFIERS (entry ids, extension points, component ids) and therefore the\n * same in every language — and this resolves it against the active UI locale. Same\n * shape as {@link cmsIssueLabel}, one layer down: the engine speaks codes and keys, the\n * studio speaks the editor's language.\n *\n * `messageRef.reason` fills the `{reason}` slot of `invalid-override`, whose detail is\n * itself prose (a `validate` rejection) and so carries its own key. A ref-less issue —\n * a third-party producer of this published type — degrades to its English\n * `issue.message`, which is honest: a visible English sentence beats a missing key.\n */\nexport function customizationIssueMessage(issue: CustomizationIssue): string {\n const ref = issue.messageRef\n if (!ref) return issue.message\n const vars = { ...ref.vars }\n if (ref.reason) vars.reason = translate(ref.reason.key, ref.reason.vars)\n return translate(ref.key, vars)\n}\n\n/**\n * The localized BODY of a {@link CmsValidationIssue} (EC-487) — the ONE place the\n * studio turns a CMS validation finding into rendered prose, exactly as\n * {@link customizationIssueMessage} does one layer up.\n *\n * EC-443 localized the issue TITLES ({@link cmsIssueLabel}); the bodies stayed English\n * because their producers live in `packages/core`, below this catalog in the DAG. So\n * the producer emits a `CmsMessageRef` — a stable key plus its interpolation values,\n * all of which are IDENTIFIERS (field/collection/route ids, locales, patterns, counts)\n * and therefore the same in every language — and this resolves it against the active\n * UI locale.\n *\n * `messageRef.details` fill placeholders whose text is itself prose, keyed by\n * placeholder name. A placeholder with no entry keeps whatever the producer put in\n * `vars` — the honest outcome for prose the engine did not author (a config-as-code\n * `validate` message, a composition finding), which then stays in its original\n * language rather than vanishing. A ref-less issue — a third-party producer of this\n * published type — degrades to its English `issue.message`: a visible English sentence\n * beats a missing key.\n */\nexport function cmsValidationIssueMessage(issue: CmsValidationIssue): string {\n return resolveMessageRef(issue.messageRef, issue.message)\n}\n\n/**\n * EC-494 — the ONE resolver every carried message ref goes through.\n *\n * Four published types now carry the same `{ key, vars?, details? }` reference —\n * `CmsValidationIssue` (EC-487), `CustomizationIssue` (EC-478, via its own `reason`\n * slot), and now `OperationIssue`/`OperationError` and the clipboard + content-query\n * errors. They are separate declarations only because the EC-265 DAG forbids the\n * lower subpaths from importing `cms-core`; the RESOLUTION is one rule, so it lives\n * in one function.\n *\n * `fallback` is the producer's prebuilt English, rendered whenever there is no ref —\n * a third-party producer, a Zod diagnostic, a persistence-layer message, a\n * config-authored `validate` string. A visible English sentence beats a missing key\n * (EC-443).\n */\nfunction resolveMessageRef(\n ref:\n | {\n readonly key: string\n readonly vars?: Readonly<Record<string, string | number>>\n readonly details?: Readonly<\n Record<string, { readonly key: string; readonly vars?: Readonly<Record<string, string | number>> }>\n >\n }\n | undefined,\n fallback: string,\n): string {\n if (!ref) return fallback\n const vars: Record<string, string | number> = { ...ref.vars }\n for (const [placeholder, nested] of Object.entries(ref.details ?? {})) {\n vars[placeholder] = translate(nested.key, nested.vars)\n }\n return translate(ref.key, vars)\n}\n\n/**\n * The localized text of ONE {@link OperationIssue} line in the error banner (EC-494).\n *\n * These issues cross a process boundary: `operations/documents.ts` rebuilds a\n * `CmsValidationIssue` as an `OperationIssue` **server-side, with no locale**, so the\n * producer cannot translate and the catalog key rides on the wire instead. A ref-less\n * issue — a Zod input diagnostic, a persistence-layer message, a third-party producer\n * of this published type — keeps its English.\n */\nexport function operationIssueMessage(issue: OperationIssue): string {\n return resolveMessageRef(issue.messageRef, issue.message)\n}\n\n/**\n * The localized ENVELOPE sentence of an {@link OperationError} (EC-494) — the line\n * beside the localized badge in `OperationErrorBanner`. Localizing only the issue\n * lines would have left exactly one English sentence under a German badge.\n */\nexport function operationErrorMessage(error: OperationError): string {\n return resolveMessageRef(error.messageRef, error.message)\n}\n\n/**\n * The localized text of a clipboard fragment failure (EC-494) — parse (`corrupt-json`,\n * `foreign-format`, `unsupported-version`, `invalid-payload`) or build\n * (`node-not-found`, `fixture-not-found`), rendered by the builder's paste notice.\n */\nexport function clipboardErrorMessage(error: FragmentParseError | BuildFragmentError): string {\n return resolveMessageRef(error.messageRef, error.message)\n}\n\n/**\n * The localized text of a {@link ContentQueryError} (EC-494) — the filter builder's\n * per-clause line and the canvas listing notice, both of which render errors built by\n * `core/content`'s `validateWhere`/`validateSort`/`validateLimit`.\n */\nexport function contentQueryErrorMessage(error: ContentQueryError): string {\n return resolveMessageRef(error.messageRef, error.message)\n}\n\n/**\n * Plain-language title for an operation failure code — localized against the active\n * studio-UI locale. A runtime-unknown code (impossible typewise; a cast could smuggle\n * one) degrades to the generic title, never the raw enum.\n */\nexport function operationErrorLabel(code: OperationErrorCode): string {\n const key = OPERATION_ERROR_LABEL_KEYS[code] as string | undefined\n return translate(key ?? OPERATION_ERROR_LABEL_KEYS.unknown)\n}\n\n/** The leaf of a component id, namespace stripped (`base.Heading` → `Heading`). */\nexport function componentLeafId(componentId: string): string {\n const dot = componentId.lastIndexOf('.')\n return dot === -1 ? componentId : componentId.slice(dot + 1)\n}\n\n/**\n * Strip the `base.`/`project.` namespace prefix from a component id for compact,\n * editor-facing labels (`base.Heading` → `Heading`). Unlike {@link componentLeafId}\n * it removes only those two known prefixes, so a dotted custom id keeps its shape.\n */\nexport function shortId(componentId: string): string {\n return componentId.replace('base.', '').replace('project.', '')\n}\n\n/**\n * The human display name of a component TYPE for editor-facing surfaces: the\n * manifest's authored `title` (EC-407: resolved through {@link resolveLabel}, so a\n * `{ en, de }` localized title renders in the active studio-UI locale) when present,\n * else the humanized leaf of its id (`base.Heading` → `Heading`,\n * `project.MarketingHero` → `Marketing hero`). Never the raw namespaced id.\n *\n * `locale` is optional: omit it (the render-site default) to resolve against the\n * active studio-UI locale non-reactively; pass it explicitly for pure/unit callers.\n */\nexport function componentDisplayName(\n componentId: string,\n manifest?: ComponentManifest | undefined,\n locale?: string,\n): string {\n const resolved =\n locale === undefined ? localizedLabel(manifest?.title) : (resolveLabel(manifest?.title, locale) ?? '')\n return resolved || humanizeName(componentLeafId(componentId))\n}\n"]}
@@ -31,11 +31,13 @@ export declare function fixtureStudioRegistry(): StudioRegistry;
31
31
  * persistence/cms-core never depend on the registry — the studio supplies this shape.
32
32
  */
33
33
  export declare function studioManifestLookup(): PropFieldLookup;
34
- /** A RenderContext for fixture previews (bindings resolve to undefined). */
34
+ /** A RenderContext for fixture previews (static props only; no asset/relation resolvers). */
35
35
  export declare function previewContext(studio: StudioRegistry): RenderContext;
36
36
  /**
37
37
  * Per-component status (brief §4.11, §8.3, EC-055):
38
- * - `invalid`: the registry reported a structured issue for this id.
38
+ * - `invalid`: the registry reported a structured issue for this id — including
39
+ * an `invalid-implementation` (EC-555: the entry HAS an implementation, it is
40
+ * just not a component, so it is not merely missing).
39
41
  * - `incompatible`: a manifest exists but no implementation is wired up.
40
42
  * - `valid`: healthy.
41
43
  */
@@ -1,34 +1,42 @@
1
1
  import { ComponentRegistry, manifestPropFields } from '@elytracms/core/component-registry';
2
- import { basePrimitives, getImplementation } from '@elytracms/core/runtime-renderer';
2
+ import { basePrimitives, getImplementation, registerImplementations } from '@elytracms/core/runtime-renderer';
3
3
  import { getActiveProjectSlug, resolveDeploymentComponents } from '../workspace/index.js';
4
4
  import { projectComponentImplementations, projectComponentManifests } from './project-components.js';
5
5
  /**
6
- * EC-194/EC-208/EC-223: the consuming repo's OWN real components, INJECTED through
7
- * config-as-code (the mount contract). The active project's `components` field holds
8
- * the live (manifest + implementation) pairs the consumer's `elytra.config.ts` handed
9
- * in by dependency injection — for Aurora these live in
10
- * `apps/example-site/components/marketing` (Next-free, so they render identically in
11
- * the studio canvas and the host). No `@site` alias and no static codegen seam: the
12
- * registry reads the live set off the resolved config. Absent any, the studio falls
13
- * back to the built-in demo fixtures (golden path).
6
+ * EC-555: the config's implementations are `unknown` (`HostComponentEntry`), so
7
+ * they go through core's one registration step — the same one the Next host
8
+ * uses (EC-541) — instead of a cast: a non-component is withheld (its nodes
9
+ * take the renderer's missing-component path, never `createElement`) and
10
+ * recorded as an `invalid-implementation` issue. The fixture set below is
11
+ * engine-owned and typed as components, so it needs no runtime check.
14
12
  */
15
13
  function projectComponents() {
16
14
  const components = resolveDeploymentComponents();
17
15
  if (components && components.length > 0) {
18
- return {
19
- manifests: components.map((c) => c.manifest),
20
- implementations: Object.fromEntries(components.map((c) => [c.manifest.id, c.implementation])),
21
- };
16
+ const { implementations, issues } = registerImplementations(components);
17
+ return { manifests: components.map((c) => c.manifest), implementations, issues };
22
18
  }
23
- return { manifests: projectComponentManifests, implementations: projectComponentImplementations };
19
+ return {
20
+ manifests: projectComponentManifests,
21
+ implementations: projectComponentImplementations,
22
+ issues: [],
23
+ };
24
24
  }
25
25
  /** Compose a StudioRegistry from the base primitives plus a project component set. */
26
26
  function buildStudioRegistry(project) {
27
27
  const base = basePrimitives();
28
28
  // Inline-editable opt-ins (EC-158) live directly on the base-primitive
29
29
  // manifests (`Heading.text`, `Text.value`) in `@elytracms/core/runtime-renderer`.
30
+ const registry = new ComponentRegistry([...base.manifests, ...project.manifests]);
31
+ // EC-555: implementation issues join the registry's OWN list, because that is
32
+ // the one list every studio status reader consults — `componentStatus` below
33
+ // (→ 'invalid'), the Components surface, and the blocks panel tile, which
34
+ // prints each issue's message. A second list would be a second reader.
35
+ registry.issues.push(...project.issues);
30
36
  return {
31
- registry: new ComponentRegistry([...base.manifests, ...project.manifests]),
37
+ registry,
38
+ // Project wins over base by spread (a project entry under a `base.*` id
39
+ // replaces the primitive; a WITHHELD one leaves the primitive in place).
32
40
  implementations: { ...base.implementations, ...project.implementations },
33
41
  };
34
42
  }
@@ -56,6 +64,7 @@ export function fixtureStudioRegistry() {
56
64
  return buildStudioRegistry({
57
65
  manifests: projectComponentManifests,
58
66
  implementations: projectComponentImplementations,
67
+ issues: [],
59
68
  });
60
69
  }
61
70
  /**
@@ -74,13 +83,9 @@ export function studioManifestLookup() {
74
83
  return Object.fromEntries(manifestPropFields(manifest).map((field) => [field.name, field]));
75
84
  };
76
85
  }
77
- /** A RenderContext for fixture previews (bindings resolve to undefined). */
86
+ /** A RenderContext for fixture previews (static props only; no asset/relation resolvers). */
78
87
  export function previewContext(studio) {
79
- return {
80
- registry: studio.registry,
81
- implementations: studio.implementations,
82
- resolveBinding: () => undefined,
83
- };
88
+ return { registry: studio.registry, implementations: studio.implementations };
84
89
  }
85
90
  export function componentStatus(studio, manifest) {
86
91
  if (studio.registry.issues.some((i) => i.componentId === manifest.id))
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/registry/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAG1F,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,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CAAC,iBAAiB,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,cAAc,CAAA;IAClF,OAAO,OAAO,CAAA;AAChB,CAAC;AASD,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAClC,MAAM,MAAM,GAAmB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;IAC3F,KAAK,MAAM,CAAC,IAAI,GAAG;QAAE,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC5D,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { ComponentRegistry, manifestPropFields } from '@elytracms/core/component-registry'\nimport type { ComponentManifest } from '@elytracms/core/component-registry'\nimport type { PropFieldLookup } from '@elytracms/core/cms-core'\nimport { basePrimitives, getImplementation } from '@elytracms/core/runtime-renderer'\nimport type { ComponentImplementations, RenderContext } from '@elytracms/core/runtime-renderer'\nimport { getActiveProjectSlug, resolveDeploymentComponents } from '../workspace'\nimport { projectComponentImplementations, projectComponentManifests } from './project-components'\n\n/**\n * The Studio's view of a project's component registry (brief §7.2, §8.3): the\n * platform primitives plus the project's own components, with their\n * implementations for live previews. Deterministic singleton, built in-process\n * from code-owned manifests — component manifests live in TS next to the\n * components, so local/CI/browser runs need no backend.\n */\nexport interface StudioRegistry {\n registry: ComponentRegistry\n implementations: ComponentImplementations\n}\n\n/**\n * EC-194/EC-208/EC-223: the consuming repo's OWN real components, INJECTED through\n * config-as-code (the mount contract). The active project's `components` field holds\n * the live (manifest + implementation) pairs the consumer's `elytra.config.ts` handed\n * in by dependency injection — for Aurora these live in\n * `apps/example-site/components/marketing` (Next-free, so they render identically in\n * the studio canvas and the host). No `@site` alias and no static codegen seam: the\n * registry reads the live set off the resolved config. Absent any, the studio falls\n * back to the built-in demo fixtures (golden path).\n */\nfunction projectComponents(): {\n manifests: ComponentManifest[]\n implementations: ComponentImplementations\n} {\n const components = resolveDeploymentComponents()\n if (components && components.length > 0) {\n return {\n manifests: components.map((c) => c.manifest),\n implementations: Object.fromEntries(\n components.map((c) => [c.manifest.id, c.implementation]),\n ) as ComponentImplementations,\n }\n }\n return { manifests: projectComponentManifests, implementations: projectComponentImplementations }\n}\n\n/** Compose a StudioRegistry from the base primitives plus a project component set. */\nfunction buildStudioRegistry(project: {\n manifests: ComponentManifest[]\n implementations: ComponentImplementations\n}): StudioRegistry {\n const base = basePrimitives()\n // Inline-editable opt-ins (EC-158) live directly on the base-primitive\n // manifests (`Heading.text`, `Text.value`) in `@elytracms/core/runtime-renderer`.\n return {\n registry: new ComponentRegistry([...base.manifests, ...project.manifests]),\n implementations: { ...base.implementations, ...project.implementations },\n }\n}\n\nlet cached: StudioRegistry | null = null\nlet cachedSlug: string | null = null\n\nexport function getStudioRegistry(): StudioRegistry {\n // Re-derive when the active project changes — different projects may register\n // different component libraries (per-project registry, AD-8).\n const slug = getActiveProjectSlug()\n if (cached && cachedSlug === slug) return cached\n cached = buildStudioRegistry(projectComponents())\n cachedSlug = slug\n return cached\n}\n\n/**\n * The built-in demo fixtures as a StudioRegistry, independent of the active\n * project's `components` config ref. This is the golden-path component set\n * (`project.MarketingHero`, `FeatureCard`, `PricingCallout`, `LegacyBanner`) used\n * when a project declares no ref — and the deterministic registry that blocks /\n * clipboard / thumbnail tests pin to, so they assert against a known component set\n * regardless of which library `elytra.config.ts` happens to select (EC-194).\n */\nexport function fixtureStudioRegistry(): StudioRegistry {\n return buildStudioRegistry({\n manifests: projectComponentManifests,\n implementations: projectComponentImplementations,\n })\n}\n\n/**\n * Adapt the live registry to the cms-core {@link PropFieldLookup} contract (EC-277):\n * a component id → its prop field-defs, name-injected. Threaded into the studio's\n * write-time self-typing lens so relation/asset props inside compositions are\n * self-typed on write (\"schema leads, component adopts\"). Manifests are code (AD-11);\n * persistence/cms-core never depend on the registry — the studio supplies this shape.\n */\nexport function studioManifestLookup(): PropFieldLookup {\n const { registry } = getStudioRegistry()\n return (componentId) => {\n const manifest = registry.getManifest(componentId)\n if (!manifest) return undefined\n return Object.fromEntries(manifestPropFields(manifest).map((field) => [field.name, field]))\n }\n}\n\n/** A RenderContext for fixture previews (bindings resolve to undefined). */\nexport function previewContext(studio: StudioRegistry): RenderContext {\n return {\n registry: studio.registry,\n implementations: studio.implementations,\n resolveBinding: () => undefined,\n }\n}\n\n/**\n * Per-component status (brief §4.11, §8.3, EC-055):\n * - `invalid`: the registry reported a structured issue for this id.\n * - `incompatible`: a manifest exists but no implementation is wired up.\n * - `valid`: healthy.\n */\nexport type ComponentStatus = 'valid' | 'incompatible' | 'invalid'\n\nexport function componentStatus(\n studio: StudioRegistry,\n manifest: ComponentManifest,\n): ComponentStatus {\n if (studio.registry.issues.some((i) => i.componentId === manifest.id)) return 'invalid'\n if (!getImplementation(studio.implementations, manifest.id)) return 'incompatible'\n return 'valid'\n}\n\nexport interface RegistryHealth {\n total: number\n valid: number\n incompatible: number\n invalid: number\n}\n\nexport function registryHealth(studio: StudioRegistry): RegistryHealth {\n const all = studio.registry.list()\n const health: RegistryHealth = { total: all.length, valid: 0, incompatible: 0, invalid: 0 }\n for (const m of all) health[componentStatus(studio, m)] += 1\n return health\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/registry/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAG1F,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAE7G,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EAAE,+BAA+B,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,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AM,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,cAAc,CAAA;IAClF,OAAO,OAAO,CAAA;AAChB,CAAC;AASD,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAClC,MAAM,MAAM,GAAmB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;IAC3F,KAAK,MAAM,CAAC,IAAI,GAAG;QAAE,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC5D,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { ComponentRegistry, manifestPropFields } from '@elytracms/core/component-registry'\nimport type { ComponentIssue, ComponentManifest } from '@elytracms/core/component-registry'\nimport type { PropFieldLookup } from '@elytracms/core/cms-core'\nimport { basePrimitives, getImplementation, registerImplementations } from '@elytracms/core/runtime-renderer'\nimport type { ComponentImplementations, RenderContext } from '@elytracms/core/runtime-renderer'\nimport { getActiveProjectSlug, resolveDeploymentComponents } from '../workspace'\nimport { projectComponentImplementations, projectComponentManifests } from './project-components'\n\n/**\n * The Studio's view of a project's component registry (brief §7.2, §8.3): the\n * platform primitives plus the project's own components, with their\n * implementations for live previews. Deterministic singleton, built in-process\n * from code-owned manifests — component manifests live in TS next to the\n * components, so local/CI/browser runs need no backend.\n */\nexport interface StudioRegistry {\n registry: ComponentRegistry\n implementations: ComponentImplementations\n}\n\n/**\n * EC-194/EC-208/EC-223: the consuming repo's OWN real components, INJECTED through\n * config-as-code (the mount contract). The active project's `components` field holds\n * the live (manifest + implementation) pairs the consumer's `elytra.config.ts` handed\n * in by dependency injection — for Aurora these live in\n * `apps/example-site/components/marketing` (Next-free, so they render identically in\n * the studio canvas and the host). No `@site` alias and no static codegen seam: the\n * registry reads the live set off the resolved config. Absent any, the studio falls\n * back to the built-in demo fixtures (golden path).\n */\n/** A project component set, ready to layer over the base primitives. */\ninterface ProjectComponentSet {\n manifests: ComponentManifest[]\n implementations: ComponentImplementations\n /** Registration issues the registry itself cannot see (`invalid-implementation`, EC-555). */\n issues: readonly ComponentIssue[]\n}\n\n/**\n * EC-555: the config's implementations are `unknown` (`HostComponentEntry`), so\n * they go through core's one registration step — the same one the Next host\n * uses (EC-541) — instead of a cast: a non-component is withheld (its nodes\n * take the renderer's missing-component path, never `createElement`) and\n * recorded as an `invalid-implementation` issue. The fixture set below is\n * engine-owned and typed as components, so it needs no runtime check.\n */\nfunction projectComponents(): ProjectComponentSet {\n const components = resolveDeploymentComponents()\n if (components && components.length > 0) {\n const { implementations, issues } = registerImplementations(components)\n return { manifests: components.map((c) => c.manifest), implementations, issues }\n }\n return {\n manifests: projectComponentManifests,\n implementations: projectComponentImplementations,\n issues: [],\n }\n}\n\n/** Compose a StudioRegistry from the base primitives plus a project component set. */\nfunction buildStudioRegistry(project: ProjectComponentSet): StudioRegistry {\n const base = basePrimitives()\n // Inline-editable opt-ins (EC-158) live directly on the base-primitive\n // manifests (`Heading.text`, `Text.value`) in `@elytracms/core/runtime-renderer`.\n const registry = new ComponentRegistry([...base.manifests, ...project.manifests])\n // EC-555: implementation issues join the registry's OWN list, because that is\n // the one list every studio status reader consults — `componentStatus` below\n // (→ 'invalid'), the Components surface, and the blocks panel tile, which\n // prints each issue's message. A second list would be a second reader.\n registry.issues.push(...project.issues)\n return {\n registry,\n // Project wins over base by spread (a project entry under a `base.*` id\n // replaces the primitive; a WITHHELD one leaves the primitive in place).\n implementations: { ...base.implementations, ...project.implementations },\n }\n}\n\nlet cached: StudioRegistry | null = null\nlet cachedSlug: string | null = null\n\nexport function getStudioRegistry(): StudioRegistry {\n // Re-derive when the active project changes — different projects may register\n // different component libraries (per-project registry, AD-8).\n const slug = getActiveProjectSlug()\n if (cached && cachedSlug === slug) return cached\n cached = buildStudioRegistry(projectComponents())\n cachedSlug = slug\n return cached\n}\n\n/**\n * The built-in demo fixtures as a StudioRegistry, independent of the active\n * project's `components` config ref. This is the golden-path component set\n * (`project.MarketingHero`, `FeatureCard`, `PricingCallout`, `LegacyBanner`) used\n * when a project declares no ref — and the deterministic registry that blocks /\n * clipboard / thumbnail tests pin to, so they assert against a known component set\n * regardless of which library `elytra.config.ts` happens to select (EC-194).\n */\nexport function fixtureStudioRegistry(): StudioRegistry {\n return buildStudioRegistry({\n manifests: projectComponentManifests,\n implementations: projectComponentImplementations,\n issues: [],\n })\n}\n\n/**\n * Adapt the live registry to the cms-core {@link PropFieldLookup} contract (EC-277):\n * a component id → its prop field-defs, name-injected. Threaded into the studio's\n * write-time self-typing lens so relation/asset props inside compositions are\n * self-typed on write (\"schema leads, component adopts\"). Manifests are code (AD-11);\n * persistence/cms-core never depend on the registry — the studio supplies this shape.\n */\nexport function studioManifestLookup(): PropFieldLookup {\n const { registry } = getStudioRegistry()\n return (componentId) => {\n const manifest = registry.getManifest(componentId)\n if (!manifest) return undefined\n return Object.fromEntries(manifestPropFields(manifest).map((field) => [field.name, field]))\n }\n}\n\n/** A RenderContext for fixture previews (static props only; no asset/relation resolvers). */\nexport function previewContext(studio: StudioRegistry): RenderContext {\n return { registry: studio.registry, implementations: studio.implementations }\n}\n\n/**\n * Per-component status (brief §4.11, §8.3, EC-055):\n * - `invalid`: the registry reported a structured issue for this id — including\n * an `invalid-implementation` (EC-555: the entry HAS an implementation, it is\n * just not a component, so it is not merely missing).\n * - `incompatible`: a manifest exists but no implementation is wired up.\n * - `valid`: healthy.\n */\nexport type ComponentStatus = 'valid' | 'incompatible' | 'invalid'\n\nexport function componentStatus(\n studio: StudioRegistry,\n manifest: ComponentManifest,\n): ComponentStatus {\n if (studio.registry.issues.some((i) => i.componentId === manifest.id)) return 'invalid'\n if (!getImplementation(studio.implementations, manifest.id)) return 'incompatible'\n return 'valid'\n}\n\nexport interface RegistryHealth {\n total: number\n valid: number\n incompatible: number\n invalid: number\n}\n\nexport function registryHealth(studio: StudioRegistry): RegistryHealth {\n const all = studio.registry.list()\n const health: RegistryHealth = { total: all.length, valid: 0, incompatible: 0, invalid: 0 }\n for (const m of all) health[componentStatus(studio, m)] += 1\n return health\n}\n"]}
@@ -39,7 +39,6 @@ const MarketingHeroManifest = defineComponent({
39
39
  },
40
40
  },
41
41
  slots: [],
42
- designTokens: ['color.primary', 'space.section', 'font.display'],
43
42
  fixtures: [
44
43
  { name: 'Default' },
45
44
  {
@@ -83,7 +82,6 @@ const FeatureCardManifest = defineComponent({
83
82
  },
84
83
  },
85
84
  slots: [],
86
- designTokens: ['color.surface', 'color.primary'],
87
85
  fixtures: [{ name: 'Default' }, { name: 'Accent', props: { tone: 'accent', title: 'AI inspectable' } }],
88
86
  });
89
87
  // --- project.PricingCallout ------------------------------------------------
@@ -109,7 +107,6 @@ const PricingCalloutManifest = defineComponent({
109
107
  featured: { type: 'boolean', default: false, form: { label: 'Featured' } },
110
108
  },
111
109
  slots: [],
112
- designTokens: ['color.primary', 'space.card'],
113
110
  fixtures: [{ name: 'Standard' }, { name: 'Featured', props: { featured: true, plan: 'Team', price: '$79' } }],
114
111
  });
115
112
  // --- project.LegacyBanner (intentionally has NO implementation) -------------
@@ -1 +1 @@
1
- {"version":3,"file":"project-components.js","sourceRoot":"","sources":["../../../src/lib/registry/project-components.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAcpE,SAAS,GAAG,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAA;AACzE,CAAC;AAED,8EAA8E;AAE9E,SAAS,aAAa,CAAC,KAAY;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,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sBAAsB;IACtB,oBAAoB;CACrB,CAAA;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,+BAA+B,GAAyC;IACnF,uBAAuB,EAAE,aAAa;IACtC,qBAAqB,EAAE,WAAW;IAClC,wBAAwB,EAAE,cAAc;CACzC,CAAA","sourcesContent":["import { defineComponent } from '@elytracms/core/component-registry'\nimport type { ComponentManifest } from '@elytracms/core/component-registry'\nimport type { ComponentType, ReactNode } from 'react'\n\n/**\n * Sample `project.*` components for the Studio Components surface (brief §4.2,\n * §8.3). These stand in for the project-specific components that are the center\n * of the product: each declares a full manifest (prop schema metadata, defaults,\n * inspector controls, binding permissions, slot rules, design-token hints, and\n * preview fixtures) and ships a self-contained implementation the fixture runner\n * renders. Deterministic — no time/random.\n */\n\ntype Props = Record<string, unknown>\nfunction str(value: unknown, fallback = ''): string {\n return typeof value === 'string' && value.length > 0 ? value : fallback\n}\n\n// --- project.MarketingHero -------------------------------------------------\n\nfunction MarketingHero(props: Props): ReactNode {\n const align = props.align === 'center' ? 'items-center text-center' : 'items-start text-left'\n return (\n <div className={`flex flex-col gap-3 rounded-xl border border-border bg-card p-8 ${align}`}>\n {str(props.eyebrow) ? (\n <span className=\"text-[0.7rem] font-semibold uppercase tracking-[0.14em] text-primary\">\n {str(props.eyebrow)}\n </span>\n ) : null}\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground\">\n {str(props.heading, 'Headline goes here')}\n </h2>\n {str(props.subheading) ? (\n <p className=\"max-w-prose text-sm text-muted-foreground\">{str(props.subheading)}</p>\n ) : null}\n {str(props.ctaLabel) ? (\n <span className=\"mt-1 inline-flex w-fit items-center rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground\">\n {str(props.ctaLabel)}\n </span>\n ) : null}\n </div>\n )\n}\n\nconst MarketingHeroManifest = defineComponent({\n id: 'project.MarketingHero',\n namespace: 'project',\n title: 'Marketing Hero',\n description: 'A headline hero section with eyebrow, subheading, and a call to action.',\n category: 'marketing',\n props: {\n eyebrow: { type: 'text', default: 'New', form: { label: 'Eyebrow' } },\n heading: {\n type: 'text',\n default: 'Build code-first websites',\n validation: { min: 1 },\n form: { label: 'Heading' },\n },\n subheading: {\n type: 'text',\n default: 'One canonical graph powers editing, content, and export.',\n form: { label: 'Subheading', control: 'textarea' },\n },\n ctaLabel: { type: 'text', default: 'Get started', form: { label: 'CTA label' } },\n align: {\n type: 'select',\n default: 'left',\n options: [\n { value: 'left', label: 'Left' },\n { value: 'center', label: 'Center' },\n ],\n form: { label: 'Alignment' },\n },\n },\n slots: [],\n designTokens: ['color.primary', 'space.section', 'font.display'],\n fixtures: [\n { name: 'Default' },\n {\n name: 'Centered',\n props: { align: 'center', eyebrow: 'Launch', heading: 'Ship faster', ctaLabel: 'Try it' },\n },\n { name: 'Minimal', props: { eyebrow: '', subheading: '', ctaLabel: '', heading: 'Just a headline' } },\n ],\n})\n\n// --- project.FeatureCard ---------------------------------------------------\n\nfunction FeatureCard(props: Props): ReactNode {\n const accent = props.tone === 'accent'\n return (\n <div\n className={`flex flex-col gap-2 rounded-lg border p-5 ${\n accent ? 'border-primary/30 bg-primary/5' : 'border-border bg-card'\n }`}\n >\n <div className={`grid size-8 place-items-center rounded-md ${accent ? 'bg-primary text-primary-foreground' : 'bg-muted text-foreground'}`}>\n <span className=\"text-sm font-bold\">{str(props.title, 'F').charAt(0)}</span>\n </div>\n <h3 className=\"text-sm font-semibold text-foreground\">{str(props.title, 'Feature title')}</h3>\n <p className=\"text-xs text-muted-foreground\">{str(props.body, 'A short description of the feature.')}</p>\n </div>\n )\n}\n\nconst FeatureCardManifest = defineComponent({\n id: 'project.FeatureCard',\n namespace: 'project',\n title: 'Feature Card',\n description: 'A compact card highlighting a single feature.',\n category: 'marketing',\n props: {\n title: {\n type: 'text',\n default: 'Validation first',\n validation: { min: 1 },\n form: { label: 'Title' },\n },\n body: {\n type: 'text',\n default: 'Broken bindings and missing components are explicit, never silent.',\n form: { label: 'Body', control: 'textarea' },\n },\n tone: {\n type: 'select',\n default: 'default',\n options: [\n { value: 'default', label: 'Default' },\n { value: 'accent', label: 'Accent' },\n ],\n form: { label: 'Tone' },\n },\n },\n slots: [],\n designTokens: ['color.surface', 'color.primary'],\n fixtures: [{ name: 'Default' }, { name: 'Accent', props: { tone: 'accent', title: 'AI inspectable' } }],\n})\n\n// --- project.PricingCallout ------------------------------------------------\n\nfunction PricingCallout(props: Props): ReactNode {\n const featured = props.featured === true\n return (\n <div\n className={`flex flex-col gap-1 rounded-xl border p-6 ${\n featured ? 'border-primary bg-primary/5 shadow-md' : 'border-border bg-card'\n }`}\n >\n {featured ? (\n <span className=\"mb-1 w-fit rounded-full bg-primary px-2 py-0.5 text-[0.65rem] font-semibold uppercase tracking-wide text-primary-foreground\">\n Popular\n </span>\n ) : null}\n <span className=\"text-sm font-medium text-muted-foreground\">{str(props.plan, 'Plan')}</span>\n <div className=\"flex items-baseline gap-1\">\n <span className=\"text-3xl font-semibold tracking-tight text-foreground\">{str(props.price, '$0')}</span>\n <span className=\"text-sm text-muted-foreground\">/{str(props.period, 'mo')}</span>\n </div>\n </div>\n )\n}\n\nconst PricingCalloutManifest = defineComponent({\n id: 'project.PricingCallout',\n namespace: 'project',\n title: 'Pricing Callout',\n description: 'A pricing plan callout with an optional featured emphasis.',\n category: 'commerce',\n props: {\n plan: {\n type: 'text',\n default: 'Pro',\n validation: { min: 1 },\n form: { label: 'Plan' },\n },\n price: { type: 'text', default: '$29', form: { label: 'Price' } },\n period: { type: 'text', default: 'mo', form: { label: 'Period' } },\n featured: { type: 'boolean', default: false, form: { label: 'Featured' } },\n },\n slots: [],\n designTokens: ['color.primary', 'space.card'],\n fixtures: [{ name: 'Standard' }, { name: 'Featured', props: { featured: true, plan: 'Team', price: '$79' } }],\n})\n\n// --- project.LegacyBanner (intentionally has NO implementation) -------------\n//\n// Registered manifest with no implementation — exercises the \"incompatible /\n// missing implementation\" component status (EC-055) and the renderer's\n// missing-component fallback (brief §4.11).\n\nconst LegacyBannerManifest = defineComponent({\n id: 'project.LegacyBanner',\n namespace: 'project',\n title: 'Legacy Banner',\n description: 'A deprecated banner whose implementation has not been wired up.',\n category: 'marketing',\n props: {\n message: { type: 'text', default: 'Deprecated', form: { label: 'Message' } },\n },\n slots: [],\n fixtures: [{ name: 'Default' }],\n})\n\n/** Project component manifests (including the deliberately-unimplemented one). */\nexport const projectComponentManifests: ComponentManifest[] = [\n MarketingHeroManifest,\n FeatureCardManifest,\n PricingCalloutManifest,\n LegacyBannerManifest,\n]\n\n/** Implementations for the project components — note `LegacyBanner` is absent. */\nexport const projectComponentImplementations: Record<string, ComponentType<Props>> = {\n 'project.MarketingHero': MarketingHero,\n 'project.FeatureCard': FeatureCard,\n 'project.PricingCallout': PricingCallout,\n}\n"]}
1
+ {"version":3,"file":"project-components.js","sourceRoot":"","sources":["../../../src/lib/registry/project-components.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAcpE,SAAS,GAAG,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAA;AACzE,CAAC;AAED,8EAA8E;AAE9E,SAAS,aAAa,CAAC,KAAY;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,uBAAuB,CAAA;IAC7F,OAAO,CACL,eAAK,SAAS,EAAE,mEAAmE,KAAK,EAAE,aACvF,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACpB,eAAM,SAAS,EAAC,sEAAsE,YACnF,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GACd,CACR,CAAC,CAAC,CAAC,IAAI,EACR,aAAI,SAAS,EAAC,uDAAuD,YAClE,GAAG,CAAC,KAAK,CA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AU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;CAC9G,CAAC,CAAA;AAEF,+EAA+E;AAC/E,EAAE;AACF,6EAA6E;AAC7E,uEAAuE;AACvE,4CAA4C;AAE5C,MAAM,oBAAoB,GAAG,eAAe,CAAC;IAC3C,EAAE,EAAE,sBAAsB;IAC1B,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,iEAAiE;IAC9E,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE;QACL,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;KAC7E;IACD,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;CAChC,CAAC,CAAA;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC5D,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;CACrB,CAAA;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,+BAA+B,GAAyC;IACnF,uBAAuB,EAAE,aAAa;IACtC,qBAAqB,EAAE,WAAW;IAClC,wBAAwB,EAAE,cAAc;CACzC,CAAA","sourcesContent":["import { defineComponent } from '@elytracms/core/component-registry'\nimport type { ComponentManifest } from '@elytracms/core/component-registry'\nimport type { ComponentType, ReactNode } from 'react'\n\n/**\n * Sample `project.*` components for the Studio Components surface (brief §4.2,\n * §8.3). These stand in for the project-specific components that are the center\n * of the product: each declares a full manifest (prop schema metadata, defaults,\n * inspector controls, binding permissions, slot rules, design-token hints, and\n * preview fixtures) and ships a self-contained implementation the fixture runner\n * renders. Deterministic — no time/random.\n */\n\ntype Props = Record<string, unknown>\nfunction str(value: unknown, fallback = ''): string {\n return typeof value === 'string' && value.length > 0 ? value : fallback\n}\n\n// --- project.MarketingHero -------------------------------------------------\n\nfunction MarketingHero(props: Props): ReactNode {\n const align = props.align === 'center' ? 'items-center text-center' : 'items-start text-left'\n return (\n <div className={`flex flex-col gap-3 rounded-xl border border-border bg-card p-8 ${align}`}>\n {str(props.eyebrow) ? (\n <span className=\"text-[0.7rem] font-semibold uppercase tracking-[0.14em] text-primary\">\n {str(props.eyebrow)}\n </span>\n ) : null}\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground\">\n {str(props.heading, 'Headline goes here')}\n </h2>\n {str(props.subheading) ? (\n <p className=\"max-w-prose text-sm text-muted-foreground\">{str(props.subheading)}</p>\n ) : null}\n {str(props.ctaLabel) ? (\n <span className=\"mt-1 inline-flex w-fit items-center rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground\">\n {str(props.ctaLabel)}\n </span>\n ) : null}\n </div>\n )\n}\n\nconst MarketingHeroManifest = defineComponent({\n id: 'project.MarketingHero',\n namespace: 'project',\n title: 'Marketing Hero',\n description: 'A headline hero section with eyebrow, subheading, and a call to action.',\n category: 'marketing',\n props: {\n eyebrow: { type: 'text', default: 'New', form: { label: 'Eyebrow' } },\n heading: {\n type: 'text',\n default: 'Build code-first websites',\n validation: { min: 1 },\n form: { label: 'Heading' },\n },\n subheading: {\n type: 'text',\n default: 'One canonical graph powers editing, content, and export.',\n form: { label: 'Subheading', control: 'textarea' },\n },\n ctaLabel: { type: 'text', default: 'Get started', form: { label: 'CTA label' } },\n align: {\n type: 'select',\n default: 'left',\n options: [\n { value: 'left', label: 'Left' },\n { value: 'center', label: 'Center' },\n ],\n form: { label: 'Alignment' },\n },\n },\n slots: [],\n fixtures: [\n { name: 'Default' },\n {\n name: 'Centered',\n props: { align: 'center', eyebrow: 'Launch', heading: 'Ship faster', ctaLabel: 'Try it' },\n },\n { name: 'Minimal', props: { eyebrow: '', subheading: '', ctaLabel: '', heading: 'Just a headline' } },\n ],\n})\n\n// --- project.FeatureCard ---------------------------------------------------\n\nfunction FeatureCard(props: Props): ReactNode {\n const accent = props.tone === 'accent'\n return (\n <div\n className={`flex flex-col gap-2 rounded-lg border p-5 ${\n accent ? 'border-primary/30 bg-primary/5' : 'border-border bg-card'\n }`}\n >\n <div className={`grid size-8 place-items-center rounded-md ${accent ? 'bg-primary text-primary-foreground' : 'bg-muted text-foreground'}`}>\n <span className=\"text-sm font-bold\">{str(props.title, 'F').charAt(0)}</span>\n </div>\n <h3 className=\"text-sm font-semibold text-foreground\">{str(props.title, 'Feature title')}</h3>\n <p className=\"text-xs text-muted-foreground\">{str(props.body, 'A short description of the feature.')}</p>\n </div>\n )\n}\n\nconst FeatureCardManifest = defineComponent({\n id: 'project.FeatureCard',\n namespace: 'project',\n title: 'Feature Card',\n description: 'A compact card highlighting a single feature.',\n category: 'marketing',\n props: {\n title: {\n type: 'text',\n default: 'Validation first',\n validation: { min: 1 },\n form: { label: 'Title' },\n },\n body: {\n type: 'text',\n default: 'Broken bindings and missing components are explicit, never silent.',\n form: { label: 'Body', control: 'textarea' },\n },\n tone: {\n type: 'select',\n default: 'default',\n options: [\n { value: 'default', label: 'Default' },\n { value: 'accent', label: 'Accent' },\n ],\n form: { label: 'Tone' },\n },\n },\n slots: [],\n fixtures: [{ name: 'Default' }, { name: 'Accent', props: { tone: 'accent', title: 'AI inspectable' } }],\n})\n\n// --- project.PricingCallout ------------------------------------------------\n\nfunction PricingCallout(props: Props): ReactNode {\n const featured = props.featured === true\n return (\n <div\n className={`flex flex-col gap-1 rounded-xl border p-6 ${\n featured ? 'border-primary bg-primary/5 shadow-md' : 'border-border bg-card'\n }`}\n >\n {featured ? (\n <span className=\"mb-1 w-fit rounded-full bg-primary px-2 py-0.5 text-[0.65rem] font-semibold uppercase tracking-wide text-primary-foreground\">\n Popular\n </span>\n ) : null}\n <span className=\"text-sm font-medium text-muted-foreground\">{str(props.plan, 'Plan')}</span>\n <div className=\"flex items-baseline gap-1\">\n <span className=\"text-3xl font-semibold tracking-tight text-foreground\">{str(props.price, '$0')}</span>\n <span className=\"text-sm text-muted-foreground\">/{str(props.period, 'mo')}</span>\n </div>\n </div>\n )\n}\n\nconst PricingCalloutManifest = defineComponent({\n id: 'project.PricingCallout',\n namespace: 'project',\n title: 'Pricing Callout',\n description: 'A pricing plan callout with an optional featured emphasis.',\n category: 'commerce',\n props: {\n plan: {\n type: 'text',\n default: 'Pro',\n validation: { min: 1 },\n form: { label: 'Plan' },\n },\n price: { type: 'text', default: '$29', form: { label: 'Price' } },\n period: { type: 'text', default: 'mo', form: { label: 'Period' } },\n featured: { type: 'boolean', default: false, form: { label: 'Featured' } },\n },\n slots: [],\n fixtures: [{ name: 'Standard' }, { name: 'Featured', props: { featured: true, plan: 'Team', price: '$79' } }],\n})\n\n// --- project.LegacyBanner (intentionally has NO implementation) -------------\n//\n// Registered manifest with no implementation — exercises the \"incompatible /\n// missing implementation\" component status (EC-055) and the renderer's\n// missing-component fallback (brief §4.11).\n\nconst LegacyBannerManifest = defineComponent({\n id: 'project.LegacyBanner',\n namespace: 'project',\n title: 'Legacy Banner',\n description: 'A deprecated banner whose implementation has not been wired up.',\n category: 'marketing',\n props: {\n message: { type: 'text', default: 'Deprecated', form: { label: 'Message' } },\n },\n slots: [],\n fixtures: [{ name: 'Default' }],\n})\n\n/** Project component manifests (including the deliberately-unimplemented one). */\nexport const projectComponentManifests: ComponentManifest[] = [\n MarketingHeroManifest,\n FeatureCardManifest,\n PricingCalloutManifest,\n LegacyBannerManifest,\n]\n\n/** Implementations for the project components — note `LegacyBanner` is absent. */\nexport const projectComponentImplementations: Record<string, ComponentType<Props>> = {\n 'project.MarketingHero': MarketingHero,\n 'project.FeatureCard': FeatureCard,\n 'project.PricingCallout': PricingCallout,\n}\n"]}
@@ -5,10 +5,9 @@ import { createRouter, isHierarchyTemplate, routeReachabilityIssues } from '@ely
5
5
  * `createRouter` has always computed structural issues (**route conflicts** and
6
6
  * **redirect loops**) and, before this, no studio surface showed them. The delivery
7
7
  * content client exposes them as `routerIssues`, but that path never reaches the
8
- * studio: its only producer, the Convex `createContent` kit, has no studio caller —
9
- * it serves the delivery host. So the studio computes them from the two inputs it
10
- * already holds, which is also the only way it can: routes come from config
11
- * (`resolveDeploymentRoutes`), redirects come from the editorial rail.
8
+ * studio: it serves the delivery host. So the studio computes them from the two
9
+ * inputs it already holds, which is also the only way it can: routes come from
10
+ * config (`resolveDeploymentRoutes`), redirects come from the editorial rail.
12
11
  *
13
12
  * This is NOT a revived Routes view (EC-303 retired that, correctly — routes are
14
13
  * code). It is validation of the code + data the studio already reads.
@@ -22,7 +21,7 @@ import { createRouter, isHierarchyTemplate, routeReachabilityIssues } from '@ely
22
21
  * makes `/:slug` + `/:path*` look like a conflict — measured — which the runtime
23
22
  * does not consider one. A false alarm here would be worse than no alarm: it would
24
23
  * teach developers to ignore the surface.
25
- * - **Only ENABLED redirects count** (the Convex content kit filters `row.enabled`).
24
+ * - **Only ENABLED redirects count** (`delivery:snapshot` filters `row.enabled`).
26
25
  * `enabled` is the switch for *pausing* a redirect, so a paused chain is not live
27
26
  * and must not be reported as a loop.
28
27
  *
@@ -1 +1 @@
1
- {"version":3,"file":"route-issues.js","sourceRoot":"","sources":["../../../src/lib/routes/route-issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAIrG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CAAC,MAAqC;IAC1D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,GAAG,GAAyB,EAAE,CAAA;IACpC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YACnC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E,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QACzE,8EAA8E;QAC9E,iFAAiF;QACjF,uCAAuC;QACvC,GAAG,uBAAuB,CAAC,MAAM,CAAC;KACnC,CAAA;AACH,CAAC","sourcesContent":["import { createRouter, isHierarchyTemplate, routeReachabilityIssues } from '@elytracms/core/cms-core'\nimport type { CmsValidationIssue, RedirectRecord, RouteRecord } from '@elytracms/core/cms-core'\nimport type { RedirectEntry } from '@elytracms/core/persistence'\n\n/**\n * The studio's URL-map validation (EC-469) — the pure core.\n *\n * `createRouter` has always computed structural issues (**route conflicts** and\n * **redirect loops**) and, before this, no studio surface showed them. The delivery\n * content client exposes them as `routerIssues`, but that path never reaches the\n * studio: its only producer, the Convex `createContent` kit, has no studio caller —\n * it serves the delivery host. So the studio computes them from the two inputs it\n * already holds, which is also the only way it can: routes come from config\n * (`resolveDeploymentRoutes`), redirects come from the editorial rail.\n *\n * This is NOT a revived Routes view (EC-303 retired that, correctly — routes are\n * code). It is validation of the code + data the studio already reads.\n *\n * **Fidelity is the whole point**, so both of delivery's input rules are applied\n * here, not approximated:\n *\n * - **Hierarchy mounts are filtered out** (`content/client.ts` does exactly this\n * before constructing its router). A mount (`/:path*`, EC-218) is resolved\n * per-request against the parent chain, not by the router. Counting it as a route\n * makes `/:slug` + `/:path*` look like a conflict — measured — which the runtime\n * does not consider one. A false alarm here would be worse than no alarm: it would\n * teach developers to ignore the surface.\n * - **Only ENABLED redirects count** (the Convex content kit filters `row.enabled`).\n * `enabled` is the switch for *pausing* a redirect, so a paused chain is not live\n * and must not be reported as a loop.\n *\n * `unknown-route-target` is deliberately NOT produced by the ROUTER here. Despite the\n * ticket's framing it is not a router issue: the *resolver* raises it per resolved URL\n * against the documents that exist (`content/client.ts`), so it needs a URL and a\n * document pool, neither of which a project-level check has.\n *\n * ## Unreachable declarations (EC-484)\n *\n * Beside the two router codes, this reports declarations that serve NOTHING —\n * measured, previously silent everywhere: an all-dynamic route (`/:slug`) matching\n * every URL at a depth a hierarchy mount serves; and a catch-all with a dynamic prefix\n * (`/:lang/:path*`), which every router drops and no mount is built from.\n *\n * **EC-488 narrowed the first one.** It used to mean the mount's root pages 404 though\n * they exist in the studio; the resolver now falls through to the mounts when a matched\n * route resolves no document, so those pages serve and the finding is a `warning` about\n * content-decided precedence (a page whose composed path collides with the route\n * collection's slug is still silently shadowed). The severity comes from the shared\n * `routeReachabilityIssues`, so this surface tracks it without a change here.\n *\n * This one belongs in the studio, unlike the mount-vs-mount conflicts EC-482 left to\n * `elytra doctor`, because of who meets the symptom: a 404 on a page the editor can\n * see in the studio is what an editor reports and a developer cannot reproduce from a\n * document. Naming it at the rail foot turns \"the About page is broken\" into a route\n * id. It is also not a new precedent — this function has surfaced the code-side\n * `route-conflict` since EC-469.\n *\n * The COLLECTION-dependent half of EC-484 (a mount whose collection has no `parent`\n * self-relation, so it can never compose a path) is not here: this core is given\n * routes and redirects, and `elytra doctor` — which loads the collections anyway —\n * reports it at build time, where a developer fixes it.\n */\n\n/**\n * Collapse the several reports of ONE redirect cycle into one finding.\n *\n * `createRouter` walks every redirect and reports a loop per distinct loop *entry\n * point* (`routes.ts`, EC-020) — correct for a machine, but a 2-hop cycle then reads\n * as two separate bugs at the rail foot, and fixing one makes both vanish. Every\n * rotation of a cycle visits the same set of paths, so the sorted member set is a\n * stable identity for the cycle: dedupe on it, keep the first, and two genuinely\n * different cycles still report separately. Presentation only — nothing is hidden, and\n * `createRouter`'s shared behaviour is untouched.\n */\nfunction collapseLoops(issues: readonly CmsValidationIssue[]): CmsValidationIssue[] {\n const seen = new Set<string>()\n const out: CmsValidationIssue[] = []\n for (const issue of issues) {\n if (issue.code !== 'redirect-loop') {\n out.push(issue)\n continue\n }\n const chain = issue.meta?.chain\n const key = Array.isArray(chain)\n ? [...new Set(chain.map(String))].sort().join('|')\n : issue.path.join('/')\n if (seen.has(key)) continue\n seen.add(key)\n out.push(issue)\n }\n return out\n}\n\n/** Project the stored editorial records onto the routing shape delivery resolves. */\nfunction liveRedirects(redirects: readonly RedirectEntry[]): RedirectRecord[] {\n return redirects\n .filter((entry) => entry.enabled)\n .map((entry) => ({\n id: entry.id,\n from: entry.from,\n to: entry.to,\n permanent: entry.permanent,\n }))\n}\n\n/**\n * The project's structural URL-map issues: route conflicts (from config routes),\n * redirect loops (from the enabled editorial redirects), and declarations that cannot\n * serve content at all (EC-484). Pure and total — it never throws, and an empty result\n * means \"no structural problem\", not \"not checked\".\n */\nexport function routeValidationIssues(\n routes: readonly RouteRecord[],\n redirects: readonly RedirectEntry[] = [],\n): readonly CmsValidationIssue[] {\n const routable = routes.filter((route) => !isHierarchyTemplate(route))\n return [\n ...collapseLoops(createRouter(routable, liveRedirects(redirects)).issues),\n // Routes only: the reachability checks that need the collection set stay with\n // `elytra doctor`, which has it. Passing no collections is the documented way to\n // ask for exactly the route-side half.\n ...routeReachabilityIssues(routes),\n ]\n}\n"]}
1
+ {"version":3,"file":"route-issues.js","sourceRoot":"","sources":["../../../src/lib/routes/route-issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAIrG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CAAC,MAAqC;IAC1D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,GAAG,GAAyB,EAAE,CAAA;IACpC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YACnC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACf,SAAQ;QACV,CAAC;QACD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,CAAA;QAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAA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ter, isHierarchyTemplate, routeReachabilityIssues } from '@elytracms/core/cms-core'\nimport type { CmsValidationIssue, RedirectRecord, RouteRecord } from '@elytracms/core/cms-core'\nimport type { RedirectEntry } from '@elytracms/core/persistence'\n\n/**\n * The studio's URL-map validation (EC-469) — the pure core.\n *\n * `createRouter` has always computed structural issues (**route conflicts** and\n * **redirect loops**) and, before this, no studio surface showed them. The delivery\n * content client exposes them as `routerIssues`, but that path never reaches the\n * studio: it serves the delivery host. So the studio computes them from the two\n * inputs it already holds, which is also the only way it can: routes come from\n * config (`resolveDeploymentRoutes`), redirects come from the editorial rail.\n *\n * This is NOT a revived Routes view (EC-303 retired that, correctly — routes are\n * code). It is validation of the code + data the studio already reads.\n *\n * **Fidelity is the whole point**, so both of delivery's input rules are applied\n * here, not approximated:\n *\n * - **Hierarchy mounts are filtered out** (`content/client.ts` does exactly this\n * before constructing its router). A mount (`/:path*`, EC-218) is resolved\n * per-request against the parent chain, not by the router. Counting it as a route\n * makes `/:slug` + `/:path*` look like a conflict — measured — which the runtime\n * does not consider one. A false alarm here would be worse than no alarm: it would\n * teach developers to ignore the surface.\n * - **Only ENABLED redirects count** (`delivery:snapshot` filters `row.enabled`).\n * `enabled` is the switch for *pausing* a redirect, so a paused chain is not live\n * and must not be reported as a loop.\n *\n * `unknown-route-target` is deliberately NOT produced by the ROUTER here. Despite the\n * ticket's framing it is not a router issue: the *resolver* raises it per resolved URL\n * against the documents that exist (`content/client.ts`), so it needs a URL and a\n * document pool, neither of which a project-level check has.\n *\n * ## Unreachable declarations (EC-484)\n *\n * Beside the two router codes, this reports declarations that serve NOTHING —\n * measured, previously silent everywhere: an all-dynamic route (`/:slug`) matching\n * every URL at a depth a hierarchy mount serves; and a catch-all with a dynamic prefix\n * (`/:lang/:path*`), which every router drops and no mount is built from.\n *\n * **EC-488 narrowed the first one.** It used to mean the mount's root pages 404 though\n * they exist in the studio; the resolver now falls through to the mounts when a matched\n * route resolves no document, so those pages serve and the finding is a `warning` about\n * content-decided precedence (a page whose composed path collides with the route\n * collection's slug is still silently shadowed). The severity comes from the shared\n * `routeReachabilityIssues`, so this surface tracks it without a change here.\n *\n * This one belongs in the studio, unlike the mount-vs-mount conflicts EC-482 left to\n * `elytra doctor`, because of who meets the symptom: a 404 on a page the editor can\n * see in the studio is what an editor reports and a developer cannot reproduce from a\n * document. Naming it at the rail foot turns \"the About page is broken\" into a route\n * id. It is also not a new precedent — this function has surfaced the code-side\n * `route-conflict` since EC-469.\n *\n * The COLLECTION-dependent half of EC-484 (a mount whose collection has no `parent`\n * self-relation, so it can never compose a path) is not here: this core is given\n * routes and redirects, and `elytra doctor` — which loads the collections anyway —\n * reports it at build time, where a developer fixes it.\n */\n\n/**\n * Collapse the several reports of ONE redirect cycle into one finding.\n *\n * `createRouter` walks every redirect and reports a loop per distinct loop *entry\n * point* (`routes.ts`, EC-020) — correct for a machine, but a 2-hop cycle then reads\n * as two separate bugs at the rail foot, and fixing one makes both vanish. Every\n * rotation of a cycle visits the same set of paths, so the sorted member set is a\n * stable identity for the cycle: dedupe on it, keep the first, and two genuinely\n * different cycles still report separately. Presentation only — nothing is hidden, and\n * `createRouter`'s shared behaviour is untouched.\n */\nfunction collapseLoops(issues: readonly CmsValidationIssue[]): CmsValidationIssue[] {\n const seen = new Set<string>()\n const out: CmsValidationIssue[] = []\n for (const issue of issues) {\n if (issue.code !== 'redirect-loop') {\n out.push(issue)\n continue\n }\n const chain = issue.meta?.chain\n const key = Array.isArray(chain)\n ? [...new Set(chain.map(String))].sort().join('|')\n : issue.path.join('/')\n if (seen.has(key)) continue\n seen.add(key)\n out.push(issue)\n }\n return out\n}\n\n/** Project the stored editorial records onto the routing shape delivery resolves. */\nfunction liveRedirects(redirects: readonly RedirectEntry[]): RedirectRecord[] {\n return redirects\n .filter((entry) => entry.enabled)\n .map((entry) => ({\n id: entry.id,\n from: entry.from,\n to: entry.to,\n permanent: entry.permanent,\n }))\n}\n\n/**\n * The project's structural URL-map issues: route conflicts (from config routes),\n * redirect loops (from the enabled editorial redirects), and declarations that cannot\n * serve content at all (EC-484). Pure and total — it never throws, and an empty result\n * means \"no structural problem\", not \"not checked\".\n */\nexport function routeValidationIssues(\n routes: readonly RouteRecord[],\n redirects: readonly RedirectEntry[] = [],\n): readonly CmsValidationIssue[] {\n const routable = routes.filter((route) => !isHierarchyTemplate(route))\n return [\n ...collapseLoops(createRouter(routable, liveRedirects(redirects)).issues),\n // Routes only: the reachability checks that need the collection set stay with\n // `elytra doctor`, which has it. Passing no collections is the documented way to\n // ask for exactly the route-side half.\n ...routeReachabilityIssues(routes),\n ]\n}\n"]}
package/dist/lib/theme.js CHANGED
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Theme controller (light/dark). The studio renders dark-first (the SSR default
3
3
  * and the `<html class="dark">` baseline); a stored preference flips the `dark`
4
- * class on the document element. Light mode is the absence of that class — the
5
- * design tokens define `:root` (light) and `.dark` overrides (see tokens.css).
4
+ * class on the document element. Light mode is the absence of that class; the
5
+ * class flips `color-scheme`, which picks each token's `light-dark()` value
6
+ * (see tokens.css).
6
7
  */
7
8
  import { createLocalPreference } from './local-preference.js';
8
9
  export const THEME_STORAGE_KEY = 'elytra-theme';
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/lib/theme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAI1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAU,MAAM,CAAA;AAE1C,uEAAuE;AACvE,MAAM,UAAU,UAAU,CAAC,KAAY,EAAE,IAAiB;IACxD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,KAAK,MAAM,CAAC,CAAA;AACjD,CAAC;AAED,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,UAAU,GAAG,qBAAqB,CAAQ,iBAAiB,EAAE;IACjE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;CACzB,CAAC,CAAA;AAEF,qEAAqE;AACrE,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,+CAA+C,iBAAiB,mFAAmF,CAAA","sourcesContent":["/**\n * Theme controller (light/dark). The studio renders dark-first (the SSR default\n * and the `<html class=\"dark\">` baseline); a stored preference flips the `dark`\n * class on the document element. Light mode is the absence of that class — the\n * design tokens define `:root` (light) and `.dark` overrides (see tokens.css).\n */\nimport { createLocalPreference } from './local-preference'\n\nexport type Theme = 'light' | 'dark'\n\nexport const THEME_STORAGE_KEY = 'elytra-theme'\nexport const DEFAULT_THEME: Theme = 'dark'\n\n/** Apply a theme to the document root by toggling the `dark` class. */\nexport function applyTheme(theme: Theme, root: HTMLElement): void {\n root.classList.toggle('dark', theme === 'dark')\n}\n\n// No `default` (EC-329): `readStoredTheme` must return `null` — not a fallback\n// theme — when nothing is stored, so `theme-context.tsx`'s mount effect can\n// fall back to whatever the pre-hydration script already applied to the DOM\n// (FOUC prevention) instead of silently overriding it with a hardcoded default.\nconst preference = createLocalPreference<Theme>(THEME_STORAGE_KEY, {\n decode: (raw) => (raw === 'light' || raw === 'dark' ? raw : undefined),\n encode: (theme) => theme,\n})\n\n/** Read the persisted preference, or null when unset/unavailable. */\nexport function readStoredTheme(): Theme | null {\n return preference.read()\n}\n\n/** Persist the preference (best-effort; storage may be unavailable). */\nexport function storeTheme(theme: Theme): void {\n preference.store(theme)\n}\n\n/**\n * Inline script body that runs before hydration to apply the stored theme,\n * preventing a flash of the wrong theme. Injected as a raw <script> in the\n * document head; defaults to dark when no preference is stored.\n */\nexport const THEME_INIT_SCRIPT = `(function(){try{var t=localStorage.getItem('${THEME_STORAGE_KEY}');document.documentElement.classList.toggle('dark',t!=='light');}catch(e){}})();`\n"]}
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/lib/theme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAI1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAU,MAAM,CAAA;AAE1C,uEAAuE;AACvE,MAAM,UAAU,UAAU,CAAC,KAAY,EAAE,IAAiB;IACxD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,KAAK,MAAM,CAAC,CAAA;AACjD,CAAC;AAED,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,UAAU,GAAG,qBAAqB,CAAQ,iBAAiB,EAAE;IACjE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;CACzB,CAAC,CAAA;AAEF,qEAAqE;AACrE,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,+CAA+C,iBAAiB,mFAAmF,CAAA","sourcesContent":["/**\n * Theme controller (light/dark). The studio renders dark-first (the SSR default\n * and the `<html class=\"dark\">` baseline); a stored preference flips the `dark`\n * class on the document element. Light mode is the absence of that class; the\n * class flips `color-scheme`, which picks each token's `light-dark()` value\n * (see tokens.css).\n */\nimport { createLocalPreference } from './local-preference'\n\nexport type Theme = 'light' | 'dark'\n\nexport const THEME_STORAGE_KEY = 'elytra-theme'\nexport const DEFAULT_THEME: Theme = 'dark'\n\n/** Apply a theme to the document root by toggling the `dark` class. */\nexport function applyTheme(theme: Theme, root: HTMLElement): void {\n root.classList.toggle('dark', theme === 'dark')\n}\n\n// No `default` (EC-329): `readStoredTheme` must return `null` — not a fallback\n// theme — when nothing is stored, so `theme-context.tsx`'s mount effect can\n// fall back to whatever the pre-hydration script already applied to the DOM\n// (FOUC prevention) instead of silently overriding it with a hardcoded default.\nconst preference = createLocalPreference<Theme>(THEME_STORAGE_KEY, {\n decode: (raw) => (raw === 'light' || raw === 'dark' ? raw : undefined),\n encode: (theme) => theme,\n})\n\n/** Read the persisted preference, or null when unset/unavailable. */\nexport function readStoredTheme(): Theme | null {\n return preference.read()\n}\n\n/** Persist the preference (best-effort; storage may be unavailable). */\nexport function storeTheme(theme: Theme): void {\n preference.store(theme)\n}\n\n/**\n * Inline script body that runs before hydration to apply the stored theme,\n * preventing a flash of the wrong theme. Injected as a raw <script> in the\n * document head; defaults to dark when no preference is stored.\n */\nexport const THEME_INIT_SCRIPT = `(function(){try{var t=localStorage.getItem('${THEME_STORAGE_KEY}');document.documentElement.classList.toggle('dark',t!=='light');}catch(e){}})();`\n"]}
@@ -108,24 +108,21 @@ export function projectSweepWebhookTag(projectId) {
108
108
  * A single keystroke-batch on a live page was dropping every cached page *and*
109
109
  * every cached 404 on the site (EC-489 widened 404s to carry collection tags).
110
110
  *
111
- * ## The one documented exception (deliberate, not an oversight)
111
+ * ## No exceptions (EC-574)
112
112
  *
113
- * `cms-data-sources` rows are the sole document class the published delivery
114
- * snapshot reads from the **draft** side, on purpose — data sources are project
115
- * config, so published bindings must resolve even when the defining row is not
116
- * itself published (`studio/convex/delivery.ts`). A save to that system
117
- * collection therefore *can* change published output and is now silent.
118
- * Accepted because: (a) it is a retired-builder remnant (EC-166/167) with
119
- * **zero writers** left in the studio — `provisionSource`/`removeSource` have
120
- * no call sites; (b) it only ever invalidated *by accident*, through the
121
- * truncated-summary sweep fallback, never through a precise tag; and (c) a
122
- * collection-scoped carve-out cannot work here — the collection name is exactly
123
- * what the truncated summary loses. If that data layer is ever revived, the fix
124
- * belongs at the delivery trust boundary (serve sources published-only), not by
125
- * re-broadening this set.
113
+ * This set used to carry one documented exception: `cms-data-sources` rows, the
114
+ * one document class the published delivery snapshot read from the **draft**
115
+ * side, so a draft save there could change published output silently (the
116
+ * wave-0089 finding). EC-574 deleted the data-binding subsystem and the
117
+ * snapshot's `sources` strand with it (`studio/convex/delivery.ts`), so every
118
+ * document class now reaches delivery through its published pin only and this
119
+ * set is complete as written.
126
120
  */
127
121
  const PUBLISHED_STATE_OPERATIONS = new Set([
128
122
  'documents.delete',
123
+ // EC-576: the drop takes every pinned version with it; its input carries no `ref`,
124
+ // so it resolves to the whole-project sweep below — the only correct tag for it.
125
+ 'documents.clear',
129
126
  'documents.publish',
130
127
  'documents.unpublish',
131
128
  'documents.pinVersion',
@@ -1 +1 @@
1
- {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/lib/webhooks/tags.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,SAAS,MAAM,CAAC,SAAiB,EAAE,GAAW;IAC5C,OAAO,KAAK,SAAS,IAAI,GAAG,EAAE,CAAA;AAChC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,UAAkB,EAAE,EAAU;IAC7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AE,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAA;AACtE,CAAC;AAED,4EAA4E;AAC5E,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1E,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CACxB,SAAiB,EACjB,KAAyD;IAEzD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC/C,MAAM,OAAO,GACX,KAAK,CAAC,SAAS,KAAK,eAAe;QACjC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC,CAAC,QAAQ,CAAE,MAAM,EAAE,CAAC,OAAO,CAAkC,EAAE,EAAE,CAAC,CAAA;IACvE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAC,SAAS,KAAK,eAAe;QACxC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,EAAE;QAClF,CAAC,CAAC,IAAI,CAAA;AACV,CAAC","sourcesContent":["import type { OperationEvent } from '@elytracms/core/operations'\n\n/**\n * Pure tag computation for the EC-146 revalidation webhooks: map a succeeded\n * publish-shaped operation event onto the Next cache tags it invalidates.\n *\n * ## Tag format (mirror of `packages/next/src/cache.ts`)\n *\n * The canonical tag format lives in `@elytracms/next` (`src/cache.ts`). The\n * builder cannot depend on that package — it would drag the `next` peer\n * dependency into the studio bundle — so the three formatters are mirrored\n * here. Both sides pin the exact literal strings in their tests\n * (`tags.test.ts` here, `cache.test.ts` there) to keep them in lock-step.\n *\n * Every emitted tag is scoped `p:<projectId>:…` — the dispatcher always knows\n * the project id, and the scope keeps multi-project hosts from\n * cross-invalidating. Hosts must configure the same id as `cache.scope`.\n *\n * ## Which events produce which tags\n *\n * The gate is **\"can this operation change PUBLISHED output?\"** — not \"did this\n * operation touch a document\" (EC-501). Live delivery is published-only, so an\n * operation that cannot move published state has no cache entry to drop and\n * every tag it emits is waste by construction.\n *\n * - **Document publish/unpublish/pin/delete** (`documents.publish`,\n * `documents.unpublish`, `documents.pinVersion`, `documents.delete`): the\n * document's own\n * `doc:<collection>:<id>` tag — dropping its detail page *and every cached\n * list that actually contained it* (fetch-time tagging) — plus the coarse\n * `collection:<name>:<locale>` membership tag for **all** configured\n * locales, sweeping cached lists whose membership may have changed\n * (new/removed/newly-matching documents).\n * - **Document SAVE** (`documents.upsert`) fires **nothing** — see\n * {@link PUBLISHED_STATE_OPERATIONS}.\n * - **Editorial redirect write** (`redirects.save`, `redirects.remove`,\n * EC-510): the whole-project sweep tag — deliberately coarse, see\n * {@link ROUTING_OPERATIONS}.\n * - **Asset edit** (`assets.upsert` of an existing asset, `assets.remove`,\n * EC-227): the `asset:<id>` tag, dropping exactly the pages that *baked* that\n * asset's delivery shape (alt/dimensions/url). An `assets.upsert` CREATE (no\n * id in the summary — minted server-side) fires nothing: a brand-new asset is\n * in no cached page yet.\n * - **Fallback**: when a `documents` (or `assets.remove`) event's input summary\n * was truncated past the identity (EC-139 caps summaries at 160 chars), the\n * project sweep tag is emitted — coarse, always correct, mirroring the EC-155\n * reference-index fallback. Since EC-501 the surviving document operations\n * all carry a small `{ projectId, ref }` input, so this is a defensive path\n * rather than a routine one — the routine truncation was the document-bearing\n * `documents.upsert`, which no longer reaches here at all.\n *\n * Every branch needs only the `projectId`, which serializes FIRST in every\n * operation input (measured 2026-08-01 across the real `redirects.save`\n * shapes), so {@link projectIdOfSummary}'s regex survives truncation even when\n * the rest of the summary is cut mid-string.\n */\n\nfunction scoped(projectId: string, tag: string): string {\n return `p:${projectId}:${tag}`\n}\n\n/** `p:<projectId>:doc:<collection>:<id>` — mirror of `docCacheTag`. */\nexport function docWebhookTag(projectId: string, collection: string, id: string): string {\n return scoped(projectId, `doc:${collection}:${id}`)\n}\n\n/** `p:<projectId>:collection:<name>:<locale>` — mirror of `collectionCacheTag`. */\nexport function collectionWebhookTag(\n projectId: string,\n collection: string,\n locale: string,\n): string {\n return scoped(projectId, `collection:${collection}:${locale}`)\n}\n\n/** `p:<projectId>:asset:<id>` — mirror of `assetCacheTag` (EC-227). */\nexport function assetWebhookTag(projectId: string, assetId: string): string {\n return scoped(projectId, `asset:${assetId}`)\n}\n\n/** `p:<projectId>:project` — mirror of `projectSweepTag`. */\nexport function projectSweepWebhookTag(projectId: string): string {\n return scoped(projectId, 'project')\n}\n\n/**\n * The document operations that can change **published** output, and therefore\n * the ones whose success must reach the host's revalidate endpoint.\n *\n * EC-224: publish/unpublish/pinVersion move the version pointer; their\n * `{ projectId, ref }` input drives the doc + per-locale collection tag set\n * (the flat `documents.setState` op is gone). `documents.delete` removes the\n * row outright, taking any pinned version with it.\n *\n * ## Why `documents.upsert` (a draft SAVE) is NOT here — EC-501\n *\n * A save writes the **draft row only**; published readers serve the *pinned\n * version snapshot*, never the draft. That is structural, not a heuristic:\n *\n * - the operation hands the document straight to `cms.upsertDocument`\n * (`core/operations/documents.ts`), whose Convex arg list has no\n * `publishedVersion` field at all (`studio/convex/cms.ts` `upsertDocument`),\n * and whose in-memory twin re-attaches the previous pin verbatim with the\n * comment \"only publish/unpublish move the pointer\"\n * (`core/persistence/cms.ts`);\n * - the published delivery snapshot skips every row without a pin and serves\n * the pinned snapshot, \"never falling back to the draft\"\n * (`studio/convex/delivery.ts`);\n * - the Convex write-chokepoint trigger already encodes exactly this verdict\n * server-side — it schedules a revalidation only when `publishedVersion`\n * actually changed, \"a plain draft save must not invalidate the published\n * host cache\" (`studio/convex/triggers.ts`, EC-286/EC-146). This emitter was\n * simply the one path that never asked.\n *\n * Measured before the change (connected studio → capture endpoint, one short\n * editing session): 12 `documents.upsert` deliveries to 1 `documents.publish`,\n * and 7 of those 12 carried the **whole-project sweep** tag rather than the\n * document's own — because a real document's `inputSummary` exceeds the EC-139\n * 160-char cap, so the identity parse below fails and falls back to the sweep.\n * A single keystroke-batch on a live page was dropping every cached page *and*\n * every cached 404 on the site (EC-489 widened 404s to carry collection tags).\n *\n * ## The one documented exception (deliberate, not an oversight)\n *\n * `cms-data-sources` rows are the sole document class the published delivery\n * snapshot reads from the **draft** side, on purpose — data sources are project\n * config, so published bindings must resolve even when the defining row is not\n * itself published (`studio/convex/delivery.ts`). A save to that system\n * collection therefore *can* change published output and is now silent.\n * Accepted because: (a) it is a retired-builder remnant (EC-166/167) with\n * **zero writers** left in the studio — `provisionSource`/`removeSource` have\n * no call sites; (b) it only ever invalidated *by accident*, through the\n * truncated-summary sweep fallback, never through a precise tag; and (c) a\n * collection-scoped carve-out cannot work here — the collection name is exactly\n * what the truncated summary loses. If that data layer is ever revived, the fix\n * belongs at the delivery trust boundary (serve sources published-only), not by\n * re-broadening this set.\n */\nconst PUBLISHED_STATE_OPERATIONS = new Set([\n 'documents.delete',\n 'documents.publish',\n 'documents.unpublish',\n 'documents.pinVersion',\n])\n/**\n * The **routing** operations (EC-510): editorial redirects, which EC-303 moved\n * out of config and into the database. Every *enabled* redirect row is\n * projected into the delivery snapshot the router and `resolvePage` consume\n * (`studio/convex/delivery.ts`), in BOTH perspectives — so saving, retargeting,\n * disabling or deleting one changes published output, exactly the question\n * {@link PUBLISHED_STATE_OPERATIONS} asks. They belong to that question, not a\n * parallel one; they are a separate set only because their tag is different.\n *\n * ## Why the coarse project sweep and NOT a targeted `route:<from>:<locale>`\n *\n * The tag vocabulary has `route:<pattern>:<locale>` and a redirect's `from` IS\n * a route path, so a targeted tag looks available. It is not — it would be\n * silently wrong in four independent ways, and a silent wrong invalidation is\n * the exact failure family EC-489/EC-501/this ticket exist to remove:\n *\n * 1. **`redirects.remove` has no `from` at all.** Its input is\n * `{ projectId, id }` (`core/operations/redirects.ts`), so the path whose\n * cache entry must drop is not in the event. Precision is unobtainable, and\n * a delete is the single most important case to get right.\n * 2. **A save can RENAME `from`.** The event carries only the NEW path; the OLD\n * one keeps serving a redirect that no longer exists. `OperationEvent` has\n * `operation`/`kind`/`status`/`inputSummary` and nothing else — no result,\n * no previous row (EC-501 rejected widening it for the same reason) — so the\n * emitter cannot even detect that a rename happened.\n * 3. **Normalization would have to be mirrored.** The cached entry is tagged\n * with the resolver's `normalizePath(url)`; `from` is editor-typed free text\n * (`z.string().min(1)`), stored verbatim and normalized only at match time.\n * A trailing slash or a query string would produce a tag that matches\n * nothing — no error, no invalidation.\n * 4. **The identity truncates.** MEASURED 2026-08-01 on the real schema: a\n * Konditorei-shaped migration redirect (legacy permalink → new path)\n * serializes to 226 chars and an EC-311 `meta` bag to 216, both past the\n * EC-139 160-char cap. A `from`-based tag would work on a demo-sized\n * redirect and degrade on the real one — EC-501's pathology in reverse.\n *\n * The sweep has none of those failure modes: it needs only `projectId`, which\n * serializes first and therefore survives truncation, so **the truncation\n * fallback and the primary answer are the same tag** — correct by design rather\n * than by accident. `nextCacheTags` stamps `project` on every cached entry, so\n * it is guaranteed to reach the affected URL whatever the redirect changed.\n *\n * ## The cost, and why it is affordable here (unlike EC-501)\n *\n * A sweep drops every cached entry, lazily on next read. That was intolerable\n * for `documents.upsert` because it fired on every ~1s keystroke batch and\n * *none* of those invalidations were necessary. A redirect write is an\n * explicit form save on a rail with `inlineEdit: false` and no autosave\n * (`redirects-collection-view-source.ts`), and every one of them IS a routing\n * change. Measured on a connected studio: a session that deliberately exercised\n * every mutation kind — create, retarget, disable, rename, delete — produced 5\n * writes. The Convex-side path already sweeps the project on every document\n * publish (`convex/revalidate.ts`, \"the honest, reliable v1\"), so this is\n * strictly rarer than a cost the engine already pays.\n *\n * If a precise redirect tag is ever wanted, the place to get it is the Convex\n * write chokepoint, where `change.oldDoc` holds the previous `from` — not here,\n * where the information does not exist.\n */\nconst ROUTING_OPERATIONS = new Set(['redirects.save', 'redirects.remove'])\n\n/**\n * Asset-record mutations (EC-227): editing an asset (alt/dimensions/re-upload)\n * must drop the published pages that *baked* its delivery shape, which carry the\n * `asset:<id>` tag. `assets.remove` always carries `assetId`; `assets.upsert`\n * carries `asset.id` only on an EDIT (a CREATE mints the id server-side).\n */\nconst ASSET_OPERATIONS = new Set(['assets.upsert', 'assets.remove'])\n\n/** One computed webhook emission: which project, why, and which tags. */\nexport interface WebhookTagSet {\n projectId: string\n /** The operation name, carried verbatim as the webhook `event`. */\n event: string\n /** Sorted, deduplicated, fully scoped Next tag strings. */\n tags: string[]\n}\n\n/** Tolerant parse of an EC-139 input summary (may be truncated past 160 chars). */\nfunction parseSummary(summary: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(summary)\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Extract the projectId even from a truncated summary (it serializes first). */\nfunction projectIdOfSummary(summary: string): string | undefined {\n const match = /\"projectId\":\"([^\"]+)\"/.exec(summary)\n return match?.[1]\n}\n\nfunction documentRefOf(value: unknown): { collection: string; id: string } | undefined {\n if (typeof value !== 'object' || value === null) return undefined\n const candidate = value as { collection?: unknown; id?: unknown }\n return typeof candidate.collection === 'string' &&\n candidate.collection.length > 0 &&\n typeof candidate.id === 'string' &&\n candidate.id.length > 0\n ? { collection: candidate.collection, id: candidate.id }\n : undefined\n}\n\n/**\n * Compute the webhook tag set for one lifecycle event, or `null` when the\n * event is not a successful publish-shaped command (queries, failures, and\n * unrelated domains never fire webhooks).\n */\nexport function webhookTagsForEvent(\n event: Pick<OperationEvent, 'operation' | 'kind' | 'status' | 'inputSummary'>,\n options: { locales: readonly string[] },\n): WebhookTagSet | null {\n if (event.status !== 'succeeded' || event.kind !== 'command') return null\n\n const isDocument = PUBLISHED_STATE_OPERATIONS.has(event.operation)\n const isAsset = ASSET_OPERATIONS.has(event.operation)\n const isRouting = ROUTING_OPERATIONS.has(event.operation)\n if (!isDocument && !isAsset && !isRouting) return null\n\n const projectId = projectIdOfSummary(event.inputSummary)\n if (projectId === undefined) return null\n\n // EC-510: one answer for every redirect write — see `ROUTING_OPERATIONS` for\n // why the targeted `route:` tag is unobtainable and the sweep is the honest one.\n if (isRouting) {\n return { projectId, event: event.operation, tags: [projectSweepWebhookTag(projectId)] }\n }\n\n if (isAsset) return assetTagsForEvent(projectId, event)\n\n const parsed = parseSummary(event.inputSummary)\n const ref = documentRefOf(parsed?.['ref']) ?? documentRefOf(parsed?.['document'])\n if (!ref) {\n // Truncated summary (large upsert payload): honest coarse fallback.\n return { projectId, event: event.operation, tags: [projectSweepWebhookTag(projectId)] }\n }\n\n const tags = new Set<string>([docWebhookTag(projectId, ref.collection, ref.id)])\n for (const locale of options.locales) {\n tags.add(collectionWebhookTag(projectId, ref.collection, locale))\n }\n // EC-207: ROUTES are config-owned (a code deploy, which rebuilds the host), so\n // a document event never needs a `route:` tag. Redirects are NOT — EC-303 made\n // them editorial data and EC-510 gives their own operations the project sweep\n // (see `ROUTING_OPERATIONS`); a *document* write still cannot change them.\n return { projectId, event: event.operation, tags: [...tags].sort() }\n}\n\n/** A non-empty string, else `undefined` (the asset id out of a summary). */\nfunction stringOf(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined\n}\n\n/**\n * Tags for an asset mutation (EC-227). The edit cases — `assets.remove` (carries\n * `assetId`) and `assets.upsert` of an existing asset (carries `asset.id`) —\n * emit exactly `asset:<id>`, dropping the pages that baked that asset. An\n * `assets.upsert` with **no** id is a CREATE: the id is minted server-side and a\n * brand-new asset cannot be baked into any existing page, so it invalidates\n * nothing (`null`, no webhook). A `remove` missing its id means a truncated\n * summary — sweep the project (coarse, always correct — the document fallback).\n */\nfunction assetTagsForEvent(\n projectId: string,\n event: Pick<OperationEvent, 'operation' | 'inputSummary'>,\n): WebhookTagSet | null {\n const parsed = parseSummary(event.inputSummary)\n const assetId =\n event.operation === 'assets.remove'\n ? stringOf(parsed?.['assetId'])\n : stringOf((parsed?.['asset'] as { id?: unknown } | undefined)?.id)\n if (assetId) {\n return { projectId, event: event.operation, tags: [assetWebhookTag(projectId, assetId)] }\n }\n return event.operation === 'assets.remove'\n ? { projectId, event: event.operation, tags: [projectSweepWebhookTag(projectId)] }\n : null\n}\n"]}
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/lib/webhooks/tags.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,SAAS,MAAM,CAAC,SAAiB,EAAE,GAAW;IAC5C,OAAO,KAAK,SAAS,IAAI,GAAG,EAAE,CAAA;AAChC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,UAAkB,EAAE,EAAU;IAC7E,OAAO,MAAM,CAAC,SAAS,EAAE,OAAO,UAAU,IAAI,EAAE,EAAE,CAAC,CAAA;AACrD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,oBAAoB,CAClC,SAAiB,EACjB,UAAkB,EAClB,MAAc;IAEd,OAAO,MAAM,CAAC,SAAS,EAAE,cAAc,UAAU,IAAI,MAAM,EAAE,CAAC,CAAA;AAChE,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,OAAe;IAChE,OAAO,MAAM,CAAC,SAAS,EAAE,SAAS,OAAO,EAAE,CAAC,CAAA;AAC9C,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,OAAO,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AACrC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8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MAAM,EAAE,CAAC,OAAO,CAAkC,EAAE,EAAE,CAAC,CAAA;IACvE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAC,SAAS,KAAK,eAAe;QACxC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,EAAE;QAClF,CAAC,CAAC,IAAI,CAAA;AACV,CAAC","sourcesContent":["import type { OperationEvent } from '@elytracms/core/operations'\n\n/**\n * Pure tag computation for the EC-146 revalidation webhooks: map a succeeded\n * publish-shaped operation event onto the Next cache tags it invalidates.\n *\n * ## Tag format (mirror of `packages/next/src/cache.ts`)\n *\n * The canonical tag format lives in `@elytracms/next` (`src/cache.ts`). The\n * builder cannot depend on that package — it would drag the `next` peer\n * dependency into the studio bundle — so the three formatters are mirrored\n * here. Both sides pin the exact literal strings in their tests\n * (`tags.test.ts` here, `cache.test.ts` there) to keep them in lock-step.\n *\n * Every emitted tag is scoped `p:<projectId>:…` — the dispatcher always knows\n * the project id, and the scope keeps multi-project hosts from\n * cross-invalidating. Hosts must configure the same id as `cache.scope`.\n *\n * ## Which events produce which tags\n *\n * The gate is **\"can this operation change PUBLISHED output?\"** — not \"did this\n * operation touch a document\" (EC-501). Live delivery is published-only, so an\n * operation that cannot move published state has no cache entry to drop and\n * every tag it emits is waste by construction.\n *\n * - **Document publish/unpublish/pin/delete** (`documents.publish`,\n * `documents.unpublish`, `documents.pinVersion`, `documents.delete`): the\n * document's own\n * `doc:<collection>:<id>` tag — dropping its detail page *and every cached\n * list that actually contained it* (fetch-time tagging) — plus the coarse\n * `collection:<name>:<locale>` membership tag for **all** configured\n * locales, sweeping cached lists whose membership may have changed\n * (new/removed/newly-matching documents).\n * - **Document SAVE** (`documents.upsert`) fires **nothing** — see\n * {@link PUBLISHED_STATE_OPERATIONS}.\n * - **Editorial redirect write** (`redirects.save`, `redirects.remove`,\n * EC-510): the whole-project sweep tag — deliberately coarse, see\n * {@link ROUTING_OPERATIONS}.\n * - **Asset edit** (`assets.upsert` of an existing asset, `assets.remove`,\n * EC-227): the `asset:<id>` tag, dropping exactly the pages that *baked* that\n * asset's delivery shape (alt/dimensions/url). An `assets.upsert` CREATE (no\n * id in the summary — minted server-side) fires nothing: a brand-new asset is\n * in no cached page yet.\n * - **Fallback**: when a `documents` (or `assets.remove`) event's input summary\n * was truncated past the identity (EC-139 caps summaries at 160 chars), the\n * project sweep tag is emitted — coarse, always correct, mirroring the EC-155\n * reference-index fallback. Since EC-501 the surviving document operations\n * all carry a small `{ projectId, ref }` input, so this is a defensive path\n * rather than a routine one — the routine truncation was the document-bearing\n * `documents.upsert`, which no longer reaches here at all.\n *\n * Every branch needs only the `projectId`, which serializes FIRST in every\n * operation input (measured 2026-08-01 across the real `redirects.save`\n * shapes), so {@link projectIdOfSummary}'s regex survives truncation even when\n * the rest of the summary is cut mid-string.\n */\n\nfunction scoped(projectId: string, tag: string): string {\n return `p:${projectId}:${tag}`\n}\n\n/** `p:<projectId>:doc:<collection>:<id>` — mirror of `docCacheTag`. */\nexport function docWebhookTag(projectId: string, collection: string, id: string): string {\n return scoped(projectId, `doc:${collection}:${id}`)\n}\n\n/** `p:<projectId>:collection:<name>:<locale>` — mirror of `collectionCacheTag`. */\nexport function collectionWebhookTag(\n projectId: string,\n collection: string,\n locale: string,\n): string {\n return scoped(projectId, `collection:${collection}:${locale}`)\n}\n\n/** `p:<projectId>:asset:<id>` — mirror of `assetCacheTag` (EC-227). */\nexport function assetWebhookTag(projectId: string, assetId: string): string {\n return scoped(projectId, `asset:${assetId}`)\n}\n\n/** `p:<projectId>:project` — mirror of `projectSweepTag`. */\nexport function projectSweepWebhookTag(projectId: string): string {\n return scoped(projectId, 'project')\n}\n\n/**\n * The document operations that can change **published** output, and therefore\n * the ones whose success must reach the host's revalidate endpoint.\n *\n * EC-224: publish/unpublish/pinVersion move the version pointer; their\n * `{ projectId, ref }` input drives the doc + per-locale collection tag set\n * (the flat `documents.setState` op is gone). `documents.delete` removes the\n * row outright, taking any pinned version with it.\n *\n * ## Why `documents.upsert` (a draft SAVE) is NOT here — EC-501\n *\n * A save writes the **draft row only**; published readers serve the *pinned\n * version snapshot*, never the draft. That is structural, not a heuristic:\n *\n * - the operation hands the document straight to `cms.upsertDocument`\n * (`core/operations/documents.ts`), whose Convex arg list has no\n * `publishedVersion` field at all (`studio/convex/cms.ts` `upsertDocument`),\n * and whose in-memory twin re-attaches the previous pin verbatim with the\n * comment \"only publish/unpublish move the pointer\"\n * (`core/persistence/cms.ts`);\n * - the published delivery snapshot skips every row without a pin and serves\n * the pinned snapshot, \"never falling back to the draft\"\n * (`studio/convex/delivery.ts`);\n * - the Convex write-chokepoint trigger already encodes exactly this verdict\n * server-side — it schedules a revalidation only when `publishedVersion`\n * actually changed, \"a plain draft save must not invalidate the published\n * host cache\" (`studio/convex/triggers.ts`, EC-286/EC-146). This emitter was\n * simply the one path that never asked.\n *\n * Measured before the change (connected studio → capture endpoint, one short\n * editing session): 12 `documents.upsert` deliveries to 1 `documents.publish`,\n * and 7 of those 12 carried the **whole-project sweep** tag rather than the\n * document's own — because a real document's `inputSummary` exceeds the EC-139\n * 160-char cap, so the identity parse below fails and falls back to the sweep.\n * A single keystroke-batch on a live page was dropping every cached page *and*\n * every cached 404 on the site (EC-489 widened 404s to carry collection tags).\n *\n * ## No exceptions (EC-574)\n *\n * This set used to carry one documented exception: `cms-data-sources` rows, the\n * one document class the published delivery snapshot read from the **draft**\n * side, so a draft save there could change published output silently (the\n * wave-0089 finding). EC-574 deleted the data-binding subsystem and the\n * snapshot's `sources` strand with it (`studio/convex/delivery.ts`), so every\n * document class now reaches delivery through its published pin only and this\n * set is complete as written.\n */\nconst PUBLISHED_STATE_OPERATIONS = new Set([\n 'documents.delete',\n // EC-576: the drop takes every pinned version with it; its input carries no `ref`,\n // so it resolves to the whole-project sweep below — the only correct tag for it.\n 'documents.clear',\n 'documents.publish',\n 'documents.unpublish',\n 'documents.pinVersion',\n])\n/**\n * The **routing** operations (EC-510): editorial redirects, which EC-303 moved\n * out of config and into the database. Every *enabled* redirect row is\n * projected into the delivery snapshot the router and `resolvePage` consume\n * (`studio/convex/delivery.ts`), in BOTH perspectives — so saving, retargeting,\n * disabling or deleting one changes published output, exactly the question\n * {@link PUBLISHED_STATE_OPERATIONS} asks. They belong to that question, not a\n * parallel one; they are a separate set only because their tag is different.\n *\n * ## Why the coarse project sweep and NOT a targeted `route:<from>:<locale>`\n *\n * The tag vocabulary has `route:<pattern>:<locale>` and a redirect's `from` IS\n * a route path, so a targeted tag looks available. It is not — it would be\n * silently wrong in four independent ways, and a silent wrong invalidation is\n * the exact failure family EC-489/EC-501/this ticket exist to remove:\n *\n * 1. **`redirects.remove` has no `from` at all.** Its input is\n * `{ projectId, id }` (`core/operations/redirects.ts`), so the path whose\n * cache entry must drop is not in the event. Precision is unobtainable, and\n * a delete is the single most important case to get right.\n * 2. **A save can RENAME `from`.** The event carries only the NEW path; the OLD\n * one keeps serving a redirect that no longer exists. `OperationEvent` has\n * `operation`/`kind`/`status`/`inputSummary` and nothing else — no result,\n * no previous row (EC-501 rejected widening it for the same reason) — so the\n * emitter cannot even detect that a rename happened.\n * 3. **Normalization would have to be mirrored.** The cached entry is tagged\n * with the resolver's `normalizePath(url)`; `from` is editor-typed free text\n * (`z.string().min(1)`), stored verbatim and normalized only at match time.\n * A trailing slash or a query string would produce a tag that matches\n * nothing — no error, no invalidation.\n * 4. **The identity truncates.** MEASURED 2026-08-01 on the real schema: a\n * Konditorei-shaped migration redirect (legacy permalink → new path)\n * serializes to 226 chars and an EC-311 `meta` bag to 216, both past the\n * EC-139 160-char cap. A `from`-based tag would work on a demo-sized\n * redirect and degrade on the real one — EC-501's pathology in reverse.\n *\n * The sweep has none of those failure modes: it needs only `projectId`, which\n * serializes first and therefore survives truncation, so **the truncation\n * fallback and the primary answer are the same tag** — correct by design rather\n * than by accident. `nextCacheTags` stamps `project` on every cached entry, so\n * it is guaranteed to reach the affected URL whatever the redirect changed.\n *\n * ## The cost, and why it is affordable here (unlike EC-501)\n *\n * A sweep drops every cached entry, lazily on next read. That was intolerable\n * for `documents.upsert` because it fired on every ~1s keystroke batch and\n * *none* of those invalidations were necessary. A redirect write is an\n * explicit form save on a rail with `inlineEdit: false` and no autosave\n * (`redirects-collection-view-source.ts`), and every one of them IS a routing\n * change. Measured on a connected studio: a session that deliberately exercised\n * every mutation kind — create, retarget, disable, rename, delete — produced 5\n * writes. The Convex-side path already sweeps the project on every document\n * publish (`convex/revalidate.ts`, \"the honest, reliable v1\"), so this is\n * strictly rarer than a cost the engine already pays.\n *\n * If a precise redirect tag is ever wanted, the place to get it is the Convex\n * write chokepoint, where `change.oldDoc` holds the previous `from` — not here,\n * where the information does not exist.\n */\nconst ROUTING_OPERATIONS = new Set(['redirects.save', 'redirects.remove'])\n\n/**\n * Asset-record mutations (EC-227): editing an asset (alt/dimensions/re-upload)\n * must drop the published pages that *baked* its delivery shape, which carry the\n * `asset:<id>` tag. `assets.remove` always carries `assetId`; `assets.upsert`\n * carries `asset.id` only on an EDIT (a CREATE mints the id server-side).\n */\nconst ASSET_OPERATIONS = new Set(['assets.upsert', 'assets.remove'])\n\n/** One computed webhook emission: which project, why, and which tags. */\nexport interface WebhookTagSet {\n projectId: string\n /** The operation name, carried verbatim as the webhook `event`. */\n event: string\n /** Sorted, deduplicated, fully scoped Next tag strings. */\n tags: string[]\n}\n\n/** Tolerant parse of an EC-139 input summary (may be truncated past 160 chars). */\nfunction parseSummary(summary: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(summary)\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Extract the projectId even from a truncated summary (it serializes first). */\nfunction projectIdOfSummary(summary: string): string | undefined {\n const match = /\"projectId\":\"([^\"]+)\"/.exec(summary)\n return match?.[1]\n}\n\nfunction documentRefOf(value: unknown): { collection: string; id: string } | undefined {\n if (typeof value !== 'object' || value === null) return undefined\n const candidate = value as { collection?: unknown; id?: unknown }\n return typeof candidate.collection === 'string' &&\n candidate.collection.length > 0 &&\n typeof candidate.id === 'string' &&\n candidate.id.length > 0\n ? { collection: candidate.collection, id: candidate.id }\n : undefined\n}\n\n/**\n * Compute the webhook tag set for one lifecycle event, or `null` when the\n * event is not a successful publish-shaped command (queries, failures, and\n * unrelated domains never fire webhooks).\n */\nexport function webhookTagsForEvent(\n event: Pick<OperationEvent, 'operation' | 'kind' | 'status' | 'inputSummary'>,\n options: { locales: readonly string[] },\n): WebhookTagSet | null {\n if (event.status !== 'succeeded' || event.kind !== 'command') return null\n\n const isDocument = PUBLISHED_STATE_OPERATIONS.has(event.operation)\n const isAsset = ASSET_OPERATIONS.has(event.operation)\n const isRouting = ROUTING_OPERATIONS.has(event.operation)\n if (!isDocument && !isAsset && !isRouting) return null\n\n const projectId = projectIdOfSummary(event.inputSummary)\n if (projectId === undefined) return null\n\n // EC-510: one answer for every redirect write — see `ROUTING_OPERATIONS` for\n // why the targeted `route:` tag is unobtainable and the sweep is the honest one.\n if (isRouting) {\n return { projectId, event: event.operation, tags: [projectSweepWebhookTag(projectId)] }\n }\n\n if (isAsset) return assetTagsForEvent(projectId, event)\n\n const parsed = parseSummary(event.inputSummary)\n const ref = documentRefOf(parsed?.['ref']) ?? documentRefOf(parsed?.['document'])\n if (!ref) {\n // Truncated summary (large upsert payload): honest coarse fallback.\n return { projectId, event: event.operation, tags: [projectSweepWebhookTag(projectId)] }\n }\n\n const tags = new Set<string>([docWebhookTag(projectId, ref.collection, ref.id)])\n for (const locale of options.locales) {\n tags.add(collectionWebhookTag(projectId, ref.collection, locale))\n }\n // EC-207: ROUTES are config-owned (a code deploy, which rebuilds the host), so\n // a document event never needs a `route:` tag. Redirects are NOT — EC-303 made\n // them editorial data and EC-510 gives their own operations the project sweep\n // (see `ROUTING_OPERATIONS`); a *document* write still cannot change them.\n return { projectId, event: event.operation, tags: [...tags].sort() }\n}\n\n/** A non-empty string, else `undefined` (the asset id out of a summary). */\nfunction stringOf(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined\n}\n\n/**\n * Tags for an asset mutation (EC-227). The edit cases — `assets.remove` (carries\n * `assetId`) and `assets.upsert` of an existing asset (carries `asset.id`) —\n * emit exactly `asset:<id>`, dropping the pages that baked that asset. An\n * `assets.upsert` with **no** id is a CREATE: the id is minted server-side and a\n * brand-new asset cannot be baked into any existing page, so it invalidates\n * nothing (`null`, no webhook). A `remove` missing its id means a truncated\n * summary — sweep the project (coarse, always correct — the document fallback).\n */\nfunction assetTagsForEvent(\n projectId: string,\n event: Pick<OperationEvent, 'operation' | 'inputSummary'>,\n): WebhookTagSet | null {\n const parsed = parseSummary(event.inputSummary)\n const assetId =\n event.operation === 'assets.remove'\n ? stringOf(parsed?.['assetId'])\n : stringOf((parsed?.['asset'] as { id?: unknown } | undefined)?.id)\n if (assetId) {\n return { projectId, event: event.operation, tags: [assetWebhookTag(projectId, assetId)] }\n }\n return event.operation === 'assets.remove'\n ? { projectId, event: event.operation, tags: [projectSweepWebhookTag(projectId)] }\n : null\n}\n"]}