@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,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderSliceOperationsFiles = renderSliceOperationsFiles;
|
|
4
|
+
exports.renderNextBuildEnvironmentWrapper = renderNextBuildEnvironmentWrapper;
|
|
4
5
|
const index_js_1 = require("../../ownership/index.js");
|
|
5
6
|
const feature_registry_js_1 = require("../feature-registry.js");
|
|
6
7
|
const logging_registry_js_1 = require("../logging-registry.js");
|
|
7
8
|
const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
|
|
9
|
+
const built_in_plan_sst_config_js_1 = require("./built-in-plan-sst-config.js");
|
|
8
10
|
/** @internal */
|
|
9
11
|
function renderSliceOperationsFiles(name, workspace = 'workspace', frameworkVersion = 'workspace-installed', sql = true) {
|
|
10
12
|
const pascalName = name
|
|
@@ -530,7 +532,15 @@ process.stdout.write(
|
|
|
530
532
|
'sst-env.d.ts': `// Bootstrap placeholder. SST overwrites this file after install, dev, or deploy.
|
|
531
533
|
export {};
|
|
532
534
|
`,
|
|
533
|
-
'sst.config.ts':
|
|
535
|
+
'sst.config.ts': (0, built_in_plan_sst_config_js_1.renderConsumerSstConfig)({
|
|
536
|
+
appName: name,
|
|
537
|
+
boundaryStage: `($dev ? 'development' : $app.stage) as
|
|
538
|
+
| 'development'
|
|
539
|
+
| 'staging'
|
|
540
|
+
| 'production'`,
|
|
541
|
+
boundarySubject: 'Native Slice',
|
|
542
|
+
buildCommandNoun: 'Slice buildCommand',
|
|
543
|
+
buildKeys: `[
|
|
534
544
|
'AUTH_CLIENT_ID',
|
|
535
545
|
'AUTH_USER_POOL_ID',
|
|
536
546
|
'CI',
|
|
@@ -559,9 +569,13 @@ export {};
|
|
|
559
569
|
'SST_RESOURCE_${pascalName}KeyValueAccess',
|
|
560
570
|
${sql ? ` 'SST_RESOURCE_${pascalName}PrimaryDatabase',\n` : ''}\
|
|
561
571
|
'SST_RESOURCE_FoundationIdentity',
|
|
562
|
-
]
|
|
563
|
-
|
|
564
|
-
|
|
572
|
+
]`,
|
|
573
|
+
buildTriggerNote: ` Replacing it with
|
|
574
|
+
// source identity skips OpenNext on same-source retries on fresh runners.`,
|
|
575
|
+
builderLogicalName: `${pascalName}WebBuilder`,
|
|
576
|
+
frameworkVersion,
|
|
577
|
+
nameSourceIdentities: true,
|
|
578
|
+
requiredBuildKeys: `[
|
|
565
579
|
'AUTH_CLIENT_ID',
|
|
566
580
|
'AUTH_USER_POOL_ID',
|
|
567
581
|
'CI',
|
|
@@ -587,116 +601,9 @@ const ebkRequiredNextBuildEnvironmentKeys = [
|
|
|
587
601
|
'SST_RESOURCE_${pascalName}KeyValueAccess',
|
|
588
602
|
${sql ? ` 'SST_RESOURCE_${pascalName}PrimaryDatabase',\n` : ''}\
|
|
589
603
|
'SST_RESOURCE_FoundationIdentity',
|
|
590
|
-
]
|
|
591
|
-
|
|
592
|
-
const
|
|
593
|
-
__pulumiType: 'command:local:Command',
|
|
594
|
-
} as unknown as new (
|
|
595
|
-
name: string,
|
|
596
|
-
args: { environment?: unknown; triggers?: unknown },
|
|
597
|
-
options?: unknown,
|
|
598
|
-
) => unknown;
|
|
599
|
-
|
|
600
|
-
const ebkSourceCommitPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
601
|
-
const ebkSourceTreePattern = /^[a-f0-9]{64}$/;
|
|
602
|
-
|
|
603
|
-
function exactNextBuildEnvironment(value: unknown): Record<string, string> {
|
|
604
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
605
|
-
throw new Error('The Next build environment must resolve to one object.');
|
|
606
|
-
}
|
|
607
|
-
const environment = value as Record<string, unknown>;
|
|
608
|
-
const retained = Object.fromEntries(
|
|
609
|
-
Object.entries(environment)
|
|
610
|
-
.filter(([key]) => ebkNextBuildEnvironmentKeys.has(key))
|
|
611
|
-
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0)),
|
|
612
|
-
);
|
|
613
|
-
for (const key of ebkRequiredNextBuildEnvironmentKeys) {
|
|
614
|
-
if (typeof retained[key] !== 'string') {
|
|
615
|
-
throw new Error('The Next build environment omitted ' + key + '.');
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return retained as Record<string, string>;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
// SST 4.17.1 installs its transform globals only while evaluating $config.run.
|
|
622
|
-
// Register there, before infrastructure construction, rather than at module
|
|
623
|
-
// load. The explicit Slice buildCommand separately routes diff/refresh invokes
|
|
624
|
-
// through the wrapper.
|
|
625
|
-
function registerExactNextBuildEnvironmentTransform(): void {
|
|
626
|
-
$transform(
|
|
627
|
-
ebkLocalCommandResource,
|
|
628
|
-
(
|
|
629
|
-
args: { environment?: unknown; triggers?: unknown },
|
|
630
|
-
_options: unknown,
|
|
631
|
-
resourceName: string,
|
|
632
|
-
) => {
|
|
633
|
-
if (resourceName !== '${pascalName}WebBuilder') return;
|
|
634
|
-
const unresolvedEnvironment = args.environment as Record<
|
|
635
|
-
string,
|
|
636
|
-
unknown
|
|
637
|
-
>;
|
|
638
|
-
const resolveEnvironment = (environment: Record<string, unknown>) => {
|
|
639
|
-
const resolved = exactNextBuildEnvironment({
|
|
640
|
-
...environment,
|
|
641
|
-
CI: 'true',
|
|
642
|
-
NEXT_TELEMETRY_DISABLED: '1',
|
|
643
|
-
});
|
|
644
|
-
const sourceCommit = resolved.EBK_SOURCE_COMMIT.trim();
|
|
645
|
-
const sourceTree = resolved.EBK_LOCAL_SOURCE_TREE.trim();
|
|
646
|
-
if (
|
|
647
|
-
!ebkSourceCommitPattern.test(sourceCommit) ||
|
|
648
|
-
!ebkSourceTreePattern.test(sourceTree)
|
|
649
|
-
) {
|
|
650
|
-
throw new Error(
|
|
651
|
-
'The Next builder requires exact EBK commit and working-tree identities.',
|
|
652
|
-
);
|
|
653
|
-
}
|
|
654
|
-
return resolved;
|
|
655
|
-
};
|
|
656
|
-
args.environment = $output(unresolvedEnvironment).apply(
|
|
657
|
-
resolveEnvironment,
|
|
658
|
-
);
|
|
659
|
-
// Preserve SST's native per-invocation build trigger. Replacing it with
|
|
660
|
-
// source identity skips OpenNext on same-source retries on fresh runners.
|
|
661
|
-
},
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
export default $config({
|
|
666
|
-
app(input: { stage?: string } | undefined) {
|
|
667
|
-
const stage = input?.stage ?? 'development';
|
|
668
|
-
const production = input?.stage === 'production';
|
|
669
|
-
return {
|
|
670
|
-
name: '${name}',
|
|
671
|
-
removal: production ? 'retain' : 'remove',
|
|
672
|
-
protect: production,
|
|
673
|
-
home: 'aws',
|
|
674
|
-
providers: {
|
|
675
|
-
aws: {
|
|
676
|
-
defaultTags: {
|
|
677
|
-
// SST contributes sst:app and sst:stage. Keep the provider baseline
|
|
678
|
-
// at eight tags so generated S3 asset objects remain within AWS's
|
|
679
|
-
// hard ten-tag object limit. Performance coverage requires this
|
|
680
|
-
// provider baseline; repository and production-profile identity is
|
|
681
|
-
// supplementary on resources using createStandardResourceTags.
|
|
682
|
-
tags: {
|
|
683
|
-
'ebk:cost-allocation': 'unallocated',
|
|
684
|
-
'ebk:cost-scope': '${workspace}/${name}/' + stage,
|
|
685
|
-
'ebk:framework-version': '${frameworkVersion}',
|
|
686
|
-
'ebk:managed-by': 'empire-builder-kit',
|
|
687
|
-
'ebk:owner': '${name}-product',
|
|
688
|
-
'ebk:slice': '${name}',
|
|
689
|
-
'ebk:stage': stage,
|
|
690
|
-
'ebk:workspace': '${workspace}',
|
|
691
|
-
},
|
|
692
|
-
},
|
|
693
|
-
region: process.env.AWS_REGION ?? 'us-east-1',
|
|
694
|
-
},
|
|
695
|
-
},
|
|
696
|
-
};
|
|
697
|
-
},
|
|
698
|
-
async run() {
|
|
699
|
-
const personalStagePattern = /^personal-[a-f0-9]{24}$/;
|
|
604
|
+
]`,
|
|
605
|
+
runEntry: 'app()',
|
|
606
|
+
stageGuard: ` const personalStagePattern = /^personal-[a-f0-9]{24}$/;
|
|
700
607
|
if ($dev && !personalStagePattern.test($app.stage)) {
|
|
701
608
|
throw new Error(
|
|
702
609
|
'SST dev requires the framework-derived personal stage. Use ebk dev.',
|
|
@@ -714,39 +621,12 @@ export default $config({
|
|
|
714
621
|
'A personal stage may run only through the framework development adapter.',
|
|
715
622
|
);
|
|
716
623
|
}
|
|
717
|
-
const {
|
|
718
|
-
installLambdaPolicyWriteOrdering,
|
|
719
|
-
installStageIamBoundaryTransforms,
|
|
720
|
-
} = await import('@empire-builder-kit/nx/aws-authority');
|
|
721
|
-
registerExactNextBuildEnvironmentTransform();
|
|
722
|
-
const accountId = process.env.AWS_EXPECTED_ACCOUNT_ID?.trim() ?? '';
|
|
723
|
-
if (!/^[0-9]{12}$/.test(accountId)) {
|
|
724
|
-
throw new Error(
|
|
725
|
-
'Native Slice IAM boundary injection requires AWS_EXPECTED_ACCOUNT_ID.',
|
|
726
|
-
);
|
|
727
|
-
}
|
|
728
|
-
installStageIamBoundaryTransforms({
|
|
729
|
-
accountId,
|
|
730
|
-
instanceProfileResource: aws.iam.InstanceProfile,
|
|
731
|
-
registerTransform: $transform,
|
|
732
|
-
roleResource: aws.iam.Role,
|
|
733
|
-
resourceStage: $app.stage,
|
|
734
|
-
stage: ($dev ? 'development' : $app.stage) as
|
|
735
|
-
| 'development'
|
|
736
|
-
| 'staging'
|
|
737
|
-
| 'production',
|
|
738
|
-
});
|
|
739
|
-
// Order Function URL and Lambda permission policy writes before any
|
|
740
|
-
// resource registers; the pinned providers otherwise race them.
|
|
741
|
-
installLambdaPolicyWriteOrdering({
|
|
742
|
-
mergeOptions: $util.mergeOptions,
|
|
743
|
-
registerStackTransformation: $util.runtime.registerStackTransformation,
|
|
744
|
-
});
|
|
745
|
-
const { app } = await import('./infra/index.js');
|
|
746
|
-
return app();
|
|
747
|
-
},
|
|
748
|
-
});
|
|
749
624
|
`,
|
|
625
|
+
tagBaselineNote: ` Performance coverage requires this
|
|
626
|
+
// provider baseline; repository and production-profile identity is
|
|
627
|
+
// supplementary on resources using createStandardResourceTags.`,
|
|
628
|
+
workspace,
|
|
629
|
+
}),
|
|
750
630
|
'tools/ebk-next-dev.mjs': `import { createRequire } from 'node:module';
|
|
751
631
|
import { dirname, join } from 'node:path';
|
|
752
632
|
const require = createRequire(import.meta.url);
|
|
@@ -759,29 +639,7 @@ try {
|
|
|
759
639
|
process.exitCode = 1;
|
|
760
640
|
}
|
|
761
641
|
`,
|
|
762
|
-
'tools/ebk-next-build-environment.mjs':
|
|
763
|
-
import { fileURLToPath } from 'node:url';
|
|
764
|
-
import {
|
|
765
|
-
chmodSync,
|
|
766
|
-
closeSync,
|
|
767
|
-
existsSync,
|
|
768
|
-
fstatSync,
|
|
769
|
-
lstatSync,
|
|
770
|
-
openSync,
|
|
771
|
-
readSync,
|
|
772
|
-
readFileSync,
|
|
773
|
-
readdirSync,
|
|
774
|
-
realpathSync,
|
|
775
|
-
renameSync,
|
|
776
|
-
rmSync,
|
|
777
|
-
unlinkSync,
|
|
778
|
-
writeFileSync,
|
|
779
|
-
} from 'node:fs';
|
|
780
|
-
import { dirname, join, relative, resolve } from 'node:path';
|
|
781
|
-
|
|
782
|
-
// SST diff/refresh invokes the build outside the Command resource transform.
|
|
783
|
-
// Reconstruct the child environment here so every builder path has one policy.
|
|
784
|
-
const applicationKeys = new Set(${JSON.stringify([
|
|
642
|
+
'tools/ebk-next-build-environment.mjs': renderNextBuildEnvironmentWrapper([
|
|
785
643
|
'AUTH_CLIENT_ID',
|
|
786
644
|
'AUTH_USER_POOL_ID',
|
|
787
645
|
'CI',
|
|
@@ -810,7 +668,81 @@ const applicationKeys = new Set(${JSON.stringify([
|
|
|
810
668
|
`SST_RESOURCE_${pascalName}KeyValueAccess`,
|
|
811
669
|
...(sql ? [`SST_RESOURCE_${pascalName}PrimaryDatabase`] : []),
|
|
812
670
|
'SST_RESOURCE_FoundationIdentity',
|
|
813
|
-
],
|
|
671
|
+
]),
|
|
672
|
+
'tsconfig.json': (0, built_in_plan_shared_js_1.json)({
|
|
673
|
+
extends: '../../tsconfig.base.json',
|
|
674
|
+
compilerOptions: {
|
|
675
|
+
allowJs: true,
|
|
676
|
+
esModuleInterop: true,
|
|
677
|
+
jsx: 'react-jsx',
|
|
678
|
+
lib: ['dom', 'dom.iterable', 'es2022'],
|
|
679
|
+
module: 'esnext',
|
|
680
|
+
moduleResolution: 'bundler',
|
|
681
|
+
plugins: [{ name: 'next' }],
|
|
682
|
+
resolveJsonModule: true,
|
|
683
|
+
types: ['node'],
|
|
684
|
+
},
|
|
685
|
+
include: [
|
|
686
|
+
'async/**/*.ts',
|
|
687
|
+
'authorization/**/*.ts',
|
|
688
|
+
'configuration/**/*.ts',
|
|
689
|
+
'contracts/**/*.ts',
|
|
690
|
+
'database/**/*.ts',
|
|
691
|
+
'data/**/*.ts',
|
|
692
|
+
'data/**/*.cts',
|
|
693
|
+
'api/**/*.ts',
|
|
694
|
+
'infra/**/*.ts',
|
|
695
|
+
'jobs/**/*.ts',
|
|
696
|
+
'performance/**/*.ts',
|
|
697
|
+
'reliability/**/*.ts',
|
|
698
|
+
'secrets/**/*.ts',
|
|
699
|
+
'services/**/*.ts',
|
|
700
|
+
'web/**/*.ts',
|
|
701
|
+
'web/**/*.tsx',
|
|
702
|
+
'vitest.config.ts',
|
|
703
|
+
'sst.config.ts',
|
|
704
|
+
'sst-env.d.ts',
|
|
705
|
+
'ebk-globals.d.ts',
|
|
706
|
+
],
|
|
707
|
+
exclude: ['.sst', 'dist', 'node_modules'],
|
|
708
|
+
}),
|
|
709
|
+
};
|
|
710
|
+
const sqlOnlyPaths = new Set([
|
|
711
|
+
'scripts/check-database.mjs',
|
|
712
|
+
'scripts/local-database.mjs',
|
|
713
|
+
'scripts/migrate-database.mjs',
|
|
714
|
+
]);
|
|
715
|
+
return Object.fromEntries(Object.entries(files).filter(([path]) => sql || !sqlOnlyPaths.has(path)));
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* The managed OpenNext build wrapper that SST's Next.js build command runs.
|
|
719
|
+
* It forwards only `applicationKeys` and operating-system keys to the exact
|
|
720
|
+
* managed OpenNext builder. Product Slices and the root site share it.
|
|
721
|
+
*/
|
|
722
|
+
function renderNextBuildEnvironmentWrapper(applicationKeys, owner = 'Slice') {
|
|
723
|
+
return `import { spawnSync } from 'node:child_process';
|
|
724
|
+
import { fileURLToPath } from 'node:url';
|
|
725
|
+
import {
|
|
726
|
+
chmodSync,
|
|
727
|
+
closeSync,
|
|
728
|
+
existsSync,
|
|
729
|
+
fstatSync,
|
|
730
|
+
lstatSync,
|
|
731
|
+
openSync,
|
|
732
|
+
readSync,
|
|
733
|
+
readFileSync,
|
|
734
|
+
readdirSync,
|
|
735
|
+
realpathSync,
|
|
736
|
+
renameSync,
|
|
737
|
+
rmSync,
|
|
738
|
+
unlinkSync,
|
|
739
|
+
writeFileSync,
|
|
740
|
+
} from 'node:fs';
|
|
741
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
742
|
+
|
|
743
|
+
// SST diff/refresh invokes the build outside the Command resource transform.
|
|
744
|
+
// Reconstruct the child environment here so every builder path has one policy.
|
|
745
|
+
const applicationKeys = new Set(${JSON.stringify(applicationKeys, null, 2)});
|
|
814
746
|
const operatingKeys = new Set(
|
|
815
747
|
[
|
|
816
748
|
'APPDATA',
|
|
@@ -927,21 +859,21 @@ const environment = Object.fromEntries(
|
|
|
927
859
|
)
|
|
928
860
|
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0)),
|
|
929
861
|
);
|
|
930
|
-
// Resolve through this managed
|
|
862
|
+
// Resolve through this managed ${owner}, never an ephemeral npx/dlx install.
|
|
931
863
|
const sliceRoot = realpathSync(resolve(dirname(fileURLToPath(import.meta.url)), '..'));
|
|
932
864
|
const sliceManifestPath = join(sliceRoot, 'package.json');
|
|
933
865
|
const sliceManifestIdentity = lstatSync(sliceManifestPath, { throwIfNoEntry: false });
|
|
934
866
|
if (!sliceManifestIdentity?.isFile() || sliceManifestIdentity.size > 1_048_576 ||
|
|
935
867
|
realpathSync(sliceManifestPath) !== sliceManifestPath ||
|
|
936
868
|
JSON.parse(readFileSync(sliceManifestPath, 'utf8')).devDependencies?.['@opennextjs/aws'] !== '${built_in_plan_shared_js_1.OPEN_NEXT_AWS_VERSION}') {
|
|
937
|
-
throw new Error('The
|
|
869
|
+
throw new Error('The ${owner} must declare the exact managed OpenNext dependency.');
|
|
938
870
|
}
|
|
939
|
-
// Only this declared
|
|
871
|
+
// Only this declared ${owner} slot is authority. Canonicalizing it supports pnpm
|
|
940
872
|
// links without searching NODE_PATH, ancestor/global packages, or PATH shims.
|
|
941
873
|
const managedSlot = join(sliceRoot, 'node_modules/@opennextjs/aws');
|
|
942
874
|
if (!existsSync(managedSlot)) {
|
|
943
875
|
throw new Error(
|
|
944
|
-
'The managed OpenNext ${built_in_plan_shared_js_1.OPEN_NEXT_AWS_VERSION} builder is not installed in this
|
|
876
|
+
'The managed OpenNext ${built_in_plan_shared_js_1.OPEN_NEXT_AWS_VERSION} builder is not installed in this ${owner}. ' +
|
|
945
877
|
'Install the workspace dependencies, including development dependencies ' +
|
|
946
878
|
'(pnpm install --frozen-lockfile), before building.',
|
|
947
879
|
);
|
|
@@ -1169,50 +1101,6 @@ if (result.status !== 0) {
|
|
|
1169
1101
|
throw new Error('The normalized OpenNext image optimizer package lock is invalid.');
|
|
1170
1102
|
}
|
|
1171
1103
|
}
|
|
1172
|
-
|
|
1173
|
-
'tsconfig.json': (0, built_in_plan_shared_js_1.json)({
|
|
1174
|
-
extends: '../../tsconfig.base.json',
|
|
1175
|
-
compilerOptions: {
|
|
1176
|
-
allowJs: true,
|
|
1177
|
-
esModuleInterop: true,
|
|
1178
|
-
jsx: 'react-jsx',
|
|
1179
|
-
lib: ['dom', 'dom.iterable', 'es2022'],
|
|
1180
|
-
module: 'esnext',
|
|
1181
|
-
moduleResolution: 'bundler',
|
|
1182
|
-
plugins: [{ name: 'next' }],
|
|
1183
|
-
resolveJsonModule: true,
|
|
1184
|
-
types: ['node'],
|
|
1185
|
-
},
|
|
1186
|
-
include: [
|
|
1187
|
-
'async/**/*.ts',
|
|
1188
|
-
'authorization/**/*.ts',
|
|
1189
|
-
'configuration/**/*.ts',
|
|
1190
|
-
'contracts/**/*.ts',
|
|
1191
|
-
'database/**/*.ts',
|
|
1192
|
-
'data/**/*.ts',
|
|
1193
|
-
'data/**/*.cts',
|
|
1194
|
-
'api/**/*.ts',
|
|
1195
|
-
'infra/**/*.ts',
|
|
1196
|
-
'jobs/**/*.ts',
|
|
1197
|
-
'performance/**/*.ts',
|
|
1198
|
-
'reliability/**/*.ts',
|
|
1199
|
-
'secrets/**/*.ts',
|
|
1200
|
-
'services/**/*.ts',
|
|
1201
|
-
'web/**/*.ts',
|
|
1202
|
-
'web/**/*.tsx',
|
|
1203
|
-
'vitest.config.ts',
|
|
1204
|
-
'sst.config.ts',
|
|
1205
|
-
'sst-env.d.ts',
|
|
1206
|
-
'ebk-globals.d.ts',
|
|
1207
|
-
],
|
|
1208
|
-
exclude: ['.sst', 'dist', 'node_modules'],
|
|
1209
|
-
}),
|
|
1210
|
-
};
|
|
1211
|
-
const sqlOnlyPaths = new Set([
|
|
1212
|
-
'scripts/check-database.mjs',
|
|
1213
|
-
'scripts/local-database.mjs',
|
|
1214
|
-
'scripts/migrate-database.mjs',
|
|
1215
|
-
]);
|
|
1216
|
-
return Object.fromEntries(Object.entries(files).filter(([path]) => sql || !sqlOnlyPaths.has(path)));
|
|
1104
|
+
`;
|
|
1217
1105
|
}
|
|
1218
1106
|
//# sourceMappingURL=built-in-plan-operations-files.js.map
|
|
@@ -2268,7 +2268,12 @@ or DynamoDB TTL timing, prevents replay.
|
|
|
2268
2268
|
Overdue effect deletion and its deadline report commit atomically. Reports stay
|
|
2269
2269
|
durable until metric emission and acknowledgement succeed; a lost acknowledgement
|
|
2270
2270
|
may repeat the breach metric. A partial scan does not emit a fabricated zero
|
|
2271
|
-
backlog.
|
|
2271
|
+
backlog. Each run reports \`PerformanceLoadCleanupContinuationRequired\` (1 when
|
|
2272
|
+
its inventory was incomplete); \`performance-load-cleanup-backlog\` alarms when
|
|
2273
|
+
every run in three consecutive hours reported 1. One interrupted run can need
|
|
2274
|
+
several runs to converge, because a resumed scan rescans from the start; a
|
|
2275
|
+
cadence slower than hourly can leave the alarm unable to fire. Require
|
|
2276
|
+
complete-scan evidence and no continuation or pending deadline
|
|
2272
2277
|
reports before retiring an old signing key. Explicit maintenance pauses retain
|
|
2273
2278
|
their existing behavior and can delay cleanup; selecting a capacity profile
|
|
2274
2279
|
does not resume this worker.
|
|
@@ -188,8 +188,10 @@ function alarmRegistrations(name, sql) {
|
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
...registered('performance-load-cleanup-backlog'),
|
|
191
|
-
condition: '
|
|
191
|
+
condition: 'Every cleanup run in three consecutive hours reported PerformanceLoadCleanupContinuationRequired: no run completed a full performance-load expiry inventory within its 5,000-record, four-minute bound (Minimum of a per-run flag).',
|
|
192
192
|
dependencyAlarmIds: [],
|
|
193
|
+
expectedFalseNegativeRisk: 'Paused or failing cleanup reports nothing; failures surface through inbox-cleanup-errors. When the configured inboxCleanup cadence is slower than one hour, some hourly periods have no data and the three-period condition may never be met.',
|
|
194
|
+
expectedFalsePositiveRisk: 'A run resumed from a saved cursor must rescan from the start before it can converge, so one interrupted run can report continuation for several runs. Expiry shares the run budget with inbox cleanup. Records near or above the 5,000-record per-run bound report continuation on every run; that is a capacity signal, not a failed cleanup.',
|
|
193
195
|
severity: 'high',
|
|
194
196
|
},
|
|
195
197
|
{
|
|
@@ -315,8 +317,10 @@ function alarmRegistrations(name, sql) {
|
|
|
315
317
|
},
|
|
316
318
|
{
|
|
317
319
|
...registered('inbox-cleanup-backlog'),
|
|
318
|
-
condition: '
|
|
320
|
+
condition: 'Every cleanup run in three consecutive hours reported InboxCleanupContinuationRequired: no run completed a full provider-inbox inventory within its 10,000-receipt, four-minute bound (Minimum of a per-run flag).',
|
|
319
321
|
dependencyAlarmIds: ['inbox-cleanup-errors'],
|
|
322
|
+
expectedFalseNegativeRisk: 'Paused or failing cleanup reports nothing; failures surface through inbox-cleanup-errors. When the configured inboxCleanup cadence is slower than one hour, some hourly periods have no data and the three-period condition may never be met.',
|
|
323
|
+
expectedFalsePositiveRisk: 'A run resumed from a saved cursor must rescan from the start before it can converge, so one interrupted run can report continuation for several runs; three hours absorb this while the retained inbox stays at or below about 6,666 receipts. A retained inbox near or above the 10,000-receipt per-run bound reports continuation on every run; that is a capacity signal, not a failed cleanup.',
|
|
320
324
|
severity: 'high',
|
|
321
325
|
},
|
|
322
326
|
...(sql
|
|
@@ -658,14 +662,14 @@ function deployedAlarmResources(name, sql) {
|
|
|
658
662
|
Slice: name,
|
|
659
663
|
Stage: '{stage}',
|
|
660
664
|
},
|
|
661
|
-
evaluationPeriods:
|
|
665
|
+
evaluationPeriods: 3,
|
|
662
666
|
id: 'performance-load-cleanup-backlog',
|
|
663
|
-
metricName: '
|
|
667
|
+
metricName: 'PerformanceLoadCleanupContinuationRequired',
|
|
664
668
|
name: `${name}-{stage}-performance-load-cleanup-backlog`,
|
|
665
669
|
namespace: 'EBK/Performance',
|
|
666
670
|
period: 3600,
|
|
667
671
|
signal: 'metric',
|
|
668
|
-
statistic: '
|
|
672
|
+
statistic: 'Minimum',
|
|
669
673
|
threshold: 1,
|
|
670
674
|
treatMissingData: 'notBreaching',
|
|
671
675
|
},
|
|
@@ -994,14 +998,14 @@ function deployedAlarmResources(name, sql) {
|
|
|
994
998
|
Slice: name,
|
|
995
999
|
Stage: '{stage}',
|
|
996
1000
|
},
|
|
997
|
-
evaluationPeriods:
|
|
1001
|
+
evaluationPeriods: 3,
|
|
998
1002
|
id: 'inbox-cleanup-backlog',
|
|
999
|
-
metricName: '
|
|
1003
|
+
metricName: 'InboxCleanupContinuationRequired',
|
|
1000
1004
|
name: `${name}-{stage}-inbox-cleanup-backlog`,
|
|
1001
1005
|
namespace: 'EBK/Async',
|
|
1002
1006
|
period: 3600,
|
|
1003
1007
|
signal: 'metric',
|
|
1004
|
-
statistic: '
|
|
1008
|
+
statistic: 'Minimum',
|
|
1005
1009
|
threshold: 1,
|
|
1006
1010
|
treatMissingData: 'notBreaching',
|
|
1007
1011
|
},
|
|
@@ -17,7 +17,7 @@ export declare const PRODUCT_VERSIONS: {
|
|
|
17
17
|
readonly awsSts: "^3.700.0";
|
|
18
18
|
readonly drizzle: "^0.45.2";
|
|
19
19
|
readonly drizzleKit: "^0.31.4";
|
|
20
|
-
readonly next: "16.4.
|
|
20
|
+
readonly next: "16.4.5";
|
|
21
21
|
readonly pg: "^8.22.0";
|
|
22
22
|
readonly playwright: "^1.59.1";
|
|
23
23
|
readonly react: "19.2.8";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What differs between the managed sst.config.ts of a Product Slice and that
|
|
3
|
+
* of the root site. Both are Next.js consumers of the Foundation and share one
|
|
4
|
+
* skeleton: the Next build environment allowlist, the IAM boundary injection,
|
|
5
|
+
* the Lambda policy write ordering and the provider tag baseline.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConsumerSstConfigInput {
|
|
8
|
+
/**
|
|
9
|
+
* The SST app name. It is also the `ebk:slice` tag, the cost-scope segment
|
|
10
|
+
* and the `<appName>-product` owner tag.
|
|
11
|
+
*/
|
|
12
|
+
appName: string;
|
|
13
|
+
workspace: string;
|
|
14
|
+
/** Stamped as the `ebk:framework-version` tag. */
|
|
15
|
+
frameworkVersion: string;
|
|
16
|
+
/** The Next.js builder whose environment the transform rewrites. */
|
|
17
|
+
builderLogicalName: string;
|
|
18
|
+
/**
|
|
19
|
+
* Every key the Next build may see, as the TypeScript source of the
|
|
20
|
+
* allowlist Set's argument.
|
|
21
|
+
*/
|
|
22
|
+
buildKeys: string;
|
|
23
|
+
/**
|
|
24
|
+
* The keys the Next build must receive, as a TypeScript array literal.
|
|
25
|
+
* Omitted when every allowlisted key is required.
|
|
26
|
+
*/
|
|
27
|
+
requiredBuildKeys?: string;
|
|
28
|
+
/** The opening statements of `run()`: which modes and stages may run. */
|
|
29
|
+
stageGuard: string;
|
|
30
|
+
/** Who the IAM boundary error names, such as 'Native Slice'. */
|
|
31
|
+
boundarySubject: string;
|
|
32
|
+
/** The `installStageIamBoundaryTransforms` `stage:` value. */
|
|
33
|
+
boundaryStage: string;
|
|
34
|
+
/** What `run()` returns: the `infra/index.ts` entry call. */
|
|
35
|
+
runEntry: string;
|
|
36
|
+
/** The words that name the explicit build command in its comment. */
|
|
37
|
+
buildCommandNoun: string;
|
|
38
|
+
/** Appended to the comment that keeps SST's build trigger. */
|
|
39
|
+
buildTriggerNote: string;
|
|
40
|
+
/** Appended to the comment on the provider tag baseline. */
|
|
41
|
+
tagBaselineNote: string;
|
|
42
|
+
/**
|
|
43
|
+
* Name the trimmed source identities before testing them, rather than test
|
|
44
|
+
* them inline. Both forms check the same values.
|
|
45
|
+
*/
|
|
46
|
+
nameSourceIdentities: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** The managed sst.config.ts of a Next.js Foundation consumer. */
|
|
49
|
+
export declare function renderConsumerSstConfig(input: ConsumerSstConfigInput): string;
|