@empire-builder-kit/nx 1.0.0-rc.2 → 1.0.0-rc.21
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/executors.json +10 -0
- package/package.json +4 -4
- package/src/cli/output.js +1 -1
- package/src/developer-agent/model.js +4 -4
- package/src/developer-agent/model.js.map +1 -1
- package/src/developer-agent/operation-registry.js +67 -10
- package/src/developer-agent/operation-registry.js.map +1 -1
- package/src/developer-agent/planning.js +7 -9
- package/src/developer-agent/planning.js.map +1 -1
- package/src/developer-agent/workspace-inspection.js +12 -0
- package/src/developer-agent/workspace-inspection.js.map +1 -1
- package/src/executors/blueprint-trust/blueprint-trust.js +6 -0
- package/src/executors/blueprint-trust/blueprint-trust.js.map +1 -1
- package/src/executors/deployment-plan/deployment-plan.js +5 -0
- package/src/executors/deployment-plan/deployment-plan.js.map +1 -1
- package/src/executors/foundation-preflight/foundation-preflight.d.ts +2 -0
- package/src/executors/foundation-preflight/foundation-preflight.js +6 -2
- package/src/executors/foundation-preflight/foundation-preflight.js.map +1 -1
- package/src/executors/foundation-preflight/schema.json +10 -0
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +2 -0
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +2 -1
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js.map +1 -1
- package/src/executors/foundation-profile-preflight/schema.json +19 -3
- package/src/executors/github-bootstrap/github-bootstrap.js +1 -0
- package/src/executors/github-bootstrap/github-bootstrap.js.map +1 -1
- package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +229 -5
- package/src/executors/infrastructure-plan/infrastructure-plan.js +2298 -175
- package/src/executors/infrastructure-plan/infrastructure-plan.js.map +1 -1
- package/src/executors/infrastructure-plan/schema.json +16 -0
- package/src/executors/local-deploy/fixtures/local-deploy-state-machine.mjs +53 -0
- package/src/executors/local-deploy/local-approval.d.ts +23 -0
- package/src/executors/local-deploy/local-approval.js +43 -0
- package/src/executors/local-deploy/local-approval.js.map +1 -0
- package/src/executors/local-deploy/local-deploy.d.ts +69 -0
- package/src/executors/local-deploy/local-deploy.js +911 -0
- package/src/executors/local-deploy/local-deploy.js.map +1 -0
- package/src/executors/local-deploy/schema.json +42 -0
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +3 -0
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +94 -0
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js.map +1 -0
- package/src/executors/router-waf-rehearsal/schema.json +9 -0
- package/src/executors/secret-metadata/schema.json +5 -0
- package/src/executors/secret-metadata/secret-metadata.d.ts +12 -1
- package/src/executors/secret-metadata/secret-metadata.js +68 -16
- package/src/executors/secret-metadata/secret-metadata.js.map +1 -1
- package/src/executors/sst-lifecycle/logging-preflight.d.ts +5 -0
- package/src/executors/sst-lifecycle/logging-preflight.js +23 -13
- package/src/executors/sst-lifecycle/logging-preflight.js.map +1 -1
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +8 -1
- package/src/executors/sst-lifecycle/run-sst-command.js +144 -12
- package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -1
- package/src/executors/sst-lifecycle/schema.json +13 -1
- package/src/executors/sst-lifecycle/sst-environment-source.d.ts +25 -0
- package/src/executors/sst-lifecycle/sst-environment-source.js +213 -0
- package/src/executors/sst-lifecycle/sst-environment-source.js.map +1 -0
- package/src/foundation/index.d.ts +2 -0
- package/src/foundation/index.js +2 -0
- package/src/foundation/index.js.map +1 -1
- package/src/foundation/logging-preflight.js +1 -1
- package/src/foundation/logging-preflight.js.map +1 -1
- package/src/foundation/logging.d.ts +3 -1
- package/src/foundation/logging.js +1 -1
- package/src/foundation/logging.js.map +1 -1
- package/src/foundation/partial-state.d.ts +10 -0
- package/src/foundation/partial-state.js +21 -0
- package/src/foundation/partial-state.js.map +1 -0
- package/src/foundation/router-waf.d.ts +98 -0
- package/src/foundation/router-waf.js +401 -0
- package/src/foundation/router-waf.js.map +1 -0
- package/src/generators/function/function.js +2 -1
- package/src/generators/function/function.js.map +1 -1
- package/src/generators/post-generation-install.d.ts +1 -0
- package/src/generators/post-generation-install.js +134 -67
- package/src/generators/post-generation-install.js.map +1 -1
- package/src/generators/preset/generator.js +23 -3
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/schema.d.ts +7 -0
- package/src/generators/preset/schema.json +47 -0
- package/src/generators/preset/tool-versions.d.ts +5 -5
- package/src/generators/preset/tool-versions.js +4 -4
- package/src/generators/preset/workspace-files-ci-acceptance.d.ts +1 -0
- package/src/generators/preset/workspace-files-ci-acceptance.js +791 -0
- package/src/generators/preset/workspace-files-ci-acceptance.js.map +1 -0
- package/src/generators/preset/workspace-files-developer-agent.d.ts +2 -0
- package/src/generators/preset/workspace-files-developer-agent.js +25 -11
- package/src/generators/preset/workspace-files-developer-agent.js.map +1 -1
- package/src/generators/preset/workspace-files-foundation-workload-roles.js +5 -2
- package/src/generators/preset/workspace-files-foundation-workload-roles.js.map +1 -1
- package/src/generators/preset/workspace-files-performance-load.js +2 -1
- package/src/generators/preset/workspace-files-performance-load.js.map +1 -1
- package/src/generators/preset/workspace-files-workload-role-baseline.js +254 -42
- package/src/generators/preset/workspace-files-workload-role-baseline.js.map +1 -1
- package/src/generators/preset/workspace-files.d.ts +8 -4
- package/src/generators/preset/workspace-files.js +1039 -68
- package/src/generators/preset/workspace-files.js.map +1 -1
- package/src/generators/repository-policy/repository-policy.js +65 -3
- package/src/generators/repository-policy/repository-policy.js.map +1 -1
- package/src/generators/repository-policy/schema.d.ts +6 -0
- package/src/generators/repository-policy/schema.json +46 -0
- package/src/generators/slice/built-in-plan-api-files.js +2 -1
- package/src/generators/slice/built-in-plan-api-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +19 -1
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-data-files.js +16 -5
- package/src/generators/slice/built-in-plan-data-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-data-retention-job-files.js +10 -6
- package/src/generators/slice/built-in-plan-data-retention-job-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +25 -10
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-foundation-files.js +2 -3
- package/src/generators/slice/built-in-plan-foundation-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-infrastructure-files.js +364 -29
- package/src/generators/slice/built-in-plan-infrastructure-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +67 -11
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-metadata-files.js +1 -0
- package/src/generators/slice/built-in-plan-metadata-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-operations-files.js +442 -5
- package/src/generators/slice/built-in-plan-operations-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-performance-files.d.ts +2 -1
- package/src/generators/slice/built-in-plan-performance-files.js +41 -47
- package/src/generators/slice/built-in-plan-performance-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-project-files.js +14 -1
- package/src/generators/slice/built-in-plan-project-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-release-files.js +235 -56
- package/src/generators/slice/built-in-plan-release-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-testing-files.js +92 -5
- package/src/generators/slice/built-in-plan-testing-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-web-files.js +13 -0
- package/src/generators/slice/built-in-plan-web-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-workload-role-files.js +5 -2
- package/src/generators/slice/built-in-plan-workload-role-files.js.map +1 -1
- package/src/generators/slice/built-in-plan.d.ts +2 -1
- package/src/generators/slice/built-in-plan.js +8 -5
- package/src/generators/slice/built-in-plan.js.map +1 -1
- package/src/generators/slice/slice.js +11 -3
- package/src/generators/slice/slice.js.map +1 -1
- package/src/generators/upgrade/upgrade.js +35 -0
- package/src/generators/upgrade/upgrade.js.map +1 -1
- package/src/generators/workload/frozen-container.d.ts +3 -2
- package/src/generators/workload/frozen-container.js +6 -4
- package/src/generators/workload/frozen-container.js.map +1 -1
- package/src/generators/workload/workload.js +2 -2
- package/src/generators/workload/workload.js.map +1 -1
- package/src/git-policy/github-bootstrap.d.ts +3 -1
- package/src/git-policy/github-bootstrap.js +22 -5
- package/src/git-policy/github-bootstrap.js.map +1 -1
- package/src/git-policy/routing.d.ts +2 -0
- package/src/git-policy/routing.js +12 -1
- package/src/git-policy/routing.js.map +1 -1
- package/src/infrastructure-change/local-capability.d.ts +73 -0
- package/src/infrastructure-change/local-capability.js +114 -0
- package/src/infrastructure-change/local-capability.js.map +1 -0
- package/src/infrastructure-change/model.d.ts +25 -4
- package/src/infrastructure-change/model.js +1 -0
- package/src/infrastructure-change/model.js.map +1 -1
- package/src/infrastructure-change/normalize.d.ts +4 -0
- package/src/infrastructure-change/normalize.js +47 -7
- package/src/infrastructure-change/normalize.js.map +1 -1
- package/src/infrastructure-change/plan.d.ts +30 -3
- package/src/infrastructure-change/plan.js +323 -13
- package/src/infrastructure-change/plan.js.map +1 -1
- package/src/infrastructure-change/risk.d.ts +3 -1
- package/src/infrastructure-change/risk.js +96 -16
- package/src/infrastructure-change/risk.js.map +1 -1
- package/src/local-dev/environment-inspector.d.ts +1 -0
- package/src/local-dev/environment-inspector.js +21 -9
- package/src/local-dev/environment-inspector.js.map +1 -1
- package/src/local-dev/private-state.d.ts +2 -0
- package/src/local-dev/private-state.js +3 -1
- package/src/local-dev/private-state.js.map +1 -1
- package/src/performance/cost-controls.d.ts +5 -3
- package/src/performance/cost-controls.js +30 -24
- package/src/performance/cost-controls.js.map +1 -1
- package/src/performance/model.d.ts +1 -1
- package/src/performance/model.js +0 -2
- package/src/performance/model.js.map +1 -1
- package/src/performance/test-fixtures.js +0 -2
- package/src/performance/test-fixtures.js.map +1 -1
- package/src/release/source-authority.d.ts +1 -0
- package/src/release/source-authority.js +136 -9
- package/src/release/source-authority.js.map +1 -1
- package/src/repository-policy/deployment-plan.d.ts +4 -1
- package/src/repository-policy/deployment-plan.js +8 -0
- package/src/repository-policy/deployment-plan.js.map +1 -1
- package/src/repository-policy/foundation-profile.js +1 -2
- package/src/repository-policy/foundation-profile.js.map +1 -1
- package/src/repository-policy/policy.d.ts +25 -1
- package/src/repository-policy/policy.js +145 -4
- package/src/repository-policy/policy.js.map +1 -1
- package/src/schemas/performance-policy-v1.json +0 -2
- package/src/schemas/repository-policy-v1.json +41 -0
- package/src/secrets/operator.js +22 -4
- package/src/secrets/operator.js.map +1 -1
- package/src/secrets/verification.js +9 -1
- package/src/secrets/verification.js.map +1 -1
- package/src/sst-environment-source-format.d.ts +3 -0
- package/src/sst-environment-source-format.js +179 -0
- package/src/sst-environment-source-format.js.map +1 -0
- package/src/supply-chain/blueprint-trust-git.js +72 -21
- package/src/supply-chain/blueprint-trust-git.js.map +1 -1
- package/src/supply-chain/blueprint-verification-authority.js +55 -3
- package/src/supply-chain/blueprint-verification-authority.js.map +1 -1
- package/src/supply-chain/blueprint-verification-execution.js +17 -2
- package/src/supply-chain/blueprint-verification-execution.js.map +1 -1
- package/src/supply-chain/build-output.d.ts +7 -1
- package/src/supply-chain/build-output.js +160 -20
- package/src/supply-chain/build-output.js.map +1 -1
- package/src/supply-chain/generated-command.js +131 -43
- package/src/supply-chain/generated-command.js.map +1 -1
- package/src/supply-chain/generated-container-release-command.js +187 -38
- package/src/supply-chain/generated-container-release-command.js.map +1 -1
- package/src/supply-chain/generated-ecr-collector-command.js +12 -2
- package/src/supply-chain/generated-ecr-collector-command.js.map +1 -1
- package/src/supply-chain/generated-scanner-command.js +114 -54
- package/src/supply-chain/generated-scanner-command.js.map +1 -1
- package/src/supply-chain/inventory.d.ts +17 -0
- package/src/supply-chain/inventory.js +114 -3
- package/src/supply-chain/inventory.js.map +1 -1
- package/src/supply-chain/pnpm-toolchain-authority.d.ts +4 -3
- package/src/supply-chain/pnpm-toolchain-authority.js +20 -34
- package/src/supply-chain/pnpm-toolchain-authority.js.map +1 -1
- package/src/supply-chain/policy.js +4 -1
- package/src/supply-chain/policy.js.map +1 -1
- package/src/supply-chain/sbom.d.ts +1 -1
- package/src/supply-chain/sbom.js +30 -5
- package/src/supply-chain/sbom.js.map +1 -1
- package/src/supply-chain/scanner.js +10 -1
- package/src/supply-chain/scanner.js.map +1 -1
- package/src/workload-roles/account-baseline.d.ts +11 -0
- package/src/workload-roles/account-baseline.js +253 -16
- package/src/workload-roles/account-baseline.js.map +1 -1
- package/src/workload-roles/authority.d.ts +3 -1
- package/src/workload-roles/authority.js +48 -2
- package/src/workload-roles/authority.js.map +1 -1
- package/src/workload-roles/aws-s3-state.js +27 -0
- package/src/workload-roles/aws-s3-state.js.map +1 -1
- package/src/workload-roles/boundary.d.ts +2 -1
- package/src/workload-roles/boundary.js +9 -2
- package/src/workload-roles/boundary.js.map +1 -1
- package/src/workload-roles/handler.js +52 -24
- package/src/workload-roles/handler.js.map +1 -1
- package/src/workload-roles/injection.js +1 -1
- package/src/workload-roles/injection.js.map +1 -1
- package/src/workload-roles/provisioner.js +12 -4
- package/src/workload-roles/provisioner.js.map +1 -1
- package/src/workload-roles/registration.d.ts +1 -0
- package/src/workload-roles/registration.js +5 -0
- package/src/workload-roles/registration.js.map +1 -1
- package/src/workload-roles/stage-boundary.js +1 -1
- package/src/workload-roles/stage-boundary.js.map +1 -1
- package/src/workload-roles/standard-slice.js +1 -0
- package/src/workload-roles/standard-slice.js.map +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isExactGeneratedRootSstEnvironmentSourceBytes = isExactGeneratedRootSstEnvironmentSourceBytes;
|
|
4
|
+
exports.isExactGeneratedRootSstPythonSourceBytes = isExactGeneratedRootSstPythonSourceBytes;
|
|
5
|
+
exports.exactGeneratedNestedSstEnvironmentSourceBytes = exactGeneratedNestedSstEnvironmentSourceBytes;
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const GENERATED_HEADER = [
|
|
8
|
+
'/* This file is auto-generated by SST. Do not edit. */',
|
|
9
|
+
'/* tslint:disable */',
|
|
10
|
+
'/* eslint-disable */',
|
|
11
|
+
'/* deno-fmt-ignore-file */',
|
|
12
|
+
'/* biome-ignore-all lint: auto-generated */',
|
|
13
|
+
'',
|
|
14
|
+
];
|
|
15
|
+
function exactJsonString(value) {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(value);
|
|
18
|
+
return typeof parsed === 'string' && JSON.stringify(parsed) === value;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function exactGeneratedResourceMembers(lines) {
|
|
25
|
+
let depth = 0;
|
|
26
|
+
for (const line of lines) {
|
|
27
|
+
const indentation = line.match(/^ */u)?.[0].length ?? 0;
|
|
28
|
+
if (line.trim() === '}') {
|
|
29
|
+
if (depth === 0 || indentation !== 4 + (depth - 1) * 2)
|
|
30
|
+
return false;
|
|
31
|
+
depth -= 1;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (indentation !== 4 + depth * 2)
|
|
35
|
+
return false;
|
|
36
|
+
const property = line
|
|
37
|
+
.slice(indentation)
|
|
38
|
+
.match(/^("(?:[^"\\]|\\.)*"): (.+)$/u);
|
|
39
|
+
if (!property ||
|
|
40
|
+
!property[1] ||
|
|
41
|
+
!property[2] ||
|
|
42
|
+
!exactJsonString(property[1])) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (property[2] === '{') {
|
|
46
|
+
depth += 1;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// SST emits JSON property names followed by TypeScript type expressions.
|
|
50
|
+
// Keep the accepted alphabet deliberately type-only: executable statement
|
|
51
|
+
// delimiters, comments, assignments, templates, and braces are excluded.
|
|
52
|
+
if (!/^[A-Za-z0-9_.$@/:"'<>()[\]|&?, -]+$/u.test(property[2])) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return depth === 0;
|
|
57
|
+
}
|
|
58
|
+
function isExactGeneratedRootSstEnvironmentSourceBytes(bytes) {
|
|
59
|
+
const source = bytes.toString('utf8');
|
|
60
|
+
if (!Buffer.from(source, 'utf8').equals(bytes))
|
|
61
|
+
return false;
|
|
62
|
+
const normalized = source.split('\r\n').join('\n');
|
|
63
|
+
if (normalized.includes('\r'))
|
|
64
|
+
return false;
|
|
65
|
+
const lines = normalized.endsWith('\n')
|
|
66
|
+
? normalized.slice(0, -1).split('\n')
|
|
67
|
+
: normalized.split('\n');
|
|
68
|
+
const prefix = [
|
|
69
|
+
...GENERATED_HEADER,
|
|
70
|
+
'declare module "sst" {',
|
|
71
|
+
' export interface Resource {',
|
|
72
|
+
];
|
|
73
|
+
const suffix = [' }', '}', '', 'import "sst"', 'export {}'];
|
|
74
|
+
if (lines.length < prefix.length + suffix.length ||
|
|
75
|
+
prefix.some((line, index) => lines[index] !== line) ||
|
|
76
|
+
suffix.some((line, index) => lines[lines.length - suffix.length + index] !== line)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return exactGeneratedResourceMembers(lines.slice(prefix.length, lines.length - suffix.length));
|
|
80
|
+
}
|
|
81
|
+
function exactGeneratedPythonType(value) {
|
|
82
|
+
if (!/^[A-Za-z0-9_,.[\]| ]+$/u.test(value))
|
|
83
|
+
return false;
|
|
84
|
+
const identifiers = value.match(/[A-Za-z_][A-Za-z0-9_]*/gu) ?? [];
|
|
85
|
+
if (identifiers.some((identifier) => ![
|
|
86
|
+
'Any',
|
|
87
|
+
'None',
|
|
88
|
+
'bool',
|
|
89
|
+
'dict',
|
|
90
|
+
'float',
|
|
91
|
+
'int',
|
|
92
|
+
'list',
|
|
93
|
+
'set',
|
|
94
|
+
'str',
|
|
95
|
+
'tuple',
|
|
96
|
+
].includes(identifier))) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
let depth = 0;
|
|
100
|
+
for (const character of value) {
|
|
101
|
+
if (character === '[')
|
|
102
|
+
depth += 1;
|
|
103
|
+
if (character === ']')
|
|
104
|
+
depth -= 1;
|
|
105
|
+
if (depth < 0)
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return depth === 0;
|
|
109
|
+
}
|
|
110
|
+
function isExactGeneratedRootSstPythonSourceBytes(bytes) {
|
|
111
|
+
const source = bytes.toString('utf8');
|
|
112
|
+
if (!Buffer.from(source, 'utf8').equals(bytes))
|
|
113
|
+
return false;
|
|
114
|
+
const normalized = source.split('\r\n').join('\n');
|
|
115
|
+
if (normalized.includes('\r'))
|
|
116
|
+
return false;
|
|
117
|
+
const lines = normalized.endsWith('\n')
|
|
118
|
+
? normalized.slice(0, -1).split('\n')
|
|
119
|
+
: normalized.split('\n');
|
|
120
|
+
if (lines.at(-1) === '')
|
|
121
|
+
lines.pop();
|
|
122
|
+
if (lines.at(-1) === '')
|
|
123
|
+
return false;
|
|
124
|
+
const prefix = [
|
|
125
|
+
'# Automatically generated by SST',
|
|
126
|
+
'# pylint: disable=all',
|
|
127
|
+
'# ruff: noqa',
|
|
128
|
+
'from typing import Any',
|
|
129
|
+
'',
|
|
130
|
+
'class Resource:',
|
|
131
|
+
];
|
|
132
|
+
if (lines.length <= prefix.length ||
|
|
133
|
+
prefix.some((line, index) => lines[index] !== line)) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
let observedClass = false;
|
|
137
|
+
let observedMember = false;
|
|
138
|
+
for (const line of lines.slice(prefix.length)) {
|
|
139
|
+
const classDeclaration = line.match(/^ {4}class ([A-Za-z_][A-Za-z0-9_]*):$/u);
|
|
140
|
+
if (classDeclaration) {
|
|
141
|
+
if (observedClass && !observedMember)
|
|
142
|
+
return false;
|
|
143
|
+
observedClass = true;
|
|
144
|
+
observedMember = false;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const member = line.match(/^ {8}([A-Za-z_][A-Za-z0-9_]*): (.+)$/u);
|
|
148
|
+
if (!observedClass ||
|
|
149
|
+
!member?.[2] ||
|
|
150
|
+
!exactGeneratedPythonType(member[2])) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
observedMember = true;
|
|
154
|
+
}
|
|
155
|
+
return observedClass && observedMember;
|
|
156
|
+
}
|
|
157
|
+
function exactGeneratedNestedSstEnvironmentSourceBytes(nestedPath, rootSourcePath) {
|
|
158
|
+
const reference = (0, node_path_1.relative)((0, node_path_1.dirname)(nestedPath), rootSourcePath)
|
|
159
|
+
.split('\\')
|
|
160
|
+
.join('/');
|
|
161
|
+
if (!reference.startsWith('../') || reference.endsWith('/'))
|
|
162
|
+
return [];
|
|
163
|
+
const lines = [
|
|
164
|
+
...GENERATED_HEADER,
|
|
165
|
+
`/// <reference path="${reference}" />`,
|
|
166
|
+
'',
|
|
167
|
+
'import "sst"',
|
|
168
|
+
'export {}',
|
|
169
|
+
];
|
|
170
|
+
const lf = lines.join('\n');
|
|
171
|
+
const crlf = lines.join('\r\n');
|
|
172
|
+
return [
|
|
173
|
+
Buffer.from(lf, 'utf8'),
|
|
174
|
+
Buffer.from(`${lf}\n`, 'utf8'),
|
|
175
|
+
Buffer.from(crlf, 'utf8'),
|
|
176
|
+
Buffer.from(`${crlf}\r\n`, 'utf8'),
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=sst-environment-source-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sst-environment-source-format.js","sourceRoot":"","sources":["../../../../packages/nx/src/sst-environment-source-format.ts"],"names":[],"mappings":";;AAuDA,sGA4BC;AAiCD,4FAiDC;AAED,sGAwBC;AA/LD,yCAA8C;AAE9C,MAAM,gBAAgB,GAAG;IACvB,wDAAwD;IACxD,sBAAsB;IACtB,sBAAsB;IACtB,4BAA4B;IAC5B,6CAA6C;IAC7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AE,IAAI,EAAE,MAAM,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,MAAM,EAAE,MAAM,CAAC;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -369,6 +369,24 @@ function historyStates(context, history, policyPath, snapshotPath) {
|
|
|
369
369
|
}
|
|
370
370
|
return states;
|
|
371
371
|
}
|
|
372
|
+
function optionalBlueprintTrustAuthorityBaseline(context, tip, policyPath = exports.BLUEPRINT_TRUST_POLICY_PATH, snapshotPath = exports.BLUEPRINT_TRUST_SNAPSHOT_PATH) {
|
|
373
|
+
const stateCommits = commits(context, [tip, '--', policyPath, snapshotPath]);
|
|
374
|
+
if (stateCommits.length === 0 &&
|
|
375
|
+
stateAtCommit(context, tip, policyPath, snapshotPath) === undefined) {
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
if (stateCommits.at(-1) !== tip)
|
|
379
|
+
stateCommits.push(tip);
|
|
380
|
+
const states = historyStates(context, stateCommits, policyPath, snapshotPath);
|
|
381
|
+
return states[0]?.commit;
|
|
382
|
+
}
|
|
383
|
+
function blueprintTrustAuthorityBaseline(context, tip, policyPath = exports.BLUEPRINT_TRUST_POLICY_PATH, snapshotPath = exports.BLUEPRINT_TRUST_SNAPSHOT_PATH) {
|
|
384
|
+
const baseline = optionalBlueprintTrustAuthorityBaseline(context, tip, policyPath, snapshotPath);
|
|
385
|
+
if (!baseline) {
|
|
386
|
+
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:ownership`, 'cannot establish the first protected Blueprint trust authority commit');
|
|
387
|
+
}
|
|
388
|
+
return baseline;
|
|
389
|
+
}
|
|
372
390
|
function blueprintIdentity(value, path) {
|
|
373
391
|
if (!(0, validation_js_1.isRecord)(value) ||
|
|
374
392
|
!(0, validation_js_1.isRecord)(value.blueprint) ||
|
|
@@ -519,7 +537,11 @@ function changedOwnershipAtCommit(context, commit) {
|
|
|
519
537
|
if (paths.length > MAX_OWNERSHIP_RECORDS) {
|
|
520
538
|
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `changes more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
|
|
521
539
|
}
|
|
522
|
-
|
|
540
|
+
const parent = git(context, ['rev-parse', '--verify', `${commit}^1^{commit}`], { allowFailure: true });
|
|
541
|
+
if (!parent || !FULL_GIT_OBJECT_ID.test(parent)) {
|
|
542
|
+
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'cannot resolve the exact first parent of an ownership change after the trust authority floor');
|
|
543
|
+
}
|
|
544
|
+
return [parent, commit].flatMap((revision) => changedOwnershipValuesAtCommit(context, revision, paths).flatMap(({ path, value }) => historicalOwnershipRecord(revision, path, value)));
|
|
523
545
|
}
|
|
524
546
|
function protectedWorkspaceHasExternalBlueprintOwnership(input) {
|
|
525
547
|
if (!FULL_GIT_OBJECT_ID.test(input.commit)) {
|
|
@@ -605,20 +627,31 @@ function inspectProtectedWorkspaceExternalBlueprintHistory(input) {
|
|
|
605
627
|
const tips = [
|
|
606
628
|
...new Set(before.filter((commit) => commit !== undefined)),
|
|
607
629
|
];
|
|
630
|
+
const baselines = new Set();
|
|
608
631
|
const history = new Set();
|
|
632
|
+
const inspectedCommits = new Set();
|
|
609
633
|
for (const tip of tips) {
|
|
634
|
+
const baseline = shallowBefore === 'false'
|
|
635
|
+
? optionalBlueprintTrustAuthorityBaseline(context, tip)
|
|
636
|
+
: undefined;
|
|
637
|
+
if (baseline) {
|
|
638
|
+
baselines.add(baseline);
|
|
639
|
+
inspectedCommits.add(baseline);
|
|
640
|
+
}
|
|
610
641
|
const tipHistory = commits(context, [
|
|
611
642
|
`--max-count=${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS + 1}`,
|
|
612
|
-
tip,
|
|
643
|
+
baseline ? `${baseline}..${tip}` : tip,
|
|
613
644
|
'--',
|
|
614
645
|
OWNERSHIP_PATHSPEC,
|
|
615
646
|
]);
|
|
616
|
-
if (tipHistory.length
|
|
647
|
+
if (tipHistory.length + (baseline ? 1 : 0) >
|
|
648
|
+
MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS) {
|
|
617
649
|
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS} changing commits`);
|
|
618
650
|
}
|
|
619
651
|
for (const commit of tipHistory) {
|
|
620
652
|
history.add(commit);
|
|
621
|
-
|
|
653
|
+
inspectedCommits.add(commit);
|
|
654
|
+
if (inspectedCommits.size > MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS) {
|
|
622
655
|
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS} distinct changing commits`);
|
|
623
656
|
}
|
|
624
657
|
}
|
|
@@ -627,8 +660,7 @@ function inspectProtectedWorkspaceExternalBlueprintHistory(input) {
|
|
|
627
660
|
const externalSliceRoots = new Set();
|
|
628
661
|
let externalRecordFound = false;
|
|
629
662
|
let historicalRecordCount = 0;
|
|
630
|
-
|
|
631
|
-
const inventory = changedOwnershipAtCommit(context, commit);
|
|
663
|
+
const inspectInventory = (inventory) => {
|
|
632
664
|
historicalRecordCount += inventory.length;
|
|
633
665
|
if (historicalRecordCount > MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS) {
|
|
634
666
|
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS} aggregate Slice records`);
|
|
@@ -643,6 +675,14 @@ function inspectProtectedWorkspaceExternalBlueprintHistory(input) {
|
|
|
643
675
|
}
|
|
644
676
|
externalSliceRoots.add(`packages/${record.slice}`);
|
|
645
677
|
}
|
|
678
|
+
};
|
|
679
|
+
for (const baseline of baselines) {
|
|
680
|
+
inspectInventory(ownershipInventoryAtCommit(context, baseline));
|
|
681
|
+
}
|
|
682
|
+
for (const commit of history) {
|
|
683
|
+
if (baselines.has(commit))
|
|
684
|
+
continue;
|
|
685
|
+
inspectInventory(changedOwnershipAtCommit(context, commit));
|
|
646
686
|
}
|
|
647
687
|
const after = resolveCommits();
|
|
648
688
|
const shallowAfter = git(context, ['rev-parse', '--is-shallow-repository']);
|
|
@@ -698,13 +738,11 @@ function changedOwnershipPaths(context, parent, commit) {
|
|
|
698
738
|
}
|
|
699
739
|
return paths;
|
|
700
740
|
}
|
|
701
|
-
function historicalOwnershipAudit(context, builtInName, tip) {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:ownership`, 'must have one exact first-parent repository root');
|
|
741
|
+
function historicalOwnershipAudit(context, builtInName, tip, baseline) {
|
|
742
|
+
if (!commits(context, [tip]).includes(baseline)) {
|
|
743
|
+
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:ownership`, 'Blueprint trust authority baseline must remain on the exact first-parent lineage');
|
|
705
744
|
}
|
|
706
|
-
const
|
|
707
|
-
const root = ownershipInventoryAtCommit(context, rootCommit);
|
|
745
|
+
const root = ownershipInventoryAtCommit(context, baseline);
|
|
708
746
|
const external = new Map();
|
|
709
747
|
const rememberExternal = (record) => {
|
|
710
748
|
if (record.name !== builtInName) {
|
|
@@ -712,9 +750,11 @@ function historicalOwnershipAudit(context, builtInName, tip) {
|
|
|
712
750
|
}
|
|
713
751
|
};
|
|
714
752
|
root.forEach(rememberExternal);
|
|
715
|
-
for (const commit of commits(context, [
|
|
716
|
-
|
|
717
|
-
|
|
753
|
+
for (const commit of commits(context, [
|
|
754
|
+
`${baseline}..${tip}`,
|
|
755
|
+
'--',
|
|
756
|
+
OWNERSHIP_PATHSPEC,
|
|
757
|
+
])) {
|
|
718
758
|
const parent = git(context, ['rev-parse', '--verify', `${commit}^1^{commit}`], { allowFailure: true });
|
|
719
759
|
if (!parent || !FULL_GIT_OBJECT_ID.test(parent)) {
|
|
720
760
|
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'cannot resolve the exact first parent of an ownership change');
|
|
@@ -764,7 +804,7 @@ function assertNoPathIndependentRelabel(builtInName, current, before, after) {
|
|
|
764
804
|
return;
|
|
765
805
|
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${current.path}#blueprint`, `cannot establish built-in provenance while historical external Blueprint ${relatedExternal.name}@${relatedExternal.version} ownership at ${relatedExternal.path} was removed, moved, or reused`);
|
|
766
806
|
}
|
|
767
|
-
function builtInProvenance(context, input, headCommit, protectedCommit) {
|
|
807
|
+
function builtInProvenance(context, input, headCommit, headBaseline, protectedCommit, protectedBaseline) {
|
|
768
808
|
const provenance = [];
|
|
769
809
|
const currentOwnership = currentOwnershipInventory(input);
|
|
770
810
|
const builtInOwnership = currentOwnership.filter(({ name }) => name === input.builtIn.name);
|
|
@@ -772,19 +812,25 @@ function builtInProvenance(context, input, headCommit, protectedCommit) {
|
|
|
772
812
|
return provenance;
|
|
773
813
|
const protectedOwnership = ownershipInventoryAtCommit(context, protectedCommit);
|
|
774
814
|
const headOwnership = ownershipInventoryAtCommit(context, headCommit);
|
|
775
|
-
const protectedAudit = historicalOwnershipAudit(context, input.builtIn.name, protectedCommit);
|
|
815
|
+
const protectedAudit = historicalOwnershipAudit(context, input.builtIn.name, protectedCommit, protectedBaseline);
|
|
776
816
|
const audits = headCommit === protectedCommit
|
|
777
817
|
? [protectedAudit]
|
|
778
818
|
: [
|
|
779
819
|
protectedAudit,
|
|
780
|
-
historicalOwnershipAudit(context, input.builtIn.name, headCommit),
|
|
820
|
+
historicalOwnershipAudit(context, input.builtIn.name, headCommit, headBaseline),
|
|
781
821
|
];
|
|
782
822
|
for (const currentRecord of builtInOwnership) {
|
|
783
823
|
const current = currentRecord;
|
|
784
824
|
const path = current.path;
|
|
785
825
|
const pathCommits = new Set([
|
|
786
|
-
|
|
787
|
-
...commits(context, [
|
|
826
|
+
headBaseline,
|
|
827
|
+
...commits(context, [`${headBaseline}..${headCommit}`, '--', path]),
|
|
828
|
+
protectedBaseline,
|
|
829
|
+
...commits(context, [
|
|
830
|
+
`${protectedBaseline}..${protectedCommit}`,
|
|
831
|
+
'--',
|
|
832
|
+
path,
|
|
833
|
+
]),
|
|
788
834
|
]);
|
|
789
835
|
for (const commit of pathCommits) {
|
|
790
836
|
const historical = readJsonBlob(context, commit, path);
|
|
@@ -1084,6 +1130,10 @@ function inspectBlueprintTrustGitAuthority(input) {
|
|
|
1084
1130
|
}
|
|
1085
1131
|
const protectedStates = historyStates(context, protectedCommits, policyPath, snapshotPath);
|
|
1086
1132
|
const protectedHistory = (0, blueprint_trust_js_1.validateBlueprintTrustHistory)(protectedStates);
|
|
1133
|
+
const protectedBaseline = protectedStates[0]?.commit;
|
|
1134
|
+
if (!protectedBaseline) {
|
|
1135
|
+
throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${authorityCommit}:ownership`, 'cannot establish the first protected Blueprint trust authority commit');
|
|
1136
|
+
}
|
|
1087
1137
|
const authorization = (0, blueprint_trust_js_1.createBlueprintTrustState)(protectedStates.at(-1));
|
|
1088
1138
|
const mergeBase = git(context, ['merge-base', authorityCommit, headCommit]);
|
|
1089
1139
|
if (!mergeBase || !FULL_GIT_OBJECT_ID.test(mergeBase)) {
|
|
@@ -1102,6 +1152,7 @@ function inspectBlueprintTrustGitAuthority(input) {
|
|
|
1102
1152
|
candidateCommits.push(headCommit);
|
|
1103
1153
|
const candidateStates = historyStates(context, candidateCommits, policyPath, snapshotPath);
|
|
1104
1154
|
const candidateHistory = (0, blueprint_trust_js_1.validateBlueprintTrustHistory)(candidateStates);
|
|
1155
|
+
const headBaseline = blueprintTrustAuthorityBaseline(context, headCommit, policyPath, snapshotPath);
|
|
1105
1156
|
const head = (0, blueprint_trust_js_1.createBlueprintTrustState)(candidateStates.at(-1));
|
|
1106
1157
|
if ((0, blueprint_trust_js_1.blueprintTrustStateDigest)(authorization) !== (0, blueprint_trust_js_1.blueprintTrustStateDigest)(head)) {
|
|
1107
1158
|
(0, blueprint_trust_js_1.planBlueprintTrustStateTransition)(authorization, head);
|
|
@@ -1112,7 +1163,7 @@ function inspectBlueprintTrustGitAuthority(input) {
|
|
|
1112
1163
|
: (0, blueprint_trust_js_1.planBlueprintTrustStateTransition)(head, current).receipt;
|
|
1113
1164
|
return {
|
|
1114
1165
|
authorization,
|
|
1115
|
-
builtInProvenance: builtInProvenance(context, input, headCommit, authorityCommit),
|
|
1166
|
+
builtInProvenance: builtInProvenance(context, input, headCommit, headBaseline, authorityCommit, protectedBaseline),
|
|
1116
1167
|
candidateHistory,
|
|
1117
1168
|
headCommit,
|
|
1118
1169
|
protectedCommit: authorityCommit,
|