canopycms 0.8.2 → 0.9.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 +79 -47
- package/dist/ai/json-to-markdown.js +2 -0
- package/dist/ai/resolve-branch.js +2 -1
- package/dist/api/branch-entry-changes.js +2 -4
- package/dist/authorization/branch.d.ts +10 -4
- package/dist/authorization/branch.js +24 -4
- package/dist/authorization/types.d.ts +1 -1
- package/dist/cli/cli.js +1984 -1630
- package/dist/cli/configured-asset-store.js +2 -8
- package/dist/cli/generate-ai-content.js +86 -16
- package/dist/cli/init.js +1 -1
- package/dist/cli/site-config.d.ts +9 -0
- package/dist/cli/site-config.js +17 -0
- package/dist/cli/sync.js +226 -74
- package/dist/config/types.d.ts +4 -4
- package/dist/config/types.js +1 -1
- package/dist/config/validation.d.ts +9 -3
- package/dist/config/validation.js +30 -5
- package/dist/content-listing.js +2 -3
- package/dist/content-store.js +5 -5
- package/dist/editor/FormRenderer.js +5 -0
- package/dist/editor/components/EntryChangesDrawer.js +3 -2
- package/dist/editor/entry-diff.js +7 -1
- package/dist/editor/fields/DateField.d.ts +19 -0
- package/dist/editor/fields/DateField.js +53 -0
- package/dist/editor/fields/DateTimeField.d.ts +10 -0
- package/dist/editor/fields/DateTimeField.js +5 -15
- package/dist/editor/fields/list-item-title.js +2 -1
- package/dist/editor/theme.js +12 -4
- package/dist/entry-schema-registry.js +2 -1
- package/dist/services.d.ts +3 -2
- package/dist/static/index.js +5 -2
- package/dist/system-users.d.ts +2 -0
- package/dist/system-users.js +6 -1
- package/dist/utils/calendar-day.d.ts +23 -0
- package/dist/utils/calendar-day.js +102 -0
- package/dist/utils/content-serialize.d.ts +4 -2
- package/dist/utils/content-serialize.js +8 -6
- package/dist/validation/entry-validator.js +7 -1
- package/dist/validation/field-traversal.js +1 -1
- 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.9.0`, built from [`2646912`](https://github.com/safeinsights/canopycms/tree/264691297c186d4a066f0455b4a20a66a84290be).
|
|
9
9
|
|
|
10
|
-
Its entries are [0.
|
|
10
|
+
Its entries are [0.9.0](#090), 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/264691297c186d4a066f0455b4a20a66a84290be/.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,38 @@ entries under **Released**.
|
|
|
62
62
|
|
|
63
63
|
## Released
|
|
64
64
|
|
|
65
|
+
### 0.9.0
|
|
66
|
+
|
|
67
|
+
#### A `date` field for a day with no time and no zone
|
|
68
|
+
|
|
69
|
+
<!-- changeset: date-field-type -->
|
|
70
|
+
|
|
71
|
+
_First in 0.9.0._
|
|
72
|
+
|
|
73
|
+
**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.
|
|
74
|
+
|
|
75
|
+
**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/264691297c186d4a066f0455b4a20a66a84290be/.changeset/README.md#field-types).
|
|
76
|
+
|
|
77
|
+
**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.
|
|
78
|
+
|
|
79
|
+
### 0.8.3
|
|
80
|
+
|
|
81
|
+
#### Dev pages load for non-admin users under `defaultBranchAccess: 'deny'`
|
|
82
|
+
|
|
83
|
+
<!-- changeset: dev-active-branch-readable-under-deny -->
|
|
84
|
+
|
|
85
|
+
_First in 0.8.3._
|
|
86
|
+
|
|
87
|
+
**What changed.** In `dev` mode with `defaultBaseBranch` set, a page rendered on a git branch other than the base failed with `Forbidden: branch access denied (no_acl)` for any user outside `admins` and `reviewers`, because CanopyCMS provisions that branch's workspace itself and so nobody counted as its creator. The active branch the dev server provisions now passes branch access the way the base branch does: readable and, subject to path permissions, editable, but not submittable by a user who has no other grant. Prod and branches people create are unchanged.
|
|
88
|
+
|
|
89
|
+
#### `canopycms sync` reaches the workspace the dev server reads for a branch with a slash
|
|
90
|
+
|
|
91
|
+
<!-- changeset: sync-resolves-branch-like-dev-server -->
|
|
92
|
+
|
|
93
|
+
_First in 0.8.3._
|
|
94
|
+
|
|
95
|
+
**What changed.** `sync` resolves a branch name the way the dev server does. On a branch such as `fix/header`, `push` used to report success but write to a nested `.canopy-dev/content-branches/fix/header` that nothing reads, so the dev site never changed; it now writes to `fix-header`, the workspace the dev server serves, and `pull`, `both` and `abort` read from it. `--branch` also takes an editor branch's short name or its workspace directory name. `sync` refuses a workspace that belongs to a different branch, and a directory under `content-branches/` that is not its own git repository. Short names honour `branchNamespace` from `canopycms.config.ts`; if the config cannot be used, `sync` warns and uses the defaults.
|
|
96
|
+
|
|
65
97
|
### 0.8.2
|
|
66
98
|
|
|
67
99
|
#### The editor says when a pull request is stuck, and what to do
|
|
@@ -316,7 +348,7 @@ _First in 0.7.0._
|
|
|
316
348
|
|
|
317
349
|
**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.
|
|
318
350
|
|
|
319
|
-
**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/
|
|
351
|
+
**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/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#rolling-the-worker-from-ci).
|
|
320
352
|
|
|
321
353
|
#### Pull request bodies link back to the editor
|
|
322
354
|
|
|
@@ -326,7 +358,7 @@ _First in 0.7.0._
|
|
|
326
358
|
|
|
327
359
|
**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.
|
|
328
360
|
|
|
329
|
-
**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/
|
|
361
|
+
**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/264691297c186d4a066f0455b4a20a66a84290be/README.md#definecanopyconfig-options).
|
|
330
362
|
|
|
331
363
|
#### CloudFront origin read timeout accepted up to 120 s; the editor waits 135 s
|
|
332
364
|
|
|
@@ -412,7 +444,7 @@ _First in 0.6.0._
|
|
|
412
444
|
|
|
413
445
|
**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.
|
|
414
446
|
|
|
415
|
-
**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/
|
|
447
|
+
**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/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md).
|
|
416
448
|
|
|
417
449
|
### 0.5.0
|
|
418
450
|
|
|
@@ -424,7 +456,7 @@ _First in 0.5.0._
|
|
|
424
456
|
|
|
425
457
|
**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.
|
|
426
458
|
|
|
427
|
-
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/
|
|
459
|
+
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#field-types).
|
|
428
460
|
|
|
429
461
|
#### SEO field location moves into config; reference pickers mark hidden entries and take a sort order — **breaking: `createNextCanopyContext({ seo })` and `AIContentConfig.seo` are removed**
|
|
430
462
|
|
|
@@ -434,7 +466,7 @@ _First in 0.5.0._
|
|
|
434
466
|
|
|
435
467
|
**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.
|
|
436
468
|
|
|
437
|
-
**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/
|
|
469
|
+
**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/264691297c186d4a066f0455b4a20a66a84290be/README.md#sitemap-and-seo-metadata) and [How References Work in the Editor](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#how-references-work-in-the-editor).
|
|
438
470
|
|
|
439
471
|
**Now deletable.** A shared `seo` constant passed separately to the Next context and the AI content config.
|
|
440
472
|
|
|
@@ -462,7 +494,7 @@ resolved without it.
|
|
|
462
494
|
**To adopt.** Where a reference renders its target's prose, set `includeBody: true` on that
|
|
463
495
|
reference field. Code that reads the body from a link-only reference's resolved type now sees
|
|
464
496
|
`string | undefined`; either set `includeBody: true` or handle the missing value. See
|
|
465
|
-
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/
|
|
497
|
+
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#resolving-references-in-a-listing).
|
|
466
498
|
|
|
467
499
|
### 0.3.3
|
|
468
500
|
|
|
@@ -879,7 +911,7 @@ URL.
|
|
|
879
911
|
2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
|
|
880
912
|
`app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
|
|
881
913
|
route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
|
|
882
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
914
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#live-preview)).
|
|
883
915
|
3. A test reading view content from the route's server HTML must load the page in a browser.
|
|
884
916
|
Server output rendered during a preview request carries the signed-in asset prefix; keep it out
|
|
885
917
|
of cross-request caches (`unstable_cache`, module memos).
|
|
@@ -894,7 +926,7 @@ kept site styles ahead of Mantine's in the preview.
|
|
|
894
926
|
server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
|
|
895
927
|
path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
|
|
896
928
|
refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
|
|
897
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
929
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#live-preview).
|
|
898
930
|
|
|
899
931
|
**To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
|
|
900
932
|
as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
|
|
@@ -976,7 +1008,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
|
|
|
976
1008
|
fields are nested or renamed, pass the AI config's `seo` the same object you pass
|
|
977
1009
|
`createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
|
|
978
1010
|
place. A field that links to a hidden section by plain URL needs a field transform; the README
|
|
979
|
-
shows [the recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1011
|
+
shows [the recipe](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#ai-content-configuration).
|
|
980
1012
|
|
|
981
1013
|
**Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
|
|
982
1014
|
|
|
@@ -998,7 +1030,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
|
|
|
998
1030
|
field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
|
|
999
1031
|
`MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
|
|
1000
1032
|
`{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
|
|
1001
|
-
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/
|
|
1033
|
+
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#mdx-content-cannot-run-code).
|
|
1002
1034
|
|
|
1003
1035
|
**To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
|
|
1004
1036
|
`mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
|
|
@@ -1135,7 +1167,7 @@ a format check.
|
|
|
1135
1167
|
|
|
1136
1168
|
- (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
|
|
1137
1169
|
re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
|
|
1138
|
-
([reference](https://github.com/safeinsights/canopycms/blob/
|
|
1170
|
+
([reference](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#definecanopyconfig-options)).
|
|
1139
1171
|
- (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
|
|
1140
1172
|
the PR-body section every user who edited the branch, not only the submitter; settings commits
|
|
1141
1173
|
(permissions, groups) carry the acting user's trailer.
|
|
@@ -1159,7 +1191,7 @@ saves only push the branch, and no failing PR task lands in System health.
|
|
|
1159
1191
|
that entry type goes unavailable: the editor says so, and its entries answer 503 with
|
|
1160
1192
|
`code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
|
|
1161
1193
|
worker holds the base branch for up to 30 minutes while that lasts; see
|
|
1162
|
-
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/
|
|
1194
|
+
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
|
|
1163
1195
|
Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
|
|
1164
1196
|
`ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
|
|
1165
1197
|
|
|
@@ -1197,7 +1229,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
|
|
|
1197
1229
|
new stack needs no steps.
|
|
1198
1230
|
|
|
1199
1231
|
**What changed.** (int.109) Detailed in
|
|
1200
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1232
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
|
|
1201
1233
|
bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
|
|
1202
1234
|
refusing clients without TLS or IAM, replacing the worker's
|
|
1203
1235
|
`AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
|
|
@@ -1251,10 +1283,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
|
|
|
1251
1283
|
with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
|
|
1252
1284
|
unchanged.
|
|
1253
1285
|
- `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
|
|
1254
|
-
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/
|
|
1286
|
+
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#worker-down-alarm).
|
|
1255
1287
|
|
|
1256
1288
|
**To adopt.** Optional. For parameter-only change sets, see
|
|
1257
|
-
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
1289
|
+
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
|
|
1258
1290
|
`alarmTopic`.
|
|
1259
1291
|
|
|
1260
1292
|
**Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
|
|
@@ -1265,7 +1297,7 @@ worker, and a hand-built alarm on the worker log group.
|
|
|
1265
1297
|
**What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
|
|
1266
1298
|
swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
|
|
1267
1299
|
`alarmTopic` if set; a retried step names itself when it gives up. See
|
|
1268
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1300
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#the-worker-instance).
|
|
1269
1301
|
|
|
1270
1302
|
**To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
|
|
1271
1303
|
not Template first and the worker contract stays at 1.
|
|
@@ -1331,7 +1363,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
|
|
|
1331
1363
|
|
|
1332
1364
|
**To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
|
|
1333
1365
|
mirror, so the root volume needs room for two
|
|
1334
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
1366
|
+
([details](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#the-worker-instance)).
|
|
1335
1367
|
|
|
1336
1368
|
#### The worker follows a rebased or deleted GitHub branch
|
|
1337
1369
|
|
|
@@ -1353,7 +1385,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
|
|
|
1353
1385
|
bundle-only roll is safe.
|
|
1354
1386
|
|
|
1355
1387
|
**To adopt.** Parameter mode: gate bundle-only rolls on the contract
|
|
1356
|
-
([recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1388
|
+
([recipe](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
|
|
1357
1389
|
`WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
|
|
1358
1390
|
copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
|
|
1359
1391
|
|
|
@@ -1370,8 +1402,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
|
|
|
1370
1402
|
template, then roll the bundle; on an older template it stops with `template too old for this
|
|
1371
1403
|
bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
|
|
1372
1404
|
takes `worker/`'s three units and `gateway.env.example`
|
|
1373
|
-
([steps](https://github.com/safeinsights/canopycms/blob/
|
|
1374
|
-
[checklist](https://github.com/safeinsights/canopycms/blob/
|
|
1405
|
+
([steps](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
|
|
1406
|
+
[checklist](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#first-deploy-checklist).
|
|
1375
1407
|
|
|
1376
1408
|
#### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
|
|
1377
1409
|
|
|
@@ -1382,7 +1414,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
|
|
|
1382
1414
|
`X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
|
|
1383
1415
|
its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
|
|
1384
1416
|
marked `noindex`. The editor's default preview is same-origin and unaffected. See
|
|
1385
|
-
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/
|
|
1417
|
+
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
|
|
1386
1418
|
|
|
1387
1419
|
**To adopt.** If you wired the Function URL into your own distribution by hand, delete those
|
|
1388
1420
|
behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
|
|
@@ -1558,7 +1590,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
|
|
|
1558
1590
|
**To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
|
|
1559
1591
|
apply the same rule here, for example `referenceLink: (target, { body }) =>
|
|
1560
1592
|
!body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
|
|
1561
|
-
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
1593
|
+
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#ai-content-configuration).
|
|
1562
1594
|
|
|
1563
1595
|
**Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
|
|
1564
1596
|
change its link.
|
|
@@ -1633,7 +1665,7 @@ _First in int.115._
|
|
|
1633
1665
|
entry the base branch also changed, the "updated on the base branch" notice and the branch's
|
|
1634
1666
|
conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
|
|
1635
1667
|
base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
|
|
1636
|
-
and Unpublishing](https://github.com/safeinsights/canopycms/blob/
|
|
1668
|
+
and Unpublishing](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#drafts-and-unpublishing) section covers long-lived branches and
|
|
1637
1669
|
unpublishing.
|
|
1638
1670
|
|
|
1639
1671
|
#### The editor calls the content drawer "All content"
|
|
@@ -1945,7 +1977,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
|
|
|
1945
1977
|
The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
|
|
1946
1978
|
|
|
1947
1979
|
**To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
|
|
1948
|
-
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/
|
|
1980
|
+
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#stamping-a-publication-date).
|
|
1949
1981
|
|
|
1950
1982
|
**Now deletable.** A build step or hook that writes a missing publication date into new entries.
|
|
1951
1983
|
|
|
@@ -1992,7 +2024,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
|
|
|
1992
2024
|
stored at, and `react-split-pane` is no longer a dependency.
|
|
1993
2025
|
`EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
|
|
1994
2026
|
no longer exported from `canopycms/client`. See
|
|
1995
|
-
[Your root layout](https://github.com/safeinsights/canopycms/blob/
|
|
2027
|
+
[Your root layout](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#editor-customization).
|
|
1996
2028
|
|
|
1997
2029
|
**To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
|
|
1998
2030
|
instead, which lays out its own panes. Hiding your site chrome on the editor route is now
|
|
@@ -2103,7 +2135,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
|
|
|
2103
2135
|
**To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
|
|
2104
2136
|
`ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
|
|
2105
2137
|
own pages, mount the hook as in
|
|
2106
|
-
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/
|
|
2138
|
+
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
|
|
2107
2139
|
Your own Server Actions in the CMS build still 403 behind OAC.
|
|
2108
2140
|
|
|
2109
2141
|
**Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
|
|
@@ -2144,12 +2176,12 @@ fast naming the ARN, the field and the keys present, never a value.
|
|
|
2144
2176
|
**To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
|
|
2145
2177
|
prop. The scaffolded stack fills them from the repository _variables_
|
|
2146
2178
|
`CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
|
|
2147
|
-
([why the prefix](https://github.com/safeinsights/canopycms/blob/
|
|
2179
|
+
([why the prefix](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
|
|
2148
2180
|
adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
|
|
2149
2181
|
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
|
|
2150
2182
|
(also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
|
|
2151
2183
|
resource's configuration, readable by anyone who can describe it. Only `CLERK_SECRET_KEY` goes through Secrets Manager; `CLERK_JWT_KEY` and the publishable
|
|
2152
|
-
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2184
|
+
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#security-model)).
|
|
2153
2185
|
|
|
2154
2186
|
**Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
|
|
2155
2187
|
worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
|
|
@@ -2161,7 +2193,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
|
|
|
2161
2193
|
`githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
|
|
2162
2194
|
nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
|
|
2163
2195
|
anyone holding an App's key can mint a token for any of its installations
|
|
2164
|
-
([why](https://github.com/safeinsights/canopycms/blob/
|
|
2196
|
+
([why](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
|
|
2165
2197
|
|
|
2166
2198
|
**To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
|
|
2167
2199
|
`githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
|
|
@@ -2174,7 +2206,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2174
2206
|
`verify` checks an existing installation's permissions: run it, since an App missing a
|
|
2175
2207
|
permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
|
|
2176
2208
|
never edits an existing JSON secret (create one and point the JSON-field prop at it)
|
|
2177
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
2209
|
+
([details](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
|
|
2178
2210
|
2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
|
|
2179
2211
|
of the three is refused at synth, and so is an App alongside a token.
|
|
2180
2212
|
3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
|
|
@@ -2185,7 +2217,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2185
2217
|
|
|
2186
2218
|
The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
|
|
2187
2219
|
IAM policy automatically, so you need not add it to `secretsArns`. See
|
|
2188
|
-
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/
|
|
2220
|
+
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#authenticating-as-a-github-app).
|
|
2189
2221
|
|
|
2190
2222
|
```bash
|
|
2191
2223
|
canopycms init-github-app create -- \
|
|
@@ -2233,7 +2265,7 @@ downloads the `.pem` from the App's settings page.
|
|
|
2233
2265
|
|
|
2234
2266
|
**What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
|
|
2235
2267
|
key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
|
|
2236
|
-
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/
|
|
2268
|
+
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#rotating-a-secret).
|
|
2237
2269
|
|
|
2238
2270
|
**To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
|
|
2239
2271
|
GitHub App private key is still read only at boot: store the new key, replace the instance, and
|
|
@@ -2287,12 +2319,12 @@ also check the bucket policy for its grant.
|
|
|
2287
2319
|
5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
|
|
2288
2320
|
Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
|
|
2289
2321
|
`webpack` and it can read your Next version. A webpack build still fails its image transforms
|
|
2290
|
-
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/
|
|
2322
|
+
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#dual-build-support)).
|
|
2291
2323
|
|
|
2292
2324
|
**Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
|
|
2293
2325
|
function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
|
|
2294
2326
|
function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
|
|
2295
|
-
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/
|
|
2327
|
+
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#where-the-image-is-built)).
|
|
2296
2328
|
|
|
2297
2329
|
**To adopt.**
|
|
2298
2330
|
|
|
@@ -2321,7 +2353,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
|
|
|
2321
2353
|
|
|
2322
2354
|
**What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
|
|
2323
2355
|
replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
|
|
2324
|
-
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2356
|
+
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#media-configuration) for the
|
|
2325
2357
|
CloudFront behavior it expects.
|
|
2326
2358
|
|
|
2327
2359
|
**To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
|
|
@@ -2346,7 +2378,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
|
|
|
2346
2378
|
bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
|
|
2347
2379
|
`Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
|
|
2348
2380
|
`AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
|
|
2349
|
-
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/
|
|
2381
|
+
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#cross-account-asset-bucket).
|
|
2350
2382
|
|
|
2351
2383
|
**To adopt.** Optional:
|
|
2352
2384
|
|
|
@@ -2456,7 +2488,7 @@ public JWKS PEM, used only to verify signatures.
|
|
|
2456
2488
|
to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
|
|
2457
2489
|
deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
|
|
2458
2490
|
`clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
|
|
2459
|
-
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2491
|
+
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/docs/deploying-to-aws.md#security-model)).
|
|
2460
2492
|
|
|
2461
2493
|
#### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
|
|
2462
2494
|
|
|
@@ -2555,7 +2587,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
|
2555
2587
|
Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
|
|
2556
2588
|
no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
|
|
2557
2589
|
`AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
|
|
2558
|
-
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2590
|
+
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#media-configuration)). Two traps:
|
|
2559
2591
|
|
|
2560
2592
|
- Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
|
|
2561
2593
|
a nested route prefix and emits zero params, building green.
|
|
@@ -2714,7 +2746,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
|
|
|
2714
2746
|
`withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
|
|
2715
2747
|
`canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
|
|
2716
2748
|
`createNextCanopyContext`'s result. See
|
|
2717
|
-
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
2749
|
+
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#sitemap-and-seo-metadata). Every routable entry type is in
|
|
2718
2750
|
the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
|
|
2719
2751
|
sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
|
|
2720
2752
|
filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
|
|
@@ -2771,7 +2803,7 @@ underscore-prefixed files are skipped.
|
|
|
2771
2803
|
|
|
2772
2804
|
**What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
|
|
2773
2805
|
`defaultPathAccess: { read: 'allow' }`
|
|
2774
|
-
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/
|
|
2806
|
+
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#public-read-on-server-deployments)).
|
|
2775
2807
|
|
|
2776
2808
|
**To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
|
|
2777
2809
|
consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
|
|
@@ -2824,7 +2856,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
|
|
|
2824
2856
|
**What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
|
|
2825
2857
|
gives one template's value type) requires exactly
|
|
2826
2858
|
one component per block template name when written as an object literal. See
|
|
2827
|
-
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/
|
|
2859
|
+
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#block-component-registries) and
|
|
2828
2860
|
`apps/example1/app/components/PostView.tsx`.
|
|
2829
2861
|
|
|
2830
2862
|
```ts
|
|
@@ -2846,7 +2878,7 @@ templates against the schema.
|
|
|
2846
2878
|
|
|
2847
2879
|
**What changed.** Spreading a `const` field array into several schemas, and nesting
|
|
2848
2880
|
`defineInlineFieldGroup()` inside a block template, are documented
|
|
2849
|
-
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/
|
|
2881
|
+
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
|
|
2850
2882
|
identity helper for them.
|
|
2851
2883
|
|
|
2852
2884
|
```ts
|
|
@@ -2865,7 +2897,7 @@ field by composing from the same `const` field object.
|
|
|
2865
2897
|
A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
|
|
2866
2898
|
it, and listings do with
|
|
2867
2899
|
[`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
|
|
2868
|
-
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/
|
|
2900
|
+
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/264691297c186d4a066f0455b4a20a66a84290be/README.md#shared--referenced-blocks).
|
|
2869
2901
|
|
|
2870
2902
|
**Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
|
|
2871
2903
|
|
|
@@ -2887,7 +2919,7 @@ Not retro-documented, apart from these:
|
|
|
2887
2919
|
|
|
2888
2920
|
#### The registry is keyed by entry-type name (0.0.42)
|
|
2889
2921
|
|
|
2890
|
-
**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/
|
|
2922
|
+
**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/264691297c186d4a066f0455b4a20a66a84290be/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
|
|
2891
2923
|
|
|
2892
2924
|
**To adopt.**
|
|
2893
2925
|
|
|
@@ -152,6 +152,7 @@ function renderField(field, value, depth, entry, opts) {
|
|
|
152
152
|
switch (field.type) {
|
|
153
153
|
case 'string':
|
|
154
154
|
case 'number':
|
|
155
|
+
case 'date':
|
|
155
156
|
case 'datetime':
|
|
156
157
|
return `${heading} ${label}${descriptionLine}\n\n${String(value)}`;
|
|
157
158
|
case 'boolean':
|
|
@@ -222,6 +223,7 @@ function renderListField(field, values, depth, label, heading, descriptionLine,
|
|
|
222
223
|
const FLAT_CELL_TYPES = new Set([
|
|
223
224
|
'string',
|
|
224
225
|
'number',
|
|
226
|
+
'date',
|
|
225
227
|
'datetime',
|
|
226
228
|
'boolean',
|
|
227
229
|
'select',
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { loadOrCreateBranchContext } from '../branch-workspace.js';
|
|
6
6
|
import { readsFromCheckout } from '../build-mode.js';
|
|
7
7
|
import { GitManager } from '../git-manager.js';
|
|
8
|
+
import { AI_USER_ID } from '../system-users.js';
|
|
8
9
|
import { baseBranchOf } from '../utils/base-branch.js';
|
|
9
10
|
import { detectHeadBranch } from '../utils/git.js';
|
|
10
11
|
/**
|
|
@@ -36,7 +37,7 @@ export async function resolveBranchRoot(config) {
|
|
|
36
37
|
config: resolved,
|
|
37
38
|
branchName: activeBranch,
|
|
38
39
|
mode: config.mode,
|
|
39
|
-
createdBy:
|
|
40
|
+
createdBy: AI_USER_ID,
|
|
40
41
|
remoteUrl: config.defaultRemoteUrl,
|
|
41
42
|
});
|
|
42
43
|
return context.branchRoot;
|
|
@@ -5,10 +5,10 @@ import { entryRefFromRepoPath, entryRefFromRepoPathShape, parseEntryParts, } fro
|
|
|
5
5
|
import { ContentStore, ContentStoreError } from '../content-store.js';
|
|
6
6
|
import { resolveCollectionPath } from '../content-id-index.js';
|
|
7
7
|
import { BaseBranchMissingError } from '../git-manager.js';
|
|
8
|
-
import { withItemKeys } from '../item-keys.js';
|
|
9
8
|
import { getBranchProtection } from '../authorization/protected-branch.js';
|
|
10
9
|
import { baseBranchOf } from '../utils/base-branch.js';
|
|
11
10
|
import { findBodyFieldName } from '../utils/body-field.js';
|
|
11
|
+
import { entryAsRead } from '../utils/calendar-day.js';
|
|
12
12
|
import { isNodeError, isNotFoundError } from '../utils/error.js';
|
|
13
13
|
import { getFormatExtension } from '../utils/format.js';
|
|
14
14
|
import { entryLogicalPath } from '../paths/index.js';
|
|
@@ -155,9 +155,7 @@ const readBefore = async (git, mergeBase, logicalPath, match, branchContext, con
|
|
|
155
155
|
return {
|
|
156
156
|
format,
|
|
157
157
|
entryType: ref.entryType,
|
|
158
|
-
|
|
159
|
-
// base carries the same key on both.
|
|
160
|
-
data: withItemKeys(fields, parsed.data, 'content'),
|
|
158
|
+
data: entryAsRead(fields, parsed.data),
|
|
161
159
|
...(parsed.body !== undefined && {
|
|
162
160
|
body: parsed.body,
|
|
163
161
|
bodyFieldName: findBodyFieldName(fields),
|
|
@@ -25,6 +25,12 @@ interface BranchAccessOptions {
|
|
|
25
25
|
* private.
|
|
26
26
|
*/
|
|
27
27
|
isProtectedBranch?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether this is dev's auto-provisioned active branch ({@link isDevActiveBranch}). It passes
|
|
30
|
+
* this layer where the base branch does, so it reads (and in dev saves) like the base;
|
|
31
|
+
* {@link canPerformWorkflowAction} never passes it, so no workflow rights follow.
|
|
32
|
+
*/
|
|
33
|
+
isDevActiveBranch?: boolean;
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
36
|
* Check if user has access to a branch with explicit default behavior.
|
|
@@ -35,17 +41,17 @@ interface BranchAccessOptions {
|
|
|
35
41
|
* 3. An explicit user/group ACL -- an allowlist omitting the creator still
|
|
36
42
|
* denies them, so an admin can lock down a branch someone else created
|
|
37
43
|
* 4. With no ACL: the branch creator, then `defaultAccess`, and only where that
|
|
38
|
-
* would deny, the
|
|
39
|
-
* (see {@link BranchAccessOptions.isProtectedBranch})
|
|
44
|
+
* would deny, the base branch or dev active branch grant ({@link BranchAccessOptions})
|
|
40
45
|
* @internal Exported for tests.
|
|
41
46
|
*/
|
|
42
47
|
export declare function checkBranchAccessWithDefault(context: BranchContext, user: CanopyUser, defaultAccess?: DefaultBranchAccess, options?: BranchAccessOptions): BranchAccessResult;
|
|
43
48
|
/**
|
|
44
49
|
* Bind a default access level. `config` is needed only to resolve the
|
|
45
50
|
* protected-base-branch question, which routes through `getBranchProtection`,
|
|
46
|
-
* its single source of truth, rather than repeating the comparison here
|
|
51
|
+
* its single source of truth, rather than repeating the comparison here, and
|
|
52
|
+
* the dev-active-branch question ({@link isDevActiveBranch}).
|
|
47
53
|
*/
|
|
48
|
-
export declare function createCheckBranchAccess(defaultAccess?: DefaultBranchAccess, config?: Pick<CanopyConfig, 'mode' | 'defaultBaseBranch'>): (context: BranchContext, user: CanopyUser) => BranchAccessResult;
|
|
54
|
+
export declare function createCheckBranchAccess(defaultAccess?: DefaultBranchAccess, config?: Pick<CanopyConfig, 'mode' | 'defaultBaseBranch' | 'defaultActiveBranch'>): (context: BranchContext, user: CanopyUser) => BranchAccessResult;
|
|
49
55
|
/** Options tightening {@link canPerformWorkflowAction} beyond the default hybrid model. */
|
|
50
56
|
export interface WorkflowActionOptions {
|
|
51
57
|
/**
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { isAdmin, isLockedOutOfBranch, isReviewer } from './helpers.js';
|
|
2
2
|
import { getBranchProtection } from './protected-branch.js';
|
|
3
|
-
import { SYSTEM_USER_ID } from '../system-users.js';
|
|
3
|
+
import { isSystemUserId, SYSTEM_USER_ID } from '../system-users.js';
|
|
4
|
+
import { sanitizeBranchName } from '../paths/branch-name.js';
|
|
5
|
+
import { baseBranchOf } from '../utils/base-branch.js';
|
|
6
|
+
/**
|
|
7
|
+
* Whether `context` is the active branch a dev server provisioned for itself: owned by a CanopyCMS
|
|
8
|
+
* system user, so nobody is its creator, and named like the active branch now, which follows git
|
|
9
|
+
* HEAD unless configured and is not the base when HEAD has left a configured `defaultBaseBranch`.
|
|
10
|
+
* A person's branch never is.
|
|
11
|
+
* `mode` is the adopter's configured operating mode; a prod deployment's is 'prod', so prod
|
|
12
|
+
* returns before the name comparison and never consults its possibly unresolved base branch.
|
|
13
|
+
*/
|
|
14
|
+
function isDevActiveBranch(config, context) {
|
|
15
|
+
if (config.mode !== 'dev' || !isSystemUserId(context.branch.createdBy))
|
|
16
|
+
return false;
|
|
17
|
+
const active = config.defaultActiveBranch ?? baseBranchOf(config);
|
|
18
|
+
return sanitizeBranchName(context.branch.name) === sanitizeBranchName(active);
|
|
19
|
+
}
|
|
4
20
|
/**
|
|
5
21
|
* Check if user has access to a branch with explicit default behavior.
|
|
6
22
|
*
|
|
@@ -10,8 +26,7 @@ import { SYSTEM_USER_ID } from '../system-users.js';
|
|
|
10
26
|
* 3. An explicit user/group ACL -- an allowlist omitting the creator still
|
|
11
27
|
* denies them, so an admin can lock down a branch someone else created
|
|
12
28
|
* 4. With no ACL: the branch creator, then `defaultAccess`, and only where that
|
|
13
|
-
* would deny, the
|
|
14
|
-
* (see {@link BranchAccessOptions.isProtectedBranch})
|
|
29
|
+
* would deny, the base branch or dev active branch grant ({@link BranchAccessOptions})
|
|
15
30
|
* @internal Exported for tests.
|
|
16
31
|
*/
|
|
17
32
|
export function checkBranchAccessWithDefault(context, user, defaultAccess = 'deny', options) {
|
|
@@ -43,6 +58,9 @@ export function checkBranchAccessWithDefault(context, user, defaultAccess = 'den
|
|
|
43
58
|
if (options?.isProtectedBranch) {
|
|
44
59
|
return { allowed: true, reason: 'base_branch' };
|
|
45
60
|
}
|
|
61
|
+
if (options?.isDevActiveBranch) {
|
|
62
|
+
return { allowed: true, reason: 'dev_active_branch' };
|
|
63
|
+
}
|
|
46
64
|
return { allowed: false, reason: 'no_acl' };
|
|
47
65
|
}
|
|
48
66
|
const userAllowed = hasUserConstraint && access.allowedUsers?.includes(user.userId);
|
|
@@ -53,13 +71,15 @@ export function checkBranchAccessWithDefault(context, user, defaultAccess = 'den
|
|
|
53
71
|
/**
|
|
54
72
|
* Bind a default access level. `config` is needed only to resolve the
|
|
55
73
|
* protected-base-branch question, which routes through `getBranchProtection`,
|
|
56
|
-
* its single source of truth, rather than repeating the comparison here
|
|
74
|
+
* its single source of truth, rather than repeating the comparison here, and
|
|
75
|
+
* the dev-active-branch question ({@link isDevActiveBranch}).
|
|
57
76
|
*/
|
|
58
77
|
export function createCheckBranchAccess(defaultAccess = 'deny', config) {
|
|
59
78
|
return (context, user) => checkBranchAccessWithDefault(context, user, defaultAccess, {
|
|
60
79
|
isProtectedBranch: config
|
|
61
80
|
? getBranchProtection(config, context.branch.name, context.branch.baseBranch).isProtected
|
|
62
81
|
: false,
|
|
82
|
+
isDevActiveBranch: config ? isDevActiveBranch(config, context) : false,
|
|
63
83
|
});
|
|
64
84
|
}
|
|
65
85
|
/**
|
|
@@ -7,7 +7,7 @@ export type PermissionPath = string & {
|
|
|
7
7
|
};
|
|
8
8
|
export interface BranchAccessResult {
|
|
9
9
|
allowed: boolean;
|
|
10
|
-
reason: 'privileged' | 'base_branch' | 'creator' | 'allowed_by_acl' | 'denied_by_acl' | 'no_acl';
|
|
10
|
+
reason: 'privileged' | 'base_branch' | 'dev_active_branch' | 'creator' | 'allowed_by_acl' | 'denied_by_acl' | 'no_acl';
|
|
11
11
|
}
|
|
12
12
|
export interface PathPermissionResult {
|
|
13
13
|
allowed: boolean;
|