canopycms-cdk 0.1.0-int.115 → 0.1.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.
|
@@ -37,9 +37,7 @@ export interface AssetSupportProps {
|
|
|
37
37
|
* bucket) instead of creating one. The caller owns that bucket's
|
|
38
38
|
* lifecycle rules and CORS configuration in this mode: `IBucket` (an
|
|
39
39
|
* imported bucket reference) has no CDK-level `addLifecycleRule`/
|
|
40
|
-
* `addCorsRule` - only a bucket this construct creates itself does.
|
|
41
|
-
* `.claude/future-tasks/docs-site-assets-wiring.md` for the BYO-mode
|
|
42
|
-
* wiring this is designed for.
|
|
40
|
+
* `addCorsRule` - only a bucket this construct creates itself does.
|
|
43
41
|
*
|
|
44
42
|
* @default - a new private bucket is created (standalone mode)
|
|
45
43
|
*/
|
|
@@ -12,7 +12,7 @@ import { CANOPY_INSPECT, EFS_MOUNT_PATH, GATEWAY_LOG, GATEWAY_LOG_DIR, GATEWAY_U
|
|
|
12
12
|
* Duplicated rather than imported so a CONSTRUCT-only consumer does not pay for
|
|
13
13
|
* the core package's module graph. Whether that still justifies duplicating is
|
|
14
14
|
* an open question, tracked alongside the same question about the S3 prefix
|
|
15
|
-
* constants in
|
|
15
|
+
* constants in safeinsights/canopycms#608.
|
|
16
16
|
*
|
|
17
17
|
* Drift between the two copies is caught by a test, not by this comment:
|
|
18
18
|
* cms-deploy.test.ts drives both this construct and the runtime predicate over
|
|
@@ -72,7 +72,7 @@ export declare const INSPECT_RC = "/opt/canopy-worker/inspect.rc";
|
|
|
72
72
|
* `canopy-inspect`: run one command (or, with `--interactive`, a shell) as the worker's user,
|
|
73
73
|
* inside exactly the worker's sandbox, so a hostile repository on EFS reaches only what the
|
|
74
74
|
* worker reaches. `--interactive` relays the sandbox's terminal raw, and the worker can reach its
|
|
75
|
-
* pty (
|
|
75
|
+
* pty (safeinsights/canopycms#604). Run as root. Nothing after `--` is composed by a shell
|
|
76
76
|
* outside the sandbox: inspect-checks runs its assertions, then execs the command.
|
|
77
77
|
*/
|
|
78
78
|
export declare function canopyInspectScript(): string[];
|
|
@@ -288,7 +288,7 @@ function shellWord(value) {
|
|
|
288
288
|
* `canopy-inspect`: run one command (or, with `--interactive`, a shell) as the worker's user,
|
|
289
289
|
* inside exactly the worker's sandbox, so a hostile repository on EFS reaches only what the
|
|
290
290
|
* worker reaches. `--interactive` relays the sandbox's terminal raw, and the worker can reach its
|
|
291
|
-
* pty (
|
|
291
|
+
* pty (safeinsights/canopycms#604). Run as root. Nothing after `--` is composed by a shell
|
|
292
292
|
* outside the sandbox: inspect-checks runs its assertions, then execs the command.
|
|
293
293
|
*/
|
|
294
294
|
export function canopyInspectScript() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canopycms-cdk",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.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.1.0
|
|
37
|
+
"canopycms": "0.1.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
|
|
64
|
-
"canopycms": "0.1.0
|
|
63
|
+
"canopycms": "0.1.0",
|
|
64
|
+
"canopycms-auth-clerk": "0.1.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "rm -rf dist && tsc && node ../../scripts/add-js-extensions.mjs dist",
|
package/worker/dist/index.js
CHANGED
|
@@ -73162,6 +73162,7 @@ import os from "node:os";
|
|
|
73162
73162
|
import path31 from "node:path";
|
|
73163
73163
|
|
|
73164
73164
|
// ../canopycms/src/utils/debug.ts
|
|
73165
|
+
var envFlag = (name2) => typeof process !== "undefined" && process.env[name2] === "true";
|
|
73165
73166
|
var LOG_LEVELS = {
|
|
73166
73167
|
DEBUG: 0,
|
|
73167
73168
|
INFO: 1,
|
|
@@ -73174,7 +73175,7 @@ var DebugLogger = class {
|
|
|
73174
73175
|
this.options = options;
|
|
73175
73176
|
}
|
|
73176
73177
|
shouldLog(level) {
|
|
73177
|
-
const enabled = this.options.enabled ??
|
|
73178
|
+
const enabled = this.options.enabled ?? envFlag("CANOPYCMS_DEBUG");
|
|
73178
73179
|
if (!enabled) return false;
|
|
73179
73180
|
const minLevel = this.options.minLevel ?? "DEBUG";
|
|
73180
73181
|
return LOG_LEVELS[level] >= LOG_LEVELS[minLevel];
|
|
@@ -73252,7 +73253,7 @@ function createDebugLogger(options) {
|
|
|
73252
73253
|
return new DebugLogger(options);
|
|
73253
73254
|
}
|
|
73254
73255
|
var testLogger = createDebugLogger({
|
|
73255
|
-
enabled:
|
|
73256
|
+
enabled: envFlag("E2E_DEBUG"),
|
|
73256
73257
|
prefix: "E2E",
|
|
73257
73258
|
throwOnError: false
|
|
73258
73259
|
});
|
|
@@ -73630,7 +73631,7 @@ function resolveWorkerGitHubAuth(config) {
|
|
|
73630
73631
|
// key does not expire, and `@octokit/auth-app`'s own cache mints a new
|
|
73631
73632
|
// installation token when the old one expires. A rotated key or an
|
|
73632
73633
|
// early-revoked token is NOT recovered here — see
|
|
73633
|
-
//
|
|
73634
|
+
// safeinsights/canopycms#894.
|
|
73634
73635
|
refreshCredential: async () => {
|
|
73635
73636
|
}
|
|
73636
73637
|
};
|
|
@@ -78839,9 +78840,24 @@ var STALE_LEASE_REASON = "stale info";
|
|
|
78839
78840
|
function isStaleLeaseRejection(message2) {
|
|
78840
78841
|
return message2.includes(REJECTED_MARKER) && message2.includes(STALE_LEASE_REASON);
|
|
78841
78842
|
}
|
|
78842
|
-
var
|
|
78843
|
+
var WORKFLOW_REFUSAL_LEADS = ["refusing to allow a ", "refusing to allow an "];
|
|
78844
|
+
var WORKFLOW_REFUSAL_TAIL = " to create or update workflow ";
|
|
78843
78845
|
function workflowPushRefusalFile(message2) {
|
|
78844
|
-
|
|
78846
|
+
for (const line of message2.split("\n")) {
|
|
78847
|
+
const spans = line.split("`");
|
|
78848
|
+
for (let i10 = 0; i10 + 2 < spans.length; i10++) {
|
|
78849
|
+
const span = spans[i10];
|
|
78850
|
+
const file = spans[i10 + 1];
|
|
78851
|
+
if (file === "" || !span.endsWith(WORKFLOW_REFUSAL_TAIL)) continue;
|
|
78852
|
+
const head = span.slice(0, -WORKFLOW_REFUSAL_TAIL.length);
|
|
78853
|
+
const named = WORKFLOW_REFUSAL_LEADS.some((lead) => {
|
|
78854
|
+
const at = head.indexOf(lead);
|
|
78855
|
+
return at !== -1 && at + lead.length < head.length;
|
|
78856
|
+
});
|
|
78857
|
+
if (named) return file;
|
|
78858
|
+
}
|
|
78859
|
+
}
|
|
78860
|
+
return null;
|
|
78845
78861
|
}
|
|
78846
78862
|
async function resolveGitDir(repoPath) {
|
|
78847
78863
|
const dotGit = path5.join(repoPath, ".git");
|
|
@@ -80571,7 +80587,7 @@ var GitHubMirror = class {
|
|
|
80571
80587
|
* Clear what a killed gateway left, before any git runs: finish or undo an interrupted rebuild,
|
|
80572
80588
|
* then every lock and temporary in the mirror. Nothing in this process writes it yet:
|
|
80573
80589
|
* maintenance starts only after a session. A git a stopped dev worker left running is not
|
|
80574
|
-
* covered (
|
|
80590
|
+
* covered (safeinsights/canopycms#907).
|
|
80575
80591
|
*/
|
|
80576
80592
|
async sweepAtStart() {
|
|
80577
80593
|
await fs9.mkdir(this.stateDirectory, { recursive: true, mode: 448 });
|
|
@@ -81996,7 +82012,7 @@ var LocalGitHubGateway = class {
|
|
|
81996
82012
|
* branch first. The mirror kills its git when `signal` aborts, and GitHub moves the ref only
|
|
81997
82013
|
* after receiving the whole pack, so a killed push changes nothing or is found already done by
|
|
81998
82014
|
* the re-run, unless git's transport child outlives it
|
|
81999
|
-
* (
|
|
82015
|
+
* (safeinsights/canopycms#907).
|
|
82000
82016
|
*/
|
|
82001
82017
|
async pushInSession(mirror, credential, request, received, signal) {
|
|
82002
82018
|
const { branch, sha } = request;
|
|
@@ -82475,7 +82491,7 @@ init_error();
|
|
|
82475
82491
|
init_worker_status();
|
|
82476
82492
|
|
|
82477
82493
|
// ../canopycms/src/version.ts
|
|
82478
|
-
var CANOPYCMS_VERSION = "0.1.0
|
|
82494
|
+
var CANOPYCMS_VERSION = "0.1.0";
|
|
82479
82495
|
|
|
82480
82496
|
// ../canopycms/src/worker/schema-gate.ts
|
|
82481
82497
|
import fs14 from "node:fs/promises";
|
|
@@ -83684,6 +83700,7 @@ var SHAPE_REFUSALS = /* @__PURE__ */ new Set([400, 411, 413, 415, 431]);
|
|
|
83684
83700
|
function refusedRequestError(message2, status) {
|
|
83685
83701
|
return status !== void 0 && SHAPE_REFUSALS.has(status) ? new GatewayRequestRefusedError(message2, status) : new GitHubGatewayProtocolError(message2);
|
|
83686
83702
|
}
|
|
83703
|
+
var NOT_AN_ERROR_MESSAGE = "The GitHub gateway failed with a value that is not an Error";
|
|
83687
83704
|
function encodeError(err) {
|
|
83688
83705
|
const text = (value) => redactEgress(value).slice(0, MAX_MESSAGE_LENGTH);
|
|
83689
83706
|
if (err instanceof GatewayRefusalError) {
|
|
@@ -83703,7 +83720,8 @@ function encodeError(err) {
|
|
|
83703
83720
|
return { kind: "transient", code: err.code, message: text(err.message) };
|
|
83704
83721
|
}
|
|
83705
83722
|
if (!(err instanceof Error)) {
|
|
83706
|
-
|
|
83723
|
+
gatewayLogWarn("Answered a thrown value that is not an Error:", text(String(err)));
|
|
83724
|
+
return { kind: "error", name: "Error", message: NOT_AN_ERROR_MESSAGE };
|
|
83707
83725
|
}
|
|
83708
83726
|
const status = err.status;
|
|
83709
83727
|
if (typeof status === "number" && Number.isInteger(status)) {
|
|
@@ -87370,7 +87388,7 @@ var CmsWorker = class {
|
|
|
87370
87388
|
* and GitHub calls are killed and the task is released to pending with no
|
|
87371
87389
|
* retry spent; a sync's bundle, unbundle, ref update and settings push
|
|
87372
87390
|
* are killed. The gateway's GitHub fetches and mirror maintenance run on
|
|
87373
|
-
* (
|
|
87391
|
+
* (safeinsights/canopycms#907). A branch rebase
|
|
87374
87392
|
* is never aborted, because a rebase killed mid-branch is recovered
|
|
87375
87393
|
* lossily; anything still unsettled after a short grace is abandoned to
|
|
87376
87394
|
* the process exit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
fbba7d902caff4a42500d3e4072acb67a7e4e070cb83115e94f6993d6b90f0b6 index.js
|