canopycms 0.11.0 → 0.12.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 +68 -48
- package/dist/api/branch-changes.d.ts +1 -0
- package/dist/api/branch-changes.js +1 -1
- package/dist/api/branch-entry-changes.d.ts +92 -7
- package/dist/api/branch-entry-changes.js +272 -38
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +4 -0
- package/dist/cli/cli.js +62 -1
- package/dist/cli/generate-ai-content.js +61 -0
- package/dist/content-store.d.ts +26 -0
- package/dist/content-store.js +73 -0
- package/dist/editor/Editor.js +134 -15
- package/dist/editor/comments/ThreadReplyControls.js +5 -2
- package/dist/editor/components/EntryChangesDrawer.d.ts +36 -0
- package/dist/editor/components/EntryChangesDrawer.js +141 -5
- package/dist/editor/components/EntryHeader.js +2 -4
- package/dist/editor/copy.d.ts +8 -0
- package/dist/editor/copy.js +8 -0
- package/dist/editor/entry-diff.d.ts +16 -1
- package/dist/editor/entry-diff.js +21 -11
- package/dist/editor/undo-change.d.ts +45 -0
- package/dist/editor/undo-change.js +226 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
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.
|
|
8
|
+
Version `0.12.0`, built from [`b67d39a`](https://github.com/safeinsights/canopycms/tree/b67d39a9a60e1c1d9dd23324c78df06c2295afa8).
|
|
9
9
|
|
|
10
|
-
Its entries are [0.
|
|
10
|
+
Its entries are [0.12.0](#0120), 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/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/.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**
|
|
@@ -62,6 +62,26 @@ entries under **Released**.
|
|
|
62
62
|
|
|
63
63
|
## Released
|
|
64
64
|
|
|
65
|
+
### 0.12.0
|
|
66
|
+
|
|
67
|
+
#### Undo a branch's saved changes from "Show changes"
|
|
68
|
+
|
|
69
|
+
<!-- changeset: undo-branch-changes -->
|
|
70
|
+
|
|
71
|
+
_First in 0.12.0._
|
|
72
|
+
|
|
73
|
+
**What changed.** The "Show changes" drawer can now set saved changes back to the base branch. Each changed field, list item or block has "Undo change", and the entry has "Undo all changes". An undo is an unsaved edit in the form: "Redo change" or "Discard changes" reverses it, and Save keeps it. A change the form has edited since can't be undone or redone until that edit is saved or discarded, so no edit is lost. List and block items are matched by item key, so a removed item comes back in its old place with its comment threads, and an item the branch added goes, its threads moving to the entry as a Remove does. An entry added on the branch offers "Delete entry", and one deleted on it "Restore entry", which puts the base's file back with its content id, so references and comment threads find it again. It puts the entry back in its collection's manual order, and refuses while another entry holds the URL, past the type's `maxItems`, or when the type's format has changed since. The controls follow the form's rules: disabled with the lock's reason on a branch in review, approved or otherwise read-only, and hidden without edit access. An entry type change can't be undone here, and undo leaves a moved entry where it is.
|
|
74
|
+
|
|
75
|
+
### 0.11.1
|
|
76
|
+
|
|
77
|
+
#### A comment thread you can't resolve shows Resolve disabled, with the reason
|
|
78
|
+
|
|
79
|
+
<!-- changeset: resolve-disabled-with-reason -->
|
|
80
|
+
|
|
81
|
+
_First in 0.11.1._
|
|
82
|
+
|
|
83
|
+
**What changed.** On a thread someone else started, a user outside Reviewers and Admins used to see Reply but no Resolve, with nothing to say why. Resolve now stays in place, disabled, and its tooltip explains that only the person who started the thread or a reviewer can resolve it, and suggests replying to let them know it's done. Who may resolve a thread is unchanged.
|
|
84
|
+
|
|
65
85
|
### 0.11.0
|
|
66
86
|
|
|
67
87
|
#### The preview follows the form to the field you're on
|
|
@@ -98,7 +118,7 @@ _First in 0.9.0._
|
|
|
98
118
|
|
|
99
119
|
**What changed.** A new scalar field type, `date`, holds a calendar day as a `YYYY-MM-DD` string, edited with a day picker. `datetime` stores an instant, so a day picked in one zone can read as the day before in another; a `date` is the same day everywhere. A save and a production build refuse a value that is not a real day, such as `2026-02-30` or `2026-5-1`; YAML rolls an unquoted `2026-02-30` forward first, so quote hand-written days. A hand-written unquoted `2024-05-01` in md or mdx frontmatter reads as that day in every zone, and survives a save on its own line. `list: true` is refused on a `date`; use an object list with a `date` field inside, which `itemTitleField` may name. `stampOnPublish` stays on `datetime`, and `datetime` values and checks are unchanged. Editor field errors now meet 4.5:1 contrast.
|
|
100
120
|
|
|
101
|
-
**To adopt.** Change `type: 'string'` to `type: 'date'` on a field that holds `YYYY-MM-DD`: `TypeFromEntrySchema` still gives `string`, and every `YYYY-MM-DD` value stays as it is. A production build lists any entry whose value is not a real day, such as `2026-5-1`; fix those by hand. A custom field type that was named `date` keeps its `customRenderers` entry but is now checked as a `date`, so rename it if its values differ. See [Field Types](https://github.com/safeinsights/canopycms/blob/
|
|
121
|
+
**To adopt.** Change `type: 'string'` to `type: 'date'` on a field that holds `YYYY-MM-DD`: `TypeFromEntrySchema` still gives `string`, and every `YYYY-MM-DD` value stays as it is. A production build lists any entry whose value is not a real day, such as `2026-5-1`; fix those by hand. A custom field type that was named `date` keeps its `customRenderers` entry but is now checked as a `date`, so rename it if its values differ. See [Field Types](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/.changeset/README.md#field-types).
|
|
102
122
|
|
|
103
123
|
**Now deletable.** A `string` field with a hand-written `YYYY-MM-DD` format check, and site code that reads a `datetime` back into a day.
|
|
104
124
|
|
|
@@ -374,7 +394,7 @@ _First in 0.7.0._
|
|
|
374
394
|
|
|
375
395
|
**What changed.** The pull request a submit opens now lists the branch's unresolved editor comment threads: where each one is, the first line of its first comment (80 characters at most) and a link to it in the editor. Once every thread is resolved, it says so. The list is updated whenever a comment is added, replied to or resolved, as well as on submit. Comment excerpts are visible to everyone who can read the pull request, which on a public repository means everyone. Open threads do not block the merge or keep the pull request in draft. A pull request opened before this release shows no list until its branch is next submitted.
|
|
376
396
|
|
|
377
|
-
**To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
397
|
+
**To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#rolling-the-worker-from-ci).
|
|
378
398
|
|
|
379
399
|
#### Pull request bodies link back to the editor
|
|
380
400
|
|
|
@@ -384,7 +404,7 @@ _First in 0.7.0._
|
|
|
384
404
|
|
|
385
405
|
**What changed.** The pull request a submit opens links to the branch in the editor, and each changed entry to that entry. A notice tells reviewers that comments on the pull request do not reach the editor, so the author will not see them. The links use the editor's URL from the submit, accepted only when its host is the one the request was addressed to (`X-Forwarded-Host`, else `Host`), which holds behind `canopycms-cdk`'s CloudFront distribution as it stands.
|
|
386
406
|
|
|
387
|
-
**To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/
|
|
407
|
+
**To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#definecanopyconfig-options).
|
|
388
408
|
|
|
389
409
|
#### CloudFront origin read timeout accepted up to 120 s; the editor waits 135 s
|
|
390
410
|
|
|
@@ -470,7 +490,7 @@ _First in 0.6.0._
|
|
|
470
490
|
|
|
471
491
|
**What changed.** `CanopyCmsService` takes `clerkOrganizationsAsGroups` (default `true`, unchanged), which the worker honours; in a deployment it, not the plugin's `useOrganizationsAsGroups`, decides the groups. When Clerk refuses the organization list with a 403 (Organizations disabled), the refresh now writes users with no groups and logs a warning, instead of failing whole; any other failure still keeps the last snapshot. Memberships are fetched instance-wide rather than per user. The scaffolds write `false` explicitly: `useOrganizationsAsGroups` in `canopycms init`'s `canopy.ts`, and `clerkOrganizationsAsGroups` in `canopycms init-deploy aws`'s CDK stack.
|
|
472
492
|
|
|
473
|
-
**To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/
|
|
493
|
+
**To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md).
|
|
474
494
|
|
|
475
495
|
### 0.5.0
|
|
476
496
|
|
|
@@ -482,7 +502,7 @@ _First in 0.5.0._
|
|
|
482
502
|
|
|
483
503
|
**What changed.** A `type: 'reference', list: true` field now edits as rows in stored order, like an `object` list: drag a row or use its "…" menu to move or remove it, open a row to swap its entry in place, and pick from Add under the rows to append. Neither control offers an entry the list already holds. Any `list: true` field, and any `block` field, takes `maxItems`. The editor stops adding at the cap and says why, a save over it is refused, and a production build fails on an entry over it, naming the entry, field, count and cap. Adding `maxItems` to a list that already holds more therefore fails the build until an editor removes the extra items. `maxItems` on a field that holds no items is refused when the entry schema registry is created.
|
|
484
504
|
|
|
485
|
-
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/
|
|
505
|
+
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#field-types).
|
|
486
506
|
|
|
487
507
|
#### SEO field location moves into config; reference pickers mark hidden entries and take a sort order — **breaking: `createNextCanopyContext({ seo })` and `AIContentConfig.seo` are removed**
|
|
488
508
|
|
|
@@ -492,7 +512,7 @@ _First in 0.5.0._
|
|
|
492
512
|
|
|
493
513
|
**What changed.** `defineCanopyConfig` takes `seo: { group?, fields? }`, the one place every surface reads an entry's `noindex` flag: the sitemap and `entryToMetadata` that `createNextCanopyContext` returns, AI content and the editor's reference picker. A per-call `seo`/`group`/`fields` still overrides it. The free `generateContentSitemap` takes `seo` as an argument and refuses to run without it when the config sets one; `createNextCanopyContext` and the AI content config refuse a leftover `seo`. A reference picker now badges an entry hidden from search as "Hidden from search", and picking one adds a note naming the setting on that entry's form, since a page listing only indexed entries won't show it. A reference field takes `optionSort`: `'label'` (the default), `'collection'`, or `{ field, direction }`. Point `field` at an ISO date, since strings compare as text.
|
|
494
514
|
|
|
495
|
-
**To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
515
|
+
**To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#sitemap-and-seo-metadata) and [How References Work in the Editor](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#how-references-work-in-the-editor).
|
|
496
516
|
|
|
497
517
|
**Now deletable.** A shared `seo` constant passed separately to the Next context and the AI content config.
|
|
498
518
|
|
|
@@ -520,7 +540,7 @@ resolved without it.
|
|
|
520
540
|
**To adopt.** Where a reference renders its target's prose, set `includeBody: true` on that
|
|
521
541
|
reference field. Code that reads the body from a link-only reference's resolved type now sees
|
|
522
542
|
`string | undefined`; either set `includeBody: true` or handle the missing value. See
|
|
523
|
-
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/
|
|
543
|
+
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#resolving-references-in-a-listing).
|
|
524
544
|
|
|
525
545
|
### 0.3.3
|
|
526
546
|
|
|
@@ -937,7 +957,7 @@ URL.
|
|
|
937
957
|
2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
|
|
938
958
|
`app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
|
|
939
959
|
route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
|
|
940
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
960
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#live-preview)).
|
|
941
961
|
3. A test reading view content from the route's server HTML must load the page in a browser.
|
|
942
962
|
Server output rendered during a preview request carries the signed-in asset prefix; keep it out
|
|
943
963
|
of cross-request caches (`unstable_cache`, module memos).
|
|
@@ -952,7 +972,7 @@ kept site styles ahead of Mantine's in the preview.
|
|
|
952
972
|
server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
|
|
953
973
|
path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
|
|
954
974
|
refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
|
|
955
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
975
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#live-preview).
|
|
956
976
|
|
|
957
977
|
**To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
|
|
958
978
|
as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
|
|
@@ -1034,7 +1054,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
|
|
|
1034
1054
|
fields are nested or renamed, pass the AI config's `seo` the same object you pass
|
|
1035
1055
|
`createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
|
|
1036
1056
|
place. A field that links to a hidden section by plain URL needs a field transform; the README
|
|
1037
|
-
shows [the recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1057
|
+
shows [the recipe](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#ai-content-configuration).
|
|
1038
1058
|
|
|
1039
1059
|
**Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
|
|
1040
1060
|
|
|
@@ -1056,7 +1076,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
|
|
|
1056
1076
|
field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
|
|
1057
1077
|
`MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
|
|
1058
1078
|
`{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
|
|
1059
|
-
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/
|
|
1079
|
+
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#mdx-content-cannot-run-code).
|
|
1060
1080
|
|
|
1061
1081
|
**To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
|
|
1062
1082
|
`mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
|
|
@@ -1193,7 +1213,7 @@ a format check.
|
|
|
1193
1213
|
|
|
1194
1214
|
- (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
|
|
1195
1215
|
re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
|
|
1196
|
-
([reference](https://github.com/safeinsights/canopycms/blob/
|
|
1216
|
+
([reference](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#definecanopyconfig-options)).
|
|
1197
1217
|
- (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
|
|
1198
1218
|
the PR-body section every user who edited the branch, not only the submitter; settings commits
|
|
1199
1219
|
(permissions, groups) carry the acting user's trailer.
|
|
@@ -1217,7 +1237,7 @@ saves only push the branch, and no failing PR task lands in System health.
|
|
|
1217
1237
|
that entry type goes unavailable: the editor says so, and its entries answer 503 with
|
|
1218
1238
|
`code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
|
|
1219
1239
|
worker holds the base branch for up to 30 minutes while that lasts; see
|
|
1220
|
-
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/
|
|
1240
|
+
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
|
|
1221
1241
|
Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
|
|
1222
1242
|
`ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
|
|
1223
1243
|
|
|
@@ -1255,7 +1275,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
|
|
|
1255
1275
|
new stack needs no steps.
|
|
1256
1276
|
|
|
1257
1277
|
**What changed.** (int.109) Detailed in
|
|
1258
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1278
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
|
|
1259
1279
|
bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
|
|
1260
1280
|
refusing clients without TLS or IAM, replacing the worker's
|
|
1261
1281
|
`AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
|
|
@@ -1309,10 +1329,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
|
|
|
1309
1329
|
with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
|
|
1310
1330
|
unchanged.
|
|
1311
1331
|
- `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
|
|
1312
|
-
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/
|
|
1332
|
+
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#worker-down-alarm).
|
|
1313
1333
|
|
|
1314
1334
|
**To adopt.** Optional. For parameter-only change sets, see
|
|
1315
|
-
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
1335
|
+
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
|
|
1316
1336
|
`alarmTopic`.
|
|
1317
1337
|
|
|
1318
1338
|
**Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
|
|
@@ -1323,7 +1343,7 @@ worker, and a hand-built alarm on the worker log group.
|
|
|
1323
1343
|
**What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
|
|
1324
1344
|
swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
|
|
1325
1345
|
`alarmTopic` if set; a retried step names itself when it gives up. See
|
|
1326
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1346
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#the-worker-instance).
|
|
1327
1347
|
|
|
1328
1348
|
**To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
|
|
1329
1349
|
not Template first and the worker contract stays at 1.
|
|
@@ -1389,7 +1409,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
|
|
|
1389
1409
|
|
|
1390
1410
|
**To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
|
|
1391
1411
|
mirror, so the root volume needs room for two
|
|
1392
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
1412
|
+
([details](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#the-worker-instance)).
|
|
1393
1413
|
|
|
1394
1414
|
#### The worker follows a rebased or deleted GitHub branch
|
|
1395
1415
|
|
|
@@ -1411,7 +1431,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
|
|
|
1411
1431
|
bundle-only roll is safe.
|
|
1412
1432
|
|
|
1413
1433
|
**To adopt.** Parameter mode: gate bundle-only rolls on the contract
|
|
1414
|
-
([recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1434
|
+
([recipe](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
|
|
1415
1435
|
`WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
|
|
1416
1436
|
copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
|
|
1417
1437
|
|
|
@@ -1428,8 +1448,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
|
|
|
1428
1448
|
template, then roll the bundle; on an older template it stops with `template too old for this
|
|
1429
1449
|
bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
|
|
1430
1450
|
takes `worker/`'s three units and `gateway.env.example`
|
|
1431
|
-
([steps](https://github.com/safeinsights/canopycms/blob/
|
|
1432
|
-
[checklist](https://github.com/safeinsights/canopycms/blob/
|
|
1451
|
+
([steps](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
|
|
1452
|
+
[checklist](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#first-deploy-checklist).
|
|
1433
1453
|
|
|
1434
1454
|
#### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
|
|
1435
1455
|
|
|
@@ -1440,7 +1460,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
|
|
|
1440
1460
|
`X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
|
|
1441
1461
|
its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
|
|
1442
1462
|
marked `noindex`. The editor's default preview is same-origin and unaffected. See
|
|
1443
|
-
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/
|
|
1463
|
+
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
|
|
1444
1464
|
|
|
1445
1465
|
**To adopt.** If you wired the Function URL into your own distribution by hand, delete those
|
|
1446
1466
|
behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
|
|
@@ -1616,7 +1636,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
|
|
|
1616
1636
|
**To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
|
|
1617
1637
|
apply the same rule here, for example `referenceLink: (target, { body }) =>
|
|
1618
1638
|
!body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
|
|
1619
|
-
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
1639
|
+
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#ai-content-configuration).
|
|
1620
1640
|
|
|
1621
1641
|
**Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
|
|
1622
1642
|
change its link.
|
|
@@ -1691,7 +1711,7 @@ _First in int.115._
|
|
|
1691
1711
|
entry the base branch also changed, the "updated on the base branch" notice and the branch's
|
|
1692
1712
|
conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
|
|
1693
1713
|
base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
|
|
1694
|
-
and Unpublishing](https://github.com/safeinsights/canopycms/blob/
|
|
1714
|
+
and Unpublishing](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#drafts-and-unpublishing) section covers long-lived branches and
|
|
1695
1715
|
unpublishing.
|
|
1696
1716
|
|
|
1697
1717
|
#### The editor calls the content drawer "All content"
|
|
@@ -2003,7 +2023,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
|
|
|
2003
2023
|
The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
|
|
2004
2024
|
|
|
2005
2025
|
**To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
|
|
2006
|
-
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/
|
|
2026
|
+
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#stamping-a-publication-date).
|
|
2007
2027
|
|
|
2008
2028
|
**Now deletable.** A build step or hook that writes a missing publication date into new entries.
|
|
2009
2029
|
|
|
@@ -2050,7 +2070,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
|
|
|
2050
2070
|
stored at, and `react-split-pane` is no longer a dependency.
|
|
2051
2071
|
`EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
|
|
2052
2072
|
no longer exported from `canopycms/client`. See
|
|
2053
|
-
[Your root layout](https://github.com/safeinsights/canopycms/blob/
|
|
2073
|
+
[Your root layout](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#editor-customization).
|
|
2054
2074
|
|
|
2055
2075
|
**To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
|
|
2056
2076
|
instead, which lays out its own panes. Hiding your site chrome on the editor route is now
|
|
@@ -2161,7 +2181,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
|
|
|
2161
2181
|
**To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
|
|
2162
2182
|
`ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
|
|
2163
2183
|
own pages, mount the hook as in
|
|
2164
|
-
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/
|
|
2184
|
+
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
|
|
2165
2185
|
Your own Server Actions in the CMS build still 403 behind OAC.
|
|
2166
2186
|
|
|
2167
2187
|
**Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
|
|
@@ -2202,12 +2222,12 @@ fast naming the ARN, the field and the keys present, never a value.
|
|
|
2202
2222
|
**To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
|
|
2203
2223
|
prop. The scaffolded stack fills them from the repository _variables_
|
|
2204
2224
|
`CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
|
|
2205
|
-
([why the prefix](https://github.com/safeinsights/canopycms/blob/
|
|
2225
|
+
([why the prefix](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
|
|
2206
2226
|
adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
|
|
2207
2227
|
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
|
|
2208
2228
|
(also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
|
|
2209
2229
|
resource's configuration, readable by anyone who can describe it. Only `CLERK_SECRET_KEY` goes through Secrets Manager; `CLERK_JWT_KEY` and the publishable
|
|
2210
|
-
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2230
|
+
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#security-model)).
|
|
2211
2231
|
|
|
2212
2232
|
**Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
|
|
2213
2233
|
worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
|
|
@@ -2219,7 +2239,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
|
|
|
2219
2239
|
`githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
|
|
2220
2240
|
nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
|
|
2221
2241
|
anyone holding an App's key can mint a token for any of its installations
|
|
2222
|
-
([why](https://github.com/safeinsights/canopycms/blob/
|
|
2242
|
+
([why](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
|
|
2223
2243
|
|
|
2224
2244
|
**To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
|
|
2225
2245
|
`githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
|
|
@@ -2232,7 +2252,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2232
2252
|
`verify` checks an existing installation's permissions: run it, since an App missing a
|
|
2233
2253
|
permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
|
|
2234
2254
|
never edits an existing JSON secret (create one and point the JSON-field prop at it)
|
|
2235
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
2255
|
+
([details](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
|
|
2236
2256
|
2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
|
|
2237
2257
|
of the three is refused at synth, and so is an App alongside a token.
|
|
2238
2258
|
3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
|
|
@@ -2243,7 +2263,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2243
2263
|
|
|
2244
2264
|
The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
|
|
2245
2265
|
IAM policy automatically, so you need not add it to `secretsArns`. See
|
|
2246
|
-
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/
|
|
2266
|
+
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#authenticating-as-a-github-app).
|
|
2247
2267
|
|
|
2248
2268
|
```bash
|
|
2249
2269
|
canopycms init-github-app create -- \
|
|
@@ -2291,7 +2311,7 @@ downloads the `.pem` from the App's settings page.
|
|
|
2291
2311
|
|
|
2292
2312
|
**What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
|
|
2293
2313
|
key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
|
|
2294
|
-
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/
|
|
2314
|
+
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#rotating-a-secret).
|
|
2295
2315
|
|
|
2296
2316
|
**To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
|
|
2297
2317
|
GitHub App private key is still read only at boot: store the new key, replace the instance, and
|
|
@@ -2345,12 +2365,12 @@ also check the bucket policy for its grant.
|
|
|
2345
2365
|
5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
|
|
2346
2366
|
Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
|
|
2347
2367
|
`webpack` and it can read your Next version. A webpack build still fails its image transforms
|
|
2348
|
-
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/
|
|
2368
|
+
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#dual-build-support)).
|
|
2349
2369
|
|
|
2350
2370
|
**Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
|
|
2351
2371
|
function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
|
|
2352
2372
|
function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
|
|
2353
|
-
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/
|
|
2373
|
+
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#where-the-image-is-built)).
|
|
2354
2374
|
|
|
2355
2375
|
**To adopt.**
|
|
2356
2376
|
|
|
@@ -2379,7 +2399,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
|
|
|
2379
2399
|
|
|
2380
2400
|
**What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
|
|
2381
2401
|
replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
|
|
2382
|
-
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2402
|
+
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#media-configuration) for the
|
|
2383
2403
|
CloudFront behavior it expects.
|
|
2384
2404
|
|
|
2385
2405
|
**To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
|
|
@@ -2404,7 +2424,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
|
|
|
2404
2424
|
bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
|
|
2405
2425
|
`Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
|
|
2406
2426
|
`AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
|
|
2407
|
-
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/
|
|
2427
|
+
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#cross-account-asset-bucket).
|
|
2408
2428
|
|
|
2409
2429
|
**To adopt.** Optional:
|
|
2410
2430
|
|
|
@@ -2514,7 +2534,7 @@ public JWKS PEM, used only to verify signatures.
|
|
|
2514
2534
|
to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
|
|
2515
2535
|
deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
|
|
2516
2536
|
`clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
|
|
2517
|
-
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2537
|
+
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#security-model)).
|
|
2518
2538
|
|
|
2519
2539
|
#### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
|
|
2520
2540
|
|
|
@@ -2613,7 +2633,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
|
2613
2633
|
Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
|
|
2614
2634
|
no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
|
|
2615
2635
|
`AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
|
|
2616
|
-
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2636
|
+
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#media-configuration)). Two traps:
|
|
2617
2637
|
|
|
2618
2638
|
- Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
|
|
2619
2639
|
a nested route prefix and emits zero params, building green.
|
|
@@ -2772,7 +2792,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
|
|
|
2772
2792
|
`withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
|
|
2773
2793
|
`canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
|
|
2774
2794
|
`createNextCanopyContext`'s result. See
|
|
2775
|
-
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
2795
|
+
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#sitemap-and-seo-metadata). Every routable entry type is in
|
|
2776
2796
|
the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
|
|
2777
2797
|
sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
|
|
2778
2798
|
filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
|
|
@@ -2829,7 +2849,7 @@ underscore-prefixed files are skipped.
|
|
|
2829
2849
|
|
|
2830
2850
|
**What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
|
|
2831
2851
|
`defaultPathAccess: { read: 'allow' }`
|
|
2832
|
-
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/
|
|
2852
|
+
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#public-read-on-server-deployments)).
|
|
2833
2853
|
|
|
2834
2854
|
**To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
|
|
2835
2855
|
consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
|
|
@@ -2882,7 +2902,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
|
|
|
2882
2902
|
**What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
|
|
2883
2903
|
gives one template's value type) requires exactly
|
|
2884
2904
|
one component per block template name when written as an object literal. See
|
|
2885
|
-
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/
|
|
2905
|
+
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#block-component-registries) and
|
|
2886
2906
|
`apps/example1/app/components/PostView.tsx`.
|
|
2887
2907
|
|
|
2888
2908
|
```ts
|
|
@@ -2904,7 +2924,7 @@ templates against the schema.
|
|
|
2904
2924
|
|
|
2905
2925
|
**What changed.** Spreading a `const` field array into several schemas, and nesting
|
|
2906
2926
|
`defineInlineFieldGroup()` inside a block template, are documented
|
|
2907
|
-
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/
|
|
2927
|
+
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
|
|
2908
2928
|
identity helper for them.
|
|
2909
2929
|
|
|
2910
2930
|
```ts
|
|
@@ -2923,7 +2943,7 @@ field by composing from the same `const` field object.
|
|
|
2923
2943
|
A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
|
|
2924
2944
|
it, and listings do with
|
|
2925
2945
|
[`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
|
|
2926
|
-
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/
|
|
2946
|
+
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#shared--referenced-blocks).
|
|
2927
2947
|
|
|
2928
2948
|
**Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
|
|
2929
2949
|
|
|
@@ -2945,7 +2965,7 @@ Not retro-documented, apart from these:
|
|
|
2945
2965
|
|
|
2946
2966
|
#### The registry is keyed by entry-type name (0.0.42)
|
|
2947
2967
|
|
|
2948
|
-
**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/
|
|
2968
|
+
**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/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
|
|
2949
2969
|
|
|
2950
2970
|
**To adopt.**
|
|
2951
2971
|
|
|
@@ -33,6 +33,7 @@ export interface BranchChangesData {
|
|
|
33
33
|
otherFilesTruncated?: boolean;
|
|
34
34
|
}
|
|
35
35
|
export type BranchChangesResponse = ApiResponse<BranchChangesData>;
|
|
36
|
+
export declare const SYNCING_ERROR: (base: string) => string;
|
|
36
37
|
type BranchGit = ReturnType<ApiContext['services']['createGitManagerFor']>;
|
|
37
38
|
/** Why a read of a branch against its base can't be trusted: see {@link readWhileSteady}. */
|
|
38
39
|
export type UnsteadyRead = 'syncing' | 'moved';
|
|
@@ -14,7 +14,7 @@ import { canopyLogWarn } from '../utils/logger.js';
|
|
|
14
14
|
const MAX_DELETED_TITLES = 200;
|
|
15
15
|
/** Other files listed to an admin; the rest are counted only as `otherFilesTruncated`. */
|
|
16
16
|
const MAX_OTHER_FILES = 200;
|
|
17
|
-
const SYNCING_ERROR = (base) => `This branch is being synced with ${base}. Try again in a moment.`;
|
|
17
|
+
export const SYNCING_ERROR = (base) => `This branch is being synced with ${base}. Try again in a moment.`;
|
|
18
18
|
const CHANGED_MID_READ_ERROR = 'This branch changed while its changes were being read. Try again in a moment.';
|
|
19
19
|
const READ_FAILED_ERROR = "Couldn't read this branch's changes right now. Try again in a moment.";
|
|
20
20
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { ApiResponse } from './types.js';
|
|
3
3
|
import type { ContentFormat } from '../config/index.js';
|
|
4
|
-
import type { LogicalPath } from '../paths/types.js';
|
|
4
|
+
import type { ContentId, LogicalPath } from '../paths/types.js';
|
|
5
5
|
/** One side of an entry's change: its file as the editor reads it, references unresolved. */
|
|
6
6
|
export interface EntryChangeSide {
|
|
7
7
|
format: ContentFormat;
|
|
@@ -33,7 +33,7 @@ export declare const readBranchEntryChange: import("./route-builder.js").RouteDe
|
|
|
33
33
|
/** A moved entry's path at the base. */
|
|
34
34
|
from: z.ZodOptional<z.ZodType<LogicalPath, z.ZodTypeDef, LogicalPath>>;
|
|
35
35
|
/** The entry's content id: both sides must carry it, so a slug reused by another entry isn't it. */
|
|
36
|
-
id: z.ZodOptional<z.ZodType<
|
|
36
|
+
id: z.ZodOptional<z.ZodType<ContentId, z.ZodTypeDef, ContentId>>;
|
|
37
37
|
}, "strip", z.ZodTypeAny, {
|
|
38
38
|
branch: string & {
|
|
39
39
|
readonly __brand: "BranchName";
|
|
@@ -41,7 +41,7 @@ export declare const readBranchEntryChange: import("./route-builder.js").RouteDe
|
|
|
41
41
|
entryPath: string & {
|
|
42
42
|
readonly __brand: "LogicalPath";
|
|
43
43
|
};
|
|
44
|
-
id?:
|
|
44
|
+
id?: ContentId | undefined;
|
|
45
45
|
from?: LogicalPath | undefined;
|
|
46
46
|
}, {
|
|
47
47
|
branch: string & {
|
|
@@ -50,9 +50,64 @@ export declare const readBranchEntryChange: import("./route-builder.js").RouteDe
|
|
|
50
50
|
entryPath: string & {
|
|
51
51
|
readonly __brand: "LogicalPath";
|
|
52
52
|
};
|
|
53
|
-
id?:
|
|
53
|
+
id?: ContentId | undefined;
|
|
54
54
|
from?: LogicalPath | undefined;
|
|
55
55
|
}>, undefined, BranchEntryChangeResponse>;
|
|
56
|
+
declare const restoreBodySchema: z.ZodObject<{
|
|
57
|
+
/** The deleted entry's content id, which the base file must carry and the restore keeps. */
|
|
58
|
+
id: z.ZodType<ContentId, z.ZodTypeDef, ContentId>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
id: string & {
|
|
61
|
+
readonly __brand: "ContentId";
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
id: string & {
|
|
65
|
+
readonly __brand: "ContentId";
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
interface RestoreEntryData {
|
|
69
|
+
logicalPath: string;
|
|
70
|
+
contentId: string;
|
|
71
|
+
/** The entry is back, but its collection's manual order couldn't be updated. */
|
|
72
|
+
warning?: string;
|
|
73
|
+
}
|
|
74
|
+
export type RestoreEntryResponse = ApiResponse<RestoreEntryData>;
|
|
75
|
+
/**
|
|
76
|
+
* Puts back an entry deleted on the branch, as the commit the branch forked from holds it, with
|
|
77
|
+
* its content id (`ContentStore.restore`).
|
|
78
|
+
* POST /:branch/restore-entry/...entryPath
|
|
79
|
+
* @internal Exported for tests.
|
|
80
|
+
*/
|
|
81
|
+
export declare const restoreBranchEntry: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
82
|
+
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
83
|
+
entryPath: z.ZodType<LogicalPath, z.ZodTypeDef, LogicalPath>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
branch: string & {
|
|
86
|
+
readonly __brand: "BranchName";
|
|
87
|
+
};
|
|
88
|
+
entryPath: string & {
|
|
89
|
+
readonly __brand: "LogicalPath";
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
branch: string & {
|
|
93
|
+
readonly __brand: "BranchName";
|
|
94
|
+
};
|
|
95
|
+
entryPath: string & {
|
|
96
|
+
readonly __brand: "LogicalPath";
|
|
97
|
+
};
|
|
98
|
+
}>, z.ZodObject<{
|
|
99
|
+
/** The deleted entry's content id, which the base file must carry and the restore keeps. */
|
|
100
|
+
id: z.ZodType<ContentId, z.ZodTypeDef, ContentId>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
id: string & {
|
|
103
|
+
readonly __brand: "ContentId";
|
|
104
|
+
};
|
|
105
|
+
}, {
|
|
106
|
+
id: string & {
|
|
107
|
+
readonly __brand: "ContentId";
|
|
108
|
+
};
|
|
109
|
+
}>, RestoreEntryResponse>;
|
|
110
|
+
export type RestoreEntryBody = z.infer<typeof restoreBodySchema>;
|
|
56
111
|
export declare const BRANCH_ENTRY_CHANGE_ROUTES: {
|
|
57
112
|
readonly entry: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
58
113
|
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
@@ -60,7 +115,7 @@ export declare const BRANCH_ENTRY_CHANGE_ROUTES: {
|
|
|
60
115
|
/** A moved entry's path at the base. */
|
|
61
116
|
from: z.ZodOptional<z.ZodType<LogicalPath, z.ZodTypeDef, LogicalPath>>;
|
|
62
117
|
/** The entry's content id: both sides must carry it, so a slug reused by another entry isn't it. */
|
|
63
|
-
id: z.ZodOptional<z.ZodType<
|
|
118
|
+
id: z.ZodOptional<z.ZodType<ContentId, z.ZodTypeDef, ContentId>>;
|
|
64
119
|
}, "strip", z.ZodTypeAny, {
|
|
65
120
|
branch: string & {
|
|
66
121
|
readonly __brand: "BranchName";
|
|
@@ -68,7 +123,7 @@ export declare const BRANCH_ENTRY_CHANGE_ROUTES: {
|
|
|
68
123
|
entryPath: string & {
|
|
69
124
|
readonly __brand: "LogicalPath";
|
|
70
125
|
};
|
|
71
|
-
id?:
|
|
126
|
+
id?: ContentId | undefined;
|
|
72
127
|
from?: LogicalPath | undefined;
|
|
73
128
|
}, {
|
|
74
129
|
branch: string & {
|
|
@@ -77,7 +132,37 @@ export declare const BRANCH_ENTRY_CHANGE_ROUTES: {
|
|
|
77
132
|
entryPath: string & {
|
|
78
133
|
readonly __brand: "LogicalPath";
|
|
79
134
|
};
|
|
80
|
-
id?:
|
|
135
|
+
id?: ContentId | undefined;
|
|
81
136
|
from?: LogicalPath | undefined;
|
|
82
137
|
}>, undefined, BranchEntryChangeResponse>;
|
|
138
|
+
readonly restore: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
139
|
+
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
140
|
+
entryPath: z.ZodType<LogicalPath, z.ZodTypeDef, LogicalPath>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
branch: string & {
|
|
143
|
+
readonly __brand: "BranchName";
|
|
144
|
+
};
|
|
145
|
+
entryPath: string & {
|
|
146
|
+
readonly __brand: "LogicalPath";
|
|
147
|
+
};
|
|
148
|
+
}, {
|
|
149
|
+
branch: string & {
|
|
150
|
+
readonly __brand: "BranchName";
|
|
151
|
+
};
|
|
152
|
+
entryPath: string & {
|
|
153
|
+
readonly __brand: "LogicalPath";
|
|
154
|
+
};
|
|
155
|
+
}>, z.ZodObject<{
|
|
156
|
+
/** The deleted entry's content id, which the base file must carry and the restore keeps. */
|
|
157
|
+
id: z.ZodType<ContentId, z.ZodTypeDef, ContentId>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
id: string & {
|
|
160
|
+
readonly __brand: "ContentId";
|
|
161
|
+
};
|
|
162
|
+
}, {
|
|
163
|
+
id: string & {
|
|
164
|
+
readonly __brand: "ContentId";
|
|
165
|
+
};
|
|
166
|
+
}>, RestoreEntryResponse>;
|
|
83
167
|
};
|
|
168
|
+
export {};
|