@empire-builder-kit/nx 1.0.0-rc.45 → 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 +109 -9
- 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 +44 -3
- 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/github-bootstrap/github-bootstrap.d.ts +3 -0
- package/src/executors/github-bootstrap/github-bootstrap.js +28 -0
- package/src/executors/github-bootstrap/schema.json +14 -0
- 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 +52 -5
- package/src/generators/preset/workspace-files-thin-docs.js +33 -5
- package/src/generators/preset/workspace-files.js +238 -41
- 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 +126 -14
- 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 +25 -5
- 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-release-files.js +0 -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 -5
- package/src/generators/slice/built-in-plan-web-files.js +69 -5
- package/src/generators/slice/built-in-plan.js +1 -2
- 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 +347 -595
- package/src/generators/workload/reliability-registration.d.ts +1 -1
- package/src/generators/workload/reliability-registration.js +9 -9
- package/src/generators/workload/workload.d.ts +1 -1
- package/src/generators/workload/workload.js +87 -13
- package/src/git-policy/github-bootstrap.d.ts +24 -5
- package/src/git-policy/github-bootstrap.js +105 -10
- package/src/local-dev/fleet-process.d.ts +9 -2
- package/src/local-dev/fleet-process.js +27 -7
- package/src/local-dev/fleet-session.js +41 -4
- package/src/local-dev/fleet-supervisor-daemon.js +1 -5
- package/src/local-dev/fleet-supervisor.d.ts +1 -0
- package/src/local-dev/fleet-supervisor.js +34 -11
- 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 +42 -3
- package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
- package/src/supply-chain/sbom.js +74 -12
- 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
package/src/ownership/record.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generatedOwnershipSchema = exports.managedJsonPointersSchema = exports.GENERATED_COMPOSITION_KINDS = exports.GENERATED_PATH_ORIGINS = exports.GENERATED_PATH_MODES = exports.GENERATED_OWNERSHIP_SCHEMA_VERSION = void 0;
|
|
3
|
+
exports.generatedOwnershipSchema = exports.managedJsonPointersSchema = exports.ANONYMOUS_FUNCTION_AUTHENTICATION = exports.GENERATED_COMPOSITION_KINDS = exports.GENERATED_PATH_ORIGINS = exports.GENERATED_PATH_MODES = exports.GENERATED_OWNERSHIP_SCHEMA_VERSION = void 0;
|
|
4
4
|
exports.validateManagedJsonPointers = validateManagedJsonPointers;
|
|
5
5
|
exports.validateGeneratedOwnershipRecord = validateGeneratedOwnershipRecord;
|
|
6
6
|
const index_js_1 = require("../foundation/index.js");
|
|
@@ -19,6 +19,12 @@ exports.GENERATED_COMPOSITION_KINDS = [
|
|
|
19
19
|
'job',
|
|
20
20
|
'service',
|
|
21
21
|
];
|
|
22
|
+
/**
|
|
23
|
+
* A Function's recorded access. Only an anonymous Function records it; an
|
|
24
|
+
* absent field means signed-in, so every Function recorded before the field
|
|
25
|
+
* existed requires a signed-in caller.
|
|
26
|
+
*/
|
|
27
|
+
exports.ANONYMOUS_FUNCTION_AUTHENTICATION = 'anonymous';
|
|
22
28
|
function validateManagedJsonPointers(entry, path, issues) {
|
|
23
29
|
if (entry.managedJsonPointers === undefined)
|
|
24
30
|
return;
|
|
@@ -80,13 +86,27 @@ function validateCompositions(value, paths, issues) {
|
|
|
80
86
|
return;
|
|
81
87
|
}
|
|
82
88
|
for (const key of Object.keys(entry)) {
|
|
83
|
-
if (!['feature', 'kind', 'name'].includes(key)) {
|
|
89
|
+
if (!['authentication', 'feature', 'kind', 'name'].includes(key)) {
|
|
84
90
|
issues.push({
|
|
85
91
|
message: 'is not an allowed property',
|
|
86
92
|
path: `${path}.${key}`,
|
|
87
93
|
});
|
|
88
94
|
}
|
|
89
95
|
}
|
|
96
|
+
if (entry.authentication !== undefined) {
|
|
97
|
+
if (entry.kind !== 'function') {
|
|
98
|
+
issues.push({
|
|
99
|
+
message: 'is recorded only for a function',
|
|
100
|
+
path: `${path}.authentication`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else if (entry.authentication !== exports.ANONYMOUS_FUNCTION_AUTHENTICATION) {
|
|
104
|
+
issues.push({
|
|
105
|
+
message: 'must equal anonymous; a signed-in function records no authentication',
|
|
106
|
+
path: `${path}.authentication`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
90
110
|
if (typeof entry.feature !== 'string' ||
|
|
91
111
|
!compositionNamePattern.test(entry.feature)) {
|
|
92
112
|
issues.push({
|
|
@@ -368,7 +388,11 @@ exports.generatedOwnershipSchema = {
|
|
|
368
388
|
compositions: {
|
|
369
389
|
items: {
|
|
370
390
|
additionalProperties: false,
|
|
391
|
+
dependentSchemas: {
|
|
392
|
+
authentication: { properties: { kind: { const: 'function' } } },
|
|
393
|
+
},
|
|
371
394
|
properties: {
|
|
395
|
+
authentication: { const: exports.ANONYMOUS_FUNCTION_AUTHENTICATION },
|
|
372
396
|
feature: {
|
|
373
397
|
pattern: compositionNamePattern.source,
|
|
374
398
|
type: 'string',
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ValidationResult } from '../validation.js';
|
|
2
|
+
import { type GeneratedPathOwnership } from './record.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ownership of the workspace root site at packages/site. The record is told
|
|
5
|
+
* apart from a Product Slice record by its kind: a Slice record names its
|
|
6
|
+
* Slice and has no kind. It keeps the generated schema version, so workspace
|
|
7
|
+
* health and every hash-checking scanner read it with the same rules.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SITE_OWNERSHIP_SCHEMA_VERSION: 2;
|
|
10
|
+
export declare const SITE_OWNERSHIP_PATH: "packages/site/.ebk/ownership.json";
|
|
11
|
+
export interface SiteOwnershipRecord {
|
|
12
|
+
frameworkVersion: string;
|
|
13
|
+
kind: 'site';
|
|
14
|
+
paths: GeneratedPathOwnership[];
|
|
15
|
+
schemaVersion: typeof SITE_OWNERSHIP_SCHEMA_VERSION;
|
|
16
|
+
}
|
|
17
|
+
export declare function isSiteOwnershipRecord(value: unknown): boolean;
|
|
18
|
+
export declare function validateSiteOwnershipRecord(value: unknown): ValidationResult<SiteOwnershipRecord>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SITE_OWNERSHIP_PATH = exports.SITE_OWNERSHIP_SCHEMA_VERSION = void 0;
|
|
4
|
+
exports.isSiteOwnershipRecord = isSiteOwnershipRecord;
|
|
5
|
+
exports.validateSiteOwnershipRecord = validateSiteOwnershipRecord;
|
|
6
|
+
const validation_js_1 = require("../validation.js");
|
|
7
|
+
const hash_js_1 = require("./hash.js");
|
|
8
|
+
const record_js_1 = require("./record.js");
|
|
9
|
+
/**
|
|
10
|
+
* Ownership of the workspace root site at packages/site. The record is told
|
|
11
|
+
* apart from a Product Slice record by its kind: a Slice record names its
|
|
12
|
+
* Slice and has no kind. It keeps the generated schema version, so workspace
|
|
13
|
+
* health and every hash-checking scanner read it with the same rules.
|
|
14
|
+
*/
|
|
15
|
+
exports.SITE_OWNERSHIP_SCHEMA_VERSION = 2;
|
|
16
|
+
exports.SITE_OWNERSHIP_PATH = 'packages/site/.ebk/ownership.json';
|
|
17
|
+
function isSafeSitePath(value) {
|
|
18
|
+
return (value !== '' &&
|
|
19
|
+
!value.startsWith('/') &&
|
|
20
|
+
!value.startsWith('\\') &&
|
|
21
|
+
!value.split(/[\\/]/).includes('..'));
|
|
22
|
+
}
|
|
23
|
+
function isSiteOwnershipRecord(value) {
|
|
24
|
+
return (0, validation_js_1.isRecord)(value) && value.kind === 'site';
|
|
25
|
+
}
|
|
26
|
+
function validateSiteOwnershipRecord(value) {
|
|
27
|
+
if (!(0, validation_js_1.isRecord)(value)) {
|
|
28
|
+
return {
|
|
29
|
+
valid: false,
|
|
30
|
+
issues: [{ message: 'must be an object', path: 'ownership' }],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const issues = [];
|
|
34
|
+
for (const key of Object.keys(value)) {
|
|
35
|
+
if (!['frameworkVersion', 'kind', 'paths', 'schemaVersion'].includes(key)) {
|
|
36
|
+
issues.push({
|
|
37
|
+
message: 'is not an allowed property',
|
|
38
|
+
path: `ownership.${key}`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (value.schemaVersion !== exports.SITE_OWNERSHIP_SCHEMA_VERSION) {
|
|
43
|
+
issues.push({ message: 'must equal 2', path: 'ownership.schemaVersion' });
|
|
44
|
+
}
|
|
45
|
+
if (value.kind !== 'site') {
|
|
46
|
+
issues.push({ message: 'must equal site', path: 'ownership.kind' });
|
|
47
|
+
}
|
|
48
|
+
if (typeof value.frameworkVersion !== 'string' ||
|
|
49
|
+
value.frameworkVersion.trim() === '') {
|
|
50
|
+
issues.push({
|
|
51
|
+
message: 'must be a non-empty string',
|
|
52
|
+
path: 'ownership.frameworkVersion',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!Array.isArray(value.paths)) {
|
|
56
|
+
issues.push({ message: 'must be an array', path: 'ownership.paths' });
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
value.paths.forEach((entry, index) => {
|
|
61
|
+
const entryPath = `ownership.paths[${index}]`;
|
|
62
|
+
if (!(0, validation_js_1.isRecord)(entry)) {
|
|
63
|
+
issues.push({ message: 'must be an object', path: entryPath });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (typeof entry.path !== 'string' || !isSafeSitePath(entry.path)) {
|
|
67
|
+
issues.push({
|
|
68
|
+
message: 'must be a safe site-relative path',
|
|
69
|
+
path: `${entryPath}.path`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else if (seen.has(entry.path)) {
|
|
73
|
+
issues.push({
|
|
74
|
+
message: 'must not duplicate a path',
|
|
75
|
+
path: `${entryPath}.path`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
seen.add(entry.path);
|
|
80
|
+
}
|
|
81
|
+
if (!record_js_1.GENERATED_PATH_MODES.includes(entry.mode)) {
|
|
82
|
+
issues.push({
|
|
83
|
+
message: 'must equal managed or seeded',
|
|
84
|
+
path: `${entryPath}.mode`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (entry.origin !== 'framework') {
|
|
88
|
+
issues.push({
|
|
89
|
+
message: 'must equal framework',
|
|
90
|
+
path: `${entryPath}.origin`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (typeof entry.sha256 !== 'string' ||
|
|
94
|
+
!hash_js_1.GENERATED_CONTENT_HASH_PATTERN.test(entry.sha256)) {
|
|
95
|
+
issues.push({
|
|
96
|
+
message: 'must be a lowercase SHA-256 digest',
|
|
97
|
+
path: `${entryPath}.sha256`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
(0, record_js_1.validateManagedJsonPointers)(entry, entryPath, issues);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return (0, validation_js_1.validationResult)(value, issues);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=site-record.js.map
|
|
@@ -17,6 +17,9 @@ export interface ProtectedDeploymentPlan {
|
|
|
17
17
|
foundationProject?: string;
|
|
18
18
|
orderedProjects: string[];
|
|
19
19
|
productionApprovalMode: ProductionApprovalMode;
|
|
20
|
+
/** The workspace root site, deployed after the Foundation. It is never
|
|
21
|
+
* a Slice project, so it takes no release-candidate or container path. */
|
|
22
|
+
siteProject?: string;
|
|
20
23
|
sliceProjects: string[];
|
|
21
24
|
stage: ProtectedDeploymentStage;
|
|
22
25
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROTECTED_DEPLOYMENT_STAGES = exports.PROTECTED_DEPLOYMENT_ACTIONS = void 0;
|
|
4
4
|
exports.createProtectedDeploymentPlan = createProtectedDeploymentPlan;
|
|
5
|
+
const root_site_js_1 = require("../foundation/root-site.js");
|
|
5
6
|
const policy_js_1 = require("./policy.js");
|
|
6
7
|
exports.PROTECTED_DEPLOYMENT_ACTIONS = [
|
|
7
8
|
'deploy',
|
|
@@ -51,19 +52,28 @@ function createProtectedDeploymentPlan(policy, options) {
|
|
|
51
52
|
.filter((project) => hasTag(project, 'type:slice') &&
|
|
52
53
|
supportsAction(project, options.action))
|
|
53
54
|
.sort(compareCodePoints);
|
|
55
|
+
const sites = options.projects.filter((project) => hasTag(project, 'type:site') && supportsAction(project, options.action));
|
|
56
|
+
if (sites.length > 1 || sites.some(({ name }) => name !== root_site_js_1.ROOT_SITE_NAME)) {
|
|
57
|
+
throw new Error(`Protected deployment planning accepts one root site, the ${root_site_js_1.ROOT_SITE_NAME} project.`);
|
|
58
|
+
}
|
|
59
|
+
const site = sites[0];
|
|
54
60
|
if (options.action === 'remove' || options.action === 'unlock') {
|
|
55
61
|
if (!options.requestedProject) {
|
|
56
62
|
throw new Error(`Protected ${options.action} requires one explicit registered --project; batch recovery is not implicit.`);
|
|
57
63
|
}
|
|
58
|
-
const selected = [foundation, ...slices].find(({ name }) => name === options.requestedProject);
|
|
64
|
+
const selected = [foundation, ...(site ? [site] : []), ...slices].find(({ name }) => name === options.requestedProject);
|
|
59
65
|
if (!selected) {
|
|
60
|
-
throw new Error(`Protected ${options.action} project ${options.requestedProject} is not a registered Foundation or Product Slice with that target.`);
|
|
66
|
+
throw new Error(`Protected ${options.action} project ${options.requestedProject} is not a registered Foundation, root site or Product Slice with that target.`);
|
|
61
67
|
}
|
|
62
68
|
const decision = (0, policy_js_1.evaluateRepositoryPolicyRequest)(policy, {
|
|
63
69
|
action: options.action,
|
|
64
70
|
projects: [
|
|
65
71
|
{
|
|
66
|
-
kind: selected === foundation
|
|
72
|
+
kind: selected === foundation
|
|
73
|
+
? 'foundation'
|
|
74
|
+
: selected === site
|
|
75
|
+
? 'site'
|
|
76
|
+
: 'slice',
|
|
67
77
|
name: selected.name,
|
|
68
78
|
},
|
|
69
79
|
],
|
|
@@ -87,13 +97,18 @@ function createProtectedDeploymentPlan(policy, options) {
|
|
|
87
97
|
: {}),
|
|
88
98
|
orderedProjects: [selected.name],
|
|
89
99
|
productionApprovalMode: policy.productionApproval.mode,
|
|
90
|
-
|
|
100
|
+
...(selected === site ? { siteProject: site.name } : {}),
|
|
101
|
+
sliceProjects: selected === foundation || selected === site ? [] : [selected.name],
|
|
91
102
|
stage: options.stage,
|
|
92
103
|
};
|
|
93
104
|
}
|
|
94
105
|
if (options.requestedProject) {
|
|
95
106
|
throw new Error(`Protected ${options.action} derives its complete project set from committed policy; --project cannot narrow or expand it.`);
|
|
96
107
|
}
|
|
108
|
+
// site is reserved for the root site; only its remove stays planned.
|
|
109
|
+
if (slices.some(({ name }) => name === root_site_js_1.ROOT_SITE_NAME)) {
|
|
110
|
+
throw new Error(`Product Slice ${root_site_js_1.ROOT_SITE_NAME} cannot ${options.action}: ${root_site_js_1.ROOT_SITE_NAME} is reserved for the workspace root site. ${root_site_js_1.ROOT_SITE_RENAME_GUIDANCE}`);
|
|
111
|
+
}
|
|
97
112
|
const selectedSlices = options.stage === 'production'
|
|
98
113
|
? slices.filter(({ name }) => {
|
|
99
114
|
const status = policy.slices[name]?.productionStatus;
|
|
@@ -107,6 +122,9 @@ function createProtectedDeploymentPlan(policy, options) {
|
|
|
107
122
|
if (missingPolicyEntries.length > 0) {
|
|
108
123
|
throw new Error(`Registered Product Slices are missing explicit blocked, pilot, or ready production policy entries: ${missingPolicyEntries.join(', ')}.`);
|
|
109
124
|
}
|
|
125
|
+
if (site && policy.site === undefined) {
|
|
126
|
+
throw new Error('The registered root site is missing an explicit blocked or ready production policy member: site.productionStatus.');
|
|
127
|
+
}
|
|
110
128
|
for (const [name, entry] of Object.entries(policy.slices)) {
|
|
111
129
|
if ((entry.productionStatus === 'pilot' ||
|
|
112
130
|
entry.productionStatus === 'ready') &&
|
|
@@ -115,8 +133,17 @@ function createProtectedDeploymentPlan(policy, options) {
|
|
|
115
133
|
}
|
|
116
134
|
}
|
|
117
135
|
}
|
|
136
|
+
// Production deploys the root site only while its policy says ready.
|
|
137
|
+
const selectedSite = site &&
|
|
138
|
+
(options.stage !== 'production' ||
|
|
139
|
+
policy.site?.productionStatus === 'ready')
|
|
140
|
+
? site
|
|
141
|
+
: undefined;
|
|
118
142
|
const selectedProjects = [
|
|
119
143
|
{ kind: 'foundation', name: foundation.name },
|
|
144
|
+
...(selectedSite
|
|
145
|
+
? [{ kind: 'site', name: selectedSite.name }]
|
|
146
|
+
: []),
|
|
120
147
|
...selectedSlices.map(({ name }) => ({ kind: 'slice', name })),
|
|
121
148
|
];
|
|
122
149
|
const decision = (0, policy_js_1.evaluateRepositoryPolicyRequest)(policy, {
|
|
@@ -140,9 +167,11 @@ function createProtectedDeploymentPlan(policy, options) {
|
|
|
140
167
|
foundationProject: foundation.name,
|
|
141
168
|
orderedProjects: [
|
|
142
169
|
foundation.name,
|
|
170
|
+
...(selectedSite ? [selectedSite.name] : []),
|
|
143
171
|
...selectedSlices.map(({ name }) => name),
|
|
144
172
|
],
|
|
145
173
|
productionApprovalMode: policy.productionApproval.mode,
|
|
174
|
+
...(selectedSite ? { siteProject: selectedSite.name } : {}),
|
|
146
175
|
sliceProjects: selectedSlices.map(({ name }) => name),
|
|
147
176
|
stage: options.stage,
|
|
148
177
|
};
|
|
@@ -5,4 +5,5 @@ tslib_1.__exportStar(require("./aurora-preflight.js"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./deployment-plan.js"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./foundation-profile.js"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./policy.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./public-dns.js"), exports);
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ValidationIssue, type ValidationResult } from '../validation.js';
|
|
2
|
+
import { type RepositoryPublicDns } from './public-dns.js';
|
|
2
3
|
export declare const REPOSITORY_POLICY_FILE: "ebk.repository-policy.json";
|
|
3
4
|
export declare const REPOSITORY_POLICY_SCHEMA_VERSION: 1;
|
|
4
5
|
export declare const REPOSITORY_POLICY_SCHEMA_URL: "./node_modules/@empire-builder-kit/nx/schemas/repository-policy-v1.json";
|
|
@@ -7,6 +8,8 @@ export declare const PRODUCTION_APPROVAL_MODES: readonly ["promotion-pr", "envir
|
|
|
7
8
|
export declare const PRODUCTION_FOUNDATION_PROFILES: readonly ["cost-optimized", "balanced", "standard"];
|
|
8
9
|
export declare const DEFAULT_RECOVERY_PRODUCTION_FOUNDATION_PROFILE: "standard";
|
|
9
10
|
export declare const SLICE_PRODUCTION_STATUSES: readonly ["blocked", "pilot", "ready"];
|
|
11
|
+
/** The root site has no pilot posture: production serves it or skips it. */
|
|
12
|
+
export declare const ROOT_SITE_PRODUCTION_STATUSES: readonly ["blocked", "ready"];
|
|
10
13
|
export declare const REPOSITORY_MODE_PRESETS: readonly ["incubation", "controlled-production", "operational"];
|
|
11
14
|
export declare const DEPLOYMENT_PROFILES: readonly ["starter", "production-isolated", "fully-isolated"];
|
|
12
15
|
/** How work reaches production. protected-pair keeps develop and main with a
|
|
@@ -22,6 +25,7 @@ export type ProductionAccess = (typeof PRODUCTION_ACCESS_VALUES)[number];
|
|
|
22
25
|
export type ProductionApprovalMode = (typeof PRODUCTION_APPROVAL_MODES)[number];
|
|
23
26
|
export type ProductionFoundationProfile = (typeof PRODUCTION_FOUNDATION_PROFILES)[number];
|
|
24
27
|
export type SliceProductionStatus = (typeof SLICE_PRODUCTION_STATUSES)[number];
|
|
28
|
+
export type RootSiteProductionStatus = (typeof ROOT_SITE_PRODUCTION_STATUSES)[number];
|
|
25
29
|
export type RepositoryModePreset = (typeof REPOSITORY_MODE_PRESETS)[number];
|
|
26
30
|
export type DeploymentProfile = (typeof DEPLOYMENT_PROFILES)[number];
|
|
27
31
|
export type CanonicalDeploymentStage = 'development' | 'staging' | 'production';
|
|
@@ -54,10 +58,16 @@ export interface RepositoryOperatingPolicy {
|
|
|
54
58
|
productionApproval: {
|
|
55
59
|
mode: ProductionApprovalMode;
|
|
56
60
|
};
|
|
61
|
+
/** Optional per-stage public Route 53 binding (aws partition only). */
|
|
62
|
+
publicDns?: RepositoryPublicDns;
|
|
57
63
|
productionFoundation: {
|
|
58
64
|
profile: ProductionFoundationProfile;
|
|
59
65
|
};
|
|
60
66
|
schemaVersion: typeof REPOSITORY_POLICY_SCHEMA_VERSION;
|
|
67
|
+
/** Optional production posture of the workspace root site; absent is blocked. */
|
|
68
|
+
site?: {
|
|
69
|
+
productionStatus: RootSiteProductionStatus;
|
|
70
|
+
};
|
|
61
71
|
slices: Record<string, {
|
|
62
72
|
productionStatus: SliceProductionStatus;
|
|
63
73
|
}>;
|
|
@@ -74,7 +84,7 @@ export interface RepositoryOperatingPolicy {
|
|
|
74
84
|
}
|
|
75
85
|
export type RepositoryPolicyLifecycleAction = 'deploy' | 'dev' | 'migrate' | 'refresh' | 'remove' | 'unlock';
|
|
76
86
|
export interface RepositoryPolicyProject {
|
|
77
|
-
kind: 'foundation' | 'slice';
|
|
87
|
+
kind: 'foundation' | 'site' | 'slice';
|
|
78
88
|
name: string;
|
|
79
89
|
}
|
|
80
90
|
export interface RepositoryPolicyRequest {
|
|
@@ -96,6 +106,7 @@ export interface RepositoryPolicyChange {
|
|
|
96
106
|
productionAccess?: ProductionAccess;
|
|
97
107
|
productionApprovalMode?: ProductionApprovalMode;
|
|
98
108
|
productionFoundationProfile?: ProductionFoundationProfile;
|
|
109
|
+
site?: RootSiteProductionStatus;
|
|
99
110
|
slices?: Readonly<Record<string, SliceProductionStatus>>;
|
|
100
111
|
}
|
|
101
112
|
export declare function validateRepositoryOperatingPolicy(value: unknown): ValidationResult<RepositoryOperatingPolicy>;
|
|
@@ -109,5 +120,6 @@ export declare function validateRepositoryOperatingPolicyMigrationProvenance(inp
|
|
|
109
120
|
export declare function readRepositoryOperatingPolicy(workspaceRoot: string): RepositoryOperatingPolicy;
|
|
110
121
|
export declare function createIncubationRepositoryPolicy(deploymentProfile?: DeploymentProfile, workspaceDeploymentId?: string): RepositoryOperatingPolicy;
|
|
111
122
|
export declare function applyRepositoryPolicyChange(current: RepositoryOperatingPolicy, change: RepositoryPolicyChange): RepositoryOperatingPolicy;
|
|
123
|
+
export declare function rootSiteProductionStatus(policy: Pick<RepositoryOperatingPolicy, 'site'>): RootSiteProductionStatus;
|
|
112
124
|
export declare function evaluateRepositoryPolicyRequest(policy: RepositoryOperatingPolicy, request: RepositoryPolicyRequest): RepositoryPolicyDecision;
|
|
113
125
|
export declare function assertRepositoryPolicyRequest(workspaceRoot: string, request: RepositoryPolicyRequest): RepositoryPolicyDecision;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_DELIVERY_LANE = exports.DELIVERY_LANES = exports.DEPLOYMENT_PROFILES = exports.REPOSITORY_MODE_PRESETS = exports.SLICE_PRODUCTION_STATUSES = exports.DEFAULT_RECOVERY_PRODUCTION_FOUNDATION_PROFILE = exports.PRODUCTION_FOUNDATION_PROFILES = exports.PRODUCTION_APPROVAL_MODES = exports.PRODUCTION_ACCESS_VALUES = exports.REPOSITORY_POLICY_SCHEMA_URL = exports.REPOSITORY_POLICY_SCHEMA_VERSION = exports.REPOSITORY_POLICY_FILE = void 0;
|
|
3
|
+
exports.DEFAULT_DELIVERY_LANE = exports.DELIVERY_LANES = exports.DEPLOYMENT_PROFILES = exports.REPOSITORY_MODE_PRESETS = exports.ROOT_SITE_PRODUCTION_STATUSES = exports.SLICE_PRODUCTION_STATUSES = exports.DEFAULT_RECOVERY_PRODUCTION_FOUNDATION_PROFILE = exports.PRODUCTION_FOUNDATION_PROFILES = exports.PRODUCTION_APPROVAL_MODES = exports.PRODUCTION_ACCESS_VALUES = exports.REPOSITORY_POLICY_SCHEMA_URL = exports.REPOSITORY_POLICY_SCHEMA_VERSION = exports.REPOSITORY_POLICY_FILE = void 0;
|
|
4
4
|
exports.deliveryLaneOf = deliveryLaneOf;
|
|
5
5
|
exports.normalizeDeploymentAccountId = normalizeDeploymentAccountId;
|
|
6
6
|
exports.requiresGithubDeployment = requiresGithubDeployment;
|
|
@@ -18,6 +18,7 @@ exports.validateRepositoryOperatingPolicyMigrationProvenance = validateRepositor
|
|
|
18
18
|
exports.readRepositoryOperatingPolicy = readRepositoryOperatingPolicy;
|
|
19
19
|
exports.createIncubationRepositoryPolicy = createIncubationRepositoryPolicy;
|
|
20
20
|
exports.applyRepositoryPolicyChange = applyRepositoryPolicyChange;
|
|
21
|
+
exports.rootSiteProductionStatus = rootSiteProductionStatus;
|
|
21
22
|
exports.evaluateRepositoryPolicyRequest = evaluateRepositoryPolicyRequest;
|
|
22
23
|
exports.assertRepositoryPolicyRequest = assertRepositoryPolicyRequest;
|
|
23
24
|
const node_crypto_1 = require("node:crypto");
|
|
@@ -28,6 +29,8 @@ const node_path_1 = require("node:path");
|
|
|
28
29
|
const validation_js_1 = require("../validation.js");
|
|
29
30
|
const identity_js_1 = require("../workspace-deployment/identity.js");
|
|
30
31
|
const migration_evidence_js_1 = require("../workspace-deployment/migration-evidence.js");
|
|
32
|
+
const public_dns_js_1 = require("./public-dns.js");
|
|
33
|
+
const root_site_js_1 = require("../foundation/root-site.js");
|
|
31
34
|
exports.REPOSITORY_POLICY_FILE = 'ebk.repository-policy.json';
|
|
32
35
|
exports.REPOSITORY_POLICY_SCHEMA_VERSION = 1;
|
|
33
36
|
const MAX_REPOSITORY_POLICY_BYTES = 1024 * 1024;
|
|
@@ -47,6 +50,8 @@ exports.PRODUCTION_FOUNDATION_PROFILES = [
|
|
|
47
50
|
];
|
|
48
51
|
exports.DEFAULT_RECOVERY_PRODUCTION_FOUNDATION_PROFILE = 'standard';
|
|
49
52
|
exports.SLICE_PRODUCTION_STATUSES = ['blocked', 'pilot', 'ready'];
|
|
53
|
+
/** The root site has no pilot posture: production serves it or skips it. */
|
|
54
|
+
exports.ROOT_SITE_PRODUCTION_STATUSES = ['blocked', 'ready'];
|
|
50
55
|
exports.REPOSITORY_MODE_PRESETS = [
|
|
51
56
|
'incubation',
|
|
52
57
|
'controlled-production',
|
|
@@ -191,7 +196,9 @@ const POLICY_PROPERTIES = new Set([
|
|
|
191
196
|
'productionAccess',
|
|
192
197
|
'productionApproval',
|
|
193
198
|
'productionFoundation',
|
|
199
|
+
'publicDns',
|
|
194
200
|
'schemaVersion',
|
|
201
|
+
'site',
|
|
195
202
|
'slices',
|
|
196
203
|
'workspaceDeploymentId',
|
|
197
204
|
'workspaceDeploymentProvenance',
|
|
@@ -387,6 +394,13 @@ function validateRepositoryOperatingPolicy(value) {
|
|
|
387
394
|
}
|
|
388
395
|
}
|
|
389
396
|
}
|
|
397
|
+
issues.push(...(0, public_dns_js_1.validateRepositoryPublicDns)({
|
|
398
|
+
activeStages: isOneOf(value.deploymentProfile, exports.DEPLOYMENT_PROFILES)
|
|
399
|
+
? activeDeploymentStages(value.deploymentProfile)
|
|
400
|
+
: [],
|
|
401
|
+
deploymentRegion: value.deploymentRegion,
|
|
402
|
+
value: value.publicDns,
|
|
403
|
+
}));
|
|
390
404
|
if (!isOneOf(value.productionAccess, exports.PRODUCTION_ACCESS_VALUES)) {
|
|
391
405
|
issues.push({
|
|
392
406
|
message: `must equal ${exports.PRODUCTION_ACCESS_VALUES.join(' or ')}`,
|
|
@@ -423,6 +437,23 @@ function validateRepositoryOperatingPolicy(value) {
|
|
|
423
437
|
});
|
|
424
438
|
}
|
|
425
439
|
}
|
|
440
|
+
if (value.site !== undefined) {
|
|
441
|
+
if (!(0, validation_js_1.isRecord)(value.site)) {
|
|
442
|
+
issues.push({
|
|
443
|
+
message: 'must be an object with an explicit productionStatus',
|
|
444
|
+
path: 'policy.site',
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
rejectUnknownProperties(value.site, new Set(['productionStatus']), 'policy.site', issues);
|
|
449
|
+
if (!isOneOf(value.site.productionStatus, exports.ROOT_SITE_PRODUCTION_STATUSES)) {
|
|
450
|
+
issues.push({
|
|
451
|
+
message: `must equal ${exports.ROOT_SITE_PRODUCTION_STATUSES.join(' or ')}`,
|
|
452
|
+
path: 'policy.site.productionStatus',
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
426
457
|
if (!(0, validation_js_1.isRecord)(value.slices)) {
|
|
427
458
|
issues.push({ message: 'must be an object', path: 'policy.slices' });
|
|
428
459
|
}
|
|
@@ -435,6 +466,12 @@ function validateRepositoryOperatingPolicy(value) {
|
|
|
435
466
|
path,
|
|
436
467
|
});
|
|
437
468
|
}
|
|
469
|
+
if ((0, root_site_js_1.isReservedRootSiteName)(slice)) {
|
|
470
|
+
issues.push({
|
|
471
|
+
message: `is reserved for the workspace root site. ${root_site_js_1.ROOT_SITE_RENAME_GUIDANCE}`,
|
|
472
|
+
path,
|
|
473
|
+
});
|
|
474
|
+
}
|
|
438
475
|
if (!(0, validation_js_1.isRecord)(entry)) {
|
|
439
476
|
issues.push({ message: 'must be an object', path });
|
|
440
477
|
continue;
|
|
@@ -651,6 +688,8 @@ function applyRepositoryPolicyChange(current, change) {
|
|
|
651
688
|
for (const entry of Object.values(next.slices)) {
|
|
652
689
|
entry.productionStatus = 'blocked';
|
|
653
690
|
}
|
|
691
|
+
if (next.site)
|
|
692
|
+
next.site.productionStatus = 'blocked';
|
|
654
693
|
}
|
|
655
694
|
else if (change.preset === 'controlled-production') {
|
|
656
695
|
next.productionAccess = 'controlled';
|
|
@@ -698,14 +737,23 @@ function applyRepositoryPolicyChange(current, change) {
|
|
|
698
737
|
if (!SLICE_NAME_PATTERN.test(slice)) {
|
|
699
738
|
throw new Error(`Product Slice name ${slice} must use lowercase letters, numbers, and hyphens.`);
|
|
700
739
|
}
|
|
740
|
+
if ((0, root_site_js_1.isReservedRootSiteName)(slice)) {
|
|
741
|
+
throw new Error(root_site_js_1.ROOT_SITE_RESERVED_SLICE_NAME_MESSAGE);
|
|
742
|
+
}
|
|
701
743
|
next.slices[slice] = { productionStatus };
|
|
702
744
|
}
|
|
745
|
+
if (change.site !== undefined) {
|
|
746
|
+
next.site = { productionStatus: change.site };
|
|
747
|
+
}
|
|
703
748
|
const result = validateRepositoryOperatingPolicy(next);
|
|
704
749
|
if (!result.valid) {
|
|
705
750
|
throw new Error(`Repository Operating Policy change is invalid:\n${formatRepositoryPolicyIssues(result.issues)}`);
|
|
706
751
|
}
|
|
707
752
|
return result.value;
|
|
708
753
|
}
|
|
754
|
+
function rootSiteProductionStatus(policy) {
|
|
755
|
+
return policy.site?.productionStatus ?? 'blocked';
|
|
756
|
+
}
|
|
709
757
|
function evaluateRepositoryPolicyRequest(policy, request) {
|
|
710
758
|
const reasons = [];
|
|
711
759
|
const projectNames = new Set();
|
|
@@ -736,6 +784,12 @@ function evaluateRepositoryPolicyRequest(policy, request) {
|
|
|
736
784
|
const profile = policy.productionFoundation.profile;
|
|
737
785
|
if (!recoveryAction) {
|
|
738
786
|
for (const project of request.projects) {
|
|
787
|
+
if (project.kind === 'site') {
|
|
788
|
+
if (rootSiteProductionStatus(policy) === 'blocked') {
|
|
789
|
+
reasons.push('The root site is blocked for production deployment; set site.productionStatus to ready after review.');
|
|
790
|
+
}
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
739
793
|
if (project.kind !== 'slice')
|
|
740
794
|
continue;
|
|
741
795
|
const status = policy.slices[project.name]?.productionStatus ?? 'blocked';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ValidationIssue } from '../validation.js';
|
|
2
|
+
import type { CanonicalDeploymentStage, RepositoryOperatingPolicy } from './policy.js';
|
|
3
|
+
/**
|
|
4
|
+
* One reviewed public Route 53 hosted zone for one canonical stage. The stage
|
|
5
|
+
* deployment authority grants direct record writes only in this zone, and the
|
|
6
|
+
* generated Foundation passes the same zone to SST. Bindings exist only in the
|
|
7
|
+
* `aws` partition.
|
|
8
|
+
*/
|
|
9
|
+
export interface PublicDnsBinding {
|
|
10
|
+
hostedZoneId: string;
|
|
11
|
+
rootDomain: string;
|
|
12
|
+
}
|
|
13
|
+
export type RepositoryPublicDns = Partial<Record<CanonicalDeploymentStage, PublicDnsBinding>>;
|
|
14
|
+
export type RouterPublicDomain = {
|
|
15
|
+
kind: 'cloudfront';
|
|
16
|
+
} | ({
|
|
17
|
+
kind: 'custom-domain';
|
|
18
|
+
} & PublicDnsBinding);
|
|
19
|
+
/** Route 53 hosted-zone IDs: `Z` plus at most 31 upper-case alphanumerics,
|
|
20
|
+
* without an ARN or `/hostedzone/` prefix. */
|
|
21
|
+
export declare const PUBLIC_DNS_HOSTED_ZONE_ID_PATTERN: RegExp;
|
|
22
|
+
/** Lower-case LDH names with bounded labels, no wildcard, trailing dot,
|
|
23
|
+
* scheme, or port. */
|
|
24
|
+
export declare const PUBLIC_DNS_ROOT_DOMAIN_PATTERN: RegExp;
|
|
25
|
+
export declare function validateRepositoryPublicDns(input: {
|
|
26
|
+
activeStages: readonly CanonicalDeploymentStage[];
|
|
27
|
+
deploymentRegion: unknown;
|
|
28
|
+
value: unknown;
|
|
29
|
+
}): ValidationIssue[];
|
|
30
|
+
/** The committed binding for one canonical stage, or undefined. */
|
|
31
|
+
export declare function repositoryPublicDnsForStage(policy: Pick<RepositoryOperatingPolicy, 'publicDns'>, stage: string): PublicDnsBinding | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the generated Foundation's public domain. The committed
|
|
34
|
+
* `publicDns.<stage>` binding is the only switch: with a binding the stage
|
|
35
|
+
* serves its `rootDomain`, whether or not `EBK_ROOT_DOMAIN` is set, so a
|
|
36
|
+
* stage deployed by the generated Deploy workflow (which never sets it) and a
|
|
37
|
+
* local redeploy with the variable unset both keep the domain. Without a
|
|
38
|
+
* binding the Router keeps its CloudFront URL. `EBK_ROOT_DOMAIN` is an
|
|
39
|
+
* optional cross-check: when set it must equal the binding's `rootDomain`,
|
|
40
|
+
* and setting it with no binding for the same canonical stage refuses. Both
|
|
41
|
+
* refusals happen before Foundation constructs any resource, because the
|
|
42
|
+
* stage authority grants record writes only in the bound zone.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveFoundationPublicDomain(input: {
|
|
45
|
+
configuredRootDomain: string | undefined;
|
|
46
|
+
policy: Pick<RepositoryOperatingPolicy, 'publicDns'>;
|
|
47
|
+
stage: string;
|
|
48
|
+
}): RouterPublicDomain;
|
|
49
|
+
/**
|
|
50
|
+
* Resolves the generated Foundation Router domain. Without `EBK_ROOT_DOMAIN`
|
|
51
|
+
* the Router keeps its CloudFront URL, even when a binding exists. With it,
|
|
52
|
+
* the committed binding for the same canonical stage must exist and match
|
|
53
|
+
* exactly; otherwise Foundation refuses before constructing any resource,
|
|
54
|
+
* because the stage authority grants record writes only in that zone.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Only a managed Foundation generated before the binding became
|
|
57
|
+
* the switch calls this. Installing new packages alone must not move such a
|
|
58
|
+
* stage to its custom domain before its Foundation upgrade is applied; the
|
|
59
|
+
* current generated Foundation calls {@link resolveFoundationPublicDomain}.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveRouterPublicDomain(input: {
|
|
62
|
+
configuredRootDomain: string | undefined;
|
|
63
|
+
policy: Pick<RepositoryOperatingPolicy, 'publicDns'>;
|
|
64
|
+
stage: string;
|
|
65
|
+
}): RouterPublicDomain;
|