canopycms 0.11.1 → 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 +58 -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/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,16 @@ 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
|
+
|
|
65
75
|
### 0.11.1
|
|
66
76
|
|
|
67
77
|
#### A comment thread you can't resolve shows Resolve disabled, with the reason
|
|
@@ -108,7 +118,7 @@ _First in 0.9.0._
|
|
|
108
118
|
|
|
109
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.
|
|
110
120
|
|
|
111
|
-
**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).
|
|
112
122
|
|
|
113
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.
|
|
114
124
|
|
|
@@ -384,7 +394,7 @@ _First in 0.7.0._
|
|
|
384
394
|
|
|
385
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.
|
|
386
396
|
|
|
387
|
-
**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).
|
|
388
398
|
|
|
389
399
|
#### Pull request bodies link back to the editor
|
|
390
400
|
|
|
@@ -394,7 +404,7 @@ _First in 0.7.0._
|
|
|
394
404
|
|
|
395
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.
|
|
396
406
|
|
|
397
|
-
**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).
|
|
398
408
|
|
|
399
409
|
#### CloudFront origin read timeout accepted up to 120 s; the editor waits 135 s
|
|
400
410
|
|
|
@@ -480,7 +490,7 @@ _First in 0.6.0._
|
|
|
480
490
|
|
|
481
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.
|
|
482
492
|
|
|
483
|
-
**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).
|
|
484
494
|
|
|
485
495
|
### 0.5.0
|
|
486
496
|
|
|
@@ -492,7 +502,7 @@ _First in 0.5.0._
|
|
|
492
502
|
|
|
493
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.
|
|
494
504
|
|
|
495
|
-
**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).
|
|
496
506
|
|
|
497
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**
|
|
498
508
|
|
|
@@ -502,7 +512,7 @@ _First in 0.5.0._
|
|
|
502
512
|
|
|
503
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.
|
|
504
514
|
|
|
505
|
-
**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).
|
|
506
516
|
|
|
507
517
|
**Now deletable.** A shared `seo` constant passed separately to the Next context and the AI content config.
|
|
508
518
|
|
|
@@ -530,7 +540,7 @@ resolved without it.
|
|
|
530
540
|
**To adopt.** Where a reference renders its target's prose, set `includeBody: true` on that
|
|
531
541
|
reference field. Code that reads the body from a link-only reference's resolved type now sees
|
|
532
542
|
`string | undefined`; either set `includeBody: true` or handle the missing value. See
|
|
533
|
-
[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).
|
|
534
544
|
|
|
535
545
|
### 0.3.3
|
|
536
546
|
|
|
@@ -947,7 +957,7 @@ URL.
|
|
|
947
957
|
2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
|
|
948
958
|
`app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
|
|
949
959
|
route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
|
|
950
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
960
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#live-preview)).
|
|
951
961
|
3. A test reading view content from the route's server HTML must load the page in a browser.
|
|
952
962
|
Server output rendered during a preview request carries the signed-in asset prefix; keep it out
|
|
953
963
|
of cross-request caches (`unstable_cache`, module memos).
|
|
@@ -962,7 +972,7 @@ kept site styles ahead of Mantine's in the preview.
|
|
|
962
972
|
server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
|
|
963
973
|
path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
|
|
964
974
|
refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
|
|
965
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
975
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#live-preview).
|
|
966
976
|
|
|
967
977
|
**To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
|
|
968
978
|
as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
|
|
@@ -1044,7 +1054,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
|
|
|
1044
1054
|
fields are nested or renamed, pass the AI config's `seo` the same object you pass
|
|
1045
1055
|
`createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
|
|
1046
1056
|
place. A field that links to a hidden section by plain URL needs a field transform; the README
|
|
1047
|
-
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).
|
|
1048
1058
|
|
|
1049
1059
|
**Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
|
|
1050
1060
|
|
|
@@ -1066,7 +1076,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
|
|
|
1066
1076
|
field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
|
|
1067
1077
|
`MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
|
|
1068
1078
|
`{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
|
|
1069
|
-
[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).
|
|
1070
1080
|
|
|
1071
1081
|
**To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
|
|
1072
1082
|
`mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
|
|
@@ -1203,7 +1213,7 @@ a format check.
|
|
|
1203
1213
|
|
|
1204
1214
|
- (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
|
|
1205
1215
|
re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
|
|
1206
|
-
([reference](https://github.com/safeinsights/canopycms/blob/
|
|
1216
|
+
([reference](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#definecanopyconfig-options)).
|
|
1207
1217
|
- (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
|
|
1208
1218
|
the PR-body section every user who edited the branch, not only the submitter; settings commits
|
|
1209
1219
|
(permissions, groups) carry the acting user's trailer.
|
|
@@ -1227,7 +1237,7 @@ saves only push the branch, and no failing PR task lands in System health.
|
|
|
1227
1237
|
that entry type goes unavailable: the editor says so, and its entries answer 503 with
|
|
1228
1238
|
`code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
|
|
1229
1239
|
worker holds the base branch for up to 30 minutes while that lasts; see
|
|
1230
|
-
[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).
|
|
1231
1241
|
Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
|
|
1232
1242
|
`ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
|
|
1233
1243
|
|
|
@@ -1265,7 +1275,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
|
|
|
1265
1275
|
new stack needs no steps.
|
|
1266
1276
|
|
|
1267
1277
|
**What changed.** (int.109) Detailed in
|
|
1268
|
-
[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
|
|
1269
1279
|
bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
|
|
1270
1280
|
refusing clients without TLS or IAM, replacing the worker's
|
|
1271
1281
|
`AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
|
|
@@ -1319,10 +1329,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
|
|
|
1319
1329
|
with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
|
|
1320
1330
|
unchanged.
|
|
1321
1331
|
- `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
|
|
1322
|
-
[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).
|
|
1323
1333
|
|
|
1324
1334
|
**To adopt.** Optional. For parameter-only change sets, see
|
|
1325
|
-
[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
|
|
1326
1336
|
`alarmTopic`.
|
|
1327
1337
|
|
|
1328
1338
|
**Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
|
|
@@ -1333,7 +1343,7 @@ worker, and a hand-built alarm on the worker log group.
|
|
|
1333
1343
|
**What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
|
|
1334
1344
|
swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
|
|
1335
1345
|
`alarmTopic` if set; a retried step names itself when it gives up. See
|
|
1336
|
-
[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).
|
|
1337
1347
|
|
|
1338
1348
|
**To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
|
|
1339
1349
|
not Template first and the worker contract stays at 1.
|
|
@@ -1399,7 +1409,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
|
|
|
1399
1409
|
|
|
1400
1410
|
**To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
|
|
1401
1411
|
mirror, so the root volume needs room for two
|
|
1402
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
1412
|
+
([details](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/docs/deploying-to-aws.md#the-worker-instance)).
|
|
1403
1413
|
|
|
1404
1414
|
#### The worker follows a rebased or deleted GitHub branch
|
|
1405
1415
|
|
|
@@ -1421,7 +1431,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
|
|
|
1421
1431
|
bundle-only roll is safe.
|
|
1422
1432
|
|
|
1423
1433
|
**To adopt.** Parameter mode: gate bundle-only rolls on the contract
|
|
1424
|
-
([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
|
|
1425
1435
|
`WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
|
|
1426
1436
|
copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
|
|
1427
1437
|
|
|
@@ -1438,8 +1448,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
|
|
|
1438
1448
|
template, then roll the bundle; on an older template it stops with `template too old for this
|
|
1439
1449
|
bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
|
|
1440
1450
|
takes `worker/`'s three units and `gateway.env.example`
|
|
1441
|
-
([steps](https://github.com/safeinsights/canopycms/blob/
|
|
1442
|
-
[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).
|
|
1443
1453
|
|
|
1444
1454
|
#### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
|
|
1445
1455
|
|
|
@@ -1450,7 +1460,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
|
|
|
1450
1460
|
`X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
|
|
1451
1461
|
its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
|
|
1452
1462
|
marked `noindex`. The editor's default preview is same-origin and unaffected. See
|
|
1453
|
-
[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).
|
|
1454
1464
|
|
|
1455
1465
|
**To adopt.** If you wired the Function URL into your own distribution by hand, delete those
|
|
1456
1466
|
behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
|
|
@@ -1626,7 +1636,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
|
|
|
1626
1636
|
**To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
|
|
1627
1637
|
apply the same rule here, for example `referenceLink: (target, { body }) =>
|
|
1628
1638
|
!body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
|
|
1629
|
-
[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).
|
|
1630
1640
|
|
|
1631
1641
|
**Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
|
|
1632
1642
|
change its link.
|
|
@@ -1701,7 +1711,7 @@ _First in int.115._
|
|
|
1701
1711
|
entry the base branch also changed, the "updated on the base branch" notice and the branch's
|
|
1702
1712
|
conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
|
|
1703
1713
|
base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
|
|
1704
|
-
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
|
|
1705
1715
|
unpublishing.
|
|
1706
1716
|
|
|
1707
1717
|
#### The editor calls the content drawer "All content"
|
|
@@ -2013,7 +2023,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
|
|
|
2013
2023
|
The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
|
|
2014
2024
|
|
|
2015
2025
|
**To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
|
|
2016
|
-
`{ 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).
|
|
2017
2027
|
|
|
2018
2028
|
**Now deletable.** A build step or hook that writes a missing publication date into new entries.
|
|
2019
2029
|
|
|
@@ -2060,7 +2070,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
|
|
|
2060
2070
|
stored at, and `react-split-pane` is no longer a dependency.
|
|
2061
2071
|
`EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
|
|
2062
2072
|
no longer exported from `canopycms/client`. See
|
|
2063
|
-
[Your root layout](https://github.com/safeinsights/canopycms/blob/
|
|
2073
|
+
[Your root layout](https://github.com/safeinsights/canopycms/blob/b67d39a9a60e1c1d9dd23324c78df06c2295afa8/README.md#editor-customization).
|
|
2064
2074
|
|
|
2065
2075
|
**To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
|
|
2066
2076
|
instead, which lays out its own panes. Hiding your site chrome on the editor route is now
|
|
@@ -2171,7 +2181,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
|
|
|
2171
2181
|
**To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
|
|
2172
2182
|
`ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
|
|
2173
2183
|
own pages, mount the hook as in
|
|
2174
|
-
[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).
|
|
2175
2185
|
Your own Server Actions in the CMS build still 403 behind OAC.
|
|
2176
2186
|
|
|
2177
2187
|
**Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
|
|
@@ -2212,12 +2222,12 @@ fast naming the ARN, the field and the keys present, never a value.
|
|
|
2212
2222
|
**To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
|
|
2213
2223
|
prop. The scaffolded stack fills them from the repository _variables_
|
|
2214
2224
|
`CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
|
|
2215
|
-
([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
|
|
2216
2226
|
adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
|
|
2217
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
|
|
2218
2228
|
(also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
|
|
2219
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
|
|
2220
|
-
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)).
|
|
2221
2231
|
|
|
2222
2232
|
**Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
|
|
2223
2233
|
worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
|
|
@@ -2229,7 +2239,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
|
|
|
2229
2239
|
`githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
|
|
2230
2240
|
nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
|
|
2231
2241
|
anyone holding an App's key can mint a token for any of its installations
|
|
2232
|
-
([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)).
|
|
2233
2243
|
|
|
2234
2244
|
**To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
|
|
2235
2245
|
`githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
|
|
@@ -2242,7 +2252,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2242
2252
|
`verify` checks an existing installation's permissions: run it, since an App missing a
|
|
2243
2253
|
permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
|
|
2244
2254
|
never edits an existing JSON secret (create one and point the JSON-field prop at it)
|
|
2245
|
-
([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)).
|
|
2246
2256
|
2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
|
|
2247
2257
|
of the three is refused at synth, and so is an App alongside a token.
|
|
2248
2258
|
3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
|
|
@@ -2253,7 +2263,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2253
2263
|
|
|
2254
2264
|
The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
|
|
2255
2265
|
IAM policy automatically, so you need not add it to `secretsArns`. See
|
|
2256
|
-
[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).
|
|
2257
2267
|
|
|
2258
2268
|
```bash
|
|
2259
2269
|
canopycms init-github-app create -- \
|
|
@@ -2301,7 +2311,7 @@ downloads the `.pem` from the App's settings page.
|
|
|
2301
2311
|
|
|
2302
2312
|
**What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
|
|
2303
2313
|
key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
|
|
2304
|
-
[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).
|
|
2305
2315
|
|
|
2306
2316
|
**To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
|
|
2307
2317
|
GitHub App private key is still read only at boot: store the new key, replace the instance, and
|
|
@@ -2355,12 +2365,12 @@ also check the bucket policy for its grant.
|
|
|
2355
2365
|
5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
|
|
2356
2366
|
Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
|
|
2357
2367
|
`webpack` and it can read your Next version. A webpack build still fails its image transforms
|
|
2358
|
-
([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)).
|
|
2359
2369
|
|
|
2360
2370
|
**Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
|
|
2361
2371
|
function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
|
|
2362
2372
|
function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
|
|
2363
|
-
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)).
|
|
2364
2374
|
|
|
2365
2375
|
**To adopt.**
|
|
2366
2376
|
|
|
@@ -2389,7 +2399,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
|
|
|
2389
2399
|
|
|
2390
2400
|
**What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
|
|
2391
2401
|
replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
|
|
2392
|
-
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
|
|
2393
2403
|
CloudFront behavior it expects.
|
|
2394
2404
|
|
|
2395
2405
|
**To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
|
|
@@ -2414,7 +2424,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
|
|
|
2414
2424
|
bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
|
|
2415
2425
|
`Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
|
|
2416
2426
|
`AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
|
|
2417
|
-
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).
|
|
2418
2428
|
|
|
2419
2429
|
**To adopt.** Optional:
|
|
2420
2430
|
|
|
@@ -2524,7 +2534,7 @@ public JWKS PEM, used only to verify signatures.
|
|
|
2524
2534
|
to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
|
|
2525
2535
|
deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
|
|
2526
2536
|
`clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
|
|
2527
|
-
`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)).
|
|
2528
2538
|
|
|
2529
2539
|
#### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
|
|
2530
2540
|
|
|
@@ -2623,7 +2633,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
|
2623
2633
|
Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
|
|
2624
2634
|
no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
|
|
2625
2635
|
`AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
|
|
2626
|
-
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:
|
|
2627
2637
|
|
|
2628
2638
|
- Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
|
|
2629
2639
|
a nested route prefix and emits zero params, building green.
|
|
@@ -2782,7 +2792,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
|
|
|
2782
2792
|
`withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
|
|
2783
2793
|
`canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
|
|
2784
2794
|
`createNextCanopyContext`'s result. See
|
|
2785
|
-
[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
|
|
2786
2796
|
the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
|
|
2787
2797
|
sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
|
|
2788
2798
|
filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
|
|
@@ -2839,7 +2849,7 @@ underscore-prefixed files are skipped.
|
|
|
2839
2849
|
|
|
2840
2850
|
**What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
|
|
2841
2851
|
`defaultPathAccess: { read: 'allow' }`
|
|
2842
|
-
([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)).
|
|
2843
2853
|
|
|
2844
2854
|
**To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
|
|
2845
2855
|
consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
|
|
@@ -2892,7 +2902,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
|
|
|
2892
2902
|
**What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
|
|
2893
2903
|
gives one template's value type) requires exactly
|
|
2894
2904
|
one component per block template name when written as an object literal. See
|
|
2895
|
-
[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
|
|
2896
2906
|
`apps/example1/app/components/PostView.tsx`.
|
|
2897
2907
|
|
|
2898
2908
|
```ts
|
|
@@ -2914,7 +2924,7 @@ templates against the schema.
|
|
|
2914
2924
|
|
|
2915
2925
|
**What changed.** Spreading a `const` field array into several schemas, and nesting
|
|
2916
2926
|
`defineInlineFieldGroup()` inside a block template, are documented
|
|
2917
|
-
([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
|
|
2918
2928
|
identity helper for them.
|
|
2919
2929
|
|
|
2920
2930
|
```ts
|
|
@@ -2933,7 +2943,7 @@ field by composing from the same `const` field object.
|
|
|
2933
2943
|
A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
|
|
2934
2944
|
it, and listings do with
|
|
2935
2945
|
[`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
|
|
2936
|
-
(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).
|
|
2937
2947
|
|
|
2938
2948
|
**Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
|
|
2939
2949
|
|
|
@@ -2955,7 +2965,7 @@ Not retro-documented, apart from these:
|
|
|
2955
2965
|
|
|
2956
2966
|
#### The registry is keyed by entry-type name (0.0.42)
|
|
2957
2967
|
|
|
2958
|
-
**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.
|
|
2959
2969
|
|
|
2960
2970
|
**To adopt.**
|
|
2961
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 {};
|