canopycms 0.2.0-int.119 → 0.2.0-int.121

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 (50) hide show
  1. package/CHANGELOG.md +102 -46
  2. package/dist/api/assets.js +20 -10
  3. package/dist/assets/editor-thumbnail-widths.d.ts +11 -0
  4. package/dist/assets/editor-thumbnail-widths.js +7 -0
  5. package/dist/assets/finalize.d.ts +7 -6
  6. package/dist/assets/finalize.js +15 -9
  7. package/dist/assets/materialize.d.ts +17 -2
  8. package/dist/assets/materialize.js +57 -4
  9. package/dist/assets/store-s3.d.ts +7 -3
  10. package/dist/assets/store-s3.js +25 -6
  11. package/dist/assets/types.d.ts +7 -2
  12. package/dist/cli/cli.js +40 -23
  13. package/dist/config/types.d.ts +3 -2
  14. package/dist/editor/Editor.js +37 -5
  15. package/dist/editor/EntryNavigator.d.ts +9 -4
  16. package/dist/editor/EntryNavigator.js +36 -16
  17. package/dist/editor/PreviewFrame.d.ts +3 -1
  18. package/dist/editor/PreviewFrame.js +43 -2
  19. package/dist/editor/PreviewPane.d.ts +2 -0
  20. package/dist/editor/components/BranchLockBanner.d.ts +7 -8
  21. package/dist/editor/components/BranchLockBanner.js +25 -2
  22. package/dist/editor/components/BranchRowLock.d.ts +12 -0
  23. package/dist/editor/components/BranchRowLock.js +19 -0
  24. package/dist/editor/components/EditorHeader.js +3 -18
  25. package/dist/editor/components/PreviewLinkToast.d.ts +5 -0
  26. package/dist/editor/components/PreviewLinkToast.js +33 -0
  27. package/dist/editor/fields/FieldLabel.d.ts +1 -1
  28. package/dist/editor/fields/FieldLabel.js +1 -1
  29. package/dist/editor/fields/ImageField.d.ts +1 -1
  30. package/dist/editor/fields/ImageField.js +36 -27
  31. package/dist/editor/hooks/useBranchManager.d.ts +2 -0
  32. package/dist/editor/hooks/useBranchManager.js +1 -0
  33. package/dist/editor/media/AssetCard.js +4 -2
  34. package/dist/editor/media/AssetListRow.js +4 -2
  35. package/dist/editor/media/CropStep.d.ts +8 -10
  36. package/dist/editor/media/CropStep.js +39 -27
  37. package/dist/editor/media/crop-availability.d.ts +6 -0
  38. package/dist/editor/media/crop-availability.js +19 -0
  39. package/dist/editor/media/crop-math.d.ts +19 -13
  40. package/dist/editor/media/crop-math.js +50 -11
  41. package/dist/editor/preview-bridge.d.ts +7 -0
  42. package/dist/editor/preview-bridge.js +93 -1
  43. package/dist/editor/preview-path.d.ts +5 -0
  44. package/dist/editor/preview-path.js +18 -0
  45. package/dist/editor/theme.d.ts +1 -0
  46. package/dist/editor/theme.js +17 -1
  47. package/dist/server.d.ts +2 -0
  48. package/dist/version.d.ts +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,9 +5,18 @@ packages release together, at one version.
5
5
 
6
6
  ## This build
7
7
 
