@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators.json +11 -1
- package/package.json +3 -3
- package/src/aws-authority/stage-authority.d.ts +30 -2
- package/src/aws-authority/stage-authority.js +220 -25
- package/src/developer-agent/generator-planning.js +99 -6
- package/src/developer-agent/model.d.ts +7 -3
- package/src/developer-agent/model.js +1 -0
- package/src/developer-agent/operation-registry.d.ts +1 -0
- package/src/developer-agent/operation-registry.js +43 -2
- package/src/developer-agent/planning.js +5 -2
- package/src/developer-agent/preview-changes.js +10 -0
- package/src/developer-agent/validation.js +7 -3
- package/src/developer-agent/workspace-inspection.js +51 -4
- package/src/executors/deployment-plan/deployment-plan.js +3 -0
- package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
- package/src/executors/dev-doctor/dev-doctor.js +136 -49
- package/src/executors/dev-setup/dev-setup.d.ts +18 -1
- package/src/executors/dev-setup/dev-setup.js +320 -196
- package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
- package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
- package/src/executors/local-deploy/local-deploy.d.ts +15 -0
- package/src/executors/local-deploy/local-deploy.js +96 -14
- package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
- package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
- package/src/foundation/cost-estimate.js +1 -1
- package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
- package/src/foundation/identity-domain-parent-ready.js +333 -0
- package/src/foundation/identity-domain.d.ts +94 -0
- package/src/foundation/identity-domain.js +115 -0
- package/src/foundation/index.d.ts +2 -0
- package/src/foundation/index.js +7 -0
- package/src/foundation/preflight.js +17 -1
- package/src/foundation/root-site-readiness.d.ts +27 -0
- package/src/foundation/root-site-readiness.js +78 -0
- package/src/foundation/root-site.d.ts +81 -0
- package/src/foundation/root-site.js +268 -0
- package/src/generators/framework-prerequisites.d.ts +2 -0
- package/src/generators/framework-prerequisites.js +34 -0
- package/src/generators/function/function-registration.d.ts +24 -0
- package/src/generators/function/function-registration.js +66 -0
- package/src/generators/function/function.d.ts +16 -1
- package/src/generators/function/function.js +101 -18
- package/src/generators/function/schema.d.ts +1 -0
- package/src/generators/function/schema.json +6 -0
- package/src/generators/function-access/function-access.d.ts +14 -0
- package/src/generators/function-access/function-access.js +141 -0
- package/src/generators/function-access/schema.d.ts +6 -0
- package/src/generators/function-access/schema.json +25 -0
- package/src/generators/post-generation-install.d.ts +1 -1
- package/src/generators/post-generation-install.js +1 -1
- package/src/generators/preset/dependency-overrides.d.ts +1 -1
- package/src/generators/preset/dependency-overrides.js +1 -1
- package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
- package/src/generators/preset/workspace-files-developer-agent.js +17 -11
- package/src/generators/preset/workspace-files-stage-authority.js +58 -1
- package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
- package/src/generators/preset/workspace-files-thin-deploy.js +47 -4
- package/src/generators/preset/workspace-files-thin-docs.js +33 -5
- package/src/generators/preset/workspace-files.js +207 -13
- package/src/generators/repository-policy/repository-policy.js +2 -1
- package/src/generators/repository-policy/schema.d.ts +2 -0
- package/src/generators/repository-policy/schema.json +7 -2
- package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
- package/src/generators/site/built-in-site-documentation-files.js +92 -0
- package/src/generators/site/built-in-site-files.d.ts +8 -0
- package/src/generators/site/built-in-site-files.js +40 -0
- package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
- package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
- package/src/generators/site/built-in-site-plan.d.ts +19 -0
- package/src/generators/site/built-in-site-plan.js +65 -0
- package/src/generators/site/built-in-site-project-files.d.ts +3 -0
- package/src/generators/site/built-in-site-project-files.js +258 -0
- package/src/generators/site/built-in-site-script-files.d.ts +2 -0
- package/src/generators/site/built-in-site-script-files.js +306 -0
- package/src/generators/site/built-in-site-shared.d.ts +9 -0
- package/src/generators/site/built-in-site-shared.js +21 -0
- package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
- package/src/generators/site/built-in-site-smoke-files.js +37 -0
- package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
- package/src/generators/site/built-in-site-sst-config-files.js +39 -0
- package/src/generators/site/built-in-site-web-files.d.ts +2 -0
- package/src/generators/site/built-in-site-web-files.js +284 -0
- package/src/generators/site/schema.d.ts +4 -0
- package/src/generators/site/schema.json +20 -0
- package/src/generators/site/site.d.ts +13 -0
- package/src/generators/site/site.js +221 -0
- package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
- package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
- package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
- package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
- package/src/generators/slice/built-in-plan-data-files.js +116 -11
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
- package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
- package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
- package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
- package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
- package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
- package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
- package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
- package/src/generators/slice/built-in-plan-metadata-files.js +21 -4
- package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
- package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
- package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
- package/src/generators/slice/built-in-plan-operations-files.js +107 -219
- package/src/generators/slice/built-in-plan-performance-files.js +6 -1
- package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
- package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
- package/src/generators/slice/built-in-plan-shared.js +1 -1
- package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
- package/src/generators/slice/built-in-plan-sst-config.js +160 -0
- package/src/generators/slice/built-in-plan-testing-files.js +92 -49
- package/src/generators/slice/built-in-plan-verification-files.js +15 -4
- package/src/generators/slice/built-in-plan-web-files.js +65 -0
- package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
- package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
- package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
- package/src/generators/slice/deployed-smoke-readiness.js +118 -23
- package/src/generators/slice/persistence-contract.js +2 -2
- package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
- package/src/generators/slice/pnpm-launch-script.js +28 -0
- package/src/generators/slice/slice.js +27 -0
- package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
- package/src/generators/upgrade/custom-domain-notice.js +38 -0
- package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
- package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
- package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
- package/src/generators/upgrade/framework-package-upgrade.js +78 -0
- package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
- package/src/generators/upgrade/function-authentication-notice.js +74 -0
- package/src/generators/upgrade/schema.json +2 -2
- package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
- package/src/generators/upgrade/upgrade-plan.js +406 -0
- package/src/generators/upgrade/upgrade.d.ts +1 -35
- package/src/generators/upgrade/upgrade.js +259 -593
- package/src/generators/workload/workload.js +60 -4
- package/src/git-policy/github-bootstrap.d.ts +6 -5
- package/src/git-policy/github-bootstrap.js +6 -4
- package/src/local-dev/fleet-process.d.ts +9 -2
- package/src/local-dev/fleet-process.js +27 -7
- package/src/local-dev/gateway-daemon.d.ts +1 -1
- package/src/local-dev/gateway-daemon.js +6 -4
- package/src/local-dev/portless.d.ts +5 -0
- package/src/local-dev/portless.js +5 -0
- package/src/local-dev/process-group.d.ts +10 -0
- package/src/local-dev/process-group.js +33 -0
- package/src/local-dev/tls.js +31 -2
- package/src/local-dev/trust-store.d.ts +42 -0
- package/src/local-dev/trust-store.js +87 -0
- package/src/ownership/composition.d.ts +7 -0
- package/src/ownership/composition.js +64 -56
- package/src/ownership/index.d.ts +1 -0
- package/src/ownership/index.js +1 -0
- package/src/ownership/record.d.ts +19 -0
- package/src/ownership/record.js +26 -2
- package/src/ownership/site-record.d.ts +18 -0
- package/src/ownership/site-record.js +105 -0
- package/src/repository-policy/deployment-plan.d.ts +3 -0
- package/src/repository-policy/deployment-plan.js +33 -4
- package/src/repository-policy/index.d.ts +1 -0
- package/src/repository-policy/index.js +1 -0
- package/src/repository-policy/policy.d.ts +13 -1
- package/src/repository-policy/policy.js +55 -1
- package/src/repository-policy/public-dns.d.ts +65 -0
- package/src/repository-policy/public-dns.js +168 -0
- package/src/schemas/generated-ownership-v2.json +6 -0
- package/src/schemas/repository-policy-v1.json +67 -1
- package/src/supply-chain/blueprint-trust-git.js +24 -0
- package/src/supply-chain/blueprint-verification-authority.js +21 -3
- package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
- package/src/work-markers/work-markers.js +4 -1
- package/src/workspace-deployment/ownership.d.ts +15 -0
- package/src/workspace-deployment/ownership.js +19 -3
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeveloperAgentUpgradePreviewBindingError = void 0;
|
|
3
|
+
exports.DeveloperAgentUpgradePreviewBindingError = exports.createUpgradeReport = void 0;
|
|
4
4
|
exports.developerAgentUpgradeExecutionOptions = developerAgentUpgradeExecutionOptions;
|
|
5
5
|
exports.preserveCompositionRegions = preserveCompositionRegions;
|
|
6
6
|
exports.reemitRecordedNativeRuntimeCompositions = reemitRecordedNativeRuntimeCompositions;
|
|
7
7
|
exports.inspectWorkspaceSstVersion = inspectWorkspaceSstVersion;
|
|
8
|
-
exports.createUpgradeReport = createUpgradeReport;
|
|
9
8
|
exports.upgradeFoundationForRequirements = upgradeFoundationForRequirements;
|
|
10
9
|
exports.upgradeGenerator = upgradeGenerator;
|
|
11
10
|
const deterministic_order_js_1 = require("../../deterministic-order.js");
|
|
@@ -13,7 +12,7 @@ const capacity_migration_js_1 = require("../../repository-policy/capacity-migrat
|
|
|
13
12
|
const dependency_overrides_js_1 = require("../preset/dependency-overrides.js");
|
|
14
13
|
const observability_js_1 = require("../../foundation/observability.js");
|
|
15
14
|
const workspace_files_adopter_skills_js_1 = require("../preset/workspace-files-adopter-skills.js");
|
|
16
|
-
const
|
|
15
|
+
const framework_prerequisites_js_1 = require("../framework-prerequisites.js");
|
|
17
16
|
const sql_seeded_reconciliation_js_1 = require("./sql-seeded-reconciliation.js");
|
|
18
17
|
const devkit_1 = require("@nx/devkit");
|
|
19
18
|
const node_buffer_1 = require("node:buffer");
|
|
@@ -25,11 +24,14 @@ const yaml_1 = require("yaml");
|
|
|
25
24
|
const index_js_1 = require("../../blueprints/index.js");
|
|
26
25
|
const index_js_2 = require("../../api-contract/index.js");
|
|
27
26
|
const index_js_3 = require("../../foundation/index.js");
|
|
27
|
+
const root_site_js_1 = require("../../foundation/root-site.js");
|
|
28
28
|
const capability_plan_js_1 = require("../../foundation/capability-plan.js");
|
|
29
29
|
const persistence_contract_js_1 = require("../slice/persistence-contract.js");
|
|
30
30
|
const index_js_4 = require("../../repository-policy/index.js");
|
|
31
31
|
const index_js_5 = require("../../ownership/index.js");
|
|
32
32
|
const function_js_1 = require("../function/function.js");
|
|
33
|
+
const function_registration_js_1 = require("../function/function-registration.js");
|
|
34
|
+
const built_in_site_plan_js_1 = require("../site/built-in-site-plan.js");
|
|
33
35
|
const logging_registry_js_1 = require("../logging-registry.js");
|
|
34
36
|
const feature_registry_js_1 = require("../feature-registry.js");
|
|
35
37
|
const generator_js_1 = require("../preset/generator.js");
|
|
@@ -45,7 +47,14 @@ const model_js_1 = require("../../developer-agent/model.js");
|
|
|
45
47
|
const preview_source_js_1 = require("../../developer-agent/preview-source.js");
|
|
46
48
|
const preview_changes_js_1 = require("../../developer-agent/preview-changes.js");
|
|
47
49
|
const validation_js_1 = require("../../developer-agent/validation.js");
|
|
50
|
+
const custom_domain_notice_js_1 = require("./custom-domain-notice.js");
|
|
51
|
+
const function_authentication_notice_js_1 = require("./function-authentication-notice.js");
|
|
52
|
+
const external_blueprint_compositions_js_1 = require("./external-blueprint-compositions.js");
|
|
48
53
|
const tree_policy_js_1 = require("../repository-policy/tree-policy.js");
|
|
54
|
+
const framework_package_upgrade_js_1 = require("./framework-package-upgrade.js");
|
|
55
|
+
const upgrade_plan_js_1 = require("./upgrade-plan.js");
|
|
56
|
+
var upgrade_plan_js_2 = require("./upgrade-plan.js");
|
|
57
|
+
Object.defineProperty(exports, "createUpgradeReport", { enumerable: true, get: function () { return upgrade_plan_js_2.createUpgradeReport; } });
|
|
49
58
|
function readRepositoryDeploymentRenderingOptions(tree) {
|
|
50
59
|
const policy = (0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree);
|
|
51
60
|
return {
|
|
@@ -267,153 +276,6 @@ async function assertCurrentDeveloperAgentPreviewSource(workspaceRoot, preview,
|
|
|
267
276
|
return previewBindingFailure();
|
|
268
277
|
}
|
|
269
278
|
}
|
|
270
|
-
const SEEDED_RECONCILIATION = {
|
|
271
|
-
'async/recovery-adapters.ts': {
|
|
272
|
-
category: 'async-adapter',
|
|
273
|
-
implications: [
|
|
274
|
-
'failure-semantics',
|
|
275
|
-
'provider-behavior',
|
|
276
|
-
'provider-permissions',
|
|
277
|
-
],
|
|
278
|
-
},
|
|
279
|
-
'async/runtime.ts': {
|
|
280
|
-
category: 'async-settings',
|
|
281
|
-
implications: [
|
|
282
|
-
'retry-and-dlq-settings',
|
|
283
|
-
'schedule-contracts',
|
|
284
|
-
'workflow-contracts',
|
|
285
|
-
],
|
|
286
|
-
},
|
|
287
|
-
'async/webhook.ts': {
|
|
288
|
-
category: 'async-adapter',
|
|
289
|
-
implications: [
|
|
290
|
-
'provider-authentication',
|
|
291
|
-
'provider-behavior',
|
|
292
|
-
'webhook-replay-protection',
|
|
293
|
-
],
|
|
294
|
-
},
|
|
295
|
-
'async/work-contract.json': {
|
|
296
|
-
category: 'async-settings',
|
|
297
|
-
implications: [
|
|
298
|
-
'recovery-authority',
|
|
299
|
-
'retry-and-dlq-settings',
|
|
300
|
-
'workflow-versioning',
|
|
301
|
-
],
|
|
302
|
-
},
|
|
303
|
-
'configuration/declarations.json': {
|
|
304
|
-
category: 'configuration-contract',
|
|
305
|
-
implications: [
|
|
306
|
-
'configuration-types',
|
|
307
|
-
'outage-policy',
|
|
308
|
-
'provider-permissions',
|
|
309
|
-
],
|
|
310
|
-
},
|
|
311
|
-
'configuration/declarations.ts': {
|
|
312
|
-
category: 'configuration-contract',
|
|
313
|
-
implications: [
|
|
314
|
-
'configuration-types',
|
|
315
|
-
'outage-policy',
|
|
316
|
-
'provider-permissions',
|
|
317
|
-
],
|
|
318
|
-
},
|
|
319
|
-
'configuration/local-values.json': {
|
|
320
|
-
category: 'configuration-values',
|
|
321
|
-
implications: ['local-defaults', 'safe-fallbacks'],
|
|
322
|
-
},
|
|
323
|
-
'docs/reliability/slo.json': {
|
|
324
|
-
category: 'reliability-slo',
|
|
325
|
-
implications: [
|
|
326
|
-
'error-budget-policy',
|
|
327
|
-
'journey-ownership',
|
|
328
|
-
'service-level-objectives',
|
|
329
|
-
],
|
|
330
|
-
},
|
|
331
|
-
'frontend/contract.json': {
|
|
332
|
-
category: 'frontend-contract',
|
|
333
|
-
implications: [
|
|
334
|
-
'accessibility-proof',
|
|
335
|
-
'browser-security-boundary',
|
|
336
|
-
'public-configuration',
|
|
337
|
-
],
|
|
338
|
-
},
|
|
339
|
-
'frontend/security-headers.json': {
|
|
340
|
-
category: 'frontend-security',
|
|
341
|
-
implications: [
|
|
342
|
-
'content-security-policy',
|
|
343
|
-
'response-header-ownership',
|
|
344
|
-
'transport-profile',
|
|
345
|
-
],
|
|
346
|
-
},
|
|
347
|
-
'operations/features.json': {
|
|
348
|
-
category: 'feature-controls',
|
|
349
|
-
implications: ['flag-lifecycle', 'owners', 'stop-conditions'],
|
|
350
|
-
},
|
|
351
|
-
'operations/reliability.json': {
|
|
352
|
-
category: 'reliability-operations',
|
|
353
|
-
implications: [
|
|
354
|
-
'alarm-registration',
|
|
355
|
-
'database-capacity-dynamodb-table-and-pending-events-throttle-metrics',
|
|
356
|
-
'diagnostic-authority',
|
|
357
|
-
'event-delivery-alarms-and-hourly-outbox-backlog-period',
|
|
358
|
-
'incident-remediation',
|
|
359
|
-
'performance-load-cleanup-backlog-two-evaluation-periods',
|
|
360
|
-
],
|
|
361
|
-
},
|
|
362
|
-
'operations/release.json': {
|
|
363
|
-
category: 'release-controls',
|
|
364
|
-
implications: [
|
|
365
|
-
'artifact-inventory',
|
|
366
|
-
'compatibility-sequence',
|
|
367
|
-
'rollout-controls',
|
|
368
|
-
],
|
|
369
|
-
},
|
|
370
|
-
'performance/aggregate-count-provider.ts': {
|
|
371
|
-
category: 'performance-aggregate-provider',
|
|
372
|
-
implications: [
|
|
373
|
-
'aggregate-source-authority',
|
|
374
|
-
'business-capability-counts',
|
|
375
|
-
'provider-data-access',
|
|
376
|
-
],
|
|
377
|
-
},
|
|
378
|
-
'performance/policy.json': {
|
|
379
|
-
category: 'performance-policy',
|
|
380
|
-
implications: [
|
|
381
|
-
'capacity-and-load-settings',
|
|
382
|
-
'cost-budgets',
|
|
383
|
-
'journey-authority',
|
|
384
|
-
],
|
|
385
|
-
},
|
|
386
|
-
'reliability/metric-declarations.ts': {
|
|
387
|
-
category: 'reliability-metrics',
|
|
388
|
-
guidance: 'Review existing custom recordReliabilityOperation calls and declare each finite deployment-owned component/feature/operation tuple in reliability/metric-declarations.ts. Undeclared custom series are dropped by the managed recorder. Never derive declarations from request, user, resource, or correlation IDs. Preserve existing declarations, verify custom metric emission, retain evidence, and resolve the seeded reconciliation marker before protected promotion.',
|
|
389
|
-
implications: [
|
|
390
|
-
'custom-metric-series-allowlist',
|
|
391
|
-
'finite-deployment-owned-dimensions',
|
|
392
|
-
'undeclared-custom-series-are-dropped',
|
|
393
|
-
],
|
|
394
|
-
},
|
|
395
|
-
'secrets/declarations.ts': {
|
|
396
|
-
category: 'secret-contract',
|
|
397
|
-
implications: [
|
|
398
|
-
'generation-authority',
|
|
399
|
-
'secret-value-ownership',
|
|
400
|
-
'stage-requirements',
|
|
401
|
-
],
|
|
402
|
-
},
|
|
403
|
-
'secrets/metadata.json': {
|
|
404
|
-
category: 'secret-contract',
|
|
405
|
-
implications: ['logical-identity', 'management-class', 'registry-schema'],
|
|
406
|
-
},
|
|
407
|
-
'secrets/workload-access.json': {
|
|
408
|
-
category: 'secret-contract',
|
|
409
|
-
implications: [
|
|
410
|
-
'logical-identity',
|
|
411
|
-
'runtime-secret-linkage',
|
|
412
|
-
'workload-iam',
|
|
413
|
-
],
|
|
414
|
-
},
|
|
415
|
-
};
|
|
416
|
-
const SEEDED_RECONCILIATION_MARKER_REFERENCE = 'PLAN:5.6/seeded-upgrade-reconciliation';
|
|
417
279
|
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.';
|
|
418
280
|
const SEEDED_RECONCILIATION_MARKER_ANCHOR = 'async/recovery-adapters.ts';
|
|
419
281
|
const DEVELOPER_AGENT_AGENTS_HEADING = '## Developer-Agent workflow';
|
|
@@ -453,11 +315,6 @@ function planDeveloperAgentInstructionAppend(currentAgents, targetAgents) {
|
|
|
453
315
|
path: 'AGENTS.md',
|
|
454
316
|
};
|
|
455
317
|
}
|
|
456
|
-
function seededReconciliationDefinition(path) {
|
|
457
|
-
return Object.prototype.hasOwnProperty.call(SEEDED_RECONCILIATION, path)
|
|
458
|
-
? SEEDED_RECONCILIATION[path]
|
|
459
|
-
: null;
|
|
460
|
-
}
|
|
461
318
|
function appendSeededReconciliationMarker(tree, root, report) {
|
|
462
319
|
if (report.seededReconciliation.length === 0)
|
|
463
320
|
return;
|
|
@@ -466,13 +323,78 @@ function appendSeededReconciliationMarker(tree, root, report) {
|
|
|
466
323
|
if (current === null) {
|
|
467
324
|
throw new Error(`Seeded reconciliation requires deterministic anchor ${anchor}.`);
|
|
468
325
|
}
|
|
469
|
-
if (current.includes(SEEDED_RECONCILIATION_MARKER_REFERENCE))
|
|
326
|
+
if (current.includes(upgrade_plan_js_1.SEEDED_RECONCILIATION_MARKER_REFERENCE))
|
|
470
327
|
return;
|
|
471
328
|
tree.write(anchor, `${current.replace(/\s*$/, '')}\n\n${SEEDED_RECONCILIATION_MARKER}\n`);
|
|
472
329
|
}
|
|
473
330
|
function isJsonObject(value) {
|
|
474
331
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
475
332
|
}
|
|
333
|
+
const DATABASE_CREDENTIAL_ROTATION_RUNBOOK_PATH = 'docs/runbooks/database-credential-rotation.md';
|
|
334
|
+
/**
|
|
335
|
+
* The opening of the retained SQL rotation paragraph that told operators to
|
|
336
|
+
* rotate through the migration workflow and to confirm that the prior version
|
|
337
|
+
* could be restored. A newly generated runbook never contains it.
|
|
338
|
+
*/
|
|
339
|
+
const RETAINED_DATABASE_ROTATION_PARAGRAPH = 'To rotate after an authentication failure';
|
|
340
|
+
const DATABASE_CREDENTIAL_ROTATION_GUIDANCE = 'The retained database credential rotation runbook says the database migration workflow rotates this credential and asks you to confirm that the prior version can be restored. A migration with an unchanged EBK_DATABASE_CREDENTIAL_GENERATION only re-applies the current password, and after a real rotation the database refuses the AWSPREVIOUS password, so restoring it would break every new connection. Before rotating with EBK_DATABASE_CREDENTIAL_GENERATION, replace the runbook with the one a newly generated SQL Slice of the same name renders, or at least replace its paragraph that begins "To rotate after an authentication failure" as the framework upgrade guide (docs/upgrades.md) gives it. Preserve any adopter-owned content, never move the version labels of this credential, then resolve the existing seeded reconciliation marker.';
|
|
341
|
+
function appendDatabaseCredentialRotationReconciliation(currentFiles, currentOwnership, targetOwnership, report) {
|
|
342
|
+
const path = DATABASE_CREDENTIAL_ROTATION_RUNBOOK_PATH;
|
|
343
|
+
const current = currentFiles.get(path);
|
|
344
|
+
const targetEntry = targetOwnership.paths.find((entry) => entry.path === path);
|
|
345
|
+
if (current === null ||
|
|
346
|
+
current === undefined ||
|
|
347
|
+
targetEntry?.mode !== 'seeded' ||
|
|
348
|
+
!current.includes(RETAINED_DATABASE_ROTATION_PARAGRAPH))
|
|
349
|
+
return;
|
|
350
|
+
const currentEntry = currentOwnership.paths.find((entry) => entry.path === path);
|
|
351
|
+
report.seededReconciliation.push({
|
|
352
|
+
adopterContentSha256: (0, index_js_5.hashOwnedContent)(current, currentEntry ?? targetEntry),
|
|
353
|
+
category: 'secret-contract',
|
|
354
|
+
currentFrameworkSha256: currentEntry?.sha256 ?? null,
|
|
355
|
+
guidance: DATABASE_CREDENTIAL_ROTATION_GUIDANCE,
|
|
356
|
+
implications: [
|
|
357
|
+
'database-credential-generation',
|
|
358
|
+
'no-version-label-rollback',
|
|
359
|
+
],
|
|
360
|
+
markerReference: upgrade_plan_js_1.SEEDED_RECONCILIATION_MARKER_REFERENCE,
|
|
361
|
+
path,
|
|
362
|
+
requiredAction: 'review-and-reconcile-preserving-adopter-content',
|
|
363
|
+
targetFrameworkSha256: targetEntry.sha256,
|
|
364
|
+
});
|
|
365
|
+
report.seededReconciliation.sort((left, right) => (0, deterministic_order_js_1.compareUtf16)(left.path, right.path));
|
|
366
|
+
}
|
|
367
|
+
const SEEDED_PRODUCT_SMOKE_PATH = 'e2e/product.spec.ts';
|
|
368
|
+
/**
|
|
369
|
+
* A retained seeded deployed smoke that resolves an absolute operation path
|
|
370
|
+
* against apiUrl, as every generated one did before Slice APIs could be mapped
|
|
371
|
+
* under /<slice> on the Foundation's api.<root> domain.
|
|
372
|
+
*/
|
|
373
|
+
const ABSOLUTE_API_PATH_RESOLUTION = /new URL\(\s*['"`]\/[^)]*,\s*apiUrl\s*\)/u;
|
|
374
|
+
const API_BASE_PATH_GUIDANCE = "The retained seeded e2e/product.spec.ts builds API URLs with new URL('/<path>', apiUrl). With a custom domain bound for a stage, the Slice's apiUrl is https://api.<root>/<slice>; resolving an absolute path against it drops /<slice>, so the request reaches no API mapping and deployed smoke fails. Replace each such call with productEndpoint(apiUrl, '/<path>'), as a newly generated Slice of the same name renders it and as the framework upgrade guide (docs/upgrades.md) lists, preserve any adopter-owned content, then resolve the existing seeded reconciliation marker. The change is needed before the first deploy with a bound domain and is harmless without one.";
|
|
375
|
+
function appendApiBasePathReconciliation(currentFiles, currentOwnership, targetOwnership, report) {
|
|
376
|
+
const path = SEEDED_PRODUCT_SMOKE_PATH;
|
|
377
|
+
const current = currentFiles.get(path);
|
|
378
|
+
const targetEntry = targetOwnership.paths.find((entry) => entry.path === path);
|
|
379
|
+
if (current === null ||
|
|
380
|
+
current === undefined ||
|
|
381
|
+
targetEntry?.mode !== 'seeded' ||
|
|
382
|
+
!ABSOLUTE_API_PATH_RESOLUTION.test(current))
|
|
383
|
+
return;
|
|
384
|
+
const currentEntry = currentOwnership.paths.find((entry) => entry.path === path);
|
|
385
|
+
report.seededReconciliation.push({
|
|
386
|
+
adopterContentSha256: (0, index_js_5.hashOwnedContent)(current, currentEntry ?? targetEntry),
|
|
387
|
+
category: 'api-base-path',
|
|
388
|
+
currentFrameworkSha256: currentEntry?.sha256 ?? null,
|
|
389
|
+
guidance: API_BASE_PATH_GUIDANCE,
|
|
390
|
+
implications: ['custom-domain-api-mapping', 'deployed-smoke-api-urls'],
|
|
391
|
+
markerReference: upgrade_plan_js_1.SEEDED_RECONCILIATION_MARKER_REFERENCE,
|
|
392
|
+
path,
|
|
393
|
+
requiredAction: 'review-and-reconcile-preserving-adopter-content',
|
|
394
|
+
targetFrameworkSha256: targetEntry.sha256,
|
|
395
|
+
});
|
|
396
|
+
report.seededReconciliation.sort((left, right) => (0, deterministic_order_js_1.compareUtf16)(left.path, right.path));
|
|
397
|
+
}
|
|
476
398
|
function appendServiceTaskPresenceReconciliation(currentFiles, currentOwnership, targetOwnership, report) {
|
|
477
399
|
const services = currentOwnership.compositions
|
|
478
400
|
.filter(({ kind }) => kind === 'service')
|
|
@@ -518,7 +440,7 @@ function appendServiceTaskPresenceReconciliation(currentFiles, currentOwnership,
|
|
|
518
440
|
currentFrameworkSha256: currentEntry?.sha256 ?? null,
|
|
519
441
|
guidance,
|
|
520
442
|
implications: ['alarm-registration', 'service-live-task-presence'],
|
|
521
|
-
markerReference: SEEDED_RECONCILIATION_MARKER_REFERENCE,
|
|
443
|
+
markerReference: upgrade_plan_js_1.SEEDED_RECONCILIATION_MARKER_REFERENCE,
|
|
522
444
|
path,
|
|
523
445
|
requiredAction: 'review-and-reconcile-preserving-adopter-content',
|
|
524
446
|
targetFrameworkSha256: targetEntry.sha256,
|
|
@@ -674,10 +596,6 @@ function reemitRecordedNativeRuntimeCompositions(files, ownership) {
|
|
|
674
596
|
}
|
|
675
597
|
return result;
|
|
676
598
|
}
|
|
677
|
-
function exactIndentedStringCallMatches(source, callee, argument) {
|
|
678
|
-
const pattern = new RegExp(`^ ${escapeRegularExpression(callee)}\\(\\s*(['"])${escapeRegularExpression(argument)}\\1\\s*,?\\s*\\),[ \\t]*$`, 'gmu');
|
|
679
|
-
return [...source.matchAll(pattern)];
|
|
680
|
-
}
|
|
681
599
|
function reconcileFunctionRegistrationArguments(source, ownership) {
|
|
682
600
|
let reconciled = source;
|
|
683
601
|
for (const composition of ownership.compositions) {
|
|
@@ -708,8 +626,8 @@ function reconcileFunctionRegistrationArguments(source, ownership) {
|
|
|
708
626
|
else if (!(previousRouterCount === 0 && currentRouterCount === 1)) {
|
|
709
627
|
throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
|
|
710
628
|
}
|
|
711
|
-
const previousAuthorityMatches = exactIndentedStringCallMatches(registration, 'workloadRoleBindings?.extension.function', composition.name);
|
|
712
|
-
const currentAuthorityMatches = exactIndentedStringCallMatches(registration, 'nativeAuthority.permissions', `${composition.name}-function`);
|
|
629
|
+
const previousAuthorityMatches = (0, function_registration_js_1.exactIndentedStringCallMatches)(registration, 'workloadRoleBindings?.extension.function', composition.name);
|
|
630
|
+
const currentAuthorityMatches = (0, function_registration_js_1.exactIndentedStringCallMatches)(registration, 'nativeAuthority.permissions', `${composition.name}-function`);
|
|
713
631
|
if (previousAuthorityMatches.length === 1 &&
|
|
714
632
|
currentAuthorityMatches.length === 0) {
|
|
715
633
|
const [previousAuthority] = previousAuthorityMatches;
|
|
@@ -727,6 +645,9 @@ function reconcileFunctionRegistrationArguments(source, ownership) {
|
|
|
727
645
|
currentAuthorityMatches.length === 1)) {
|
|
728
646
|
throw new Error(`Retained Function ${composition.name} registration does not expose one exact native-authority argument shape.`);
|
|
729
647
|
}
|
|
648
|
+
// A signed-in Function also takes the Slice's Function access; an
|
|
649
|
+
// anonymous one does not. The secret-link call may be Prettier-wrapped.
|
|
650
|
+
registration = (0, function_registration_js_1.setFunctionRegistrationAccess)(registration, composition.name, (0, function_js_1.functionAuthenticationOf)(composition));
|
|
730
651
|
reconciled =
|
|
731
652
|
reconciled.slice(0, start) +
|
|
732
653
|
registration +
|
|
@@ -779,53 +700,6 @@ function preserveBuiltInDerivedApiArtifacts(tree, root, currentOwnership, target
|
|
|
779
700
|
}
|
|
780
701
|
return retained;
|
|
781
702
|
}
|
|
782
|
-
function upgradeConflictMessage(label, report) {
|
|
783
|
-
const ownershipDetails = [
|
|
784
|
-
...report.conflictingJsonMembers.map((member) => `- conflicting JSON ownership claim: ${member}`),
|
|
785
|
-
...report.expandedJsonOwnership.map((path) => `- unsafe expansion to whole-file JSON ownership: ${path}`),
|
|
786
|
-
];
|
|
787
|
-
return `${label} upgrade has user-modified managed files or unsafe JSON ownership changes:\n${report.conflicting.map((path) => `- ${path}`).join('\n')}${ownershipDetails.length > 0 ? `\n${ownershipDetails.join('\n')}` : ''}\nResolve or restore them before applying the upgrade.`;
|
|
788
|
-
}
|
|
789
|
-
function seededMigrationUpgradeMessage(label, report) {
|
|
790
|
-
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.`;
|
|
791
|
-
}
|
|
792
|
-
async function formatRenderedFiles(tree, files, prefix = '') {
|
|
793
|
-
const changedOptions = (0, formatting_js_1.changedTreePrettierOptions)(tree);
|
|
794
|
-
return Object.fromEntries(await Promise.all(Object.entries(files).map(async ([path, contents]) => {
|
|
795
|
-
const workspacePath = node_path_1.posix.join(prefix, path);
|
|
796
|
-
if ((0, built_in_plan_js_1.isBuiltInSliceFormatSensitivePath)(path) ||
|
|
797
|
-
(0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(workspacePath)) {
|
|
798
|
-
return [path, contents];
|
|
799
|
-
}
|
|
800
|
-
try {
|
|
801
|
-
const options = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, changedOptions);
|
|
802
|
-
return [
|
|
803
|
-
path,
|
|
804
|
-
await (0, formatting_js_1.formatTreeContentsToFixedPoint)(contents, options, workspacePath),
|
|
805
|
-
];
|
|
806
|
-
}
|
|
807
|
-
catch {
|
|
808
|
-
return [path, contents];
|
|
809
|
-
}
|
|
810
|
-
})));
|
|
811
|
-
}
|
|
812
|
-
async function formatOwnershipRecord(tree, path, label) {
|
|
813
|
-
if (!tree.exists(path)) {
|
|
814
|
-
throw new Error(`${label} ownership metadata is missing at ${path}.`);
|
|
815
|
-
}
|
|
816
|
-
await (0, formatting_js_1.formatTreeFileToFixedPoint)(tree, path);
|
|
817
|
-
}
|
|
818
|
-
function readJson(tree, path, label) {
|
|
819
|
-
const contents = tree.read(path, 'utf8');
|
|
820
|
-
if (contents === null)
|
|
821
|
-
throw new Error(`${label} does not exist at ${path}.`);
|
|
822
|
-
try {
|
|
823
|
-
return JSON.parse(contents);
|
|
824
|
-
}
|
|
825
|
-
catch (error) {
|
|
826
|
-
throw new Error(`${label} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
703
|
function objectMember(value, member) {
|
|
830
704
|
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
831
705
|
return undefined;
|
|
@@ -905,35 +779,58 @@ function inspectWorkspaceSstVersion(tree, packageJson) {
|
|
|
905
779
|
function workspaceSstVersionDriftMessage(state) {
|
|
906
780
|
return `[ebk-upgrade] ${state.classification}: workspace upgrades require the exact audited SST ${state.expectedVersion} manifest and lock resolution before framework ownership can be restamped.\n${state.issues.map((issue) => `- ${issue}`).join('\n')}\nRemediation: ${state.remediation}`;
|
|
907
781
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
: '';
|
|
915
|
-
return `${label} is invalid:\n${details}${regenerateHint}`;
|
|
916
|
-
}
|
|
917
|
-
function requireUpgradePrerequisites(tree, target) {
|
|
918
|
-
const installedVersion = (0, generator_js_1.frameworkPackageVersion)();
|
|
919
|
-
const workspaceResult = (0, index_js_5.validateWorkspaceOwnershipRecord)(readJson(tree, '.ebk/ownership.json', 'Workspace ownership metadata'));
|
|
920
|
-
if (!workspaceResult.valid) {
|
|
921
|
-
throw new Error(ownershipValidationMessage('Workspace ownership metadata', workspaceResult.issues));
|
|
922
|
-
}
|
|
923
|
-
if (workspaceResult.value.frameworkVersion !== installedVersion) {
|
|
924
|
-
throw new Error(`Workspace tooling is recorded at ${workspaceResult.value.frameworkVersion}, but the installed @empire-builder-kit/nx version is ${installedVersion}. Report and apply the workspace upgrade before upgrading the ${target === 'foundation' ? 'Standard Foundation' : 'Product Slice'}.`);
|
|
925
|
-
}
|
|
926
|
-
(0, observability_policy_js_1.requireObservabilityPolicyFromTree)(tree);
|
|
927
|
-
if (target === 'foundation')
|
|
782
|
+
// site is reserved for the workspace root site. A Product Slice generated
|
|
783
|
+
// under that name before the reservation must be renamed first; no upgrade
|
|
784
|
+
// target runs beside it.
|
|
785
|
+
function refuseProductSliceNamedSite(tree) {
|
|
786
|
+
const source = tree.read(node_path_1.posix.join(root_site_js_1.ROOT_SITE_ROOT, '.ebk/ownership.json'), 'utf8');
|
|
787
|
+
if (source === null)
|
|
928
788
|
return;
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
789
|
+
let recorded;
|
|
790
|
+
try {
|
|
791
|
+
recorded = JSON.parse(source);
|
|
932
792
|
}
|
|
933
|
-
|
|
934
|
-
throw new Error(
|
|
793
|
+
catch {
|
|
794
|
+
throw new Error(root_site_js_1.ROOT_SITE_UNREADABLE_RECORD_MESSAGE);
|
|
795
|
+
}
|
|
796
|
+
if (recorded !== null &&
|
|
797
|
+
typeof recorded === 'object' &&
|
|
798
|
+
!Array.isArray(recorded) &&
|
|
799
|
+
Object.prototype.hasOwnProperty.call(recorded, 'slice')) {
|
|
800
|
+
throw new Error(`${root_site_js_1.ROOT_SITE_ROOT} holds a Product Slice named ${root_site_js_1.ROOT_SITE_NAME}, but ${root_site_js_1.ROOT_SITE_NAME} is reserved for the workspace root site. ${root_site_js_1.ROOT_SITE_RENAME_GUIDANCE}`);
|
|
935
801
|
}
|
|
936
802
|
}
|
|
803
|
+
// The root site upgrade re-renders the site's managed files from the
|
|
804
|
+
// installed framework, preserves its seeded and adopter-owned files, and
|
|
805
|
+
// restamps its record, as the Foundation upgrade does for the Foundation.
|
|
806
|
+
async function upgradeSite(tree, options, packageJson, output) {
|
|
807
|
+
return (0, framework_package_upgrade_js_1.upgradeFrameworkPackage)(tree, options, output, {
|
|
808
|
+
label: 'Root site',
|
|
809
|
+
refusesSeededMigrationRewrites: false,
|
|
810
|
+
reportName: root_site_js_1.ROOT_SITE_NAME,
|
|
811
|
+
root: root_site_js_1.ROOT_SITE_ROOT,
|
|
812
|
+
targetLabel: 'root site',
|
|
813
|
+
requirePrerequisites: () => (0, framework_prerequisites_js_1.requireUpgradePrerequisites)(tree, 'site'),
|
|
814
|
+
validateOwnership: index_js_5.validateSiteOwnershipRecord,
|
|
815
|
+
render: () => {
|
|
816
|
+
const name = packageJson.name?.trim();
|
|
817
|
+
if (!name) {
|
|
818
|
+
throw new Error('Workspace package.json must declare a name.');
|
|
819
|
+
}
|
|
820
|
+
const runtimeVersion = packageJson.dependencies?.['@empire-builder-kit/runtime'];
|
|
821
|
+
if (!runtimeVersion) {
|
|
822
|
+
throw new Error('Workspace package.json must depend on @empire-builder-kit/runtime before upgrading the root site.');
|
|
823
|
+
}
|
|
824
|
+
return (0, built_in_site_plan_js_1.createBuiltInSitePlan)({
|
|
825
|
+
frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
|
|
826
|
+
runtimeVersion,
|
|
827
|
+
scope: `@${name}`,
|
|
828
|
+
});
|
|
829
|
+
},
|
|
830
|
+
restamp: index_js_5.restampSiteOwnership,
|
|
831
|
+
installCallback: () => options.skipInstall ? undefined : () => (0, devkit_1.installPackagesTask)(tree, true),
|
|
832
|
+
});
|
|
833
|
+
}
|
|
937
834
|
function requireName(name) {
|
|
938
835
|
const value = name.trim();
|
|
939
836
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(value)) {
|
|
@@ -1015,184 +912,6 @@ function gateBreakingBlueprintTransition(current, blueprint, apply, output) {
|
|
|
1015
912
|
}
|
|
1016
913
|
return true;
|
|
1017
914
|
}
|
|
1018
|
-
function createUpgradeReport(currentFiles, currentOwnership, targetFiles, targetOwnership, jsonOwnershipChanges = {
|
|
1019
|
-
claimedJsonMembers: [],
|
|
1020
|
-
conflictingJsonMembers: [],
|
|
1021
|
-
expandedJsonOwnership: [],
|
|
1022
|
-
releasedJsonMembers: [],
|
|
1023
|
-
}) {
|
|
1024
|
-
const report = {
|
|
1025
|
-
addedSeeded: [],
|
|
1026
|
-
appendedSeeded: [],
|
|
1027
|
-
changed: [],
|
|
1028
|
-
claimedJsonMembers: [...jsonOwnershipChanges.claimedJsonMembers],
|
|
1029
|
-
conflicting: [],
|
|
1030
|
-
conflictingJsonMembers: [...jsonOwnershipChanges.conflictingJsonMembers],
|
|
1031
|
-
expandedJsonOwnership: [...jsonOwnershipChanges.expandedJsonOwnership],
|
|
1032
|
-
incompatibleSeededMigrations: [],
|
|
1033
|
-
missing: [],
|
|
1034
|
-
obsolete: [],
|
|
1035
|
-
preservedSeeded: [],
|
|
1036
|
-
releasedJsonMembers: [...jsonOwnershipChanges.releasedJsonMembers],
|
|
1037
|
-
seededReconciliation: [],
|
|
1038
|
-
unchanged: [],
|
|
1039
|
-
};
|
|
1040
|
-
const targetPaths = new Set(targetOwnership.paths.map(({ path }) => path));
|
|
1041
|
-
const currentPathOwnership = new Map(currentOwnership.paths.map((entry) => [entry.path, entry]));
|
|
1042
|
-
for (const targetEntry of targetOwnership.paths) {
|
|
1043
|
-
const { mode, path, sha256: targetSha256 } = targetEntry;
|
|
1044
|
-
const current = currentFiles.get(path) ?? null;
|
|
1045
|
-
const target = targetFiles.get(path);
|
|
1046
|
-
const currentEntry = currentPathOwnership.get(path);
|
|
1047
|
-
if (target === undefined) {
|
|
1048
|
-
throw new Error(`Target Blueprint did not render owned path ${path}.`);
|
|
1049
|
-
}
|
|
1050
|
-
if (mode === 'seeded') {
|
|
1051
|
-
(current === null ? report.addedSeeded : report.preservedSeeded).push(path);
|
|
1052
|
-
if (current !== null &&
|
|
1053
|
-
currentEntry !== undefined &&
|
|
1054
|
-
currentEntry.sha256 !== targetSha256 &&
|
|
1055
|
-
path.startsWith('database/migrations/')) {
|
|
1056
|
-
report.incompatibleSeededMigrations.push(path);
|
|
1057
|
-
}
|
|
1058
|
-
else if (((current !== null && currentEntry?.sha256 !== targetSha256) ||
|
|
1059
|
-
(current === null &&
|
|
1060
|
-
path === 'reliability/metric-declarations.ts')) &&
|
|
1061
|
-
seededReconciliationDefinition(path) !== null) {
|
|
1062
|
-
const reconciliation = seededReconciliationDefinition(path);
|
|
1063
|
-
if (reconciliation === null) {
|
|
1064
|
-
throw new Error(`Missing seeded reconciliation definition for ${path}.`);
|
|
1065
|
-
}
|
|
1066
|
-
report.seededReconciliation.push({
|
|
1067
|
-
adopterContentSha256: current === null
|
|
1068
|
-
? null
|
|
1069
|
-
: (0, index_js_5.hashOwnedContent)(current, currentEntry ?? targetEntry),
|
|
1070
|
-
category: reconciliation.category,
|
|
1071
|
-
currentFrameworkSha256: currentEntry?.sha256 ?? null,
|
|
1072
|
-
...('guidance' in reconciliation
|
|
1073
|
-
? { guidance: reconciliation.guidance }
|
|
1074
|
-
: {}),
|
|
1075
|
-
implications: [...reconciliation.implications],
|
|
1076
|
-
markerReference: SEEDED_RECONCILIATION_MARKER_REFERENCE,
|
|
1077
|
-
path,
|
|
1078
|
-
requiredAction: current === null
|
|
1079
|
-
? 'declare-existing-custom-metric-series-before-promotion'
|
|
1080
|
-
: 'review-and-reconcile-preserving-adopter-content',
|
|
1081
|
-
targetFrameworkSha256: targetSha256,
|
|
1082
|
-
});
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
else if (current === null) {
|
|
1086
|
-
report.missing.push(path);
|
|
1087
|
-
}
|
|
1088
|
-
else if (currentEntry !== undefined &&
|
|
1089
|
-
(0, index_js_5.hashOwnedContent)(current, currentEntry) !== currentEntry.sha256) {
|
|
1090
|
-
report.conflicting.push(path);
|
|
1091
|
-
}
|
|
1092
|
-
else if (current === target) {
|
|
1093
|
-
report.unchanged.push(path);
|
|
1094
|
-
}
|
|
1095
|
-
else if (currentEntry === undefined) {
|
|
1096
|
-
report.conflicting.push(path);
|
|
1097
|
-
}
|
|
1098
|
-
else {
|
|
1099
|
-
report.changed.push(path);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
for (const entry of currentOwnership.paths) {
|
|
1103
|
-
const { mode, origin, path, sha256 } = entry;
|
|
1104
|
-
if (mode !== 'managed' ||
|
|
1105
|
-
origin === 'composition' ||
|
|
1106
|
-
targetPaths.has(path)) {
|
|
1107
|
-
continue;
|
|
1108
|
-
}
|
|
1109
|
-
const current = currentFiles.get(path) ?? null;
|
|
1110
|
-
if (current === null)
|
|
1111
|
-
continue;
|
|
1112
|
-
if ((0, index_js_5.hashOwnedContent)(current, entry) === sha256) {
|
|
1113
|
-
report.obsolete.push(path);
|
|
1114
|
-
}
|
|
1115
|
-
else if (!report.conflicting.includes(path)) {
|
|
1116
|
-
report.conflicting.push(path);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
const ownershipConflictPaths = new Set([
|
|
1120
|
-
...report.expandedJsonOwnership,
|
|
1121
|
-
...report.conflictingJsonMembers.map((member) => member.slice(0, member.indexOf('#/'))),
|
|
1122
|
-
]);
|
|
1123
|
-
for (const path of ownershipConflictPaths) {
|
|
1124
|
-
report.changed = report.changed.filter((entry) => entry !== path);
|
|
1125
|
-
report.unchanged = report.unchanged.filter((entry) => entry !== path);
|
|
1126
|
-
if (!report.conflicting.includes(path))
|
|
1127
|
-
report.conflicting.push(path);
|
|
1128
|
-
}
|
|
1129
|
-
for (const paths of Object.values(report)) {
|
|
1130
|
-
paths.sort((left, right) => typeof left === 'string' && typeof right === 'string'
|
|
1131
|
-
? (0, deterministic_order_js_1.compareUtf16)(left, right)
|
|
1132
|
-
: (0, deterministic_order_js_1.compareUtf16)(left.path, right.path));
|
|
1133
|
-
}
|
|
1134
|
-
return report;
|
|
1135
|
-
}
|
|
1136
|
-
function mergeStructuredTargetFiles(currentFiles, currentOwnership, targetFiles, targetOwnership) {
|
|
1137
|
-
const files = new Map(targetFiles);
|
|
1138
|
-
const changes = {
|
|
1139
|
-
claimedJsonMembers: [],
|
|
1140
|
-
conflictingJsonMembers: [],
|
|
1141
|
-
expandedJsonOwnership: [],
|
|
1142
|
-
releasedJsonMembers: [],
|
|
1143
|
-
};
|
|
1144
|
-
const currentEntries = new Map(currentOwnership.paths.map((entry) => [entry.path, entry]));
|
|
1145
|
-
for (const targetEntry of targetOwnership.paths) {
|
|
1146
|
-
const currentEntry = currentEntries.get(targetEntry.path);
|
|
1147
|
-
const current = currentFiles.get(targetEntry.path) ?? null;
|
|
1148
|
-
const target = files.get(targetEntry.path);
|
|
1149
|
-
if (current === null || target === undefined)
|
|
1150
|
-
continue;
|
|
1151
|
-
if (targetEntry.mode === 'seeded') {
|
|
1152
|
-
files.set(targetEntry.path, current);
|
|
1153
|
-
continue;
|
|
1154
|
-
}
|
|
1155
|
-
if (currentEntry?.managedJsonPointers && !targetEntry.managedJsonPointers) {
|
|
1156
|
-
if (targetEntry.mode === 'managed') {
|
|
1157
|
-
changes.expandedJsonOwnership.push(targetEntry.path);
|
|
1158
|
-
}
|
|
1159
|
-
else {
|
|
1160
|
-
changes.releasedJsonMembers.push(...currentEntry.managedJsonPointers.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
1161
|
-
}
|
|
1162
|
-
continue;
|
|
1163
|
-
}
|
|
1164
|
-
if (!targetEntry.managedJsonPointers)
|
|
1165
|
-
continue;
|
|
1166
|
-
if (currentEntry?.managedJsonPointers) {
|
|
1167
|
-
const transition = (0, index_js_5.analyzeManagedJsonPointerTransition)(current, target, currentEntry.managedJsonPointers, targetEntry.managedJsonPointers);
|
|
1168
|
-
changes.claimedJsonMembers.push(...transition.claimed.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
1169
|
-
changes.conflictingJsonMembers.push(...transition.conflictingClaims.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
1170
|
-
changes.releasedJsonMembers.push(...transition.released.map((pointer) => `${targetEntry.path}#${pointer}`));
|
|
1171
|
-
if (transition.conflictingClaims.length > 0) {
|
|
1172
|
-
files.set(targetEntry.path, current);
|
|
1173
|
-
continue;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
files.set(targetEntry.path, (0, index_js_5.mergeManagedJsonContents)(current, target, targetEntry.managedJsonPointers));
|
|
1177
|
-
}
|
|
1178
|
-
return { files, ...changes };
|
|
1179
|
-
}
|
|
1180
|
-
async function formatMergedManagedJsonFiles(tree, root, merge, ownership) {
|
|
1181
|
-
const files = new Map(merge.files);
|
|
1182
|
-
const changedOptions = (0, formatting_js_1.changedTreePrettierOptions)(tree);
|
|
1183
|
-
await Promise.all(ownership.paths.map(async (entry) => {
|
|
1184
|
-
if (entry.mode !== 'managed' || !entry.managedJsonPointers)
|
|
1185
|
-
return;
|
|
1186
|
-
const contents = files.get(entry.path);
|
|
1187
|
-
if (contents === undefined) {
|
|
1188
|
-
throw new Error(`Target did not render managed JSON ${entry.path}.`);
|
|
1189
|
-
}
|
|
1190
|
-
const workspacePath = node_path_1.posix.join(root, entry.path);
|
|
1191
|
-
const options = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, changedOptions);
|
|
1192
|
-
files.set(entry.path, await (0, formatting_js_1.formatTreeContentsToFixedPoint)(contents, options, workspacePath));
|
|
1193
|
-
}));
|
|
1194
|
-
return { ...merge, files };
|
|
1195
|
-
}
|
|
1196
915
|
function renderCompositionUpgradePlan(ownership, workspace, runtimeVersion, serviceAdapterOwner, deploymentProfile) {
|
|
1197
916
|
const compositionPaths = ownership.paths.filter(({ origin }) => origin === 'composition');
|
|
1198
917
|
const files = {};
|
|
@@ -1217,7 +936,7 @@ function renderCompositionUpgradePlan(ownership, workspace, runtimeVersion, serv
|
|
|
1217
936
|
};
|
|
1218
937
|
for (const composition of ownership.compositions) {
|
|
1219
938
|
if (composition.kind === 'function') {
|
|
1220
|
-
const plan = (0, function_js_1.createFunctionFilePlan)(workspace, ownership.slice, composition.name, composition.feature);
|
|
939
|
+
const plan = (0, function_js_1.createFunctionFilePlan)(workspace, ownership.slice, composition.name, composition.feature, (0, function_js_1.functionAuthenticationOf)(composition));
|
|
1221
940
|
addPlan(plan.files, plan.paths);
|
|
1222
941
|
}
|
|
1223
942
|
else {
|
|
@@ -1250,7 +969,7 @@ function retainedServiceAdapterOwner(tree, root, ownership) {
|
|
|
1250
969
|
return null;
|
|
1251
970
|
throw new Error('Product Slice Service adapter owner cannot be reconciled for upgrade.');
|
|
1252
971
|
}
|
|
1253
|
-
const operations = readJson(tree, operationsPath, 'Product Slice performance operations registry');
|
|
972
|
+
const operations = (0, upgrade_plan_js_1.readJson)(tree, operationsPath, 'Product Slice performance operations registry');
|
|
1254
973
|
const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
1255
974
|
const load = record(operations) ? operations['load'] : undefined;
|
|
1256
975
|
const allowlistedAdapters = record(load)
|
|
@@ -1263,7 +982,7 @@ function retainedServiceAdapterOwner(tree, root, ownership) {
|
|
|
1263
982
|
allowlistedAdapters.some((adapter) => typeof adapter !== 'string')) {
|
|
1264
983
|
throw new Error('Product Slice Service adapter owner cannot be reconciled for upgrade.');
|
|
1265
984
|
}
|
|
1266
|
-
const scenarioDocument = readJson(tree, node_path_1.posix.join(root, 'performance/load-scenarios.json'), 'Product Slice protected-load scenario catalog');
|
|
985
|
+
const scenarioDocument = (0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, 'performance/load-scenarios.json'), 'Product Slice protected-load scenario catalog');
|
|
1267
986
|
const scenarios = record(scenarioDocument)
|
|
1268
987
|
? scenarioDocument['scenarios']
|
|
1269
988
|
: undefined;
|
|
@@ -1271,7 +990,7 @@ function retainedServiceAdapterOwner(tree, root, ownership) {
|
|
|
1271
990
|
? scenarios.filter((scenario) => record(scenario) && scenario['id'] === 'service-extension')
|
|
1272
991
|
: [];
|
|
1273
992
|
const serviceScenario = serviceScenarios[0];
|
|
1274
|
-
const secretAccess = readJson(tree, node_path_1.posix.join(root, 'secrets/workload-access.json'), 'Product Slice secret workload access registry');
|
|
993
|
+
const secretAccess = (0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, 'secrets/workload-access.json'), 'Product Slice secret workload access registry');
|
|
1275
994
|
const bindings = record(secretAccess) ? secretAccess['bindings'] : undefined;
|
|
1276
995
|
const logicalName = 'GeneratedPerformanceLoadHmacKeys';
|
|
1277
996
|
const prereleaseLogicalName = `${ownership.slice
|
|
@@ -1351,81 +1070,52 @@ function carryRetainedServiceAdapterAuthority(targetFiles, owner) {
|
|
|
1351
1070
|
return { ...targetFiles, [path]: json(target) };
|
|
1352
1071
|
}
|
|
1353
1072
|
async function upgradeFoundation(tree, options, packageJson, output, foundationRequirements = []) {
|
|
1354
|
-
if (options.blueprint !== undefined || options.inputs !== undefined) {
|
|
1355
|
-
throw new Error('Standard Foundation upgrades do not accept Blueprint or input options.');
|
|
1356
|
-
}
|
|
1357
1073
|
const root = 'packages/foundation';
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1074
|
+
await (0, framework_package_upgrade_js_1.upgradeFrameworkPackage)(tree, options, output, {
|
|
1075
|
+
label: 'Standard Foundation',
|
|
1076
|
+
refusesSeededMigrationRewrites: true,
|
|
1077
|
+
reportName: 'foundation',
|
|
1078
|
+
root,
|
|
1079
|
+
targetLabel: 'Standard Foundation',
|
|
1080
|
+
validateOwnership: index_js_5.validateFoundationOwnershipRecord,
|
|
1081
|
+
render: () => {
|
|
1082
|
+
if (!packageJson.name) {
|
|
1083
|
+
throw new Error('Workspace package.json must declare a name.');
|
|
1084
|
+
}
|
|
1085
|
+
const deployment = readRepositoryDeploymentRenderingOptions(tree);
|
|
1086
|
+
return (0, workspace_files_js_1.renderFoundationFilePlan)({
|
|
1087
|
+
...deployment,
|
|
1088
|
+
foundationRequirements,
|
|
1089
|
+
foundationDescriptor: (0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, 'contracts/foundation.json'), 'Existing Foundation resource declaration'),
|
|
1090
|
+
frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
|
|
1091
|
+
name: packageJson.name,
|
|
1092
|
+
});
|
|
1093
|
+
},
|
|
1094
|
+
validateTarget: (ownership) => {
|
|
1095
|
+
const targetValidation = (0, index_js_5.validateFoundationOwnershipRecord)(ownership);
|
|
1096
|
+
if (!targetValidation.valid) {
|
|
1097
|
+
throw new Error(`Target Standard Foundation ownership metadata is invalid:\n${targetValidation.issues
|
|
1098
|
+
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
1099
|
+
.join('\n')}`);
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
afterReport: (currentFiles) => {
|
|
1103
|
+
const customDomainSwitchNotice = (0, custom_domain_notice_js_1.foundationCustomDomainSwitchNotice)({
|
|
1104
|
+
currentFoundationSource: currentFiles.get('infra/foundation.ts') ?? null,
|
|
1105
|
+
policy: (0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree),
|
|
1106
|
+
});
|
|
1107
|
+
if (customDomainSwitchNotice !== null) {
|
|
1108
|
+
output.warn(customDomainSwitchNotice);
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
restamp: index_js_5.restampFoundationOwnership,
|
|
1373
1112
|
});
|
|
1374
|
-
const target = {
|
|
1375
|
-
...renderedTarget,
|
|
1376
|
-
files: await formatRenderedFiles(tree, renderedTarget.files, root),
|
|
1377
|
-
};
|
|
1378
|
-
const targetValidation = (0, index_js_5.validateFoundationOwnershipRecord)(target.ownership);
|
|
1379
|
-
if (!targetValidation.valid) {
|
|
1380
|
-
throw new Error(`Target Standard Foundation ownership metadata is invalid:\n${targetValidation.issues
|
|
1381
|
-
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
1382
|
-
.join('\n')}`);
|
|
1383
|
-
}
|
|
1384
|
-
const allPaths = new Set([
|
|
1385
|
-
...currentOwnership.paths.map(({ path }) => path),
|
|
1386
|
-
...target.ownership.paths.map(({ path }) => path),
|
|
1387
|
-
]);
|
|
1388
|
-
const currentFiles = new Map([...allPaths].map((path) => [
|
|
1389
|
-
path,
|
|
1390
|
-
tree.read(node_path_1.posix.join(root, path), 'utf8'),
|
|
1391
|
-
]));
|
|
1392
|
-
let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
|
|
1393
|
-
mergedTarget = await formatMergedManagedJsonFiles(tree, root, mergedTarget, target.ownership);
|
|
1394
|
-
const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, target.ownership, mergedTarget);
|
|
1395
|
-
output.info(`[ebk-upgrade] foundation ${currentOwnership.frameworkVersion} -> ${target.ownership.frameworkVersion}\n${JSON.stringify(report, null, 2)}`);
|
|
1396
|
-
if (!options.apply)
|
|
1397
|
-
return;
|
|
1398
|
-
if (report.incompatibleSeededMigrations.length > 0) {
|
|
1399
|
-
throw new Error(seededMigrationUpgradeMessage('Standard Foundation', report));
|
|
1400
|
-
}
|
|
1401
|
-
if (report.conflicting.length > 0) {
|
|
1402
|
-
throw new Error(upgradeConflictMessage('Standard Foundation', report));
|
|
1403
|
-
}
|
|
1404
|
-
for (const path of report.obsolete)
|
|
1405
|
-
tree.delete(node_path_1.posix.join(root, path));
|
|
1406
|
-
const writePaths = new Set([
|
|
1407
|
-
...report.changed,
|
|
1408
|
-
...report.missing,
|
|
1409
|
-
...report.addedSeeded,
|
|
1410
|
-
'.ebk/ownership.json',
|
|
1411
|
-
]);
|
|
1412
|
-
for (const path of writePaths) {
|
|
1413
|
-
const contents = mergedTarget.files.get(path);
|
|
1414
|
-
if (contents === undefined) {
|
|
1415
|
-
throw new Error(`Target Standard Foundation did not render ${path}.`);
|
|
1416
|
-
}
|
|
1417
|
-
tree.write(node_path_1.posix.join(root, path), contents);
|
|
1418
|
-
}
|
|
1419
|
-
(0, index_js_5.restampFoundationOwnership)(tree);
|
|
1420
|
-
// Ownership bytes are part of the upgrade result, including agent previews
|
|
1421
|
-
// that skip workspace formatting. Canonicalize before binding those bytes.
|
|
1422
|
-
await formatOwnershipRecord(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Standard Foundation');
|
|
1423
1113
|
}
|
|
1424
1114
|
/** Internal paired-generation path: the ordinary ownership-preserving upgrader owns Foundation writes. */
|
|
1425
1115
|
async function upgradeFoundationForRequirements(tree, requirements, apply, output = devkit_1.logger) {
|
|
1426
|
-
requireUpgradePrerequisites(tree, 'product-slice');
|
|
1116
|
+
(0, framework_prerequisites_js_1.requireUpgradePrerequisites)(tree, 'product-slice');
|
|
1427
1117
|
const capabilityPlan = (0, capability_plan_js_1.planFoundationCapabilities)({
|
|
1428
|
-
current: readJson(tree, 'packages/foundation/contracts/foundation.json', 'Standard Foundation descriptor'),
|
|
1118
|
+
current: (0, upgrade_plan_js_1.readJson)(tree, 'packages/foundation/contracts/foundation.json', 'Standard Foundation descriptor'),
|
|
1429
1119
|
requirements,
|
|
1430
1120
|
});
|
|
1431
1121
|
if (capabilityPlan.migratedFromContract !== null)
|
|
@@ -1435,112 +1125,73 @@ async function upgradeFoundationForRequirements(tree, requirements, apply, outpu
|
|
|
1435
1125
|
return;
|
|
1436
1126
|
const policy = (0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree);
|
|
1437
1127
|
if (tree.exists('packages/foundation/contracts/costs.json'))
|
|
1438
|
-
(0, capacity_migration_js_1.assertCapacityMigrationChoice)(policy.productionFoundation.profile, readJson(tree, 'packages/foundation/contracts/costs.json', 'Foundation cost contract'));
|
|
1439
|
-
const packageJson = readJson(tree, 'package.json', 'Workspace package.json');
|
|
1128
|
+
(0, capacity_migration_js_1.assertCapacityMigrationChoice)(policy.productionFoundation.profile, (0, upgrade_plan_js_1.readJson)(tree, 'packages/foundation/contracts/costs.json', 'Foundation cost contract'));
|
|
1129
|
+
const packageJson = (0, upgrade_plan_js_1.readJson)(tree, 'package.json', 'Workspace package.json');
|
|
1440
1130
|
await upgradeFoundation(tree, { name: 'foundation', apply, skipFormat: true, skipInstall: true }, packageJson, output, requirements);
|
|
1441
1131
|
}
|
|
1442
1132
|
async function upgradeWorkspace(tree, options, packageJson, output) {
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1133
|
+
let sstVersionState;
|
|
1134
|
+
await (0, framework_package_upgrade_js_1.upgradeFrameworkPackage)(tree, options, output, {
|
|
1135
|
+
label: 'Workspace',
|
|
1136
|
+
refusesSeededMigrationRewrites: true,
|
|
1137
|
+
reportName: 'workspace',
|
|
1138
|
+
root: '',
|
|
1139
|
+
targetLabel: 'workspace',
|
|
1140
|
+
validateOwnership: index_js_5.validateWorkspaceOwnershipRecord,
|
|
1141
|
+
render: () => {
|
|
1142
|
+
if (!packageJson.name) {
|
|
1143
|
+
throw new Error('Workspace package.json must declare a name.');
|
|
1144
|
+
}
|
|
1145
|
+
sstVersionState = inspectWorkspaceSstVersion(tree, packageJson);
|
|
1146
|
+
const deployment = readRepositoryDeploymentRenderingOptions(tree);
|
|
1147
|
+
return (0, workspace_files_js_1.renderWorkspaceRootFilePlan)({
|
|
1148
|
+
...deployment,
|
|
1149
|
+
dependencyOverrides: tree.exists(dependency_overrides_js_1.DEPENDENCY_OVERRIDES_PATH)
|
|
1150
|
+
? (0, upgrade_plan_js_1.readJson)(tree, dependency_overrides_js_1.DEPENDENCY_OVERRIDES_PATH, 'Dependency overrides')
|
|
1151
|
+
: undefined,
|
|
1152
|
+
observabilityPolicy: tree.exists(observability_js_1.OBSERVABILITY_POLICY_PATH)
|
|
1153
|
+
? (0, upgrade_plan_js_1.readJson)(tree, observability_js_1.OBSERVABILITY_POLICY_PATH, 'Observability policy')
|
|
1154
|
+
: (0, observability_js_1.defaultObservabilityPolicy)((0, index_js_4.activeDeploymentStages)(deployment.deploymentProfile ?? 'starter'), { preserveLegacy: true }),
|
|
1155
|
+
frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
|
|
1156
|
+
name: packageJson.name,
|
|
1157
|
+
});
|
|
1158
|
+
},
|
|
1159
|
+
validateTarget: (ownership) => {
|
|
1160
|
+
if (!(0, index_js_5.validateWorkspaceOwnershipRecord)(ownership).valid) {
|
|
1161
|
+
throw new Error('Target workspace ownership metadata is invalid.');
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1164
|
+
planSeededAppend: (currentFiles, targetFiles) => planDeveloperAgentInstructionAppend(currentFiles.get('AGENTS.md') ?? null, targetFiles['AGENTS.md']),
|
|
1165
|
+
describeReport: (report) => ({
|
|
1166
|
+
...report,
|
|
1167
|
+
tooling: { sst: sstVersionState },
|
|
1168
|
+
}),
|
|
1169
|
+
afterReport: () => {
|
|
1170
|
+
if (sstVersionState?.classification === 'sst-version-drift') {
|
|
1171
|
+
const message = workspaceSstVersionDriftMessage(sstVersionState);
|
|
1172
|
+
if (options.apply)
|
|
1173
|
+
throw new Error(message);
|
|
1174
|
+
output.warn(message);
|
|
1175
|
+
}
|
|
1176
|
+
},
|
|
1177
|
+
restamp: index_js_5.restampWorkspaceOwnership,
|
|
1466
1178
|
});
|
|
1467
|
-
const target = {
|
|
1468
|
-
...renderedTarget,
|
|
1469
|
-
files: await formatRenderedFiles(tree, renderedTarget.files),
|
|
1470
|
-
};
|
|
1471
|
-
const targetValidation = (0, index_js_5.validateWorkspaceOwnershipRecord)(target.ownership);
|
|
1472
|
-
if (!targetValidation.valid) {
|
|
1473
|
-
throw new Error('Target workspace ownership metadata is invalid.');
|
|
1474
|
-
}
|
|
1475
|
-
const allPaths = new Set([
|
|
1476
|
-
...currentOwnership.paths.map(({ path }) => path),
|
|
1477
|
-
...target.ownership.paths.map(({ path }) => path),
|
|
1478
|
-
]);
|
|
1479
|
-
const currentFiles = new Map([...allPaths].map((path) => [path, tree.read(path, 'utf8')]));
|
|
1480
|
-
let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
|
|
1481
|
-
mergedTarget = await formatMergedManagedJsonFiles(tree, '', mergedTarget, target.ownership);
|
|
1482
|
-
const developerAgentInstructionAppend = planDeveloperAgentInstructionAppend(currentFiles.get('AGENTS.md') ?? null, target.files['AGENTS.md']);
|
|
1483
|
-
if (developerAgentInstructionAppend !== null) {
|
|
1484
|
-
mergedTarget.files.set(developerAgentInstructionAppend.path, developerAgentInstructionAppend.contents);
|
|
1485
|
-
}
|
|
1486
|
-
const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, target.ownership, mergedTarget);
|
|
1487
|
-
if (developerAgentInstructionAppend !== null) {
|
|
1488
|
-
report.preservedSeeded = report.preservedSeeded.filter((path) => path !== developerAgentInstructionAppend.path);
|
|
1489
|
-
report.appendedSeeded.push(developerAgentInstructionAppend.path);
|
|
1490
|
-
}
|
|
1491
|
-
output.info(`[ebk-upgrade] workspace ${currentOwnership.frameworkVersion} -> ${target.ownership.frameworkVersion}\n${JSON.stringify({ ...report, tooling: { sst: sstVersionState } }, null, 2)}`);
|
|
1492
|
-
if (sstVersionState.classification === 'sst-version-drift') {
|
|
1493
|
-
const message = workspaceSstVersionDriftMessage(sstVersionState);
|
|
1494
|
-
if (options.apply)
|
|
1495
|
-
throw new Error(message);
|
|
1496
|
-
output.warn(message);
|
|
1497
|
-
}
|
|
1498
|
-
if (!options.apply)
|
|
1499
|
-
return;
|
|
1500
|
-
if (report.incompatibleSeededMigrations.length > 0) {
|
|
1501
|
-
throw new Error(seededMigrationUpgradeMessage('Workspace', report));
|
|
1502
|
-
}
|
|
1503
|
-
if (report.conflicting.length > 0) {
|
|
1504
|
-
throw new Error(upgradeConflictMessage('Workspace', report));
|
|
1505
|
-
}
|
|
1506
|
-
for (const path of report.obsolete)
|
|
1507
|
-
tree.delete(path);
|
|
1508
|
-
const writePaths = new Set([
|
|
1509
|
-
...report.changed,
|
|
1510
|
-
...report.missing,
|
|
1511
|
-
...report.addedSeeded,
|
|
1512
|
-
...report.appendedSeeded,
|
|
1513
|
-
'.ebk/ownership.json',
|
|
1514
|
-
]);
|
|
1515
|
-
for (const path of writePaths) {
|
|
1516
|
-
if (path === developerAgentInstructionAppend?.path)
|
|
1517
|
-
continue;
|
|
1518
|
-
const contents = mergedTarget.files.get(path);
|
|
1519
|
-
if (contents === undefined) {
|
|
1520
|
-
throw new Error(`Target workspace did not render ${path}.`);
|
|
1521
|
-
}
|
|
1522
|
-
tree.write(path, contents);
|
|
1523
|
-
}
|
|
1524
|
-
if (developerAgentInstructionAppend !== null) {
|
|
1525
|
-
tree.write(developerAgentInstructionAppend.path, developerAgentInstructionAppend.contents);
|
|
1526
|
-
}
|
|
1527
|
-
(0, index_js_5.restampWorkspaceOwnership)(tree);
|
|
1528
|
-
await formatOwnershipRecord(tree, '.ebk/ownership.json', 'Workspace');
|
|
1529
1179
|
}
|
|
1530
1180
|
async function executeUpgradeGenerator(tree, options, output = devkit_1.logger, executionOptions = {}) {
|
|
1531
1181
|
const name = requireName(options.name);
|
|
1182
|
+
refuseProductSliceNamedSite(tree);
|
|
1532
1183
|
// The policy is seeded: never reinterpret an existing warm production choice
|
|
1533
1184
|
// as permission to pause it. The operator must make the rename explicitly.
|
|
1534
1185
|
const costsPath = 'packages/foundation/contracts/costs.json';
|
|
1535
1186
|
if (tree.exists(costsPath)) {
|
|
1536
|
-
(0, capacity_migration_js_1.assertCapacityMigrationChoice)((0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree).productionFoundation.profile, readJson(tree, costsPath, 'Foundation cost contract'));
|
|
1187
|
+
(0, capacity_migration_js_1.assertCapacityMigrationChoice)((0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree).productionFoundation.profile, (0, upgrade_plan_js_1.readJson)(tree, costsPath, 'Foundation cost contract'));
|
|
1537
1188
|
}
|
|
1538
|
-
const packageJson = readJson(tree, 'package.json', 'Workspace package.json');
|
|
1189
|
+
const packageJson = (0, upgrade_plan_js_1.readJson)(tree, 'package.json', 'Workspace package.json');
|
|
1539
1190
|
if (name === 'workspace') {
|
|
1540
1191
|
return upgradeWorkspace(tree, options, packageJson, output);
|
|
1541
1192
|
}
|
|
1542
1193
|
if (name === 'foundation') {
|
|
1543
|
-
requireUpgradePrerequisites(tree, 'foundation');
|
|
1194
|
+
(0, framework_prerequisites_js_1.requireUpgradePrerequisites)(tree, 'foundation');
|
|
1544
1195
|
// Refuse an unsupported core transition before changing shared contracts.
|
|
1545
1196
|
// This is a preflight, not a prerelease migration or compatibility layer.
|
|
1546
1197
|
for (const slice of tree.children('packages')) {
|
|
@@ -1548,38 +1199,44 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1548
1199
|
const path = node_path_1.posix.join(root, '.ebk/ownership.json');
|
|
1549
1200
|
if (slice === 'foundation' || !tree.exists(path))
|
|
1550
1201
|
continue;
|
|
1551
|
-
const recorded = readJson(tree, path, 'Product Slice ownership metadata');
|
|
1202
|
+
const recorded = (0, upgrade_plan_js_1.readJson)(tree, path, 'Product Slice ownership metadata');
|
|
1552
1203
|
if (recorded?.blueprint
|
|
1553
1204
|
?.name !== index_js_1.BUILTIN_BLUEPRINT_NAME)
|
|
1554
1205
|
continue;
|
|
1555
1206
|
const parsed = (0, index_js_5.validateGeneratedOwnershipRecord)(recorded);
|
|
1556
1207
|
if (!parsed.valid)
|
|
1557
|
-
throw new Error(ownershipValidationMessage('Product Slice ownership metadata', parsed.issues));
|
|
1208
|
+
throw new Error((0, upgrade_plan_js_1.ownershipValidationMessage)('Product Slice ownership metadata', parsed.issues));
|
|
1558
1209
|
(0, persistence_contract_js_1.standardPersistenceContract)({
|
|
1559
1210
|
inputs: parsed.value.inputs,
|
|
1560
1211
|
existingStandardRequirement: parsed.value.foundation,
|
|
1561
1212
|
...(tree.exists(node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH))
|
|
1562
1213
|
? {
|
|
1563
|
-
current: readJson(tree, node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH), 'Standard persistence declaration'),
|
|
1214
|
+
current: (0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH), 'Standard persistence declaration'),
|
|
1564
1215
|
}
|
|
1565
1216
|
: {}),
|
|
1566
1217
|
});
|
|
1567
1218
|
}
|
|
1568
1219
|
return upgradeFoundation(tree, options, packageJson, output);
|
|
1569
1220
|
}
|
|
1570
|
-
|
|
1221
|
+
if (name === root_site_js_1.ROOT_SITE_NAME) {
|
|
1222
|
+
return upgradeSite(tree, options, packageJson, output);
|
|
1223
|
+
}
|
|
1224
|
+
(0, framework_prerequisites_js_1.requireUpgradePrerequisites)(tree, 'product-slice');
|
|
1571
1225
|
const root = node_path_1.posix.join('packages', name);
|
|
1572
|
-
const ownershipResult = (0, index_js_5.validateGeneratedOwnershipRecord)(readJson(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice ownership metadata'));
|
|
1226
|
+
const ownershipResult = (0, index_js_5.validateGeneratedOwnershipRecord)((0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice ownership metadata'));
|
|
1573
1227
|
if (!ownershipResult.valid) {
|
|
1574
|
-
throw new Error(ownershipValidationMessage('Product Slice ownership metadata', ownershipResult.issues));
|
|
1228
|
+
throw new Error((0, upgrade_plan_js_1.ownershipValidationMessage)('Product Slice ownership metadata', ownershipResult.issues));
|
|
1575
1229
|
}
|
|
1576
1230
|
const currentOwnership = ownershipResult.value;
|
|
1577
1231
|
if (currentOwnership.slice !== name) {
|
|
1578
1232
|
throw new Error(`Ownership metadata belongs to ${currentOwnership.slice}, not ${name}.`);
|
|
1579
1233
|
}
|
|
1234
|
+
// Before the Blueprint resolves or its generator runs, and before any write.
|
|
1235
|
+
(0, external_blueprint_compositions_js_1.refuseExternalBlueprintCompositions)(tree, root, currentOwnership);
|
|
1580
1236
|
for (const composition of currentOwnership.compositions) {
|
|
1581
1237
|
(0, feature_registry_js_1.requireRegisteredSliceFeature)(tree, root, composition.feature);
|
|
1582
1238
|
}
|
|
1239
|
+
const functionAccess = (0, function_authentication_notice_js_1.planFunctionAccessTransitions)(currentOwnership.compositions, (functionName) => tree.read(node_path_1.posix.join(root, 'infra/functions', `${functionName}.ts`), 'utf8'));
|
|
1583
1240
|
const serviceAdapterOwner = retainedServiceAdapterOwner(tree, root, currentOwnership);
|
|
1584
1241
|
const recordedReference = currentOwnership.blueprint.name === index_js_1.BUILTIN_BLUEPRINT_NAME
|
|
1585
1242
|
? index_js_1.BUILTIN_BLUEPRINT_REFERENCE
|
|
@@ -1602,7 +1259,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1602
1259
|
existingStandardRequirement: currentOwnership.foundation,
|
|
1603
1260
|
...(tree.exists(node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH))
|
|
1604
1261
|
? {
|
|
1605
|
-
current: readJson(tree, node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH), 'Standard persistence declaration'),
|
|
1262
|
+
current: (0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH), 'Standard persistence declaration'),
|
|
1606
1263
|
}
|
|
1607
1264
|
: {}),
|
|
1608
1265
|
});
|
|
@@ -1619,7 +1276,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1619
1276
|
const requiredFoundation = blueprint.source === 'built-in'
|
|
1620
1277
|
? (0, capability_plan_js_1.standardPersistenceRequirement)(inputResult.value, currentOwnership.compositions)
|
|
1621
1278
|
: blueprint.manifest.foundation;
|
|
1622
|
-
const existingFoundation = readJson(tree, 'packages/foundation/contracts/foundation.json', 'Standard Foundation descriptor');
|
|
1279
|
+
const existingFoundation = (0, upgrade_plan_js_1.readJson)(tree, 'packages/foundation/contracts/foundation.json', 'Standard Foundation descriptor');
|
|
1623
1280
|
const compatibility = (0, index_js_3.validateFoundationCompatibility)(requiredFoundation, blueprint.source === 'built-in'
|
|
1624
1281
|
? (0, capability_plan_js_1.planFoundationCapabilities)({
|
|
1625
1282
|
current: existingFoundation,
|
|
@@ -1648,7 +1305,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1648
1305
|
compositions: currentOwnership.compositions,
|
|
1649
1306
|
...(tree.exists(node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH))
|
|
1650
1307
|
? {
|
|
1651
|
-
current: readJson(tree, node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH), 'Standard persistence declaration'),
|
|
1308
|
+
current: (0, upgrade_plan_js_1.readJson)(tree, node_path_1.posix.join(root, persistence_contract_js_1.STANDARD_PERSISTENCE_PATH), 'Standard persistence declaration'),
|
|
1652
1309
|
}
|
|
1653
1310
|
: {}),
|
|
1654
1311
|
});
|
|
@@ -1771,7 +1428,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1771
1428
|
}
|
|
1772
1429
|
targetFiles = { ...targetFiles, [entry.path]: contents };
|
|
1773
1430
|
}
|
|
1774
|
-
targetFiles = await formatRenderedFiles(tree, targetFiles, root);
|
|
1431
|
+
targetFiles = await (0, upgrade_plan_js_1.formatRenderedFiles)(tree, targetFiles, root);
|
|
1775
1432
|
targetOwnership = {
|
|
1776
1433
|
...targetOwnership,
|
|
1777
1434
|
compositions: currentOwnership.compositions,
|
|
@@ -1808,8 +1465,8 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1808
1465
|
path,
|
|
1809
1466
|
tree.read(node_path_1.posix.join(root, path), 'utf8'),
|
|
1810
1467
|
]));
|
|
1811
|
-
let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(targetFiles)), targetOwnership);
|
|
1812
|
-
mergedTarget = await formatMergedManagedJsonFiles(tree, root, mergedTarget, targetOwnership);
|
|
1468
|
+
let mergedTarget = (0, upgrade_plan_js_1.mergeStructuredTargetFiles)(currentFiles, currentOwnership, new Map(Object.entries(targetFiles)), targetOwnership);
|
|
1469
|
+
mergedTarget = await (0, upgrade_plan_js_1.formatMergedManagedJsonFiles)(tree, root, mergedTarget, targetOwnership);
|
|
1813
1470
|
const sqlAppends = blueprint.source === 'built-in' &&
|
|
1814
1471
|
(0, capability_plan_js_1.readStandardSqlDeclaration)(inputResult.value)
|
|
1815
1472
|
? (0, sql_seeded_reconciliation_js_1.planSqlSeededReconciliation)(currentFiles, targetFiles)
|
|
@@ -1827,9 +1484,11 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1827
1484
|
const formatting = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, (0, formatting_js_1.changedTreePrettierOptions)(tree));
|
|
1828
1485
|
mergedTarget.files.set(logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH, await (0, formatting_js_1.formatTreeContentsToFixedPoint)(loggingAppend, formatting, workspacePath));
|
|
1829
1486
|
}
|
|
1830
|
-
const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, targetOwnership, mergedTarget);
|
|
1487
|
+
const report = (0, upgrade_plan_js_1.createUpgradeReport)(currentFiles, currentOwnership, mergedTarget.files, targetOwnership, mergedTarget);
|
|
1831
1488
|
if (blueprint.source === 'built-in') {
|
|
1832
1489
|
appendServiceTaskPresenceReconciliation(currentFiles, currentOwnership, targetOwnership, report);
|
|
1490
|
+
appendDatabaseCredentialRotationReconciliation(currentFiles, currentOwnership, targetOwnership, report);
|
|
1491
|
+
appendApiBasePathReconciliation(currentFiles, currentOwnership, targetOwnership, report);
|
|
1833
1492
|
}
|
|
1834
1493
|
if (loggingAppend !== null) {
|
|
1835
1494
|
report.preservedSeeded = report.preservedSeeded.filter((path) => path !== logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH);
|
|
@@ -1840,17 +1499,24 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1840
1499
|
report.appendedSeeded.push(path);
|
|
1841
1500
|
}
|
|
1842
1501
|
report.appendedSeeded.sort(deterministic_order_js_1.compareUtf16);
|
|
1843
|
-
output.info(`[ebk-upgrade] ${name} ${currentOwnership.blueprint.name}@${currentOwnership.blueprint.version} -> ${blueprint.manifest.name}@${blueprint.manifest.version}\n${JSON.stringify(report, null, 2)}`);
|
|
1502
|
+
output.info(`[ebk-upgrade] ${name} ${currentOwnership.blueprint.name}@${currentOwnership.blueprint.version} -> ${blueprint.manifest.name}@${blueprint.manifest.version}\n${JSON.stringify(functionAccess.length > 0 ? { ...report, functionAccess } : report, null, 2)}`);
|
|
1503
|
+
const functionAuthenticationSwitchNotice = (0, function_authentication_notice_js_1.functionAuthenticationNotice)(name, functionAccess);
|
|
1504
|
+
if (functionAuthenticationSwitchNotice !== null) {
|
|
1505
|
+
output.warn(functionAuthenticationSwitchNotice);
|
|
1506
|
+
}
|
|
1507
|
+
const publicFunctionsNotice = (0, function_authentication_notice_js_1.anonymousFunctionNotice)(name, functionAccess);
|
|
1508
|
+
if (publicFunctionsNotice !== null)
|
|
1509
|
+
output.warn(publicFunctionsNotice);
|
|
1844
1510
|
if (!options.apply) {
|
|
1845
1511
|
if (blueprint.source === 'built-in')
|
|
1846
1512
|
await upgradeFoundationForRequirements(tree, [requiredFoundation], false, output);
|
|
1847
1513
|
return;
|
|
1848
1514
|
}
|
|
1849
1515
|
if (report.incompatibleSeededMigrations.length > 0) {
|
|
1850
|
-
throw new Error(seededMigrationUpgradeMessage('Product Slice', report));
|
|
1516
|
+
throw new Error((0, upgrade_plan_js_1.seededMigrationUpgradeMessage)('Product Slice', report));
|
|
1851
1517
|
}
|
|
1852
1518
|
if (report.conflicting.length > 0) {
|
|
1853
|
-
throw new Error(upgradeConflictMessage('Product Slice', report));
|
|
1519
|
+
throw new Error((0, upgrade_plan_js_1.upgradeConflictMessage)('Product Slice', report));
|
|
1854
1520
|
}
|
|
1855
1521
|
if (blueprint.source === 'built-in')
|
|
1856
1522
|
await upgradeFoundationForRequirements(tree, [requiredFoundation], true, output);
|
|
@@ -1885,7 +1551,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
|
|
|
1885
1551
|
}
|
|
1886
1552
|
}
|
|
1887
1553
|
(0, index_js_5.restampProductSliceOwnership)(tree, name, { preserveSeeded: true });
|
|
1888
|
-
await formatOwnershipRecord(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice');
|
|
1554
|
+
await (0, upgrade_plan_js_1.formatOwnershipRecord)(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice');
|
|
1889
1555
|
return options.skipInstall
|
|
1890
1556
|
? undefined
|
|
1891
1557
|
: () => (0, devkit_1.installPackagesTask)(tree, true);
|