@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.47
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/generators.json +11 -1
- package/package.json +3 -3
- package/src/aws-authority/stage-authority.d.ts +30 -2
- package/src/aws-authority/stage-authority.js +220 -25
- package/src/developer-agent/generator-planning.js +99 -6
- package/src/developer-agent/model.d.ts +7 -3
- package/src/developer-agent/model.js +1 -0
- package/src/developer-agent/operation-registry.d.ts +1 -0
- package/src/developer-agent/operation-registry.js +43 -2
- package/src/developer-agent/planning.js +5 -2
- package/src/developer-agent/preview-changes.js +10 -0
- package/src/developer-agent/validation.js +7 -3
- package/src/developer-agent/workspace-inspection.js +51 -4
- package/src/executors/deployment-plan/deployment-plan.js +3 -0
- package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
- package/src/executors/dev-doctor/dev-doctor.js +136 -49
- package/src/executors/dev-setup/dev-setup.d.ts +18 -1
- package/src/executors/dev-setup/dev-setup.js +320 -196
- package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
- package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
- package/src/executors/local-deploy/local-deploy.d.ts +15 -0
- package/src/executors/local-deploy/local-deploy.js +96 -14
- package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
- package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
- package/src/foundation/cost-estimate.js +1 -1
- package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
- package/src/foundation/identity-domain-parent-ready.js +333 -0
- package/src/foundation/identity-domain.d.ts +94 -0
- package/src/foundation/identity-domain.js +115 -0
- package/src/foundation/index.d.ts +2 -0
- package/src/foundation/index.js +7 -0
- package/src/foundation/preflight.js +17 -1
- package/src/foundation/root-site-readiness.d.ts +27 -0
- package/src/foundation/root-site-readiness.js +78 -0
- package/src/foundation/root-site.d.ts +81 -0
- package/src/foundation/root-site.js +268 -0
- package/src/generators/framework-prerequisites.d.ts +2 -0
- package/src/generators/framework-prerequisites.js +34 -0
- package/src/generators/function/function-registration.d.ts +24 -0
- package/src/generators/function/function-registration.js +66 -0
- package/src/generators/function/function.d.ts +16 -1
- package/src/generators/function/function.js +101 -18
- package/src/generators/function/schema.d.ts +1 -0
- package/src/generators/function/schema.json +6 -0
- package/src/generators/function-access/function-access.d.ts +14 -0
- package/src/generators/function-access/function-access.js +141 -0
- package/src/generators/function-access/schema.d.ts +6 -0
- package/src/generators/function-access/schema.json +25 -0
- package/src/generators/post-generation-install.d.ts +1 -1
- package/src/generators/post-generation-install.js +1 -1
- package/src/generators/preset/dependency-overrides.d.ts +1 -1
- package/src/generators/preset/dependency-overrides.js +1 -1
- package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
- package/src/generators/preset/workspace-files-developer-agent.js +17 -11
- package/src/generators/preset/workspace-files-stage-authority.js +58 -1
- package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
- package/src/generators/preset/workspace-files-thin-deploy.js +47 -4
- package/src/generators/preset/workspace-files-thin-docs.js +33 -5
- package/src/generators/preset/workspace-files.js +207 -13
- package/src/generators/repository-policy/repository-policy.js +2 -1
- package/src/generators/repository-policy/schema.d.ts +2 -0
- package/src/generators/repository-policy/schema.json +7 -2
- package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
- package/src/generators/site/built-in-site-documentation-files.js +92 -0
- package/src/generators/site/built-in-site-files.d.ts +8 -0
- package/src/generators/site/built-in-site-files.js +40 -0
- package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
- package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
- package/src/generators/site/built-in-site-plan.d.ts +19 -0
- package/src/generators/site/built-in-site-plan.js +65 -0
- package/src/generators/site/built-in-site-project-files.d.ts +3 -0
- package/src/generators/site/built-in-site-project-files.js +258 -0
- package/src/generators/site/built-in-site-script-files.d.ts +2 -0
- package/src/generators/site/built-in-site-script-files.js +306 -0
- package/src/generators/site/built-in-site-shared.d.ts +9 -0
- package/src/generators/site/built-in-site-shared.js +21 -0
- package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
- package/src/generators/site/built-in-site-smoke-files.js +37 -0
- package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
- package/src/generators/site/built-in-site-sst-config-files.js +39 -0
- package/src/generators/site/built-in-site-web-files.d.ts +2 -0
- package/src/generators/site/built-in-site-web-files.js +284 -0
- package/src/generators/site/schema.d.ts +4 -0
- package/src/generators/site/schema.json +20 -0
- package/src/generators/site/site.d.ts +13 -0
- package/src/generators/site/site.js +221 -0
- package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
- package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
- package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
- package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
- package/src/generators/slice/built-in-plan-data-files.js +116 -11
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
- package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
- package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
- package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
- package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
- package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
- package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
- package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
- package/src/generators/slice/built-in-plan-metadata-files.js +21 -4
- package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
- package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
- package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
- package/src/generators/slice/built-in-plan-operations-files.js +107 -219
- package/src/generators/slice/built-in-plan-performance-files.js +6 -1
- package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
- package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
- package/src/generators/slice/built-in-plan-shared.js +1 -1
- package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
- package/src/generators/slice/built-in-plan-sst-config.js +160 -0
- package/src/generators/slice/built-in-plan-testing-files.js +92 -49
- package/src/generators/slice/built-in-plan-verification-files.js +15 -4
- package/src/generators/slice/built-in-plan-web-files.js +65 -0
- package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
- package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
- package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
- package/src/generators/slice/deployed-smoke-readiness.js +118 -23
- package/src/generators/slice/persistence-contract.js +2 -2
- package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
- package/src/generators/slice/pnpm-launch-script.js +28 -0
- package/src/generators/slice/slice.js +27 -0
- package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
- package/src/generators/upgrade/custom-domain-notice.js +38 -0
- package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
- package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
- package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
- package/src/generators/upgrade/framework-package-upgrade.js +78 -0
- package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
- package/src/generators/upgrade/function-authentication-notice.js +74 -0
- package/src/generators/upgrade/schema.json +2 -2
- package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
- package/src/generators/upgrade/upgrade-plan.js +406 -0
- package/src/generators/upgrade/upgrade.d.ts +1 -35
- package/src/generators/upgrade/upgrade.js +259 -593
- package/src/generators/workload/workload.js +60 -4
- package/src/git-policy/github-bootstrap.d.ts +6 -5
- package/src/git-policy/github-bootstrap.js +6 -4
- package/src/local-dev/fleet-process.d.ts +9 -2
- package/src/local-dev/fleet-process.js +27 -7
- package/src/local-dev/gateway-daemon.d.ts +1 -1
- package/src/local-dev/gateway-daemon.js +6 -4
- package/src/local-dev/portless.d.ts +5 -0
- package/src/local-dev/portless.js +5 -0
- package/src/local-dev/process-group.d.ts +10 -0
- package/src/local-dev/process-group.js +33 -0
- package/src/local-dev/tls.js +31 -2
- package/src/local-dev/trust-store.d.ts +42 -0
- package/src/local-dev/trust-store.js +87 -0
- package/src/ownership/composition.d.ts +7 -0
- package/src/ownership/composition.js +64 -56
- package/src/ownership/index.d.ts +1 -0
- package/src/ownership/index.js +1 -0
- package/src/ownership/record.d.ts +19 -0
- package/src/ownership/record.js +26 -2
- package/src/ownership/site-record.d.ts +18 -0
- package/src/ownership/site-record.js +105 -0
- package/src/repository-policy/deployment-plan.d.ts +3 -0
- package/src/repository-policy/deployment-plan.js +33 -4
- package/src/repository-policy/index.d.ts +1 -0
- package/src/repository-policy/index.js +1 -0
- package/src/repository-policy/policy.d.ts +13 -1
- package/src/repository-policy/policy.js +55 -1
- package/src/repository-policy/public-dns.d.ts +65 -0
- package/src/repository-policy/public-dns.js +168 -0
- package/src/schemas/generated-ownership-v2.json +6 -0
- package/src/schemas/repository-policy-v1.json +67 -1
- package/src/supply-chain/blueprint-trust-git.js +24 -0
- package/src/supply-chain/blueprint-verification-authority.js +21 -3
- package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
- package/src/work-markers/work-markers.js +4 -1
- package/src/workspace-deployment/ownership.d.ts +15 -0
- package/src/workspace-deployment/ownership.js +19 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderManagedLogHelpers = renderManagedLogHelpers;
|
|
4
|
+
const built_in_plan_alarm_identity_js_1 = require("./built-in-plan-alarm-identity.js");
|
|
5
|
+
/**
|
|
6
|
+
* Each helper's generated TypeScript source, ending with a newline. The caller
|
|
7
|
+
* places them: `managedLogGroup` calls `managedLogContract` and
|
|
8
|
+
* `managedLogDataProtection`, whose alarm description calls
|
|
9
|
+
* `operationalAlarmDescription`; `lambdaLogging` stands alone.
|
|
10
|
+
*/
|
|
11
|
+
function renderManagedLogHelpers(input) {
|
|
12
|
+
const { owner, route } = (0, built_in_plan_alarm_identity_js_1.sliceAlarmOwnership)(input.name);
|
|
13
|
+
return {
|
|
14
|
+
managedLogGroup: `function managedLogGroup(
|
|
15
|
+
logicalName: string,
|
|
16
|
+
component: string,
|
|
17
|
+
alertTopicArn: any,
|
|
18
|
+
resource?: string,
|
|
19
|
+
) {
|
|
20
|
+
const contract = managedLogContract(component, resource);
|
|
21
|
+
const logGroup = new aws.cloudwatch.LogGroup(logicalName, {
|
|
22
|
+
logGroupClass: contract.logGroupClass,
|
|
23
|
+
name: contract.name,
|
|
24
|
+
retentionInDays: contract.retentionInDays,
|
|
25
|
+
tags: contract.tags,
|
|
26
|
+
});
|
|
27
|
+
const dataProtection = managedLogDataProtection(
|
|
28
|
+
logicalName,
|
|
29
|
+
contract,
|
|
30
|
+
logGroup.name,
|
|
31
|
+
[logGroup],
|
|
32
|
+
alertTopicArn,
|
|
33
|
+
);
|
|
34
|
+
return { contract, dataProtection, logGroup };
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
managedLogContract: `function managedLogContract(component: string, resource?: string) {
|
|
38
|
+
return createManagedLogGroupContract({
|
|
39
|
+
component,
|
|
40
|
+
retentionInDays: observability.protectedRetentionDays,
|
|
41
|
+
...(resource ? { resource } : {}),
|
|
42
|
+
slice: '${input.name}',
|
|
43
|
+
stage: $app.stage,
|
|
44
|
+
workspace: '${input.workspace}',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
`,
|
|
48
|
+
operationalAlarmDescription: `function operationalAlarmDescription(input: {
|
|
49
|
+
businessSymptom: string;
|
|
50
|
+
id: string;
|
|
51
|
+
runbook: string;
|
|
52
|
+
}) {
|
|
53
|
+
return JSON.stringify({
|
|
54
|
+
businessSymptom: input.businessSymptom,
|
|
55
|
+
id: input.id,
|
|
56
|
+
owner: '${owner}',
|
|
57
|
+
route: '${route}',
|
|
58
|
+
runbook: input.runbook,
|
|
59
|
+
schemaVersion: 1,
|
|
60
|
+
slice: '${input.name}',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
`,
|
|
64
|
+
managedLogDataProtection: `function managedLogDataProtection(
|
|
65
|
+
logicalName: string,
|
|
66
|
+
contract: ReturnType<typeof createManagedLogGroupContract>,
|
|
67
|
+
logGroupName: any,
|
|
68
|
+
dependsOn: any[],
|
|
69
|
+
alertTopicArn: any,
|
|
70
|
+
) {
|
|
71
|
+
const policy = new aws.cloudwatch.LogDataProtectionPolicy(
|
|
72
|
+
logicalName + 'DataProtection',
|
|
73
|
+
{
|
|
74
|
+
logGroupName,
|
|
75
|
+
policyDocument: JSON.stringify(contract.dataProtectionPolicy),
|
|
76
|
+
},
|
|
77
|
+
{ dependsOn },
|
|
78
|
+
);
|
|
79
|
+
const alarm = new aws.cloudwatch.MetricAlarm(
|
|
80
|
+
logicalName + 'DataProtectionFindings',
|
|
81
|
+
{
|
|
82
|
+
alarmActions: [alertTopicArn],
|
|
83
|
+
alarmDescription: operationalAlarmDescription(${(0, built_in_plan_alarm_identity_js_1.renderAlarmDescriptionInput)(input.dataProtectionAlarm, ' ')}),
|
|
84
|
+
comparisonOperator: 'GreaterThanOrEqualToThreshold',
|
|
85
|
+
dimensions: { LogGroupName: logGroupName },
|
|
86
|
+
evaluationPeriods: 1,
|
|
87
|
+
metricName: 'LogEventsWithFindings',
|
|
88
|
+
namespace: 'AWS/Logs',
|
|
89
|
+
period: 300,
|
|
90
|
+
statistic: 'Sum',
|
|
91
|
+
threshold: 1,
|
|
92
|
+
treatMissingData: 'notBreaching',
|
|
93
|
+
},
|
|
94
|
+
{ dependsOn: [policy] },
|
|
95
|
+
);
|
|
96
|
+
return { alarm, policy };
|
|
97
|
+
}
|
|
98
|
+
`,
|
|
99
|
+
lambdaLogging: `function lambdaLogging(logGroupName: any, functionName?: any) {
|
|
100
|
+
return {
|
|
101
|
+
logging: { format: 'json' as const, logGroup: logGroupName },
|
|
102
|
+
transform: {
|
|
103
|
+
function(args: Record<string, any>): undefined {
|
|
104
|
+
if (functionName) args.name = functionName;
|
|
105
|
+
args.environment = $output(args.environment ?? {}).apply(
|
|
106
|
+
(environment: Record<string, any>) => ({
|
|
107
|
+
...environment,
|
|
108
|
+
variables: $output(environment.variables ?? {}).apply(
|
|
109
|
+
(variables: Record<string, any>) => ({
|
|
110
|
+
...variables,
|
|
111
|
+
EBK_OBSERVABILITY_SUCCESS_SAMPLE_RATE:
|
|
112
|
+
String(observability.routineSuccessSampleRate),
|
|
113
|
+
}),
|
|
114
|
+
),
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
args.loggingConfig = {
|
|
118
|
+
applicationLogLevel: 'TRACE',
|
|
119
|
+
logFormat: 'JSON',
|
|
120
|
+
logGroup: logGroupName,
|
|
121
|
+
systemLogLevel: observability.systemLogLevel,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=built-in-plan-log-group-helpers.js.map
|
|
@@ -97,6 +97,10 @@ Functions added with \`nx g @empire-builder-kit/nx:function\` use
|
|
|
97
97
|
development, generated Next routing forwards only that namespace to this task's
|
|
98
98
|
SST API; handlers keep native SST live execution. This is not deployed-stage
|
|
99
99
|
fallback. Keep user-owned Next API routes local and do not add a manual proxy.
|
|
100
|
+
A Function requires a signed-in caller unless it was generated with
|
|
101
|
+
\`--authentication=anonymous\`, so call it from a server route that sends the
|
|
102
|
+
access token as a bearer token; a browser request with only the session cookie
|
|
103
|
+
is refused.
|
|
100
104
|
|
|
101
105
|
Use \`pnpm nx run ${name}:verify-local-browser\` against that owned fleet origin.
|
|
102
106
|
Before its first run, install the pinned browser from this Slice's directory
|
|
@@ -162,8 +166,11 @@ Missed SQL notifications recover on the next hourly reconciliation by default;
|
|
|
162
166
|
explicit cadence and maintenance pauses remain independent settings. No
|
|
163
167
|
transaction spans SQL and DynamoDB.
|
|
164
168
|
|
|
165
|
-
Ordinary Slice removal retains declared relational databases and their
|
|
166
|
-
|
|
169
|
+
Ordinary Slice removal retains declared relational databases and their roles.
|
|
170
|
+
It deletes their generated credential containers in every stage except
|
|
171
|
+
\`production\`, which retains them. In those other stages a later deploy
|
|
172
|
+
recreates the containers, and its bootstrap publishes a fresh credential to the
|
|
173
|
+
retained roles. The generated SQL retirement rehearsal is the protected
|
|
167
174
|
\`db-retirement-rehearsal\` target for the exact operations-declared
|
|
168
175
|
\`development\` database named \`retirement_rehearsal\`. It accepts no stage,
|
|
169
176
|
Slice, database, task, role, image, network, or workflow selection.
|
|
@@ -252,8 +259,18 @@ During replacement, first add the candidate to \`primary.provisioned\`, deploy
|
|
|
252
259
|
infrastructure, then run \`db-migrate --database=<candidate>\` and complete
|
|
253
260
|
candidate verification before changing \`primary.active\`.
|
|
254
261
|
|
|
255
|
-
|
|
256
|
-
|
|
262
|
+
A \`db-migrate\` run deploys the Slice infrastructure first. With an unchanged
|
|
263
|
+
\`EBK_DATABASE_CREDENTIAL_GENERATION\` it re-applies the current generated
|
|
264
|
+
credential; with a different one, including omitting the variable after a
|
|
265
|
+
rotation, it rotates that credential. Rotate it only as
|
|
266
|
+
[the database credential rotation runbook](runbooks/database-credential-rotation.md)
|
|
267
|
+
describes.
|
|
268
|
+
|
|
269
|
+
Ordinary removal retains every logical database and its roles. It deletes the
|
|
270
|
+
generated credential containers in every stage except \`production\`, which
|
|
271
|
+
retains them. In those other stages a later deploy recreates the containers,
|
|
272
|
+
and its bootstrap publishes a fresh credential to the retained roles. Outcome-2
|
|
273
|
+
evidence uses the separate protected
|
|
257
274
|
\`db-retirement-rehearsal\` target for exactly one reviewed, disposable
|
|
258
275
|
\`development\` database named \`retirement_rehearsal\`. Its fixed
|
|
259
276
|
AWS-internal callback task deletes that database, its three generated roles,
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderNextBuildAuthority = renderNextBuildAuthority;
|
|
4
|
+
/**
|
|
5
|
+
* The managed Finder-metadata seal for a Next.js web's built Lambda bundles.
|
|
6
|
+
* Product Slices and the root site carry the same infra/next-build-authority.ts.
|
|
7
|
+
*/
|
|
8
|
+
function renderNextBuildAuthority() {
|
|
9
|
+
return `import {
|
|
10
|
+
chmodSync,
|
|
11
|
+
existsSync,
|
|
12
|
+
lstatSync,
|
|
13
|
+
readdirSync,
|
|
14
|
+
realpathSync,
|
|
15
|
+
unlinkSync,
|
|
16
|
+
} from 'node:fs';
|
|
17
|
+
import { join, relative, resolve } from 'node:path';
|
|
18
|
+
|
|
19
|
+
const maximumEntries = 65_536;
|
|
20
|
+
const maximumDepth = 64;
|
|
21
|
+
const maximumFinderMetadataFiles = 256;
|
|
22
|
+
const maximumFinderMetadataBytes = 1_048_576n;
|
|
23
|
+
|
|
24
|
+
// SST 4.17.1 awaits FunctionArgs.hook.postbuild after Runtime.Build has
|
|
25
|
+
// materialized the exact directory that its Lambda zipper consumes. Finder
|
|
26
|
+
// metadata removed only from OpenNext's earlier output can be recreated or
|
|
27
|
+
// copied through package-local node_modules before that boundary. Sanitize the
|
|
28
|
+
// final derived bundle here so the bytes reviewed by the infrastructure plan
|
|
29
|
+
// are the bytes SST packages.
|
|
30
|
+
export function removeFinderMetadataFromBuiltFunction(rootPath: string): number {
|
|
31
|
+
const root = resolve(rootPath);
|
|
32
|
+
const rootIdentity = lstatSync(root, { bigint: true });
|
|
33
|
+
if (
|
|
34
|
+
!rootIdentity.isDirectory() ||
|
|
35
|
+
rootIdentity.isSymbolicLink() ||
|
|
36
|
+
realpathSync(root) !== root
|
|
37
|
+
) {
|
|
38
|
+
throw new Error('The built Function root has an invalid identity.');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const pendingDirectories = [{ depth: 0, path: root }];
|
|
42
|
+
let observedEntries = 0;
|
|
43
|
+
let removedFinderMetadata = 0;
|
|
44
|
+
while (pendingDirectories.length > 0) {
|
|
45
|
+
const current = pendingDirectories.pop();
|
|
46
|
+
if (!current) break;
|
|
47
|
+
if (current.depth > maximumDepth) {
|
|
48
|
+
throw new Error('The built Function tree exceeds its depth bound.');
|
|
49
|
+
}
|
|
50
|
+
for (const entry of readdirSync(current.path, { withFileTypes: true }).sort(
|
|
51
|
+
(left, right) =>
|
|
52
|
+
left.name < right.name ? -1 : left.name > right.name ? 1 : 0,
|
|
53
|
+
)) {
|
|
54
|
+
observedEntries += 1;
|
|
55
|
+
if (observedEntries > maximumEntries) {
|
|
56
|
+
throw new Error('The built Function tree exceeds its entry bound.');
|
|
57
|
+
}
|
|
58
|
+
const entryPath = join(current.path, entry.name);
|
|
59
|
+
const identity = lstatSync(entryPath, { bigint: true });
|
|
60
|
+
if (entry.name === '.DS_Store') {
|
|
61
|
+
removedFinderMetadata += 1;
|
|
62
|
+
if (
|
|
63
|
+
removedFinderMetadata > maximumFinderMetadataFiles ||
|
|
64
|
+
!identity.isFile() ||
|
|
65
|
+
identity.isSymbolicLink() ||
|
|
66
|
+
identity.nlink !== 1n ||
|
|
67
|
+
identity.size > maximumFinderMetadataBytes
|
|
68
|
+
) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
'The built Function Finder metadata has an invalid identity.',
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
unlinkSync(entryPath);
|
|
74
|
+
if (existsSync(entryPath)) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
'The built Function Finder metadata was not removed.',
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (identity.isDirectory() && !identity.isSymbolicLink()) {
|
|
82
|
+
const confined = relative(root, entryPath);
|
|
83
|
+
if (
|
|
84
|
+
confined === '..' ||
|
|
85
|
+
confined.startsWith('../') ||
|
|
86
|
+
resolve(root, confined) !== entryPath
|
|
87
|
+
) {
|
|
88
|
+
throw new Error('The built Function entry escapes its root.');
|
|
89
|
+
}
|
|
90
|
+
pendingDirectories.push({ depth: current.depth + 1, path: entryPath });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Finder can recreate its metadata in the interval between this hook and
|
|
94
|
+
// SST's asynchronous glob/archive pass. On macOS, close that exact race by
|
|
95
|
+
// removing only the owner's write bit from each completed derived
|
|
96
|
+
// directory. The generated build wrapper restores it before the next
|
|
97
|
+
// OpenNext build. Group/other permission bits remain unchanged.
|
|
98
|
+
if (process.platform === 'darwin') {
|
|
99
|
+
const currentIdentity = lstatSync(current.path, { bigint: true });
|
|
100
|
+
if (
|
|
101
|
+
!currentIdentity.isDirectory() ||
|
|
102
|
+
currentIdentity.isSymbolicLink()
|
|
103
|
+
) {
|
|
104
|
+
throw new Error('The built Function directory changed identity.');
|
|
105
|
+
}
|
|
106
|
+
chmodSync(
|
|
107
|
+
current.path,
|
|
108
|
+
Number((currentIdentity.mode & 0o7_777n) & ~0o200n),
|
|
109
|
+
);
|
|
110
|
+
if ((lstatSync(current.path, { bigint: true }).mode & 0o200n) !== 0n) {
|
|
111
|
+
throw new Error('The built Function directory was not sealed.');
|
|
112
|
+
}
|
|
113
|
+
if (existsSync(join(current.path, '.DS_Store'))) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
'The built Function Finder metadata raced its final seal.',
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return removedFinderMetadata;
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=built-in-plan-next-build-authority.js.map
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
/** @internal */
|
|
2
2
|
export declare function renderSliceOperationsFiles(name: string, workspace?: string, frameworkVersion?: string, sql?: boolean): Readonly<Record<string, string>>;
|
|
3
|
+
/**
|
|
4
|
+
* The managed OpenNext build wrapper that SST's Next.js build command runs.
|
|
5
|
+
* It forwards only `applicationKeys` and operating-system keys to the exact
|
|
6
|
+
* managed OpenNext builder. Product Slices and the root site share it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderNextBuildEnvironmentWrapper(applicationKeys: readonly string[], owner?: string): string;
|