8
- Version `0.2.0-int.119`, built from [`35953fb`](https://github.com/safeinsights/canopycms/tree/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a).
8
+ Version `0.2.0-int.121`, built from [`0a53107`](https://github.com/safeinsights/canopycms/tree/0a53107eda329ce0499edad3544a16fb130b5beb).
9
9
 
10
- No earlier int is in this build's history, so read every Unreleased entry.
10
+ ### New since int.119
11
+
12
+ - [Media-library thumbnails are stored at upload and cached by the browser — behaviour change](#media-library-thumbnails-are-stored-at-upload-and-cached-by-the-browser--behaviour-change)
13
+ - [Image fields are bordered cards, and Crop explains itself and works without aspect](#image-fields-are-bordered-cards-and-crop-explains-itself-and-works-without-aspect)
14
+ - [A locked branch shows a lock where a row's "…" menu would be](#a-locked-branch-shows-a-lock-where-a-rows--menu-would-be)
15
+ - [Links clicked in the preview open their entry instead of leaving the editor — behaviour change](#links-clicked-in-the-preview-open-their-entry-instead-of-leaving-the-editor--behaviour-change)
16
+
17
+ ### Revised since int.119
18
+
19
+ - [Removing a file from the media library hides it, and an admin can restore it — breaking (assets.delete, AssetStore) / behaviour change; template first](#removing-a-file-from-the-media-library-hides-it-and-an-admin-can-restore-it--breaking-assetsdelete-assetstore--behaviour-change-template-first)
11
20
 
12
21
  If you upgraded from a build on another branch, compare the `<!-- changeset: … -->` slugs in your previous build's `CHANGELOG.md` (`npm pack canopycms@<old>` fetches it) with this one's: entries whose slug your old file lacks are new to you.
13
22
 
@@ -24,7 +33,7 @@ Each entry has up to three parts:
24
33
  `node_modules/canopycms/CHANGELOG.md`, assembled for that build: its **This build** section lists
25
34
  what is new since the previous int on the same branch, or on a stable release links its entries, and its links point at the commit the build
26
35
  came from. The copy in the repository holds released history and the entries from before changesets;
27
- every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/.changeset/README.md) until a stable release
36
+ every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/.changeset/README.md) until a stable release
28
37
  moves it here.
29
38
 
30
39
  **Find your starting point.** From a stable pin, start at the first version under **Released**
@@ -46,8 +55,13 @@ entry replaces an earlier one's advice, the earlier one points to it.
46
55
 
47
56
  **int** is the first int prerelease carrying an entry, and each part of the entry is labelled
48
57
  `(int.N)` the same way; a number in parentheses after a change is a later int that added a part.
49
- **Action** says who must act; **Template first** means that with `workerCode: { source: 'parameter' }`,
50
- you deploy the stack template before CI rolls that int's bundle.
58
+ **Action** says who must act. **Template first** means the int's CMS image or worker bundle needs
59
+ something only the stack template adds (a grant, an environment variable, a resource or a unit
60
+ setting): deploy the template, and any grant you write yourself for a bucket you bring, before CI
61
+ rolls that int's image or, with `workerCode: { source: 'parameter' }`, its bundle. The
62
+ worker-contract gate checks only the bundle, so for the image this label is the only signal. With
63
+ the default `workerCode` and an image the stack builds, one `cdk deploy` moves all three
64
+ together; an image or bundle that CI sets as a parameter keeps its value through `cdk deploy`.
51
65
 
52
66
  Nothing in this section is edited by hand: each entry is a `.changeset/` file, which a build
53
67
  assembles here and labels with the first int that carries it, and a stable release moves the
@@ -55,15 +69,19 @@ entries under **Released**.
55
69
 
56
70
  | int | Area | Change | Action |
57
71
  | --- | --- | --- | --- |
58
- | 119 | Assets | [Library removal hides the file; grant the asset-hidden/ prefix](#removing-a-file-from-the-media-library-hides-it-and-an-admin-can-restore-it--breaking-assetsdelete-assetstore--behaviour-change) | Upgrade both; grant asset-hidden |
72
+ | 119 | Assets | [Library removal hides the file; deploy grants before the image](#removing-a-file-from-the-media-library-hides-it-and-an-admin-can-restore-it--breaking-assetsdelete-assetstore--behaviour-change-template-first) | Template first |
59
73
  | 119 | Editing | [Content panel docks when stacked; overlay slides; matched dividers](#stacked-layout-docks-the-content-panel-beside-the-form) | None |
60
74
  | 119 | Editing | [Editor opens the home page; singletons named by type](#the-editor-opens-the-home-page-and-names-single-entry-types-by-their-type--behaviour-change) | None |
61
75
  | 119 | Editing | [Drawers share the content panel's compact header](#compact-drawer-headers-jumpable-comment-headings-and-a-steadier-owner-chip) | None |
62
76
  | 119 | Editing | [Object Clear in a "…" menu; Undo stays inline](#an-objects-clear-moves-into-its--menu-with-an-inline-undo) | Editor UI tests |
63
77
  | 119 | Editing | [Top bar: one unsaved dot, no "Editing" label](#the-top-bar-shows-one-unsaved-mark-and-a-status-only-when-it-matters--behaviour-change) | None |
64
78
  | 119 | Preview | [createPreviewPage takes a layout for the site header and footer](#previews-can-show-the-site-header-and-footer-and-the-preview-stays-put-between-entries) | Optional |
79
+ | 121 | Assets | [Editor thumbnails stored at upload; raw-route redirects cacheable](#media-library-thumbnails-are-stored-at-upload-and-cached-by-the-browser--behaviour-change) | None |
80
+ | 121 | Editing | [Image field card; Crop disabled with reason; free-form crop](#image-fields-are-bordered-cards-and-crop-explains-itself-and-works-without-aspect) | None |
81
+ | 121 | Editing | [Locked branch: tree rows show a lock](#a-locked-branch-shows-a-lock-where-a-rows--menu-would-be) | None |
82
+ | 121 | Preview | [Preview links open their entry; others open a new tab](#links-clicked-in-the-preview-open-their-entry-instead-of-leaving-the-editor--behaviour-change) | None |
65
83
 
66
- ### Removing a file from the media library hides it, and an admin can restore it — **breaking (assets.delete, AssetStore) / behaviour change**
84
+ ### Removing a file from the media library hides it, and an admin can restore it — **breaking (assets.delete, AssetStore) / behaviour change; template first**
67
85
 
68
86
  <!-- changeset: ef-g-media -->
69
87
 
@@ -76,7 +94,6 @@ the media library and restore a file, and uploading the same file again restores
76
94
 
77
95
  **To adopt.**
78
96
 
79
- - Upgrade `canopycms` and `canopycms-cdk` together.
80
97
  - `assets.delete` and `DELETE /assets` are removed (`DELETE /assets` answers 410); use
81
98
  `assets.hide` / `POST /assets/hide` and `assets.restore` / `POST /assets/restore`.
82
99
  - A custom `AssetStore` drops `deleteMeta` and must implement `hideAsset` and `unhideAsset`; a
@@ -85,6 +102,11 @@ the media library and restore a file, and uploading the same file again restores
85
102
  and `s3:DeleteObject` on `asset-hidden/*` and no longer grant delete on `asset-meta/*`. If you
86
103
  write the CMS role's bucket policy yourself, do the same (no `s3:GetObject` is needed), and if
87
104
  it scopes `s3:ListBucket` by prefix, include `asset-hidden/`.
105
+ - Deploy those grants before CI rolls this release's CMS image: the stack template, built with
106
+ this release's `canopycms-cdk`, and your own bucket policy if you write one. On the old grants,
107
+ removing a file is denied, and a policy that scopes `s3:ListBucket` by prefix without
108
+ `asset-hidden/` fails every media library page. Between the deploy and the image roll,
109
+ removing a file is denied too.
88
110
  - Files removed before this release lost their metadata. Uploading the same bytes again recreates
89
111
  it, recorded under the re-uploader's name.
90
112
 
@@ -156,6 +178,40 @@ export default createPreviewPage({
156
178
 
157
179
  A preview page built on `useCanopyPreview` alone can pass `siteChrome: true` when it renders the header and footer for `?chrome=1`.
158
180
 
181
+ ### Media-library thumbnails are stored at upload and cached by the browser — **behaviour change**
182
+
183
+ <!-- changeset: editor-thumbnails-cached -->
184
+
185
+ _First in int.121._
186
+
187
+ **What changed.** Finalizing a raster upload also stores the three widths the editor shows it at (`assets/t/w=80`, `w=160`, `w=320`), so the media library's first view reads stored objects instead of transforming in the request. Uploading a file that already exists stores any of those widths it lacks. Animated images are skipped, since re-encoding every frame would hold the upload too long; their first view transforms them as before. This adds roughly 0.1 s to a typical photo's upload and up to about 0.6 s for a 24-megapixel PNG, measured locally; a failure is logged and never fails the upload. On S3, the authenticated asset route's redirect to a presigned URL is now `private, max-age` until the end of the hour rather than `no-store`, and the URL stays the same for that hour, so reopening the media library fetches no thumbnails. A cached redirect can outlive a sign-out by at most that hour; it points only at a public-prefix object under an unguessable key.
188
+
189
+ ### Image fields are bordered cards, and Crop explains itself and works without `aspect`
190
+
191
+ <!-- changeset: image-field-cards -->
192
+
193
+ _First in int.121._
194
+
195
+ **What changed.** An image field is now a bordered card: the label row holds Replace, Crop and Remove, so each action sits with its image, and the thumbnail and alt text sit inside. Crop stays visible when it can't apply and says why on hover, focus and touch: a file outside the media library, or an SVG. A read-only form omits it. A field without `aspect` no longer hides Crop: a pick isn't cropped, and Crop afterwards is a free-form rectangle of any shape. A field with `aspect` still crops on pick, locked to that shape; a picked SVG now commits without a crop step. Applying a crop that covers the whole frame stores no crop, which is also how to take one off. The crop step uses `react-image-crop` (ISC) in place of `react-easy-crop`, so it has no zoom slider: resize the box instead. A field's label row now wraps its actions under the label on a narrow form, instead of squeezing the label. The stored `crop` and `width`/`height` are unchanged.
196
+
197
+ **To adopt.** Nothing. `canopycms/client` now imports `react-image-crop`'s stylesheet through the editor theme, so a bundler that handles the Mantine stylesheets handles it too.
198
+
199
+ ### A locked branch shows a lock where a row's "…" menu would be
200
+
201
+ <!-- changeset: locked-row-lock -->
202
+
203
+ _First in int.121._
204
+
205
+ **What changed.** On a protected, in-review or approved branch the content tree no longer drops a row's "…" menu without a trace. Each row that would have had a menu shows a lock of the same size, and its tooltip gives the branch's reason ("This branch is in review. Withdraw it to make changes."), on hover, keyboard focus and touch. An entry a path rule locks keeps its own lock beside its title and gets none in the menu slot.
206
+
207
+ ### Links clicked in the preview open their entry instead of leaving the editor — **behaviour change**
208
+
209
+ <!-- changeset: preview-links-stay-in-editor -->
210
+
211
+ _First in int.121._
212
+
213
+ **What changed.** A plain click on a link in the editor's preview no longer navigates the frame off its preview route to a public page, which could refuse to be framed. A link to another page of the site opens that page's entry in the editor, keeping the draft of the one left, and focus follows into its page. A page no entry has, such as a listing, opens in a new tab, and a note naming it says so; a link to another site opens in a new tab. Cmd/Ctrl/Shift/Alt and middle clicks, links with `download` or a `target` other than `_self`, links to the same page and `mailto:`/`tel:` links behave as they do outside the editor. A click that follows a link no longer also focuses the field it sits in, except while fields are highlighted, when a click on a marked link picks its field instead. The preview takes over links only once the editor has connected, so a public page embedded elsewhere keeps its links. Pages using `useCanopyPreview` or `withCanopyPreview` get this with no change.
214
+
159
215
  ---
160
216
 
161
217
  ## Released
@@ -211,7 +267,7 @@ URL.
211
267
  2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
212
268
  `app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
213
269
  route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
214
- [Live Preview](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#live-preview)).
270
+ [Live Preview](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#live-preview)).
215
271
  3. A test reading view content from the route's server HTML must load the page in a browser.
216
272
  Server output rendered during a preview request carries the signed-in asset prefix; keep it out
217
273
  of cross-request caches (`unstable_cache`, module memos).
@@ -226,7 +282,7 @@ kept site styles ahead of Mantine's in the preview.
226
282
  server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
227
283
  path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
228
284
  refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
229
- [Live Preview](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#live-preview).
285
+ [Live Preview](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#live-preview).
230
286
 
231
287
  **To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
232
288
  as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
@@ -308,7 +364,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
308
364
  fields are nested or renamed, pass the AI config's `seo` the same object you pass
309
365
  `createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
310
366
  place. A field that links to a hidden section by plain URL needs a field transform; the README
311
- shows [the recipe](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#ai-content-configuration).
367
+ shows [the recipe](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#ai-content-configuration).
312
368
 
313
369
  **Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
314
370
 
@@ -330,7 +386,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
330
386
  field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
331
387
  `MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
332
388
  `{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
333
- [MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#mdx-content-cannot-run-code).
389
+ [MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#mdx-content-cannot-run-code).
334
390
 
335
391
  **To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
336
392
  `mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
@@ -467,7 +523,7 @@ a format check.
467
523
 
468
524
  - (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
469
525
  re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
470
- ([reference](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#definecanopyconfig-options)).
526
+ ([reference](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#definecanopyconfig-options)).
471
527
  - (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
472
528
  the PR-body section every user who edited the branch, not only the submitter; settings commits
473
529
  (permissions, groups) carry the acting user's trailer.
@@ -491,7 +547,7 @@ saves only push the branch, and no failing PR task lands in System health.
491
547
  that entry type goes unavailable: the editor says so, and its entries answer 503 with
492
548
  `code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
493
549
  worker holds the base branch for up to 30 minutes while that lasts; see
494
- [New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
550
+ [New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
495
551
  Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
496
552
  `ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
497
553
 
@@ -529,7 +585,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
529
585
  new stack needs no steps.
530
586
 
531
587
  **What changed.** (int.109) Detailed in
532
- [The worker instance](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
588
+ [The worker instance](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
533
589
  bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
534
590
  refusing clients without TLS or IAM, replacing the worker's
535
591
  `AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
@@ -583,10 +639,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
583
639
  with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
584
640
  unchanged.
585
641
  - `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
586
- [Worker-down alarm](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#worker-down-alarm).
642
+ [Worker-down alarm](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#worker-down-alarm).
587
643
 
588
644
  **To adopt.** Optional. For parameter-only change sets, see
589
- [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
645
+ [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
590
646
  `alarmTopic`.
591
647
 
592
648
  **Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
@@ -597,7 +653,7 @@ worker, and a hand-built alarm on the worker log group.
597
653
  **What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
598
654
  swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
599
655
  `alarmTopic` if set; a retried step names itself when it gives up. See
600
- [The worker instance](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#the-worker-instance).
656
+ [The worker instance](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#the-worker-instance).
601
657
 
602
658
  **To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
603
659
  not Template first and the worker contract stays at 1.
@@ -663,7 +719,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
663
719
 
664
720
  **To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
665
721
  mirror, so the root volume needs room for two
666
- ([details](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#the-worker-instance)).
722
+ ([details](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#the-worker-instance)).
667
723
 
668
724
  #### The worker follows a rebased or deleted GitHub branch
669
725
 
@@ -685,7 +741,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
685
741
  bundle-only roll is safe.
686
742
 
687
743
  **To adopt.** Parameter mode: gate bundle-only rolls on the contract
688
- ([recipe](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
744
+ ([recipe](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
689
745
  `WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
690
746
  copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
691
747
 
@@ -702,8 +758,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
702
758
  template, then roll the bundle; on an older template it stops with `template too old for this
703
759
  bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
704
760
  takes `worker/`'s three units and `gateway.env.example`
705
- ([steps](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
706
- [checklist](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#first-deploy-checklist).
761
+ ([steps](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
762
+ [checklist](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#first-deploy-checklist).
707
763
 
708
764
  #### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
709
765
 
@@ -714,7 +770,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
714
770
  `X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
715
771
  its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
716
772
  marked `noindex`. The editor's default preview is same-origin and unaffected. See
717
- [Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
773
+ [Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
718
774
 
719
775
  **To adopt.** If you wired the Function URL into your own distribution by hand, delete those
720
776
  behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
@@ -890,7 +946,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
890
946
  **To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
891
947
  apply the same rule here, for example `referenceLink: (target, { body }) =>
892
948
  !body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
893
- [AI Content Configuration](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#ai-content-configuration).
949
+ [AI Content Configuration](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#ai-content-configuration).
894
950
 
895
951
  **Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
896
952
  change its link.
@@ -965,7 +1021,7 @@ _First in int.115._
965
1021
  entry the base branch also changed, the "updated on the base branch" notice and the branch's
966
1022
  conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
967
1023
  base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
968
- and Unpublishing](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#drafts-and-unpublishing) section covers long-lived branches and
1024
+ and Unpublishing](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#drafts-and-unpublishing) section covers long-lived branches and
969
1025
  unpublishing.
970
1026
 
971
1027
  #### The editor calls the content drawer "All content"
@@ -1277,7 +1333,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
1277
1333
  The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
1278
1334
 
1279
1335
  **To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
1280
- `{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#stamping-a-publication-date).
1336
+ `{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#stamping-a-publication-date).
1281
1337
 
1282
1338
  **Now deletable.** A build step or hook that writes a missing publication date into new entries.
1283
1339
 
@@ -1324,7 +1380,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
1324
1380
  stored at, and `react-split-pane` is no longer a dependency.
1325
1381
  `EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
1326
1382
  no longer exported from `canopycms/client`. See
1327
- [Your root layout](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#editor-customization).
1383
+ [Your root layout](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#editor-customization).
1328
1384
 
1329
1385
  **To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
1330
1386
  instead, which lays out its own panes. Hiding your site chrome on the editor route is now
@@ -1435,7 +1491,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
1435
1491
  **To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
1436
1492
  `ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
1437
1493
  own pages, mount the hook as in
1438
- [Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
1494
+ [Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
1439
1495
  Your own Server Actions in the CMS build still 403 behind OAC.
1440
1496
 
1441
1497
  **Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
@@ -1476,12 +1532,12 @@ fast naming the ARN, the field and the keys present, never a value.
1476
1532
  **To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
1477
1533
  prop. The scaffolded stack fills them from the repository _variables_
1478
1534
  `CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
1479
- ([why the prefix](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
1535
+ ([why the prefix](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
1480
1536
  adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
1481
1537
  lines to `.github/workflows/deploy-cms.yml`, or re-runs the generator and diffs. `cdk synth` refuses a `…JsonField` prop without its `…SecretArn`, and an ARN carrying the ECS `:KEY::` suffix
1482
1538
  (also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
1483
1539
  resource's configuration, readable by anyone who can describe it. Only `CLERK_SECRET_KEY` goes through Secrets Manager; `CLERK_JWT_KEY` and the publishable
1484
- key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#security-model)).
1540
+ key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#security-model)).
1485
1541
 
1486
1542
  **Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
1487
1543
  worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
@@ -1493,7 +1549,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
1493
1549
  `githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
1494
1550
  nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
1495
1551
  anyone holding an App's key can mint a token for any of its installations
1496
- ([why](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
1552
+ ([why](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
1497
1553
 
1498
1554
  **To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
1499
1555
  `githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
@@ -1506,7 +1562,7 @@ anyone holding an App's key can mint a token for any of its installations
1506
1562
  `verify` checks an existing installation's permissions: run it, since an App missing a
1507
1563
  permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
1508
1564
  never edits an existing JSON secret (create one and point the JSON-field prop at it)
1509
- ([details](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
1565
+ ([details](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
1510
1566
  2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
1511
1567
  of the three is refused at synth, and so is an App alongside a token.
1512
1568
  3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
@@ -1517,7 +1573,7 @@ anyone holding an App's key can mint a token for any of its installations
1517
1573
 
1518
1574
  The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
1519
1575
  IAM policy automatically, so you need not add it to `secretsArns`. See
1520
- [Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#authenticating-as-a-github-app).
1576
+ [Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#authenticating-as-a-github-app).
1521
1577
 
1522
1578
  ```bash
1523
1579
  canopycms init-github-app create -- \
@@ -1565,7 +1621,7 @@ downloads the `.pem` from the App's settings page.
1565
1621
 
1566
1622
  **What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
1567
1623
  key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
1568
- [Rotating a secret](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#rotating-a-secret).
1624
+ [Rotating a secret](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#rotating-a-secret).
1569
1625
 
1570
1626
  **To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
1571
1627
  GitHub App private key is still read only at boot: store the new key, replace the instance, and
@@ -1619,12 +1675,12 @@ also check the bucket policy for its grant.
1619
1675
  5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
1620
1676
  Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
1621
1677
  `webpack` and it can read your Next version. A webpack build still fails its image transforms
1622
- ([Dual Build Support](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#dual-build-support)).
1678
+ ([Dual Build Support](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#dual-build-support)).
1623
1679
 
1624
1680
  **Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
1625
1681
  function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
1626
1682
  function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
1627
- on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#where-the-image-is-built)).
1683
+ on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#where-the-image-is-built)).
1628
1684
 
1629
1685
  **To adopt.**
1630
1686
 
@@ -1653,7 +1709,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
1653
1709
 
1654
1710
  **What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
1655
1711
  replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
1656
- uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#media-configuration) for the
1712
+ uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#media-configuration) for the
1657
1713
  CloudFront behavior it expects.
1658
1714
 
1659
1715
  **To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
@@ -1678,7 +1734,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
1678
1734
  bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
1679
1735
  `Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
1680
1736
  `AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
1681
- pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#cross-account-asset-bucket).
1737
+ pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#cross-account-asset-bucket).
1682
1738
 
1683
1739
  **To adopt.** Optional:
1684
1740
 
@@ -1788,7 +1844,7 @@ public JWKS PEM, used only to verify signatures.
1788
1844
  to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
1789
1845
  deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
1790
1846
  `clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
1791
- `clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/docs/deploying-to-aws.md#security-model)).
1847
+ `clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/docs/deploying-to-aws.md#security-model)).
1792
1848
 
1793
1849
  #### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
1794
1850
 
@@ -1887,7 +1943,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
1887
1943
  Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
1888
1944
  no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
1889
1945
  `AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
1890
- is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#media-configuration)). Two traps:
1946
+ is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#media-configuration)). Two traps:
1891
1947
 
1892
1948
  - Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
1893
1949
  a nested route prefix and emits zero params, building green.
@@ -2046,7 +2102,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
2046
2102
  `withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
2047
2103
  `canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
2048
2104
  `createNextCanopyContext`'s result. See
2049
- [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#sitemap-and-seo-metadata). Every routable entry type is in
2105
+ [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#sitemap-and-seo-metadata). Every routable entry type is in
2050
2106
  the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
2051
2107
  sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
2052
2108
  filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
@@ -2103,7 +2159,7 @@ underscore-prefixed files are skipped.
2103
2159
 
2104
2160
  **What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
2105
2161
  `defaultPathAccess: { read: 'allow' }`
2106
- ([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#public-read-on-server-deployments)).
2162
+ ([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#public-read-on-server-deployments)).
2107
2163
 
2108
2164
  **To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
2109
2165
  consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
@@ -2156,7 +2212,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
2156
2212
  **What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
2157
2213
  gives one template's value type) requires exactly
2158
2214
  one component per block template name when written as an object literal. See
2159
- [Block Component Registries](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#block-component-registries) and
2215
+ [Block Component Registries](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#block-component-registries) and
2160
2216
  `apps/example1/app/components/PostView.tsx`.
2161
2217
 
2162
2218
  ```ts
@@ -2178,7 +2234,7 @@ templates against the schema.
2178
2234
 
2179
2235
  **What changed.** Spreading a `const` field array into several schemas, and nesting
2180
2236
  `defineInlineFieldGroup()` inside a block template, are documented
2181
- ([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
2237
+ ([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
2182
2238
  identity helper for them.
2183
2239
 
2184
2240
  ```ts
@@ -2197,7 +2253,7 @@ field by composing from the same `const` field object.
2197
2253
  A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
2198
2254
  it, and listings do with
2199
2255
  [`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
2200
- (0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#shared--referenced-blocks).
2256
+ (0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#shared--referenced-blocks).
2201
2257
 
2202
2258
  **Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
2203
2259
 
@@ -2219,7 +2275,7 @@ Not retro-documented, apart from these:
2219
2275
 
2220
2276
  #### The registry is keyed by entry-type name (0.0.42)
2221
2277
 
2222
- **What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/35953fbf6f9e0e0bb8181ed89c3ade8cd14db72a/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
2278
+ **What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/0a53107eda329ce0499edad3544a16fb130b5beb/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
2223
2279
 
2224
2280
  **To adopt.**
2225
2281
 
@@ -255,15 +255,19 @@ const restoreAssetHandler = async (ctx, req, body) => {
255
255
  */
256
256
  const INLINE_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
257
257
  /**
258
- * A 302 to a presigned store URL. `no-store` because the URL expires: a cached redirect would
259
- * outlive it, and a browser revisiting the page would follow it to a 403.
258
+ * A 302 to a presigned store URL, cacheable by this browser alone for as long as the store says
259
+ * the URL stays reusable: the redirect then outlives a sign-out by at most that long, which is
260
+ * accepted because the target is a public-prefix object under an unguessable key.
260
261
  */
261
- function presignedRedirect(url) {
262
+ function presignedRedirect({ url, maxAgeSeconds }) {
262
263
  return {
263
264
  kind: 'binary',
264
265
  status: 302,
265
266
  body: new Uint8Array(),
266
- headers: { location: url, cacheControl: 'no-store' },
267
+ headers: {
268
+ location: url,
269
+ cacheControl: maxAgeSeconds > 0 ? `private, max-age=${maxAgeSeconds}` : 'no-store',
270
+ },
267
271
  };
268
272
  }
269
273
  /**
@@ -279,9 +283,9 @@ async function serveLazyTransform(assetStore, parsed, canonicalKey) {
279
283
  return { ok: false, status: transformed.status, error };
280
284
  }
281
285
  if (transformed.data.byteLength > INLINE_BODY_LIMIT_BYTES && assetStore.presignPublicObjectRead) {
282
- const url = await assetStore.presignPublicObjectRead(canonicalKey);
283
- if (url)
284
- return presignedRedirect(url);
286
+ const presigned = await assetStore.presignPublicObjectRead(canonicalKey);
287
+ if (presigned)
288
+ return presignedRedirect(presigned);
285
289
  }
286
290
  return {
287
291
  kind: 'binary',
@@ -290,11 +294,17 @@ async function serveLazyTransform(assetStore, parsed, canonicalKey) {
290
294
  headers: { contentType: transformed.contentType, cacheControl: TRANSFORM_CACHE_CONTROL },
291
295
  };
292
296
  }
297
+ /**
298
+ * For a streamed object stored without a Cache-Control of its own. Every key under the public
299
+ * prefix is content-addressed, so its bytes never change; `private` because this route is
300
+ * authenticated.
301
+ */
302
+ const STREAMED_OBJECT_CACHE_CONTROL = 'private, max-age=31536000, immutable';
293
303
  /** A redirect to, or the bytes of, the public object stored at `key`; `null` when there is none. */
294
304
  async function serveStoredObject(assetStore, key) {
295
305
  if (assetStore.presignPublicObjectRead) {
296
- const url = await assetStore.presignPublicObjectRead(key);
297
- return url ? presignedRedirect(url) : null;
306
+ const presigned = await assetStore.presignPublicObjectRead(key);
307
+ return presigned ? presignedRedirect(presigned) : null;
298
308
  }
299
309
  const object = await assetStore.readPublicObject(key);
300
310
  if (!object)
@@ -306,7 +316,7 @@ async function serveStoredObject(assetStore, key) {
306
316
  headers: {
307
317
  contentType: object.contentType,
308
318
  contentDisposition: object.contentDisposition,
309
- cacheControl: object.cacheControl,
319
+ cacheControl: object.cacheControl ?? STREAMED_OBJECT_CACHE_CONTROL,
310
320
  },
311
321
  };
312
322
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The widths the editor's media UI requests through the raw route: a library list row, a library
3
+ * card and an image field's preview. Finalize stores each for a still raster upload, new or
4
+ * re-uploaded (`storeEditorThumbnails`), so a first view reads a stored object instead of
5
+ * transforming in the request. Isomorphic: the editor components and finalize both import it.
6
+ */
7
+ export declare const EDITOR_THUMBNAIL_WIDTHS: {
8
+ readonly listRow: 80;
9
+ readonly card: 160;
10
+ readonly imageField: 320;
11
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The widths the editor's media UI requests through the raw route: a library list row, a library
3
+ * card and an image field's preview. Finalize stores each for a still raster upload, new or
4
+ * re-uploaded (`storeEditorThumbnails`), so a first view reads a stored object instead of
5
+ * transforming in the request. Isomorphic: the editor components and finalize both import it.
6
+ */
7
+ export const EDITOR_THUMBNAIL_WIDTHS = { listRow: 80, card: 160, imageField: 320 };
@@ -15,12 +15,13 @@ export type FinalizeAssetResult = {
15
15
  * Run the finalize pipeline over raw bytes and persist the result.
16
16
  *
17
17
  * Order matters here too: dedup FIRST (after hashing, inside the pipeline) -
18
- * if an identical blob already exists, return the existing meta and skip all
19
- * writes entirely (first-name-wins). Otherwise write the original, then the
20
- * optional public object, then `putMetaIfAbsent` LAST: meta is the commit
21
- * point for an asset's existence, so a crash between `putOriginal` and here
22
- * leaves only orphaned (harmless, content-addressed) blobs, never a meta
23
- * record pointing at a missing blob.
18
+ * if an identical blob already exists, return the existing meta, touching
19
+ * only its hidden marker and any editor thumbnails it lacks (first-name-wins).
20
+ * Otherwise write the original, then the optional public object, then
21
+ * `putMetaIfAbsent` LAST: meta is the commit point for an asset's existence,
22
+ * so a crash between `putOriginal` and here leaves only orphaned (harmless,
23
+ * content-addressed) blobs, never a meta record pointing at a missing blob.
24
+ * The editor thumbnails come after the commit.
24
25
  * @internal Exported for tests.
25
26
  */
26
27
  export declare function finalizeAsset(store: AssetStore, input: FinalizeInput): Promise<FinalizeAssetResult>;
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { runFinalizePipeline } from './pipeline.js';
7
7
  import { ASSET_PREFIXES } from './keys.js';
8
+ import { storeEditorThumbnails } from './materialize.js';
8
9
  import { getErrorMessage } from '../utils/error.js';
9
10
  import { canopyLogWarn } from '../utils/logger.js';
10
11
  /**
@@ -25,12 +26,13 @@ export function isValidStagingKey(key) {
25
26
  * Run the finalize pipeline over raw bytes and persist the result.
26
27
  *
27
28
  * Order matters here too: dedup FIRST (after hashing, inside the pipeline) -
28
- * if an identical blob already exists, return the existing meta and skip all
29
- * writes entirely (first-name-wins). Otherwise write the original, then the
30
- * optional public object, then `putMetaIfAbsent` LAST: meta is the commit
31
- * point for an asset's existence, so a crash between `putOriginal` and here
32
- * leaves only orphaned (harmless, content-addressed) blobs, never a meta
33
- * record pointing at a missing blob.
29
+ * if an identical blob already exists, return the existing meta, touching
30
+ * only its hidden marker and any editor thumbnails it lacks (first-name-wins).
31
+ * Otherwise write the original, then the optional public object, then
32
+ * `putMetaIfAbsent` LAST: meta is the commit point for an asset's existence,
33
+ * so a crash between `putOriginal` and here leaves only orphaned (harmless,
34
+ * content-addressed) blobs, never a meta record pointing at a missing blob.
35
+ * The editor thumbnails come after the commit.
34
36
  * @internal Exported for tests.
35
37
  */
36
38
  export async function finalizeAsset(store, input) {
@@ -50,6 +52,8 @@ export async function finalizeAsset(store, input) {
50
52
  catch (err) {
51
53
  canopyLogWarn(`[canopycms] could not restore removed asset ${meta.hash32} to the library on re-upload: ${getErrorMessage(err)}`);
52
54
  }
55
+ // Stores any thumbnail the existing asset lacks; this upload's bytes are its original's.
56
+ await storeEditorThumbnails(store, existing, data, { skipStored: true });
53
57
  return { ok: true, meta: existing };
54
58
  }
55
59
  // Either put may find its key taken (`already-exists`): by an earlier attempt that stopped
@@ -62,11 +66,13 @@ export async function finalizeAsset(store, input) {
62
66
  const putResult = await store.putMetaIfAbsent(meta.hash32, meta);
63
67
  if (putResult === 'already-exists') {
64
68
  // Lost a race against a concurrent identical upload - the winner's meta
65
- // (already committed) is authoritative; return it rather than ours.
69
+ // (already committed) is authoritative; return it rather than ours. The
70
+ // winner's own finalize stores its thumbnails.
66
71
  const winner = await store.getMeta(meta.hash32);
67
- if (winner)
68
- return { ok: true, meta: winner };
72
+ return { ok: true, meta: winner ?? meta };
69
73
  }
74
+ // After the commit point: a thumbnail is keyed by the committed meta's slug.
75
+ await storeEditorThumbnails(store, meta, data);
70
76
  return { ok: true, meta };
71
77
  }
72
78
  /**