canopycms-cdk 0.9.0 → 0.10.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.
@@ -370,6 +370,14 @@ export interface CanopyCmsServiceProps {
370
370
  * split), and validated at synth.
371
371
  */
372
372
  protectedBranches?: string[];
373
+ /**
374
+ * Delete a merged branch's editor copy this many days after it was archived: its workspace,
375
+ * metadata and comments, never its GitHub branch (default: unset, which keeps archived branches).
376
+ * A positive whole number, validated at synth. A branch archived without merging, or that may
377
+ * hold commits a merge left out, is left for a person to delete. The worker sweeps once per git
378
+ * sync. Stamped into the worker's `CANOPYCMS_ARCHIVED_BRANCH_RETENTION_DAYS`.
379
+ */
380
+ archivedBranchRetentionDays?: number;
373
381
  /**
374
382
  * The prefix of every branch editors create, which the GitHub gateway confines its writes to
375
383
  * (default: `canopycms/{deployment}/`). A template in which `{deployment}` is this stack's
@@ -814,6 +814,10 @@ export class CanopyCmsService extends Construct {
814
814
  ? assertValidGitBranchName('settingsBranch', props.settingsBranch)
815
815
  : undefined;
816
816
  const protectedBranches = assertValidProtectedBranches(props.protectedBranches ?? []);
817
+ const retentionDays = props.archivedBranchRetentionDays;
818
+ if (retentionDays !== undefined && !(Number.isInteger(retentionDays) && retentionDays > 0)) {
819
+ throw new Error(`CanopyCmsService: archivedBranchRetentionDays must be a positive whole number of days, not ${retentionDays}.`);
820
+ }
817
821
  // The construct stamps the namespace into both halves; an override in `environment` would reach
818
822
  // the Lambda alone and be replaced there, so it is refused rather than silently ignored.
819
823
  if (props.environment?.['CANOPYCMS_BRANCH_NAMESPACE'] !== undefined) {
@@ -1419,6 +1423,9 @@ export class CanopyCmsService extends Construct {
1419
1423
  // Only the gateway enforces it, and a split worker refuses it.
1420
1424
  envEntries.push(['CANOPYCMS_LEGACY_BRANCHES', legacyBranches.join(','), 'gateway']);
1421
1425
  }
1426
+ if (retentionDays !== undefined) {
1427
+ envEntries.push(['CANOPYCMS_ARCHIVED_BRANCH_RETENTION_DAYS', String(retentionDays), 'worker']);
1428
+ }
1422
1429
  const envFile = (readers) => envEntries
1423
1430
  .filter(([, , reader]) => readers.includes(reader))
1424
1431
  .map(([name, value]) => `${name}=${assertEnvSafe(name, value)}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canopycms-cdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "AWS CDK constructs and EC2 worker for CanopyCMS deployment",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "peerDependencies": {
35
35
  "aws-cdk-lib": "^2.260.0",
36
36
  "constructs": "^10.0.0",
37
- "canopycms": "0.9.0"
37
+ "canopycms": "0.10.0"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "aws-cdk-lib": {
@@ -60,8 +60,8 @@
60
60
  "tsx": "^4.19.0",
61
61
  "typescript": "^5.6.3",
62
62
  "vitest": "^4.1.0",
63
- "canopycms-auth-clerk": "0.9.0",
64
- "canopycms": "0.9.0"
63
+ "canopycms": "0.10.0",
64
+ "canopycms-auth-clerk": "0.10.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "rm -rf dist && tsc && node ../../scripts/add-js-extensions.mjs dist",