canopycms 0.2.0-int.119 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -62
- package/dist/api/assets.js +20 -10
- package/dist/assets/editor-thumbnail-widths.d.ts +11 -0
- package/dist/assets/editor-thumbnail-widths.js +7 -0
- package/dist/assets/finalize.d.ts +7 -6
- package/dist/assets/finalize.js +15 -9
- package/dist/assets/materialize.d.ts +17 -2
- package/dist/assets/materialize.js +57 -4
- package/dist/assets/store-s3.d.ts +7 -3
- package/dist/assets/store-s3.js +25 -6
- package/dist/assets/types.d.ts +7 -2
- package/dist/cli/cli.js +40 -23
- package/dist/config/types.d.ts +3 -2
- package/dist/dev-content-watcher.js +8 -1
- package/dist/editor/Editor.js +60 -7
- package/dist/editor/EntryNavigator.d.ts +9 -4
- package/dist/editor/EntryNavigator.js +39 -17
- package/dist/editor/PreviewFrame.d.ts +3 -1
- package/dist/editor/PreviewFrame.js +43 -2
- package/dist/editor/PreviewPane.d.ts +2 -0
- package/dist/editor/components/BranchLockBanner.d.ts +7 -8
- package/dist/editor/components/BranchLockBanner.js +25 -2
- package/dist/editor/components/BranchRowLock.d.ts +14 -0
- package/dist/editor/components/BranchRowLock.js +21 -0
- package/dist/editor/components/EditorHeader.js +3 -18
- package/dist/editor/components/PreviewLinkToast.d.ts +5 -0
- package/dist/editor/components/PreviewLinkToast.js +33 -0
- package/dist/editor/fields/FieldLabel.d.ts +1 -1
- package/dist/editor/fields/FieldLabel.js +1 -1
- package/dist/editor/fields/ImageField.d.ts +1 -1
- package/dist/editor/fields/ImageField.js +36 -27
- package/dist/editor/hooks/editor-history.d.ts +7 -0
- package/dist/editor/hooks/editor-history.js +80 -0
- package/dist/editor/hooks/useBranchActions.js +3 -1
- package/dist/editor/hooks/useBranchManager.d.ts +2 -0
- package/dist/editor/hooks/useBranchManager.js +6 -2
- package/dist/editor/hooks/useEntryManager.d.ts +9 -2
- package/dist/editor/hooks/useEntryManager.js +131 -17
- package/dist/editor/media/AssetCard.js +4 -2
- package/dist/editor/media/AssetListRow.js +4 -2
- package/dist/editor/media/CropStep.d.ts +8 -10
- package/dist/editor/media/CropStep.js +39 -27
- package/dist/editor/media/crop-availability.d.ts +6 -0
- package/dist/editor/media/crop-availability.js +19 -0
- package/dist/editor/media/crop-math.d.ts +19 -13
- package/dist/editor/media/crop-math.js +50 -11
- package/dist/editor/preview-bridge.d.ts +7 -0
- package/dist/editor/preview-bridge.js +93 -1
- package/dist/editor/preview-path.d.ts +5 -0
- package/dist/editor/preview-path.js +18 -0
- package/dist/editor/theme.d.ts +1 -0
- package/dist/editor/theme.js +38 -1
- package/dist/server.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,9 @@ packages release together, at one version.
|
|
|
5
5
|
|
|
6
6
|
## This build
|
|
7
7
|
|
|
8
|
-
Version `0.2.0
|
|
8
|
+
Version `0.2.0`, built from [`ecd004a`](https://github.com/safeinsights/canopycms/tree/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463).
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Its entries are [0.2.0](#020), under **Released**.
|
|
11
11
|
|
|
12
12
|
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
13
|
|
|
@@ -24,7 +24,7 @@ Each entry has up to three parts:
|
|
|
24
24
|
`node_modules/canopycms/CHANGELOG.md`, assembled for that build: its **This build** section lists
|
|
25
25
|
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
26
|
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/
|
|
27
|
+
every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/.changeset/README.md) until a stable release
|
|
28
28
|
moves it here.
|
|
29
29
|
|
|
30
30
|
**Find your starting point.** From a stable pin, start at the first version under **Released**
|
|
@@ -46,24 +46,25 @@ entry replaces an earlier one's advice, the earlier one points to it.
|
|
|
46
46
|
|
|
47
47
|
**int** is the first int prerelease carrying an entry, and each part of the entry is labelled
|
|
48
48
|
`(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
|
|
50
|
-
|
|
49
|
+
**Action** says who must act. **Template first** means the int's CMS image or worker bundle needs
|
|
50
|
+
something only the stack template adds (a grant, an environment variable, a resource or a unit
|
|
51
|
+
setting): deploy the template, and any grant you write yourself for a bucket you bring, before CI
|
|
52
|
+
rolls that int's image or, with `workerCode: { source: 'parameter' }`, its bundle. The
|
|
53
|
+
worker-contract gate checks only the bundle, so for the image this label is the only signal. With
|
|
54
|
+
the default `workerCode` and an image the stack builds, one `cdk deploy` moves all three
|
|
55
|
+
together; an image or bundle that CI sets as a parameter keeps its value through `cdk deploy`.
|
|
51
56
|
|
|
52
57
|
Nothing in this section is edited by hand: each entry is a `.changeset/` file, which a build
|
|
53
58
|
assembles here and labels with the first int that carries it, and a stable release moves the
|
|
54
59
|
entries under **Released**.
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
| 119 | Editing | [Content panel docks when stacked; overlay slides; matched dividers](#stacked-layout-docks-the-content-panel-beside-the-form) | None |
|
|
60
|
-
| 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
|
-
| 119 | Editing | [Drawers share the content panel's compact header](#compact-drawer-headers-jumpable-comment-headings-and-a-steadier-owner-chip) | None |
|
|
62
|
-
| 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
|
-
| 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
|
-
| 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 |
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Released
|
|
65
64
|
|
|
66
|
-
###
|
|
65
|
+
### 0.2.0
|
|
66
|
+
|
|
67
|
+
#### Removing a file from the media library hides it, and an admin can restore it — **breaking (assets.delete, AssetStore) / behaviour change; template first**
|
|
67
68
|
|
|
68
69
|
<!-- changeset: ef-g-media -->
|
|
69
70
|
|
|
@@ -76,7 +77,6 @@ the media library and restore a file, and uploading the same file again restores
|
|
|
76
77
|
|
|
77
78
|
**To adopt.**
|
|
78
79
|
|
|
79
|
-
- Upgrade `canopycms` and `canopycms-cdk` together.
|
|
80
80
|
- `assets.delete` and `DELETE /assets` are removed (`DELETE /assets` answers 410); use
|
|
81
81
|
`assets.hide` / `POST /assets/hide` and `assets.restore` / `POST /assets/restore`.
|
|
82
82
|
- A custom `AssetStore` drops `deleteMeta` and must implement `hideAsset` and `unhideAsset`; a
|
|
@@ -85,10 +85,15 @@ the media library and restore a file, and uploading the same file again restores
|
|
|
85
85
|
and `s3:DeleteObject` on `asset-hidden/*` and no longer grant delete on `asset-meta/*`. If you
|
|
86
86
|
write the CMS role's bucket policy yourself, do the same (no `s3:GetObject` is needed), and if
|
|
87
87
|
it scopes `s3:ListBucket` by prefix, include `asset-hidden/`.
|
|
88
|
+
- Deploy those grants before CI rolls this release's CMS image: the stack template, built with
|
|
89
|
+
this release's `canopycms-cdk`, and your own bucket policy if you write one. On the old grants,
|
|
90
|
+
removing a file is denied, and a policy that scopes `s3:ListBucket` by prefix without
|
|
91
|
+
`asset-hidden/` fails every media library page. Between the deploy and the image roll,
|
|
92
|
+
removing a file is denied too.
|
|
88
93
|
- Files removed before this release lost their metadata. Uploading the same bytes again recreates
|
|
89
94
|
it, recorded under the re-uploader's name.
|
|
90
95
|
|
|
91
|
-
|
|
96
|
+
#### Stacked layout docks the content panel beside the form
|
|
92
97
|
|
|
93
98
|
<!-- changeset: ef-a-shell -->
|
|
94
99
|
|
|
@@ -96,7 +101,7 @@ _First in int.119._
|
|
|
96
101
|
|
|
97
102
|
**What changed.** In a wide window the content panel docks beside the form row in the stacked layout too, keeping the preview full width; in a narrow window it slides in over the form, unless the user prefers reduced motion. Both pane dividers share one width, and a branch banner has a line beneath it.
|
|
98
103
|
|
|
99
|
-
|
|
104
|
+
#### The editor opens the home page and names single-entry types by their type — **behaviour change**
|
|
100
105
|
|
|
101
106
|
<!-- changeset: ef-b-identity -->
|
|
102
107
|
|
|
@@ -104,7 +109,7 @@ _First in int.119._
|
|
|
104
109
|
|
|
105
110
|
**What changed.** With no entry in the URL, the editor opens the entry routed at `/`, else the first with a preview. An entry type limited to one entry (`maxItems: 1`) with a label is named by that label, though entry links and search still use its title. Content tree rows show the type on a second line, quick open shows type and route, "Rename…" is "Change URL…" ("Change slug…" for an entry with no page), and the "All content" crumb, the form header's title and the rail's site button are gone.
|
|
106
111
|
|
|
107
|
-
|
|
112
|
+
#### Compact drawer headers, jumpable comment headings and a steadier owner chip
|
|
108
113
|
|
|
109
114
|
<!-- changeset: ef-c-drawers -->
|
|
110
115
|
|
|
@@ -112,7 +117,7 @@ _First in int.119._
|
|
|
112
117
|
|
|
113
118
|
**What changed.** The Branches, Comments, Media and staged-changes drawers take the content panel's compact header with no subtitle. In the Comments drawer, each thread's heading is the one control that jumps to it. The Branches drawer no longer offers "New branch comment" or "+ New", since new branch comments start in the Comments drawer. A person's chip keeps its avatar and a long name on one line.
|
|
114
119
|
|
|
115
|
-
|
|
120
|
+
#### An object's Clear moves into its "…" menu, with an inline Undo
|
|
116
121
|
|
|
117
122
|
<!-- changeset: ef-d-clear -->
|
|
118
123
|
|
|
@@ -128,7 +133,7 @@ theirs. Their Undo, and the inline one, now survive edits to other items in an e
|
|
|
128
133
|
**To adopt.** A UI test that clicked an object's "Clear" button now opens the object's
|
|
129
134
|
"Actions for …" menu and chooses the "Clear" item, then finds "Undo clear" in the label row instead of a toast.
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
#### The top bar shows one unsaved mark and a status only when it matters — **behaviour change**
|
|
132
137
|
|
|
133
138
|
<!-- changeset: ef-f-topbar -->
|
|
134
139
|
|
|
@@ -136,7 +141,7 @@ _First in int.119._
|
|
|
136
141
|
|
|
137
142
|
**What changed.** The branch pill's unsaved count is the same dot as the entry's, with a number, in the brand colour the content tree also uses. "Unsaved · kept on this device" moved into Save's tooltip and description; the bar shows it only as a warning when drafts could not be stored. The pill drops the default "Editing" status and shows In review, Approved, Archived or Protected. The "Read-only" chip no longer repeats a branch-wide lock the banner already explains; it stays for an entry read-only for its own reason.
|
|
138
143
|
|
|
139
|
-
|
|
144
|
+
#### Previews can show the site header and footer, and the preview stays put between entries
|
|
140
145
|
|
|
141
146
|
<!-- changeset: ef-e-preview -->
|
|
142
147
|
|
|
@@ -156,9 +161,65 @@ export default createPreviewPage({
|
|
|
156
161
|
|
|
157
162
|
A preview page built on `useCanopyPreview` alone can pass `siteChrome: true` when it renders the header and footer for `?chrome=1`.
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
#### Media-library thumbnails are stored at upload and cached by the browser — **breaking (AssetStore.presignPublicObjectRead) / behaviour change**
|
|
160
165
|
|
|
161
|
-
|
|
166
|
+
<!-- changeset: editor-thumbnails-cached -->
|
|
167
|
+
|
|
168
|
+
_First in int.121._
|
|
169
|
+
|
|
170
|
+
**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; their first view transforms them as before. This adds roughly 0.1 s to a typical photo's upload; 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. A streamed object stored without a `Cache-Control` is now sent as `private, max-age=31536000, immutable`, since every public-prefix key is content-addressed.
|
|
171
|
+
|
|
172
|
+
**To adopt.** Only a custom `AssetStore` that implements `presignPublicObjectRead` changes: it returns `PresignedRead` (`{ url, maxAgeSeconds }`, from `canopycms/server`) or `null`, instead of a URL string. `maxAgeSeconds` is how long a browser may reuse that URL; return `0` to keep the old `no-store` behaviour.
|
|
173
|
+
|
|
174
|
+
#### Image fields are bordered cards, and Crop explains itself and works without `aspect`
|
|
175
|
+
|
|
176
|
+
<!-- changeset: image-field-cards -->
|
|
177
|
+
|
|
178
|
+
_First in int.121._
|
|
179
|
+
|
|
180
|
+
**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.
|
|
181
|
+
|
|
182
|
+
**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.
|
|
183
|
+
|
|
184
|
+
#### A locked branch shows a lock where a row's "…" menu would be
|
|
185
|
+
|
|
186
|
+
<!-- changeset: locked-row-lock -->
|
|
187
|
+
|
|
188
|
+
_First in int.121._
|
|
189
|
+
|
|
190
|
+
**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.
|
|
191
|
+
|
|
192
|
+
#### Links clicked in the preview open their entry instead of leaving the editor — **behaviour change**
|
|
193
|
+
|
|
194
|
+
<!-- changeset: preview-links-stay-in-editor -->
|
|
195
|
+
|
|
196
|
+
_First in int.121._
|
|
197
|
+
|
|
198
|
+
**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.
|
|
199
|
+
|
|
200
|
+
#### The browser's Back and Forward move between entries in the editor — **behaviour change**
|
|
201
|
+
|
|
202
|
+
<!-- changeset: editor-back-forward-entries -->
|
|
203
|
+
|
|
204
|
+
_First in 0.2.0._
|
|
205
|
+
|
|
206
|
+
**What changed.** Opening an entry in the editor adds a browser history entry, whether it is opened from the content panel, quick open, a comment, a preview link or a new entry's creation, and so does switching branch. Back and Forward then open the entry their URL names, without reloading the page; the preview follows, focus moves to the entry's menu in the top bar, and drafts are kept, as on any switch. Choosing the open entry again adds nothing, and the editor's own corrections, such as the home page it opens at load or the URL it fixes after a rename or delete, replace the URL instead. An entry since deleted or renamed opens the home page, with a note saying so. A Back onto another branch switches to it, asking first when there are unsaved changes; staying, or a branch no longer listed, returns to the entry the Back left.
|
|
207
|
+
|
|
208
|
+
#### A locked branch's row lock shows on the hovered, focused or selected row
|
|
209
|
+
|
|
210
|
+
<!-- changeset: row-lock-on-hover -->
|
|
211
|
+
|
|
212
|
+
_First in 0.2.0._
|
|
213
|
+
|
|
214
|
+
**What changed.** The lock in a content-tree row's menu slot was drawn on every row, repeating the branch pill and banner. It now appears on the row under the pointer, the focused row, the row with focus inside it, and the selected row, so a touch user sees the row they tapped. The slot stays reserved so rows do not shift, and the lock stays in the tab order and the accessibility tree on every row.
|
|
215
|
+
|
|
216
|
+
#### The dev content watcher waits for a save to finish before comparing
|
|
217
|
+
|
|
218
|
+
<!-- changeset: dev-watcher-waits-for-writes -->
|
|
219
|
+
|
|
220
|
+
_First in 0.2.0._
|
|
221
|
+
|
|
222
|
+
**What changed.** In `dev` mode, the watcher that warns when working-tree content has diverged from the served branch clone now acts on a new or changed file only once its size has held still for 100 ms. A save that truncates and then writes could reach the watcher as one event between the two steps. The check then read a half-written file and warned of a divergence that nothing later retracted. Now any warning about a half-finished save is retracted once the save completes.
|
|
162
223
|
|
|
163
224
|
### 0.1.0
|
|
164
225
|
|
|
@@ -211,7 +272,7 @@ URL.
|
|
|
211
272
|
2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
|
|
212
273
|
`app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
|
|
213
274
|
route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
|
|
214
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
275
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#live-preview)).
|
|
215
276
|
3. A test reading view content from the route's server HTML must load the page in a browser.
|
|
216
277
|
Server output rendered during a preview request carries the signed-in asset prefix; keep it out
|
|
217
278
|
of cross-request caches (`unstable_cache`, module memos).
|
|
@@ -226,7 +287,7 @@ kept site styles ahead of Mantine's in the preview.
|
|
|
226
287
|
server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
|
|
227
288
|
path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
|
|
228
289
|
refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
|
|
229
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
290
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#live-preview).
|
|
230
291
|
|
|
231
292
|
**To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
|
|
232
293
|
as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
|
|
@@ -308,7 +369,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
|
|
|
308
369
|
fields are nested or renamed, pass the AI config's `seo` the same object you pass
|
|
309
370
|
`createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
|
|
310
371
|
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/
|
|
372
|
+
shows [the recipe](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#ai-content-configuration).
|
|
312
373
|
|
|
313
374
|
**Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
|
|
314
375
|
|
|
@@ -330,7 +391,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
|
|
|
330
391
|
field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
|
|
331
392
|
`MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
|
|
332
393
|
`{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
|
|
333
|
-
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/
|
|
394
|
+
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#mdx-content-cannot-run-code).
|
|
334
395
|
|
|
335
396
|
**To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
|
|
336
397
|
`mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
|
|
@@ -467,7 +528,7 @@ a format check.
|
|
|
467
528
|
|
|
468
529
|
- (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
|
|
469
530
|
re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
|
|
470
|
-
([reference](https://github.com/safeinsights/canopycms/blob/
|
|
531
|
+
([reference](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#definecanopyconfig-options)).
|
|
471
532
|
- (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
|
|
472
533
|
the PR-body section every user who edited the branch, not only the submitter; settings commits
|
|
473
534
|
(permissions, groups) carry the acting user's trailer.
|
|
@@ -491,7 +552,7 @@ saves only push the branch, and no failing PR task lands in System health.
|
|
|
491
552
|
that entry type goes unavailable: the editor says so, and its entries answer 503 with
|
|
492
553
|
`code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
|
|
493
554
|
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/
|
|
555
|
+
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
|
|
495
556
|
Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
|
|
496
557
|
`ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
|
|
497
558
|
|
|
@@ -529,7 +590,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
|
|
|
529
590
|
new stack needs no steps.
|
|
530
591
|
|
|
531
592
|
**What changed.** (int.109) Detailed in
|
|
532
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
593
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
|
|
533
594
|
bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
|
|
534
595
|
refusing clients without TLS or IAM, replacing the worker's
|
|
535
596
|
`AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
|
|
@@ -583,10 +644,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
|
|
|
583
644
|
with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
|
|
584
645
|
unchanged.
|
|
585
646
|
- `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
|
|
586
|
-
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/
|
|
647
|
+
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#worker-down-alarm).
|
|
587
648
|
|
|
588
649
|
**To adopt.** Optional. For parameter-only change sets, see
|
|
589
|
-
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
650
|
+
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
|
|
590
651
|
`alarmTopic`.
|
|
591
652
|
|
|
592
653
|
**Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
|
|
@@ -597,7 +658,7 @@ worker, and a hand-built alarm on the worker log group.
|
|
|
597
658
|
**What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
|
|
598
659
|
swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
|
|
599
660
|
`alarmTopic` if set; a retried step names itself when it gives up. See
|
|
600
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
661
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#the-worker-instance).
|
|
601
662
|
|
|
602
663
|
**To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
|
|
603
664
|
not Template first and the worker contract stays at 1.
|
|
@@ -663,7 +724,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
|
|
|
663
724
|
|
|
664
725
|
**To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
|
|
665
726
|
mirror, so the root volume needs room for two
|
|
666
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
727
|
+
([details](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#the-worker-instance)).
|
|
667
728
|
|
|
668
729
|
#### The worker follows a rebased or deleted GitHub branch
|
|
669
730
|
|
|
@@ -685,7 +746,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
|
|
|
685
746
|
bundle-only roll is safe.
|
|
686
747
|
|
|
687
748
|
**To adopt.** Parameter mode: gate bundle-only rolls on the contract
|
|
688
|
-
([recipe](https://github.com/safeinsights/canopycms/blob/
|
|
749
|
+
([recipe](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
|
|
689
750
|
`WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
|
|
690
751
|
copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
|
|
691
752
|
|
|
@@ -702,8 +763,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
|
|
|
702
763
|
template, then roll the bundle; on an older template it stops with `template too old for this
|
|
703
764
|
bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
|
|
704
765
|
takes `worker/`'s three units and `gateway.env.example`
|
|
705
|
-
([steps](https://github.com/safeinsights/canopycms/blob/
|
|
706
|
-
[checklist](https://github.com/safeinsights/canopycms/blob/
|
|
766
|
+
([steps](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
|
|
767
|
+
[checklist](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#first-deploy-checklist).
|
|
707
768
|
|
|
708
769
|
#### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
|
|
709
770
|
|
|
@@ -714,7 +775,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
|
|
|
714
775
|
`X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
|
|
715
776
|
its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
|
|
716
777
|
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/
|
|
778
|
+
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
|
|
718
779
|
|
|
719
780
|
**To adopt.** If you wired the Function URL into your own distribution by hand, delete those
|
|
720
781
|
behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
|
|
@@ -890,7 +951,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
|
|
|
890
951
|
**To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
|
|
891
952
|
apply the same rule here, for example `referenceLink: (target, { body }) =>
|
|
892
953
|
!body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
|
|
893
|
-
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
954
|
+
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#ai-content-configuration).
|
|
894
955
|
|
|
895
956
|
**Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
|
|
896
957
|
change its link.
|
|
@@ -965,7 +1026,7 @@ _First in int.115._
|
|
|
965
1026
|
entry the base branch also changed, the "updated on the base branch" notice and the branch's
|
|
966
1027
|
conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
|
|
967
1028
|
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/
|
|
1029
|
+
and Unpublishing](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#drafts-and-unpublishing) section covers long-lived branches and
|
|
969
1030
|
unpublishing.
|
|
970
1031
|
|
|
971
1032
|
#### The editor calls the content drawer "All content"
|
|
@@ -1277,7 +1338,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
|
|
|
1277
1338
|
The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
|
|
1278
1339
|
|
|
1279
1340
|
**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/
|
|
1341
|
+
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#stamping-a-publication-date).
|
|
1281
1342
|
|
|
1282
1343
|
**Now deletable.** A build step or hook that writes a missing publication date into new entries.
|
|
1283
1344
|
|
|
@@ -1324,7 +1385,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
|
|
|
1324
1385
|
stored at, and `react-split-pane` is no longer a dependency.
|
|
1325
1386
|
`EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
|
|
1326
1387
|
no longer exported from `canopycms/client`. See
|
|
1327
|
-
[Your root layout](https://github.com/safeinsights/canopycms/blob/
|
|
1388
|
+
[Your root layout](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#editor-customization).
|
|
1328
1389
|
|
|
1329
1390
|
**To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
|
|
1330
1391
|
instead, which lays out its own panes. Hiding your site chrome on the editor route is now
|
|
@@ -1435,7 +1496,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
|
|
|
1435
1496
|
**To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
|
|
1436
1497
|
`ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
|
|
1437
1498
|
own pages, mount the hook as in
|
|
1438
|
-
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/
|
|
1499
|
+
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
|
|
1439
1500
|
Your own Server Actions in the CMS build still 403 behind OAC.
|
|
1440
1501
|
|
|
1441
1502
|
**Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
|
|
@@ -1476,12 +1537,12 @@ fast naming the ARN, the field and the keys present, never a value.
|
|
|
1476
1537
|
**To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
|
|
1477
1538
|
prop. The scaffolded stack fills them from the repository _variables_
|
|
1478
1539
|
`CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
|
|
1479
|
-
([why the prefix](https://github.com/safeinsights/canopycms/blob/
|
|
1540
|
+
([why the prefix](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
|
|
1480
1541
|
adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
|
|
1481
1542
|
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
1543
|
(also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
|
|
1483
1544
|
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/
|
|
1545
|
+
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#security-model)).
|
|
1485
1546
|
|
|
1486
1547
|
**Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
|
|
1487
1548
|
worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
|
|
@@ -1493,7 +1554,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
|
|
|
1493
1554
|
`githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
|
|
1494
1555
|
nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
|
|
1495
1556
|
anyone holding an App's key can mint a token for any of its installations
|
|
1496
|
-
([why](https://github.com/safeinsights/canopycms/blob/
|
|
1557
|
+
([why](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
|
|
1497
1558
|
|
|
1498
1559
|
**To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
|
|
1499
1560
|
`githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
|
|
@@ -1506,7 +1567,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
1506
1567
|
`verify` checks an existing installation's permissions: run it, since an App missing a
|
|
1507
1568
|
permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
|
|
1508
1569
|
never edits an existing JSON secret (create one and point the JSON-field prop at it)
|
|
1509
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
1570
|
+
([details](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
|
|
1510
1571
|
2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
|
|
1511
1572
|
of the three is refused at synth, and so is an App alongside a token.
|
|
1512
1573
|
3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
|
|
@@ -1517,7 +1578,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
1517
1578
|
|
|
1518
1579
|
The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
|
|
1519
1580
|
IAM policy automatically, so you need not add it to `secretsArns`. See
|
|
1520
|
-
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/
|
|
1581
|
+
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#authenticating-as-a-github-app).
|
|
1521
1582
|
|
|
1522
1583
|
```bash
|
|
1523
1584
|
canopycms init-github-app create -- \
|
|
@@ -1565,7 +1626,7 @@ downloads the `.pem` from the App's settings page.
|
|
|
1565
1626
|
|
|
1566
1627
|
**What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
|
|
1567
1628
|
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/
|
|
1629
|
+
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#rotating-a-secret).
|
|
1569
1630
|
|
|
1570
1631
|
**To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
|
|
1571
1632
|
GitHub App private key is still read only at boot: store the new key, replace the instance, and
|
|
@@ -1619,12 +1680,12 @@ also check the bucket policy for its grant.
|
|
|
1619
1680
|
5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
|
|
1620
1681
|
Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
|
|
1621
1682
|
`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/
|
|
1683
|
+
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#dual-build-support)).
|
|
1623
1684
|
|
|
1624
1685
|
**Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
|
|
1625
1686
|
function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
|
|
1626
1687
|
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/
|
|
1688
|
+
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#where-the-image-is-built)).
|
|
1628
1689
|
|
|
1629
1690
|
**To adopt.**
|
|
1630
1691
|
|
|
@@ -1653,7 +1714,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
|
|
|
1653
1714
|
|
|
1654
1715
|
**What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
|
|
1655
1716
|
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/
|
|
1717
|
+
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#media-configuration) for the
|
|
1657
1718
|
CloudFront behavior it expects.
|
|
1658
1719
|
|
|
1659
1720
|
**To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
|
|
@@ -1678,7 +1739,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
|
|
|
1678
1739
|
bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
|
|
1679
1740
|
`Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
|
|
1680
1741
|
`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/
|
|
1742
|
+
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#cross-account-asset-bucket).
|
|
1682
1743
|
|
|
1683
1744
|
**To adopt.** Optional:
|
|
1684
1745
|
|
|
@@ -1788,7 +1849,7 @@ public JWKS PEM, used only to verify signatures.
|
|
|
1788
1849
|
to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
|
|
1789
1850
|
deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
|
|
1790
1851
|
`clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
|
|
1791
|
-
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
1852
|
+
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/docs/deploying-to-aws.md#security-model)).
|
|
1792
1853
|
|
|
1793
1854
|
#### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
|
|
1794
1855
|
|
|
@@ -1887,7 +1948,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
|
1887
1948
|
Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
|
|
1888
1949
|
no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
|
|
1889
1950
|
`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/
|
|
1951
|
+
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#media-configuration)). Two traps:
|
|
1891
1952
|
|
|
1892
1953
|
- Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
|
|
1893
1954
|
a nested route prefix and emits zero params, building green.
|
|
@@ -2046,7 +2107,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
|
|
|
2046
2107
|
`withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
|
|
2047
2108
|
`canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
|
|
2048
2109
|
`createNextCanopyContext`'s result. See
|
|
2049
|
-
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
2110
|
+
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#sitemap-and-seo-metadata). Every routable entry type is in
|
|
2050
2111
|
the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
|
|
2051
2112
|
sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
|
|
2052
2113
|
filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
|
|
@@ -2103,7 +2164,7 @@ underscore-prefixed files are skipped.
|
|
|
2103
2164
|
|
|
2104
2165
|
**What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
|
|
2105
2166
|
`defaultPathAccess: { read: 'allow' }`
|
|
2106
|
-
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/
|
|
2167
|
+
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#public-read-on-server-deployments)).
|
|
2107
2168
|
|
|
2108
2169
|
**To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
|
|
2109
2170
|
consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
|
|
@@ -2156,7 +2217,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
|
|
|
2156
2217
|
**What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
|
|
2157
2218
|
gives one template's value type) requires exactly
|
|
2158
2219
|
one component per block template name when written as an object literal. See
|
|
2159
|
-
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/
|
|
2220
|
+
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#block-component-registries) and
|
|
2160
2221
|
`apps/example1/app/components/PostView.tsx`.
|
|
2161
2222
|
|
|
2162
2223
|
```ts
|
|
@@ -2178,7 +2239,7 @@ templates against the schema.
|
|
|
2178
2239
|
|
|
2179
2240
|
**What changed.** Spreading a `const` field array into several schemas, and nesting
|
|
2180
2241
|
`defineInlineFieldGroup()` inside a block template, are documented
|
|
2181
|
-
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/
|
|
2242
|
+
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
|
|
2182
2243
|
identity helper for them.
|
|
2183
2244
|
|
|
2184
2245
|
```ts
|
|
@@ -2197,7 +2258,7 @@ field by composing from the same `const` field object.
|
|
|
2197
2258
|
A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
|
|
2198
2259
|
it, and listings do with
|
|
2199
2260
|
[`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/
|
|
2261
|
+
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#shared--referenced-blocks).
|
|
2201
2262
|
|
|
2202
2263
|
**Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
|
|
2203
2264
|
|
|
@@ -2219,7 +2280,7 @@ Not retro-documented, apart from these:
|
|
|
2219
2280
|
|
|
2220
2281
|
#### The registry is keyed by entry-type name (0.0.42)
|
|
2221
2282
|
|
|
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/
|
|
2283
|
+
**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/ecd004a19d226d3b93e175eb8a2bd2c5a4ef2463/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
|
|
2223
2284
|
|
|
2224
2285
|
**To adopt.**
|
|
2225
2286
|
|
package/dist/api/assets.js
CHANGED
|
@@ -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
|
|
259
|
-
*
|
|
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: {
|
|
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
|
|
283
|
-
if (
|
|
284
|
-
return presignedRedirect(
|
|
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
|
|
297
|
-
return
|
|
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 };
|