@empire-builder-kit/nx 1.0.0-rc.29 → 1.0.0-rc.31
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 +8 -3
- package/package.json +10 -7
- package/src/aws/child-environment.d.ts +10 -0
- package/src/aws/child-environment.js +77 -0
- package/src/aws/child-environment.js.map +1 -0
- package/src/aws/identity.d.ts +13 -0
- package/src/aws/identity.js +41 -0
- package/src/aws/identity.js.map +1 -0
- package/src/aws-authority/index.d.ts +1 -0
- package/src/aws-authority/index.js +5 -0
- package/src/aws-authority/index.js.map +1 -0
- package/src/aws-authority/stage-authority.d.ts +238 -0
- package/src/aws-authority/stage-authority.js +2836 -0
- package/src/aws-authority/stage-authority.js.map +1 -0
- package/src/developer-agent/generator-planning.js +4 -4
- package/src/developer-agent/generator-planning.js.map +1 -1
- package/src/developer-agent/operation-registry.js +14 -6
- package/src/developer-agent/operation-registry.js.map +1 -1
- package/src/executors/deployment-plan/deployment-plan.js +1 -1
- package/src/executors/deployment-plan/deployment-plan.js.map +1 -1
- package/src/executors/foundation-preflight/foundation-preflight.d.ts +0 -1
- package/src/executors/foundation-preflight/foundation-preflight.js.map +1 -1
- package/src/executors/foundation-preflight/schema.json +0 -5
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +12 -3
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +95 -32
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js.map +1 -1
- package/src/executors/foundation-profile-preflight/production-database-safeguard.d.ts +64 -0
- package/src/executors/foundation-profile-preflight/production-database-safeguard.js +221 -0
- package/src/executors/foundation-profile-preflight/production-database-safeguard.js.map +1 -0
- package/src/executors/foundation-profile-preflight/schema.json +1 -6
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.d.ts +11 -1
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +44 -21
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js.map +1 -1
- package/src/executors/foundation-remove-preflight/schema.json +6 -1
- package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +25 -369
- package/src/executors/infrastructure-plan/infrastructure-plan.js +222 -5463
- package/src/executors/infrastructure-plan/infrastructure-plan.js.map +1 -1
- package/src/executors/infrastructure-plan/schema.json +8 -64
- package/src/executors/local-deploy/federated-credential-transport.d.ts +48 -0
- package/src/executors/local-deploy/federated-credential-transport.js +252 -0
- package/src/executors/local-deploy/federated-credential-transport.js.map +1 -0
- package/src/executors/local-deploy/local-approval.d.ts +4 -9
- package/src/executors/local-deploy/local-approval.js +3 -7
- package/src/executors/local-deploy/local-approval.js.map +1 -1
- package/src/executors/local-deploy/local-deploy.d.ts +58 -43
- package/src/executors/local-deploy/local-deploy.js +938 -804
- package/src/executors/local-deploy/local-deploy.js.map +1 -1
- package/src/executors/local-deploy/schema.json +3 -20
- package/src/executors/refresh/refresh.js +2 -2
- package/src/executors/refresh/refresh.js.map +1 -1
- package/src/executors/remove/remove.js +2 -2
- package/src/executors/remove/remove.js.map +1 -1
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +25 -1
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +905 -22
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js.map +1 -1
- package/src/executors/router-waf-rehearsal/schema.json +17 -2
- package/src/executors/secret-initialize/schema.json +42 -0
- package/src/executors/secret-initialize/secret-initialize.d.ts +30 -0
- package/src/executors/secret-initialize/secret-initialize.js +229 -0
- package/src/executors/secret-initialize/secret-initialize.js.map +1 -0
- package/src/executors/secret-metadata/secret-metadata.d.ts +2 -1
- package/src/executors/secret-metadata/secret-metadata.js +62 -29
- package/src/executors/secret-metadata/secret-metadata.js.map +1 -1
- package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +53 -0
- package/src/executors/sst-lifecycle/generated-secret-retirement.js +192 -0
- package/src/executors/sst-lifecycle/generated-secret-retirement.js.map +1 -0
- package/src/executors/sst-lifecycle/governed-native-operation.d.ts +46 -0
- package/src/executors/sst-lifecycle/governed-native-operation.js +153 -0
- package/src/executors/sst-lifecycle/governed-native-operation.js.map +1 -0
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +25 -7
- package/src/executors/sst-lifecycle/run-sst-command.js +459 -89
- package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -1
- package/src/executors/sst-lifecycle/schema.json +0 -5
- package/src/executors/sst-lifecycle/secret-preflight.d.ts +2 -0
- package/src/executors/sst-lifecycle/secret-preflight.js +13 -7
- package/src/executors/sst-lifecycle/secret-preflight.js.map +1 -1
- package/src/executors/unlock/unlock.js +2 -2
- package/src/executors/unlock/unlock.js.map +1 -1
- package/src/foundation/router-waf-rate-rehearsal.d.ts +97 -0
- package/src/foundation/router-waf-rate-rehearsal.js +210 -0
- package/src/foundation/router-waf-rate-rehearsal.js.map +1 -0
- package/src/foundation/router-waf.d.ts +59 -9
- package/src/foundation/router-waf.js +427 -32
- package/src/foundation/router-waf.js.map +1 -1
- package/src/foundation/stages.d.ts +1 -0
- package/src/foundation/stages.js +11 -0
- package/src/foundation/stages.js.map +1 -1
- package/src/generators/formatting.d.ts +8 -0
- package/src/generators/formatting.js +118 -0
- package/src/generators/formatting.js.map +1 -0
- package/src/generators/function/function.js +37 -17
- package/src/generators/function/function.js.map +1 -1
- package/src/generators/post-generation-install.js +2 -2
- package/src/generators/post-generation-install.js.map +1 -1
- package/src/generators/preset/generator.js +22 -7
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/workspace-files-developer-agent.js +15 -7
- package/src/generators/preset/workspace-files-developer-agent.js.map +1 -1
- package/src/generators/preset/workspace-files-ecr-inspector.d.ts +18 -0
- package/src/generators/preset/workspace-files-ecr-inspector.js +298 -0
- package/src/generators/preset/workspace-files-ecr-inspector.js.map +1 -0
- package/src/generators/preset/workspace-files-performance-cost.d.ts +2 -2
- package/src/generators/preset/workspace-files-performance-cost.js +8 -8
- package/src/generators/preset/workspace-files-performance-cost.js.map +1 -1
- package/src/generators/preset/workspace-files-performance-load.d.ts +1 -1
- package/src/generators/preset/workspace-files-performance-load.js +8 -12
- package/src/generators/preset/workspace-files-performance-load.js.map +1 -1
- package/src/generators/preset/workspace-files-stage-authority.d.ts +4 -0
- package/src/generators/preset/workspace-files-stage-authority.js +275 -0
- package/src/generators/preset/workspace-files-stage-authority.js.map +1 -0
- package/src/generators/preset/workspace-files-thin-deploy.d.ts +35 -0
- package/src/generators/preset/workspace-files-thin-deploy.js +1434 -0
- package/src/generators/preset/workspace-files-thin-deploy.js.map +1 -0
- package/src/generators/preset/workspace-files-thin-docs.d.ts +5 -0
- package/src/generators/preset/workspace-files-thin-docs.js +224 -0
- package/src/generators/preset/workspace-files-thin-docs.js.map +1 -0
- package/src/generators/preset/workspace-files-thin-release.d.ts +14 -0
- package/src/generators/preset/workspace-files-thin-release.js +26 -0
- package/src/generators/preset/workspace-files-thin-release.js.map +1 -0
- package/src/generators/preset/workspace-files.d.ts +1 -1
- package/src/generators/preset/workspace-files.js +373 -223
- package/src/generators/preset/workspace-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-api-files.js +1 -0
- package/src/generators/slice/built-in-plan-api-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +4 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +5 -31
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-data-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-data-files.js +89 -30
- package/src/generators/slice/built-in-plan-data-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-foundation-files.js +3 -5
- package/src/generators/slice/built-in-plan-foundation-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-frontend-files.js +5 -1
- package/src/generators/slice/built-in-plan-frontend-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-infrastructure-files.js +199 -188
- package/src/generators/slice/built-in-plan-infrastructure-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-metadata-files.js +13 -0
- package/src/generators/slice/built-in-plan-metadata-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +307 -0
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-operations-files.js +43 -49
- package/src/generators/slice/built-in-plan-operations-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-performance-files.js +37 -19
- package/src/generators/slice/built-in-plan-performance-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-project-files.js +9 -68
- package/src/generators/slice/built-in-plan-project-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-secret-runtime-files.js +74 -76
- package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-testing-files.js +74 -47
- package/src/generators/slice/built-in-plan-testing-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-thin-release-files.d.ts +11 -0
- package/src/generators/slice/built-in-plan-thin-release-files.js +129 -0
- package/src/generators/slice/built-in-plan-thin-release-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-verification-files.js +6 -2
- package/src/generators/slice/built-in-plan-verification-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-web-files.js +4 -2
- package/src/generators/slice/built-in-plan-web-files.js.map +1 -1
- package/src/generators/slice/built-in-plan-workload-role-files.js +26 -4
- package/src/generators/slice/built-in-plan-workload-role-files.js.map +1 -1
- package/src/generators/slice/built-in-plan.d.ts +1 -0
- package/src/generators/slice/built-in-plan.js +28 -11
- package/src/generators/slice/built-in-plan.js.map +1 -1
- package/src/generators/slice/slice.js +27 -29
- package/src/generators/slice/slice.js.map +1 -1
- package/src/generators/upgrade/upgrade.d.ts +1 -1
- package/src/generators/upgrade/upgrade.js +224 -69
- package/src/generators/upgrade/upgrade.js.map +1 -1
- package/src/generators/workload/performance-registration.d.ts +1 -0
- package/src/generators/workload/performance-registration.js +6 -4
- package/src/generators/workload/performance-registration.js.map +1 -1
- package/src/generators/workload/service-performance-files.d.ts +1 -0
- package/src/generators/workload/service-performance-files.js +27 -7
- package/src/generators/workload/service-performance-files.js.map +1 -1
- package/src/generators/workload/workload.d.ts +1 -1
- package/src/generators/workload/workload.js +55 -28
- package/src/generators/workload/workload.js.map +1 -1
- package/src/git-policy/github-bootstrap.d.ts +19 -6
- package/src/git-policy/github-bootstrap.js +103 -157
- package/src/git-policy/github-bootstrap.js.map +1 -1
- package/src/local-dev/private-state.d.ts +3 -0
- package/src/local-dev/private-state.js +17 -5
- package/src/local-dev/private-state.js.map +1 -1
- package/src/performance/cost-collection.d.ts +1 -1
- package/src/performance/cost-collection.js +4 -2
- package/src/performance/cost-collection.js.map +1 -1
- package/src/performance/cost-controls.d.ts +3 -1
- package/src/performance/cost-controls.js +9 -4
- package/src/performance/cost-controls.js.map +1 -1
- package/src/performance/evidence.d.ts +1 -1
- package/src/performance/evidence.js +5 -3
- package/src/performance/evidence.js.map +1 -1
- package/src/performance/load-safety.js +5 -3
- package/src/performance/load-safety.js.map +1 -1
- package/src/performance/model.d.ts +2 -2
- package/src/performance/model.js +4 -3
- package/src/performance/model.js.map +1 -1
- package/src/release/index.d.ts +0 -2
- package/src/release/index.js +0 -2
- package/src/release/index.js.map +1 -1
- package/src/release/source-authority.d.ts +4 -5
- package/src/release/source-authority.js +13 -123
- package/src/release/source-authority.js.map +1 -1
- package/src/repository-policy/aurora-preflight.d.ts +1 -1
- package/src/repository-policy/aurora-preflight.js +4 -1
- package/src/repository-policy/aurora-preflight.js.map +1 -1
- package/src/repository-policy/policy.d.ts +5 -1
- package/src/repository-policy/policy.js +64 -13
- package/src/repository-policy/policy.js.map +1 -1
- package/src/schemas/performance-policy-v1.json +3 -1
- package/src/secrets/adapters.d.ts +5 -1
- package/src/secrets/adapters.js +22 -1
- package/src/secrets/adapters.js.map +1 -1
- package/src/secrets/aws-control-plane.d.ts +10 -1
- package/src/secrets/aws-control-plane.js +67 -0
- package/src/secrets/aws-control-plane.js.map +1 -1
- package/src/secrets/generated-aws-control-plane.d.ts +23 -0
- package/src/secrets/generated-aws-control-plane.js +259 -0
- package/src/secrets/generated-aws-control-plane.js.map +1 -0
- package/src/secrets/metadata.js +38 -10
- package/src/secrets/metadata.js.map +1 -1
- package/src/secrets/model.d.ts +8 -1
- package/src/secrets/model.js +24 -3
- package/src/secrets/model.js.map +1 -1
- package/src/secrets/operator.d.ts +89 -3
- package/src/secrets/operator.js +422 -9
- package/src/secrets/operator.js.map +1 -1
- package/src/secrets/registry.d.ts +2 -1
- package/src/secrets/registry.js +18 -1
- package/src/secrets/registry.js.map +1 -1
- package/src/secrets/workload-access.js +10 -2
- package/src/secrets/workload-access.js.map +1 -1
- package/src/supply-chain/action-pins.js +61 -7
- package/src/supply-chain/action-pins.js.map +1 -1
- package/src/supply-chain/build-output-bounds.d.ts +2 -0
- package/src/supply-chain/build-output-bounds.js +12 -0
- package/src/supply-chain/build-output-bounds.js.map +1 -0
- package/src/supply-chain/build-output.js +2 -4
- package/src/supply-chain/build-output.js.map +1 -1
- package/src/supply-chain/ecr-scanning.d.ts +5 -3
- package/src/supply-chain/ecr-scanning.js +11 -7
- package/src/supply-chain/ecr-scanning.js.map +1 -1
- package/src/supply-chain/ecs-deployed-image.d.ts +5 -3
- package/src/supply-chain/ecs-deployed-image.js +6 -4
- package/src/supply-chain/ecs-deployed-image.js.map +1 -1
- package/src/supply-chain/generated-container-release-command.js +816 -34
- package/src/supply-chain/generated-container-release-command.js.map +1 -1
- package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -1
- package/src/supply-chain/generated-ecr-collector-command.js +188 -91
- package/src/supply-chain/generated-ecr-collector-command.js.map +1 -1
- package/src/supply-chain/generated-files.js +4 -3
- package/src/supply-chain/generated-files.js.map +1 -1
- package/src/supply-chain/index.d.ts +1 -1
- package/src/supply-chain/index.js +2 -1
- package/src/supply-chain/index.js.map +1 -1
- package/src/workload-roles/index.d.ts +10 -17
- package/src/workload-roles/index.js +5 -18
- package/src/workload-roles/index.js.map +1 -1
|
@@ -13,12 +13,12 @@ const node_crypto_1 = require("node:crypto");
|
|
|
13
13
|
const node_fs_1 = require("node:fs");
|
|
14
14
|
const node_path_1 = require("node:path");
|
|
15
15
|
const node_util_1 = require("node:util");
|
|
16
|
-
const prettier_1 = require("prettier");
|
|
17
16
|
const yaml_1 = require("yaml");
|
|
18
17
|
const index_js_1 = require("../../blueprints/index.js");
|
|
19
18
|
const index_js_2 = require("../../api-contract/index.js");
|
|
20
19
|
const index_js_3 = require("../../foundation/index.js");
|
|
21
|
-
const index_js_4 = require("../../
|
|
20
|
+
const index_js_4 = require("../../repository-policy/index.js");
|
|
21
|
+
const index_js_5 = require("../../ownership/index.js");
|
|
22
22
|
const function_js_1 = require("../function/function.js");
|
|
23
23
|
const feature_registry_js_1 = require("../feature-registry.js");
|
|
24
24
|
const generator_js_1 = require("../preset/generator.js");
|
|
@@ -26,12 +26,25 @@ const tool_versions_js_1 = require("../preset/tool-versions.js");
|
|
|
26
26
|
const workspace_files_js_1 = require("../preset/workspace-files.js");
|
|
27
27
|
const built_in_plan_js_1 = require("../slice/built-in-plan.js");
|
|
28
28
|
const workload_js_1 = require("../workload/workload.js");
|
|
29
|
+
const formatting_js_1 = require("../formatting.js");
|
|
29
30
|
const git_inspection_js_1 = require("../../developer-agent/git-inspection.js");
|
|
30
31
|
const context_js_1 = require("../../developer-agent/context.js");
|
|
31
32
|
const model_js_1 = require("../../developer-agent/model.js");
|
|
32
33
|
const preview_source_js_1 = require("../../developer-agent/preview-source.js");
|
|
33
34
|
const preview_changes_js_1 = require("../../developer-agent/preview-changes.js");
|
|
34
35
|
const validation_js_1 = require("../../developer-agent/validation.js");
|
|
36
|
+
function readRepositoryDeploymentRenderingOptions(tree) {
|
|
37
|
+
const contents = tree.read(index_js_4.REPOSITORY_POLICY_FILE, 'utf8');
|
|
38
|
+
if (contents === null) {
|
|
39
|
+
throw new Error(`${index_js_4.REPOSITORY_POLICY_FILE} is required before upgrading profile-dependent workspace, Foundation, or built-in Product Slice files.`);
|
|
40
|
+
}
|
|
41
|
+
const policy = (0, index_js_4.parseRepositoryOperatingPolicy)(contents, index_js_4.REPOSITORY_POLICY_FILE);
|
|
42
|
+
return {
|
|
43
|
+
deploymentAccounts: policy.deploymentAccounts,
|
|
44
|
+
deploymentProfile: policy.deploymentProfile,
|
|
45
|
+
deploymentRegion: policy.deploymentRegion,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
35
48
|
function requireTargetCompositionFeatures(files, ownership) {
|
|
36
49
|
if (ownership.compositions.length === 0)
|
|
37
50
|
return;
|
|
@@ -355,9 +368,29 @@ const SEEDED_RECONCILIATION = {
|
|
|
355
368
|
'journey-authority',
|
|
356
369
|
],
|
|
357
370
|
},
|
|
371
|
+
'secrets/declarations.ts': {
|
|
372
|
+
category: 'secret-contract',
|
|
373
|
+
implications: [
|
|
374
|
+
'generation-authority',
|
|
375
|
+
'secret-value-ownership',
|
|
376
|
+
'stage-requirements',
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
'secrets/metadata.json': {
|
|
380
|
+
category: 'secret-contract',
|
|
381
|
+
implications: ['logical-identity', 'management-class', 'registry-schema'],
|
|
382
|
+
},
|
|
383
|
+
'secrets/workload-access.json': {
|
|
384
|
+
category: 'secret-contract',
|
|
385
|
+
implications: [
|
|
386
|
+
'logical-identity',
|
|
387
|
+
'runtime-secret-linkage',
|
|
388
|
+
'workload-iam',
|
|
389
|
+
],
|
|
390
|
+
},
|
|
358
391
|
};
|
|
359
392
|
const SEEDED_RECONCILIATION_MARKER_REFERENCE = 'PLAN:5.6/seeded-upgrade-reconciliation';
|
|
360
|
-
const SEEDED_RECONCILIATION_MARKER = '// EBK-TODO(PLAN:5.6/seeded-upgrade-reconciliation): Review retained seeded async, configuration, feature, frontend, performance, reliability, and
|
|
393
|
+
const SEEDED_RECONCILIATION_MARKER = '// EBK-TODO(PLAN:5.6/seeded-upgrade-reconciliation): Review retained seeded async, configuration, feature, frontend, performance, reliability, release, and secret decisions against this framework upgrade before protected promotion.';
|
|
361
394
|
const SEEDED_RECONCILIATION_MARKER_ANCHOR = 'async/recovery-adapters.ts';
|
|
362
395
|
const DEVELOPER_AGENT_AGENTS_HEADING = '## Developer-Agent workflow';
|
|
363
396
|
function developerAgentAgentsAppendix(renderedAgents) {
|
|
@@ -431,8 +464,8 @@ const COMPOSITION_REGIONS = [
|
|
|
431
464
|
'workload-registrations',
|
|
432
465
|
'function-registrations',
|
|
433
466
|
'composition-outputs',
|
|
434
|
-
'
|
|
435
|
-
'
|
|
467
|
+
'native-runtime-extensions',
|
|
468
|
+
'native-runtime-intent-contributions',
|
|
436
469
|
];
|
|
437
470
|
function preserveCompositionRegions(current, target) {
|
|
438
471
|
let merged = target;
|
|
@@ -457,29 +490,117 @@ function preserveCompositionRegions(current, target) {
|
|
|
457
490
|
}
|
|
458
491
|
return merged;
|
|
459
492
|
}
|
|
460
|
-
function
|
|
493
|
+
function countExact(source, value) {
|
|
494
|
+
return source.split(value).length - 1;
|
|
495
|
+
}
|
|
496
|
+
function escapeRegularExpression(value) {
|
|
497
|
+
return value.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
498
|
+
}
|
|
499
|
+
function exactIndentedStringCallMatches(source, callee, argument) {
|
|
500
|
+
const pattern = new RegExp(`^ ${escapeRegularExpression(callee)}\\(\\s*(['"])${escapeRegularExpression(argument)}\\1\\s*,?\\s*\\),[ \\t]*$`, 'gmu');
|
|
501
|
+
return [...source.matchAll(pattern)];
|
|
502
|
+
}
|
|
503
|
+
function reconcileFunctionRegistrationArguments(source, ownership) {
|
|
461
504
|
let reconciled = source;
|
|
462
505
|
for (const composition of ownership.compositions) {
|
|
463
506
|
if (composition.kind !== 'function')
|
|
464
507
|
continue;
|
|
465
508
|
const { register } = (0, function_js_1.createFunctionFilePlan)('unused-workspace', ownership.slice, composition.name, composition.feature);
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
const currentCount = reconciled.split(current).length - 1;
|
|
470
|
-
if (previousCount === 1 && currentCount === 0) {
|
|
471
|
-
reconciled = reconciled.replace(previous, current);
|
|
472
|
-
continue;
|
|
509
|
+
const registrationStart = ` ${register}(\n`;
|
|
510
|
+
if (countExact(reconciled, registrationStart) !== 1) {
|
|
511
|
+
throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
|
|
473
512
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
513
|
+
const start = reconciled.indexOf(registrationStart);
|
|
514
|
+
const registrationEnd = '\n );';
|
|
515
|
+
const end = reconciled.indexOf(registrationEnd, start);
|
|
516
|
+
if (end < 0) {
|
|
517
|
+
throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
|
|
518
|
+
}
|
|
519
|
+
let registration = reconciled.slice(start, end + registrationEnd.length);
|
|
520
|
+
if (registration.length > 64 * 1024) {
|
|
521
|
+
throw new Error(`Retained Function ${composition.name} registration exceeds its bounded managed shape.`);
|
|
522
|
+
}
|
|
523
|
+
const previousRouter = `\n api,\n foundation.discovery.alertTopicArn,`;
|
|
524
|
+
const currentRouter = `\n api,\n foundation.router,\n foundation.discovery.alertTopicArn,`;
|
|
525
|
+
const previousRouterCount = countExact(registration, previousRouter);
|
|
526
|
+
const currentRouterCount = countExact(registration, currentRouter);
|
|
527
|
+
if (previousRouterCount === 1 && currentRouterCount === 0) {
|
|
528
|
+
registration = registration.replace(previousRouter, currentRouter);
|
|
529
|
+
}
|
|
530
|
+
else if (!(previousRouterCount === 0 && currentRouterCount === 1)) {
|
|
531
|
+
throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
|
|
532
|
+
}
|
|
533
|
+
const previousAuthorityMatches = exactIndentedStringCallMatches(registration, 'workloadRoleBindings?.extension.function', composition.name);
|
|
534
|
+
const currentAuthorityMatches = exactIndentedStringCallMatches(registration, 'nativeAuthority.permissions', `${composition.name}-function`);
|
|
535
|
+
if (previousAuthorityMatches.length === 1 &&
|
|
536
|
+
currentAuthorityMatches.length === 0) {
|
|
537
|
+
const [previousAuthority] = previousAuthorityMatches;
|
|
538
|
+
const authorityIndex = previousAuthority.index;
|
|
539
|
+
if (authorityIndex === undefined) {
|
|
540
|
+
throw new Error(`Retained Function ${composition.name} registration authority is not position-bound.`);
|
|
541
|
+
}
|
|
542
|
+
const currentAuthority = ` nativeAuthority.permissions('${composition.name}-function'),`;
|
|
543
|
+
registration =
|
|
544
|
+
registration.slice(0, authorityIndex) +
|
|
545
|
+
currentAuthority +
|
|
546
|
+
registration.slice(authorityIndex + previousAuthority[0].length);
|
|
547
|
+
}
|
|
548
|
+
else if (!(previousAuthorityMatches.length === 0 &&
|
|
549
|
+
currentAuthorityMatches.length === 1)) {
|
|
550
|
+
throw new Error(`Retained Function ${composition.name} registration does not expose one exact native-authority argument shape.`);
|
|
551
|
+
}
|
|
552
|
+
reconciled =
|
|
553
|
+
reconciled.slice(0, start) +
|
|
554
|
+
registration +
|
|
555
|
+
reconciled.slice(end + registrationEnd.length);
|
|
477
556
|
}
|
|
478
557
|
return reconciled;
|
|
479
558
|
}
|
|
480
559
|
function json(value) {
|
|
481
560
|
return `${JSON.stringify(value, null, 2)}\n`;
|
|
482
561
|
}
|
|
562
|
+
const DERIVED_API_ARTIFACT_PATHS = [
|
|
563
|
+
'api/generated/contract.json',
|
|
564
|
+
'api/generated/openapi.json',
|
|
565
|
+
];
|
|
566
|
+
function preserveBuiltInDerivedApiArtifacts(tree, root, currentOwnership, targetFiles) {
|
|
567
|
+
const sourceEntry = currentOwnership.paths.find(({ path }) => path === 'api/contracts/protected.ts');
|
|
568
|
+
const source = tree.read(node_path_1.posix.join(root, 'api/contracts/protected.ts'), 'utf8');
|
|
569
|
+
if (sourceEntry?.mode !== 'seeded' || source === null)
|
|
570
|
+
return targetFiles;
|
|
571
|
+
const currentEntries = new Map(currentOwnership.paths.map((entry) => [entry.path, entry]));
|
|
572
|
+
const artifacts = DERIVED_API_ARTIFACT_PATHS.map((path) => ({
|
|
573
|
+
current: tree.read(node_path_1.posix.join(root, path), 'utf8'),
|
|
574
|
+
entry: currentEntries.get(path),
|
|
575
|
+
path,
|
|
576
|
+
}));
|
|
577
|
+
const missing = artifacts
|
|
578
|
+
.filter(({ current }) => current === null)
|
|
579
|
+
.map(({ path }) => path);
|
|
580
|
+
if (missing.length > 0) {
|
|
581
|
+
throw new Error(`Built-in Product Slice ${currentOwnership.slice} is missing derived managed API artifacts:\n${missing.map((path) => `- ${path}`).join('\n')}\nRun pnpm nx run ${currentOwnership.slice}:api-contract-generate before upgrading.`);
|
|
582
|
+
}
|
|
583
|
+
const completeCleanPair = artifacts.every(({ current, entry }) => current !== null &&
|
|
584
|
+
entry?.mode === 'managed' &&
|
|
585
|
+
entry.origin === 'blueprint' &&
|
|
586
|
+
entry.managedJsonPointers === undefined &&
|
|
587
|
+
(0, index_js_5.hashOwnedContent)(current, entry) === entry.sha256);
|
|
588
|
+
if (!completeCleanPair)
|
|
589
|
+
return targetFiles;
|
|
590
|
+
const retained = { ...targetFiles };
|
|
591
|
+
for (const { current, path } of artifacts) {
|
|
592
|
+
if (current === null) {
|
|
593
|
+
throw new Error(`Derived managed API artifact disappeared: ${path}.`);
|
|
594
|
+
}
|
|
595
|
+
// The built-in API artifacts are derived from the seeded TypeScript
|
|
596
|
+
// contract. An upgrade preserves that adopter-owned source, so rendering
|
|
597
|
+
// fresh artifacts from the uncustomized Blueprint would make the managed
|
|
598
|
+
// output disagree with its authority. The explicit api-contract-generate
|
|
599
|
+
// target remains the only operation that recompiles and restamps them.
|
|
600
|
+
retained[path] = current;
|
|
601
|
+
}
|
|
602
|
+
return retained;
|
|
603
|
+
}
|
|
483
604
|
function upgradeConflictMessage(label, report) {
|
|
484
605
|
const ownershipDetails = [
|
|
485
606
|
...report.conflictingJsonMembers.map((member) => `- conflicting JSON ownership claim: ${member}`),
|
|
@@ -490,26 +611,19 @@ function upgradeConflictMessage(label, report) {
|
|
|
490
611
|
function seededMigrationUpgradeMessage(label, report) {
|
|
491
612
|
return `${label} upgrade cannot rewrite an existing seeded database migration:\n${report.incompatibleSeededMigrations.map((path) => `- ${path}`).join('\n')}\nRegenerate this prerelease workspace instead. Stable-v1 upgrades must add a new migration rather than rewrite migration history.`;
|
|
492
613
|
}
|
|
493
|
-
async function formatRenderedFiles(files, prefix = '') {
|
|
494
|
-
const
|
|
495
|
-
'api/generated/baseline.json',
|
|
496
|
-
'api/generated/contract.json',
|
|
497
|
-
'api/generated/openapi.json',
|
|
498
|
-
]);
|
|
614
|
+
async function formatRenderedFiles(tree, files, prefix = '') {
|
|
615
|
+
const changedOptions = (0, formatting_js_1.changedTreePrettierOptions)(tree);
|
|
499
616
|
return Object.fromEntries(await Promise.all(Object.entries(files).map(async ([path, contents]) => {
|
|
500
617
|
const workspacePath = node_path_1.posix.join(prefix, path);
|
|
501
|
-
if (
|
|
502
|
-
(0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(workspacePath)
|
|
503
|
-
path.startsWith('database/migrations/')) {
|
|
618
|
+
if ((0, built_in_plan_js_1.isBuiltInSliceFormatSensitivePath)(path) ||
|
|
619
|
+
(0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(workspacePath)) {
|
|
504
620
|
return [path, contents];
|
|
505
621
|
}
|
|
506
622
|
try {
|
|
623
|
+
const options = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, changedOptions);
|
|
507
624
|
return [
|
|
508
625
|
path,
|
|
509
|
-
await (0,
|
|
510
|
-
filepath: workspacePath,
|
|
511
|
-
singleQuote: true,
|
|
512
|
-
}),
|
|
626
|
+
await (0, formatting_js_1.formatTreeContentsToFixedPoint)(contents, options, workspacePath),
|
|
513
627
|
];
|
|
514
628
|
}
|
|
515
629
|
catch {
|
|
@@ -517,6 +631,12 @@ async function formatRenderedFiles(files, prefix = '') {
|
|
|
517
631
|
}
|
|
518
632
|
})));
|
|
519
633
|
}
|
|
634
|
+
async function formatOwnershipRecord(tree, path, label) {
|
|
635
|
+
if (!tree.exists(path)) {
|
|
636
|
+
throw new Error(`${label} ownership metadata is missing at ${path}.`);
|
|
637
|
+
}
|
|
638
|
+
await (0, formatting_js_1.formatTreeFileToFixedPoint)(tree, path);
|
|
639
|
+
}
|
|
520
640
|
function readJson(tree, path, label) {
|
|
521
641
|
const contents = tree.read(path, 'utf8');
|
|
522
642
|
if (contents === null)
|
|
@@ -618,7 +738,7 @@ function ownershipValidationMessage(label, issues) {
|
|
|
618
738
|
}
|
|
619
739
|
function requireUpgradePrerequisites(tree, target) {
|
|
620
740
|
const installedVersion = (0, generator_js_1.frameworkPackageVersion)();
|
|
621
|
-
const workspaceResult = (0,
|
|
741
|
+
const workspaceResult = (0, index_js_5.validateWorkspaceOwnershipRecord)(readJson(tree, '.ebk/ownership.json', 'Workspace ownership metadata'));
|
|
622
742
|
if (!workspaceResult.valid) {
|
|
623
743
|
throw new Error(ownershipValidationMessage('Workspace ownership metadata', workspaceResult.issues));
|
|
624
744
|
}
|
|
@@ -627,7 +747,7 @@ function requireUpgradePrerequisites(tree, target) {
|
|
|
627
747
|
}
|
|
628
748
|
if (target === 'foundation')
|
|
629
749
|
return;
|
|
630
|
-
const foundationResult = (0,
|
|
750
|
+
const foundationResult = (0, index_js_5.validateFoundationOwnershipRecord)(readJson(tree, 'packages/foundation/.ebk/ownership.json', 'Standard Foundation ownership metadata'));
|
|
631
751
|
if (!foundationResult.valid) {
|
|
632
752
|
throw new Error(ownershipValidationMessage('Standard Foundation ownership metadata', foundationResult.issues));
|
|
633
753
|
}
|
|
@@ -764,7 +884,7 @@ function createUpgradeReport(currentFiles, currentOwnership, targetFiles, target
|
|
|
764
884
|
throw new Error(`Missing seeded reconciliation definition for ${path}.`);
|
|
765
885
|
}
|
|
766
886
|
report.seededReconciliation.push({
|
|
767
|
-
adopterContentSha256: (0,
|
|
887
|
+
adopterContentSha256: (0, index_js_5.hashOwnedContent)(current, currentEntry ?? targetEntry),
|
|
768
888
|
category: reconciliation.category,
|
|
769
889
|
currentFrameworkSha256: currentEntry?.sha256 ?? null,
|
|
770
890
|
implications: [...reconciliation.implications],
|
|
@@ -779,7 +899,7 @@ function createUpgradeReport(currentFiles, currentOwnership, targetFiles, target
|
|
|
779
899
|
report.missing.push(path);
|
|
780
900
|
}
|
|
781
901
|
else if (currentEntry !== undefined &&
|
|
782
|
-
(0,
|
|
902
|
+
(0, index_js_5.hashOwnedContent)(current, currentEntry) !== currentEntry.sha256) {
|
|
783
903
|
report.conflicting.push(path);
|
|
784
904
|
}
|
|
785
905
|
else if (current === target) {
|
|
@@ -802,7 +922,7 @@ function createUpgradeReport(currentFiles, currentOwnership, targetFiles, target
|
|
|
802
922
|
const current = currentFiles.get(path) ?? null;
|
|
803
923
|
if (current === null)
|
|
804
924
|
continue;
|
|
805
|
-
if ((0,
|
|
925
|
+
if ((0, index_js_5.hashOwnedContent)(current, entry) === sha256) {
|
|
806
926
|
report.obsolete.push(path);
|
|
807
927
|
}
|
|
808
928
|
else if (!report.conflicting.includes(path)) {
|
|
@@ -857,7 +977,7 @@ function mergeStructuredTargetFiles(currentFiles, currentOwnership, targetFiles,
|
|
|
857
977
|
if (!targetEntry.managedJsonPointers)
|
|
858
978
|
continue;
|
|
859
979
|
if (currentEntry?.managedJsonPointers) {
|
|
860
|
-
const transition = (0,
|
|
980
|
+
const transition = (0, index_js_5.analyzeManagedJsonPointerTransition)(current, target, currentEntry.managedJsonPointers, targetEntry.managedJsonPointers);
|
|
861
981
|
changes.claimedJsonMembers.push(...transition.claimed.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
862
982
|
changes.conflictingJsonMembers.push(...transition.conflictingClaims.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
863
983
|
changes.releasedJsonMembers.push(...transition.released.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
@@ -866,10 +986,26 @@ function mergeStructuredTargetFiles(currentFiles, currentOwnership, targetFiles,
|
|
|
866
986
|
continue;
|
|
867
987
|
}
|
|
868
988
|
}
|
|
869
|
-
files.set(targetEntry.path, (0,
|
|
989
|
+
files.set(targetEntry.path, (0, index_js_5.mergeManagedJsonContents)(current, target, targetEntry.managedJsonPointers));
|
|
870
990
|
}
|
|
871
991
|
return { files, ...changes };
|
|
872
992
|
}
|
|
993
|
+
async function formatMergedManagedJsonFiles(tree, root, merge, ownership) {
|
|
994
|
+
const files = new Map(merge.files);
|
|
995
|
+
const changedOptions = (0, formatting_js_1.changedTreePrettierOptions)(tree);
|
|
996
|
+
await Promise.all(ownership.paths.map(async (entry) => {
|
|
997
|
+
if (entry.mode !== 'managed' || !entry.managedJsonPointers)
|
|
998
|
+
return;
|
|
999
|
+
const contents = files.get(entry.path);
|
|
1000
|
+
if (contents === undefined) {
|
|
1001
|
+
throw new Error(`Target did not render managed JSON ${entry.path}.`);
|
|
1002
|
+
}
|
|
1003
|
+
const workspacePath = node_path_1.posix.join(root, entry.path);
|
|
1004
|
+
const options = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, changedOptions);
|
|
1005
|
+
files.set(entry.path, await (0, formatting_js_1.formatTreeContentsToFixedPoint)(contents, options, workspacePath));
|
|
1006
|
+
}));
|
|
1007
|
+
return { ...merge, files };
|
|
1008
|
+
}
|
|
873
1009
|
function renderCompositionUpgradePlan(ownership, workspace, runtimeVersion, serviceAdapterOwner) {
|
|
874
1010
|
const compositionPaths = ownership.paths.filter(({ origin }) => origin === 'composition');
|
|
875
1011
|
const files = {};
|
|
@@ -888,7 +1024,7 @@ function renderCompositionUpgradePlan(ownership, workspace, runtimeVersion, serv
|
|
|
888
1024
|
mode: entry.mode ?? 'managed',
|
|
889
1025
|
origin: 'composition',
|
|
890
1026
|
path: entry.path,
|
|
891
|
-
sha256: (0,
|
|
1027
|
+
sha256: (0, index_js_5.hashOwnedContent)(contents, entry),
|
|
892
1028
|
});
|
|
893
1029
|
}
|
|
894
1030
|
};
|
|
@@ -950,10 +1086,15 @@ function retainedServiceAdapterOwner(tree, root, ownership) {
|
|
|
950
1086
|
const serviceScenario = serviceScenarios[0];
|
|
951
1087
|
const secretAccess = readJson(tree, node_path_1.posix.join(root, 'secrets/workload-access.json'), 'Product Slice secret workload access registry');
|
|
952
1088
|
const bindings = record(secretAccess) ? secretAccess['bindings'] : undefined;
|
|
953
|
-
const logicalName =
|
|
1089
|
+
const logicalName = 'GeneratedPerformanceLoadHmacKeys';
|
|
1090
|
+
const prereleaseLogicalName = `${ownership.slice
|
|
954
1091
|
.split('-')
|
|
955
1092
|
.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
|
|
956
1093
|
.join('')}PerformanceLoadHmacKeys`;
|
|
1094
|
+
if (Array.isArray(bindings) &&
|
|
1095
|
+
bindings.some((binding) => record(binding) && binding['logicalName'] === prereleaseLogicalName)) {
|
|
1096
|
+
throw new Error(`Product Slice ${ownership.slice} still uses the prerelease operator HMAC declaration ${prereleaseLogicalName}. Regenerate the prerelease Slice or reconcile secrets/declarations.ts, secrets/metadata.json, and secrets/workload-access.json to GeneratedPerformanceLoadHmacKeys under a reviewed adoption ledger entry before rerunning the upgrade; no automatic prerelease migration is provided.`);
|
|
1097
|
+
}
|
|
957
1098
|
const protectedLoadBindings = Array.isArray(bindings)
|
|
958
1099
|
? bindings.filter((binding) => record(binding) &&
|
|
959
1100
|
binding['logicalName'] === logicalName &&
|
|
@@ -1027,7 +1168,7 @@ async function upgradeFoundation(tree, options, packageJson, output) {
|
|
|
1027
1168
|
throw new Error('Standard Foundation upgrades do not accept Blueprint or input options.');
|
|
1028
1169
|
}
|
|
1029
1170
|
const root = 'packages/foundation';
|
|
1030
|
-
const ownershipResult = (0,
|
|
1171
|
+
const ownershipResult = (0, index_js_5.validateFoundationOwnershipRecord)(readJson(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Standard Foundation ownership metadata'));
|
|
1031
1172
|
if (!ownershipResult.valid) {
|
|
1032
1173
|
throw new Error(ownershipValidationMessage('Standard Foundation ownership metadata', ownershipResult.issues));
|
|
1033
1174
|
}
|
|
@@ -1035,15 +1176,17 @@ async function upgradeFoundation(tree, options, packageJson, output) {
|
|
|
1035
1176
|
throw new Error('Workspace package.json must declare a name.');
|
|
1036
1177
|
}
|
|
1037
1178
|
const currentOwnership = ownershipResult.value;
|
|
1179
|
+
const deployment = readRepositoryDeploymentRenderingOptions(tree);
|
|
1038
1180
|
const renderedTarget = (0, workspace_files_js_1.renderFoundationFilePlan)({
|
|
1181
|
+
...deployment,
|
|
1039
1182
|
frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
|
|
1040
1183
|
name: packageJson.name,
|
|
1041
1184
|
});
|
|
1042
1185
|
const target = {
|
|
1043
1186
|
...renderedTarget,
|
|
1044
|
-
files: await formatRenderedFiles(renderedTarget.files, root),
|
|
1187
|
+
files: await formatRenderedFiles(tree, renderedTarget.files, root),
|
|
1045
1188
|
};
|
|
1046
|
-
const targetValidation = (0,
|
|
1189
|
+
const targetValidation = (0, index_js_5.validateFoundationOwnershipRecord)(target.ownership);
|
|
1047
1190
|
if (!targetValidation.valid) {
|
|
1048
1191
|
throw new Error(`Target Standard Foundation ownership metadata is invalid:\n${targetValidation.issues
|
|
1049
1192
|
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
@@ -1057,7 +1200,8 @@ async function upgradeFoundation(tree, options, packageJson, output) {
|
|
|
1057
1200
|
path,
|
|
1058
1201
|
tree.read(node_path_1.posix.join(root, path), 'utf8'),
|
|
1059
1202
|
]));
|
|
1060
|
-
|
|
1203
|
+
let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
|
|
1204
|
+
mergedTarget = await formatMergedManagedJsonFiles(tree, root, mergedTarget, target.ownership);
|
|
1061
1205
|
const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, target.ownership, mergedTarget);
|
|
1062
1206
|
output.info(`[ebk-upgrade] foundation ${currentOwnership.frameworkVersion} -> ${target.ownership.frameworkVersion}\n${JSON.stringify(report, null, 2)}`);
|
|
1063
1207
|
if (!options.apply)
|
|
@@ -1083,15 +1227,16 @@ async function upgradeFoundation(tree, options, packageJson, output) {
|
|
|
1083
1227
|
}
|
|
1084
1228
|
tree.write(node_path_1.posix.join(root, path), contents);
|
|
1085
1229
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1230
|
+
(0, index_js_5.restampFoundationOwnership)(tree);
|
|
1231
|
+
if (!options.skipFormat) {
|
|
1232
|
+
await formatOwnershipRecord(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Standard Foundation');
|
|
1233
|
+
}
|
|
1089
1234
|
}
|
|
1090
1235
|
async function upgradeWorkspace(tree, options, packageJson, output) {
|
|
1091
1236
|
if (options.blueprint !== undefined || options.inputs !== undefined) {
|
|
1092
1237
|
throw new Error('Workspace upgrades do not accept Blueprint or input options.');
|
|
1093
1238
|
}
|
|
1094
|
-
const ownershipResult = (0,
|
|
1239
|
+
const ownershipResult = (0, index_js_5.validateWorkspaceOwnershipRecord)(readJson(tree, '.ebk/ownership.json', 'Workspace ownership metadata'));
|
|
1095
1240
|
if (!ownershipResult.valid) {
|
|
1096
1241
|
throw new Error(ownershipValidationMessage('Workspace ownership metadata', ownershipResult.issues));
|
|
1097
1242
|
}
|
|
@@ -1100,15 +1245,17 @@ async function upgradeWorkspace(tree, options, packageJson, output) {
|
|
|
1100
1245
|
}
|
|
1101
1246
|
const sstVersionState = inspectWorkspaceSstVersion(tree, packageJson);
|
|
1102
1247
|
const currentOwnership = ownershipResult.value;
|
|
1248
|
+
const deployment = readRepositoryDeploymentRenderingOptions(tree);
|
|
1103
1249
|
const renderedTarget = (0, workspace_files_js_1.renderWorkspaceRootFilePlan)({
|
|
1250
|
+
...deployment,
|
|
1104
1251
|
frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
|
|
1105
1252
|
name: packageJson.name,
|
|
1106
1253
|
});
|
|
1107
1254
|
const target = {
|
|
1108
1255
|
...renderedTarget,
|
|
1109
|
-
files: await formatRenderedFiles(renderedTarget.files),
|
|
1256
|
+
files: await formatRenderedFiles(tree, renderedTarget.files),
|
|
1110
1257
|
};
|
|
1111
|
-
const targetValidation = (0,
|
|
1258
|
+
const targetValidation = (0, index_js_5.validateWorkspaceOwnershipRecord)(target.ownership);
|
|
1112
1259
|
if (!targetValidation.valid) {
|
|
1113
1260
|
throw new Error('Target workspace ownership metadata is invalid.');
|
|
1114
1261
|
}
|
|
@@ -1117,7 +1264,8 @@ async function upgradeWorkspace(tree, options, packageJson, output) {
|
|
|
1117
1264
|
...target.ownership.paths.map(({ path }) => path),
|
|
1118
1265
|
]);
|
|
1119
1266
|
const currentFiles = new Map([...allPaths].map((path) => [path, tree.read(path, 'utf8')]));
|
|
1120
|
-
|
|
1267
|
+
let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
|
|
1268
|
+
mergedTarget = await formatMergedManagedJsonFiles(tree, '', mergedTarget, target.ownership);
|
|
1121
1269
|
const developerAgentInstructionAppend = planDeveloperAgentInstructionAppend(currentFiles.get('AGENTS.md') ?? null, target.files['AGENTS.md']);
|
|
1122
1270
|
if (developerAgentInstructionAppend !== null) {
|
|
1123
1271
|
mergedTarget.files.set(developerAgentInstructionAppend.path, developerAgentInstructionAppend.contents);
|
|
@@ -1160,17 +1308,13 @@ async function upgradeWorkspace(tree, options, packageJson, output) {
|
|
|
1160
1308
|
}
|
|
1161
1309
|
tree.write(path, contents);
|
|
1162
1310
|
}
|
|
1163
|
-
if (!options.skipFormat) {
|
|
1164
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
1165
|
-
for (const [path, contents] of Object.entries(target.files)) {
|
|
1166
|
-
if ((0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(path))
|
|
1167
|
-
tree.write(path, contents);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
1311
|
if (developerAgentInstructionAppend !== null) {
|
|
1171
1312
|
tree.write(developerAgentInstructionAppend.path, developerAgentInstructionAppend.contents);
|
|
1172
1313
|
}
|
|
1173
|
-
(0,
|
|
1314
|
+
(0, index_js_5.restampWorkspaceOwnership)(tree);
|
|
1315
|
+
if (!options.skipFormat) {
|
|
1316
|
+
await formatOwnershipRecord(tree, '.ebk/ownership.json', 'Workspace');
|
|
1317
|
+
}
|
|
1174
1318
|
}
|
|
1175
1319
|
async function executeUpgradeGenerator(tree, options, output = devkit_1.logger, executionOptions = {}) {
|
|
1176
1320
|
const name = requireName(options.name);
|
|
@@ -1184,7 +1328,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1184
1328
|
}
|
|
1185
1329
|
requireUpgradePrerequisites(tree, 'product-slice');
|
|
1186
1330
|
const root = node_path_1.posix.join('packages', name);
|
|
1187
|
-
const ownershipResult = (0,
|
|
1331
|
+
const ownershipResult = (0, index_js_5.validateGeneratedOwnershipRecord)(readJson(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice ownership metadata'));
|
|
1188
1332
|
if (!ownershipResult.valid) {
|
|
1189
1333
|
throw new Error(ownershipValidationMessage('Product Slice ownership metadata', ownershipResult.issues));
|
|
1190
1334
|
}
|
|
@@ -1228,10 +1372,11 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1228
1372
|
let externalBlueprintDestinationPaths;
|
|
1229
1373
|
const scope = workspaceScope(packageJson);
|
|
1230
1374
|
if (blueprint.source === 'built-in') {
|
|
1375
|
+
const deployment = readRepositoryDeploymentRenderingOptions(tree);
|
|
1231
1376
|
const runtimeVersion = packageJson.dependencies?.['@empire-builder-kit/runtime'];
|
|
1232
1377
|
if (!runtimeVersion)
|
|
1233
1378
|
throw new Error('Workspace must depend on @empire-builder-kit/runtime.');
|
|
1234
|
-
const plan = (0, built_in_plan_js_1.createBuiltInSlicePlan)(name, scope, runtimeVersion, blueprint.manifest, inputResult.value);
|
|
1379
|
+
const plan = (0, built_in_plan_js_1.createBuiltInSlicePlan)(name, scope, runtimeVersion, blueprint.manifest, inputResult.value, undefined, deployment.deploymentProfile);
|
|
1235
1380
|
targetFiles = Object.fromEntries(Object.entries(plan.files).map(([path, contents]) => {
|
|
1236
1381
|
const current = tree.read(node_path_1.posix.join(root, path), 'utf8');
|
|
1237
1382
|
return [
|
|
@@ -1295,7 +1440,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1295
1440
|
mode,
|
|
1296
1441
|
origin: 'blueprint',
|
|
1297
1442
|
path,
|
|
1298
|
-
sha256: (0,
|
|
1443
|
+
sha256: (0, index_js_5.hashOwnedContent)(contents, { managedJsonPointers }),
|
|
1299
1444
|
}));
|
|
1300
1445
|
paths.sort((left, right) => (0, deterministic_order_js_1.compareUtf16)(left.path, right.path));
|
|
1301
1446
|
targetOwnership = {
|
|
@@ -1309,7 +1454,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1309
1454
|
inputs: inputResult.value,
|
|
1310
1455
|
paths,
|
|
1311
1456
|
projects: generated.projects,
|
|
1312
|
-
schemaVersion:
|
|
1457
|
+
schemaVersion: index_js_5.GENERATED_OWNERSHIP_SCHEMA_VERSION,
|
|
1313
1458
|
slice: name,
|
|
1314
1459
|
verification: blueprint.manifest.verification,
|
|
1315
1460
|
};
|
|
@@ -1329,8 +1474,9 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1329
1474
|
}
|
|
1330
1475
|
targetFiles = {
|
|
1331
1476
|
...targetFiles,
|
|
1332
|
-
[productPath]:
|
|
1477
|
+
[productPath]: reconcileFunctionRegistrationArguments(productSource, currentOwnership),
|
|
1333
1478
|
};
|
|
1479
|
+
targetFiles = preserveBuiltInDerivedApiArtifacts(tree, root, currentOwnership, targetFiles);
|
|
1334
1480
|
}
|
|
1335
1481
|
const targetPathSet = new Set(targetOwnership.paths.map(({ path }) => path));
|
|
1336
1482
|
const compositionPlan = renderCompositionUpgradePlan(currentOwnership, packageJson.name ?? '', packageJson.dependencies?.['@empire-builder-kit/runtime'] ?? '', serviceAdapterOwner);
|
|
@@ -1349,7 +1495,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1349
1495
|
}
|
|
1350
1496
|
targetFiles = { ...targetFiles, [entry.path]: contents };
|
|
1351
1497
|
}
|
|
1352
|
-
targetFiles = await formatRenderedFiles(targetFiles, root);
|
|
1498
|
+
targetFiles = await formatRenderedFiles(tree, targetFiles, root);
|
|
1353
1499
|
targetOwnership = {
|
|
1354
1500
|
...targetOwnership,
|
|
1355
1501
|
compositions: currentOwnership.compositions,
|
|
@@ -1362,7 +1508,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1362
1508
|
if (contents === undefined) {
|
|
1363
1509
|
throw new Error(`Target Blueprint did not render ${entry.path}.`);
|
|
1364
1510
|
}
|
|
1365
|
-
return { ...entry, sha256: (0,
|
|
1511
|
+
return { ...entry, sha256: (0, index_js_5.hashOwnedContent)(contents, entry) };
|
|
1366
1512
|
}),
|
|
1367
1513
|
projects: [
|
|
1368
1514
|
...new Set([...targetOwnership.projects, ...currentOwnership.projects]),
|
|
@@ -1372,7 +1518,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1372
1518
|
...targetFiles,
|
|
1373
1519
|
'.ebk/ownership.json': json(targetOwnership),
|
|
1374
1520
|
};
|
|
1375
|
-
const targetValidation = (0,
|
|
1521
|
+
const targetValidation = (0, index_js_5.validateGeneratedOwnershipRecord)(targetOwnership);
|
|
1376
1522
|
if (!targetValidation.valid) {
|
|
1377
1523
|
throw new Error(`Target ownership metadata is invalid:\n${targetValidation.issues
|
|
1378
1524
|
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
@@ -1386,7 +1532,8 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1386
1532
|
path,
|
|
1387
1533
|
tree.read(node_path_1.posix.join(root, path), 'utf8'),
|
|
1388
1534
|
]));
|
|
1389
|
-
|
|
1535
|
+
let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(targetFiles)), targetOwnership);
|
|
1536
|
+
mergedTarget = await formatMergedManagedJsonFiles(tree, root, mergedTarget, targetOwnership);
|
|
1390
1537
|
requireTargetCompositionFeatures(mergedTarget.files, targetOwnership);
|
|
1391
1538
|
const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, targetOwnership, mergedTarget);
|
|
1392
1539
|
output.info(`[ebk-upgrade] ${name} ${currentOwnership.blueprint.name}@${currentOwnership.blueprint.version} -> ${blueprint.manifest.name}@${blueprint.manifest.version}\n${JSON.stringify(report, null, 2)}`);
|
|
@@ -1419,10 +1566,18 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1419
1566
|
[blueprint.manifest.name]: blueprint.manifest.version,
|
|
1420
1567
|
};
|
|
1421
1568
|
tree.write('package.json', json(packageJson));
|
|
1569
|
+
if (!options.skipFormat) {
|
|
1570
|
+
const path = 'package.json';
|
|
1571
|
+
if (!tree.exists(path)) {
|
|
1572
|
+
throw new Error('Workspace package.json disappeared during upgrade.');
|
|
1573
|
+
}
|
|
1574
|
+
await (0, formatting_js_1.formatTreeFileToFixedPoint)(tree, path);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
(0, index_js_5.restampProductSliceOwnership)(tree, name, { preserveSeeded: true });
|
|
1578
|
+
if (!options.skipFormat) {
|
|
1579
|
+
await formatOwnershipRecord(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice');
|
|
1422
1580
|
}
|
|
1423
|
-
if (!options.skipFormat)
|
|
1424
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
1425
|
-
(0, index_js_4.restampProductSliceOwnership)(tree, name, { preserveSeeded: true });
|
|
1426
1581
|
return options.skipInstall
|
|
1427
1582
|
? undefined
|
|
1428
1583
|
: () => (0, devkit_1.installPackagesTask)(tree, true);
|