@empire-builder-kit/nx 1.0.0-beta.10
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/LICENSE +201 -0
- package/NOTICE +5 -0
- package/README.md +34 -0
- package/executors.json +74 -0
- package/generators.json +40 -0
- package/migrations/standard-pre-v1-to-v1.md +11 -0
- package/package.json +80 -0
- package/src/blueprints/execution.d.ts +31 -0
- package/src/blueprints/execution.js +166 -0
- package/src/blueprints/execution.js.map +1 -0
- package/src/blueprints/index.d.ts +5 -0
- package/src/blueprints/index.js +9 -0
- package/src/blueprints/index.js.map +1 -0
- package/src/blueprints/inputs.d.ts +43 -0
- package/src/blueprints/inputs.js +103 -0
- package/src/blueprints/inputs.js.map +1 -0
- package/src/blueprints/manifest.d.ts +281 -0
- package/src/blueprints/manifest.js +441 -0
- package/src/blueprints/manifest.js.map +1 -0
- package/src/blueprints/resolver.d.ts +28 -0
- package/src/blueprints/resolver.js +218 -0
- package/src/blueprints/resolver.js.map +1 -0
- package/src/blueprints/transitions.d.ts +20 -0
- package/src/blueprints/transitions.js +61 -0
- package/src/blueprints/transitions.js.map +1 -0
- package/src/executors/deploy/deploy.d.ts +4 -0
- package/src/executors/deploy/deploy.js +6 -0
- package/src/executors/deploy/deploy.js.map +1 -0
- package/src/executors/deployment-plan/deployment-plan.d.ts +9 -0
- package/src/executors/deployment-plan/deployment-plan.js +50 -0
- package/src/executors/deployment-plan/deployment-plan.js.map +1 -0
- package/src/executors/deployment-plan/schema.json +24 -0
- package/src/executors/dev/dev.d.ts +4 -0
- package/src/executors/dev/dev.js +6 -0
- package/src/executors/dev/dev.js.map +1 -0
- package/src/executors/dev-doctor/dev-doctor.d.ts +31 -0
- package/src/executors/dev-doctor/dev-doctor.js +260 -0
- package/src/executors/dev-doctor/dev-doctor.js.map +1 -0
- package/src/executors/dev-doctor/schema.json +17 -0
- package/src/executors/dev-setup/dev-setup.d.ts +11 -0
- package/src/executors/dev-setup/dev-setup.js +454 -0
- package/src/executors/dev-setup/dev-setup.js.map +1 -0
- package/src/executors/dev-setup/schema.json +16 -0
- package/src/executors/fleet/fleet.d.ts +62 -0
- package/src/executors/fleet/fleet.js +613 -0
- package/src/executors/fleet/fleet.js.map +1 -0
- package/src/executors/fleet/schema.json +37 -0
- package/src/executors/foundation-preflight/foundation-preflight.d.ts +15 -0
- package/src/executors/foundation-preflight/foundation-preflight.js +116 -0
- package/src/executors/foundation-preflight/foundation-preflight.js.map +1 -0
- package/src/executors/foundation-preflight/schema.json +31 -0
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +8 -0
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +41 -0
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js.map +1 -0
- package/src/executors/foundation-profile-preflight/schema.json +21 -0
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.d.ts +13 -0
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +69 -0
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js.map +1 -0
- package/src/executors/foundation-remove-preflight/schema.json +17 -0
- package/src/executors/github-bootstrap/github-bootstrap.d.ts +8 -0
- package/src/executors/github-bootstrap/github-bootstrap.js +30 -0
- package/src/executors/github-bootstrap/github-bootstrap.js.map +1 -0
- package/src/executors/github-bootstrap/schema.json +25 -0
- package/src/executors/refresh/refresh.d.ts +4 -0
- package/src/executors/refresh/refresh.js +6 -0
- package/src/executors/refresh/refresh.js.map +1 -0
- package/src/executors/remove/remove.d.ts +4 -0
- package/src/executors/remove/remove.js +6 -0
- package/src/executors/remove/remove.js.map +1 -0
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +31 -0
- package/src/executors/sst-lifecycle/run-sst-command.js +226 -0
- package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -0
- package/src/executors/sst-lifecycle/schema.json +45 -0
- package/src/executors/unlock/unlock.d.ts +4 -0
- package/src/executors/unlock/unlock.js +6 -0
- package/src/executors/unlock/unlock.js.map +1 -0
- package/src/executors/work-markers/schema.json +14 -0
- package/src/executors/work-markers/work-markers.d.ts +6 -0
- package/src/executors/work-markers/work-markers.js +20 -0
- package/src/executors/work-markers/work-markers.js.map +1 -0
- package/src/foundation/aurora-logical-database.d.ts +76 -0
- package/src/foundation/aurora-logical-database.js +419 -0
- package/src/foundation/aurora-logical-database.js.map +1 -0
- package/src/foundation/discovery.d.ts +55 -0
- package/src/foundation/discovery.js +55 -0
- package/src/foundation/discovery.js.map +1 -0
- package/src/foundation/index.d.ts +6 -0
- package/src/foundation/index.js +10 -0
- package/src/foundation/index.js.map +1 -0
- package/src/foundation/local-database-contract.d.ts +30 -0
- package/src/foundation/local-database-contract.js +75 -0
- package/src/foundation/local-database-contract.js.map +1 -0
- package/src/foundation/preflight.d.ts +31 -0
- package/src/foundation/preflight.js +114 -0
- package/src/foundation/preflight.js.map +1 -0
- package/src/foundation/provision-database-bindings.d.ts +30 -0
- package/src/foundation/provision-database-bindings.js +113 -0
- package/src/foundation/provision-database-bindings.js.map +1 -0
- package/src/foundation/provision-logical-database.d.ts +26 -0
- package/src/foundation/provision-logical-database.js +163 -0
- package/src/foundation/provision-logical-database.js.map +1 -0
- package/src/foundation/requirements.d.ts +37 -0
- package/src/foundation/requirements.js +141 -0
- package/src/foundation/requirements.js.map +1 -0
- package/src/foundation/stages.d.ts +14 -0
- package/src/foundation/stages.js +51 -0
- package/src/foundation/stages.js.map +1 -0
- package/src/generators/function/function.d.ts +13 -0
- package/src/generators/function/function.js +71 -0
- package/src/generators/function/function.js.map +1 -0
- package/src/generators/function/schema.d.ts +5 -0
- package/src/generators/function/schema.json +20 -0
- package/src/generators/job/job.d.ts +4 -0
- package/src/generators/job/job.js +5 -0
- package/src/generators/job/job.js.map +1 -0
- package/src/generators/preset/generator.d.ts +5 -0
- package/src/generators/preset/generator.js +41 -0
- package/src/generators/preset/generator.js.map +1 -0
- package/src/generators/preset/schema.d.ts +4 -0
- package/src/generators/preset/schema.json +22 -0
- package/src/generators/preset/workspace-files.d.ts +18 -0
- package/src/generators/preset/workspace-files.js +1605 -0
- package/src/generators/preset/workspace-files.js.map +1 -0
- package/src/generators/repository-policy/repository-policy.d.ts +4 -0
- package/src/generators/repository-policy/repository-policy.js +107 -0
- package/src/generators/repository-policy/repository-policy.js.map +1 -0
- package/src/generators/repository-policy/schema.d.ts +18 -0
- package/src/generators/repository-policy/schema.json +46 -0
- package/src/generators/service/service.d.ts +4 -0
- package/src/generators/service/service.js +5 -0
- package/src/generators/service/service.js.map +1 -0
- package/src/generators/slice/schema.d.ts +7 -0
- package/src/generators/slice/schema.json +38 -0
- package/src/generators/slice/slice.d.ts +26 -0
- package/src/generators/slice/slice.js +1698 -0
- package/src/generators/slice/slice.js.map +1 -0
- package/src/generators/upgrade/schema.d.ts +8 -0
- package/src/generators/upgrade/schema.json +31 -0
- package/src/generators/upgrade/upgrade.d.ts +27 -0
- package/src/generators/upgrade/upgrade.js +682 -0
- package/src/generators/upgrade/upgrade.js.map +1 -0
- package/src/generators/workload/schema.d.ts +6 -0
- package/src/generators/workload/schema.json +21 -0
- package/src/generators/workload/workload.d.ts +16 -0
- package/src/generators/workload/workload.js +157 -0
- package/src/generators/workload/workload.js.map +1 -0
- package/src/git-policy/action-pins.d.ts +28 -0
- package/src/git-policy/action-pins.js +35 -0
- package/src/git-policy/action-pins.js.map +1 -0
- package/src/git-policy/github-bootstrap.d.ts +23 -0
- package/src/git-policy/github-bootstrap.js +759 -0
- package/src/git-policy/github-bootstrap.js.map +1 -0
- package/src/git-policy/index.d.ts +3 -0
- package/src/git-policy/index.js +7 -0
- package/src/git-policy/index.js.map +1 -0
- package/src/git-policy/routing.d.ts +15 -0
- package/src/git-policy/routing.js +77 -0
- package/src/git-policy/routing.js.map +1 -0
- package/src/index.d.ts +8 -0
- package/src/index.js +12 -0
- package/src/index.js.map +1 -0
- package/src/local-dev/contracts.d.ts +31 -0
- package/src/local-dev/contracts.js +126 -0
- package/src/local-dev/contracts.js.map +1 -0
- package/src/local-dev/effects.d.ts +16 -0
- package/src/local-dev/effects.js +63 -0
- package/src/local-dev/effects.js.map +1 -0
- package/src/local-dev/gateway-daemon.d.ts +4 -0
- package/src/local-dev/gateway-daemon.js +39 -0
- package/src/local-dev/gateway-daemon.js.map +1 -0
- package/src/local-dev/gateway.d.ts +60 -0
- package/src/local-dev/gateway.js +368 -0
- package/src/local-dev/gateway.js.map +1 -0
- package/src/local-dev/identity.d.ts +16 -0
- package/src/local-dev/identity.js +101 -0
- package/src/local-dev/identity.js.map +1 -0
- package/src/local-dev/index.d.ts +7 -0
- package/src/local-dev/index.js +11 -0
- package/src/local-dev/index.js.map +1 -0
- package/src/local-dev/portless.d.ts +15 -0
- package/src/local-dev/portless.js +115 -0
- package/src/local-dev/portless.js.map +1 -0
- package/src/local-dev/ports.d.ts +10 -0
- package/src/local-dev/ports.js +39 -0
- package/src/local-dev/ports.js.map +1 -0
- package/src/local-dev/proxy.d.ts +37 -0
- package/src/local-dev/proxy.js +271 -0
- package/src/local-dev/proxy.js.map +1 -0
- package/src/local-dev/tls.d.ts +24 -0
- package/src/local-dev/tls.js +294 -0
- package/src/local-dev/tls.js.map +1 -0
- package/src/ownership/composition.d.ts +16 -0
- package/src/ownership/composition.js +125 -0
- package/src/ownership/composition.js.map +1 -0
- package/src/ownership/foundation-record.d.ts +66 -0
- package/src/ownership/foundation-record.js +108 -0
- package/src/ownership/foundation-record.js.map +1 -0
- package/src/ownership/hash.d.ts +2 -0
- package/src/ownership/hash.js +10 -0
- package/src/ownership/hash.js.map +1 -0
- package/src/ownership/index.d.ts +6 -0
- package/src/ownership/index.js +10 -0
- package/src/ownership/index.js.map +1 -0
- package/src/ownership/json-ownership.d.ts +13 -0
- package/src/ownership/json-ownership.js +147 -0
- package/src/ownership/json-ownership.js.map +1 -0
- package/src/ownership/record.d.ts +186 -0
- package/src/ownership/record.js +336 -0
- package/src/ownership/record.js.map +1 -0
- package/src/ownership/workspace-record.d.ts +66 -0
- package/src/ownership/workspace-record.js +108 -0
- package/src/ownership/workspace-record.js.map +1 -0
- package/src/repository-policy/aurora-preflight.d.ts +15 -0
- package/src/repository-policy/aurora-preflight.js +45 -0
- package/src/repository-policy/aurora-preflight.js.map +1 -0
- package/src/repository-policy/deployment-plan.d.ts +24 -0
- package/src/repository-policy/deployment-plan.js +124 -0
- package/src/repository-policy/deployment-plan.js.map +1 -0
- package/src/repository-policy/foundation-profile.d.ts +20 -0
- package/src/repository-policy/foundation-profile.js +45 -0
- package/src/repository-policy/foundation-profile.js.map +1 -0
- package/src/repository-policy/index.d.ts +4 -0
- package/src/repository-policy/index.js +8 -0
- package/src/repository-policy/index.js.map +1 -0
- package/src/repository-policy/policy.d.ts +59 -0
- package/src/repository-policy/policy.js +274 -0
- package/src/repository-policy/policy.js.map +1 -0
- package/src/schemas/blueprint-input-schema-v1.json +23 -0
- package/src/schemas/blueprint-v1.json +186 -0
- package/src/schemas/foundation-ownership-v2.json +42 -0
- package/src/schemas/foundation-requirement-v1.json +32 -0
- package/src/schemas/generated-ownership-v2.json +117 -0
- package/src/schemas/repository-policy-v1.json +58 -0
- package/src/schemas/workspace-ownership-v2.json +42 -0
- package/src/validation.d.ts +14 -0
- package/src/validation.js +14 -0
- package/src/validation.js.map +1 -0
- package/src/work-markers/index.d.ts +1 -0
- package/src/work-markers/index.js +5 -0
- package/src/work-markers/index.js.map +1 -0
- package/src/work-markers/work-markers.d.ts +39 -0
- package/src/work-markers/work-markers.js +359 -0
- package/src/work-markers/work-markers.js.map +1 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Empire Builder Kit local fleet",
|
|
5
|
+
"description": "Run selected Product Slices locally behind one checkout-isolated HTTPS origin and route the rest to the development Foundation.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"appData": { "type": "string" },
|
|
10
|
+
"developmentRouterUrl": { "type": "string" },
|
|
11
|
+
"hostSuffix": { "type": "string", "default": "ebk.localhost" },
|
|
12
|
+
"maxRestartAttempts": {
|
|
13
|
+
"description": "Maximum automatic restarts for a repeatedly failing selected Slice.",
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"minimum": 0,
|
|
16
|
+
"default": 3
|
|
17
|
+
},
|
|
18
|
+
"profile": { "type": "string" },
|
|
19
|
+
"region": { "type": "string" },
|
|
20
|
+
"safeMethodFallback": { "type": "boolean", "default": false },
|
|
21
|
+
"slices": {
|
|
22
|
+
"description": "Comma-separated Product Slice names to run locally.",
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"sstMode": {
|
|
26
|
+
"description": "SST dev presentation mode for fleet-launched Slices. mono is safe for agents and non-cursor-addressable terminals; multiplexer opts into SST's interactive default.",
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["mono", "multiplexer"],
|
|
29
|
+
"default": "mono"
|
|
30
|
+
},
|
|
31
|
+
"stage": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"required": ["slices", "stage"]
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
import type { FoundationRequirement } from '../../foundation/requirements.js';
|
|
3
|
+
interface FoundationPreflightOptions {
|
|
4
|
+
advisory?: boolean;
|
|
5
|
+
capabilities?: FoundationRequirement['capabilities'];
|
|
6
|
+
contract?: string;
|
|
7
|
+
deployIfMissing?: boolean;
|
|
8
|
+
foundationProject?: string;
|
|
9
|
+
foundationStage?: string;
|
|
10
|
+
profile?: string;
|
|
11
|
+
region?: string;
|
|
12
|
+
stage: string;
|
|
13
|
+
}
|
|
14
|
+
declare const executor: PromiseExecutor<FoundationPreflightOptions>;
|
|
15
|
+
export default executor;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const preflight_js_1 = require("../../foundation/preflight.js");
|
|
5
|
+
const discovery_js_1 = require("../../foundation/discovery.js");
|
|
6
|
+
const stages_js_1 = require("../../foundation/stages.js");
|
|
7
|
+
const index_js_1 = require("../../repository-policy/index.js");
|
|
8
|
+
const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
|
|
9
|
+
async function deployFoundation(options, context, foundationStage) {
|
|
10
|
+
const project = options.foundationProject?.trim() || 'foundation';
|
|
11
|
+
const root = context.projectsConfigurations?.projects[project]?.root;
|
|
12
|
+
if (!root) {
|
|
13
|
+
devkit_1.logger.error(`[foundation-preflight] Foundation project ${project} is not registered in the Nx workspace.`);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
devkit_1.logger.info(`[foundation-preflight] deploying ${project} at canonical stage ${foundationStage}.`);
|
|
17
|
+
const result = await (0, run_sst_command_js_1.runSstCommand)('deploy', {
|
|
18
|
+
cwd: root,
|
|
19
|
+
...(options.profile?.trim() ? { profile: options.profile.trim() } : {}),
|
|
20
|
+
stage: foundationStage,
|
|
21
|
+
stageMode: 'foundation',
|
|
22
|
+
}, { ...context, projectName: project });
|
|
23
|
+
return result.success;
|
|
24
|
+
}
|
|
25
|
+
const executor = async (options, context) => {
|
|
26
|
+
let stages;
|
|
27
|
+
try {
|
|
28
|
+
stages = (0, stages_js_1.resolveFoundationStages)({
|
|
29
|
+
consumerStage: options.stage,
|
|
30
|
+
foundationStage: options.foundationStage ?? process.env.EBK_FOUNDATION_STAGE,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
devkit_1.logger.error(error instanceof Error ? error.message : String(error));
|
|
35
|
+
return { success: false };
|
|
36
|
+
}
|
|
37
|
+
if (stages.consumerStage === 'production') {
|
|
38
|
+
try {
|
|
39
|
+
if (!context.projectName) {
|
|
40
|
+
throw new Error('Production Foundation preflight requires an Nx Product Slice project name.');
|
|
41
|
+
}
|
|
42
|
+
(0, index_js_1.assertRepositoryPolicyRequest)(context.root, {
|
|
43
|
+
action: 'deploy',
|
|
44
|
+
projects: [{ kind: 'slice', name: context.projectName }],
|
|
45
|
+
stage: stages.consumerStage,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
devkit_1.logger.error(error instanceof Error ? error.message : String(error));
|
|
50
|
+
return { success: false };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const requestedRegion = options.region?.trim() ||
|
|
54
|
+
process.env.AWS_REGION?.trim() ||
|
|
55
|
+
process.env.AWS_DEFAULT_REGION?.trim();
|
|
56
|
+
const reader = (0, preflight_js_1.createFoundationParameterReader)({
|
|
57
|
+
profile: options.profile,
|
|
58
|
+
region: requestedRegion,
|
|
59
|
+
});
|
|
60
|
+
let region = requestedRegion ?? 'default';
|
|
61
|
+
try {
|
|
62
|
+
region = await reader.resolveRegion();
|
|
63
|
+
let report = await (0, preflight_js_1.evaluateFoundationPreflight)({
|
|
64
|
+
consumerStage: stages.consumerStage,
|
|
65
|
+
foundationStage: stages.foundationStage,
|
|
66
|
+
readParameters: reader.read,
|
|
67
|
+
region,
|
|
68
|
+
requirement: {
|
|
69
|
+
capabilities: options.capabilities ?? discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.capabilities,
|
|
70
|
+
contract: options.contract ?? discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.contract,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
if (report.state === 'absent' &&
|
|
74
|
+
options.deployIfMissing === true &&
|
|
75
|
+
!stages.mapped) {
|
|
76
|
+
if (stages.foundationStage === 'staging' ||
|
|
77
|
+
stages.foundationStage === 'production') {
|
|
78
|
+
devkit_1.logger.error(`[foundation-preflight] ${stages.foundationStage} Foundation is absent. Protected workflows must run the Foundation target and its profile capability preflight before Product Slices; Foundation auto-deploy is disabled for protected stages.`);
|
|
79
|
+
return { success: false };
|
|
80
|
+
}
|
|
81
|
+
const deployed = await deployFoundation(options, context, stages.foundationStage);
|
|
82
|
+
if (!deployed)
|
|
83
|
+
return { success: false };
|
|
84
|
+
report = await (0, preflight_js_1.evaluateFoundationPreflight)({
|
|
85
|
+
consumerStage: stages.consumerStage,
|
|
86
|
+
foundationStage: stages.foundationStage,
|
|
87
|
+
readParameters: reader.read,
|
|
88
|
+
region,
|
|
89
|
+
requirement: {
|
|
90
|
+
capabilities: options.capabilities ??
|
|
91
|
+
discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.capabilities,
|
|
92
|
+
contract: options.contract ?? discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.contract,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const message = (0, preflight_js_1.formatFoundationPreflightReport)(report);
|
|
97
|
+
if (report.ok) {
|
|
98
|
+
devkit_1.logger.info(message);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
devkit_1.logger.error(message);
|
|
102
|
+
}
|
|
103
|
+
return { success: report.ok || options.advisory === true };
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
107
|
+
if (options.advisory === true) {
|
|
108
|
+
devkit_1.logger.warn(`[foundation-preflight] consumerStage=${stages.consumerStage} foundationStage=${stages.foundationStage} region=${region}: skipped because AWS SSM lookup is unavailable. ${message}`);
|
|
109
|
+
return { success: true };
|
|
110
|
+
}
|
|
111
|
+
devkit_1.logger.error(`[foundation-preflight] consumerStage=${stages.consumerStage} foundationStage=${stages.foundationStage} region=${region}: AWS SSM lookup failed. ${message}`);
|
|
112
|
+
return { success: false };
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
exports.default = executor;
|
|
116
|
+
//# sourceMappingURL=foundation-preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundation-preflight.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/foundation-preflight/foundation-preflight.ts"],"names":[],"mappings":";;AAAA,uCAAgF;AAChF,gEAIuC;AACvC,gEAAgF;AAEhF,0DAAqE;AACrE,+DAAiF;AACjF,4EAAoE;AAcpE,KAAK,UAAU,gBAAgB,CAC7B,OAAmC,EACnC,OAAwB,EACxB,eAAuB;IAEvB,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,YAAY,CAAC;IAClE,MAAM,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IACrE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,eAAM,CAAC,KAAK,CACV,6CAA6C,OAAO,yCAAyC,CAC9F,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAM,CAAC,IAAI,CACT,oCAAoC,OAAO,uBAAuB,eAAe,GAAG,CACrF,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,IAAA,kCAAa,EAChC,QAAQ,EACR;QACE,GAAG,EAAE,IAAI;QACT,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,KAAK,EAAE,eAAe;QACtB,SAAS,EAAE,YAAY;KACxB,EACD,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CACrC,CAAC;IACF,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,QAAQ,GAAgD,KAAK,EACjE,OAAO,EACP,OAAO,EACP,EAAE;IACF,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAA,mCAAuB,EAAC;YAC/B,aAAa,EAAE,OAAO,CA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
+
"version": 2,
|
|
4
|
+
"title": "Empire Builder Kit Foundation preflight",
|
|
5
|
+
"description": "Validate the deployed Standard Foundation discovery contract before operating a Product Slice.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"stage": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
12
|
+
"default": "development"
|
|
13
|
+
},
|
|
14
|
+
"foundationStage": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$"
|
|
17
|
+
},
|
|
18
|
+
"region": { "type": "string" },
|
|
19
|
+
"profile": { "type": "string" },
|
|
20
|
+
"contract": { "type": "string", "default": "^1.0.0" },
|
|
21
|
+
"capabilities": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": { "type": "string" },
|
|
24
|
+
"uniqueItems": true
|
|
25
|
+
},
|
|
26
|
+
"advisory": { "type": "boolean", "default": false },
|
|
27
|
+
"deployIfMissing": { "type": "boolean", "default": false },
|
|
28
|
+
"foundationProject": { "type": "string", "default": "foundation" }
|
|
29
|
+
},
|
|
30
|
+
"required": ["stage"]
|
|
31
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const index_js_1 = require("../../repository-policy/index.js");
|
|
5
|
+
const stages_js_1 = require("../../foundation/stages.js");
|
|
6
|
+
const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
|
|
7
|
+
const executor = async (options, context) => {
|
|
8
|
+
try {
|
|
9
|
+
const stage = (0, stages_js_1.requireFoundationStage)(options.stage);
|
|
10
|
+
if (stage === 'development') {
|
|
11
|
+
devkit_1.logger.info('[foundation-profile-preflight] development uses the generated non-production profile; no protected profile check is required.');
|
|
12
|
+
return { success: true };
|
|
13
|
+
}
|
|
14
|
+
(0, run_sst_command_js_1.assertSstLifecyclePolicy)('deploy', stage);
|
|
15
|
+
(0, index_js_1.assertRepositoryPolicyRequest)(context.root, {
|
|
16
|
+
action: 'deploy',
|
|
17
|
+
projects: [{ kind: 'foundation', name: 'foundation' }],
|
|
18
|
+
stage,
|
|
19
|
+
});
|
|
20
|
+
const requestedRegion = options.region?.trim() ||
|
|
21
|
+
process.env.AWS_REGION?.trim() ||
|
|
22
|
+
process.env.AWS_DEFAULT_REGION?.trim();
|
|
23
|
+
const reader = (0, index_js_1.createAuroraProfileCapabilityReader)({
|
|
24
|
+
...(options.profile?.trim() ? { profile: options.profile.trim() } : {}),
|
|
25
|
+
...(requestedRegion ? { region: requestedRegion } : {}),
|
|
26
|
+
});
|
|
27
|
+
const region = requestedRegion ?? (await reader.resolveRegion());
|
|
28
|
+
const report = (0, index_js_1.evaluateAuroraProfileCapability)(await reader.read(), region);
|
|
29
|
+
if (!report.ok) {
|
|
30
|
+
throw new Error(`Aurora ${report.engine} ${report.engineVersion} is not orderable as db.serverless in ${report.region}; protected Foundation deployment is blocked before mutation.`);
|
|
31
|
+
}
|
|
32
|
+
devkit_1.logger.info(`[foundation-profile-preflight] Aurora ${report.engine} ${report.engineVersion} is orderable as db.serverless in ${report.region}.`);
|
|
33
|
+
return { success: true };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
devkit_1.logger.error(error instanceof Error ? error.message : String(error));
|
|
37
|
+
return { success: false };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.default = executor;
|
|
41
|
+
//# sourceMappingURL=foundation-profile-preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundation-profile-preflight.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/foundation-profile-preflight/foundation-profile-preflight.ts"],"names":[],"mappings":";;AAAA,uCAA0D;AAC1D,+DAI0C;AAC1C,0DAAoE;AACpE,4EAA+E;AAQ/E,M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CAAC;QAC5E,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,yCAAyC,MAAM,CAAC,MAAM,+DAA+D,CACrK,CAAC;QACJ,CAAC;QACD,eAAM,CAAC,IAAI,CACT,yCAAyC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,qCAAqC,MAAM,CAAC,MAAM,GAAG,CACpI,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Empire Builder Kit production Foundation profile preflight",
|
|
5
|
+
"description": "Verify the pinned Aurora Serverless engine is orderable in the selected Region before Foundation mutation.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"stage": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
12
|
+
"default": "development"
|
|
13
|
+
},
|
|
14
|
+
"profile": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Optional local AWS profile. Protected stages are still restricted to the generated GitHub workflow."
|
|
17
|
+
},
|
|
18
|
+
"region": { "type": "string" }
|
|
19
|
+
},
|
|
20
|
+
"required": ["stage"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
interface FoundationRemovePreflightOptions {
|
|
3
|
+
profile?: string;
|
|
4
|
+
region?: string;
|
|
5
|
+
stage: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function evaluateFoundationRemoval(foundationStage: string, registrationNames: readonly string[]): {
|
|
8
|
+
message: string;
|
|
9
|
+
success: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function productSliceRegistrationName(foundationStage: string, parameterName: string | undefined): string;
|
|
12
|
+
declare const executor: PromiseExecutor<FoundationRemovePreflightOptions>;
|
|
13
|
+
export default executor;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.evaluateFoundationRemoval = evaluateFoundationRemoval;
|
|
4
|
+
exports.productSliceRegistrationName = productSliceRegistrationName;
|
|
5
|
+
const client_ssm_1 = require("@aws-sdk/client-ssm");
|
|
6
|
+
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const discovery_js_1 = require("../../foundation/discovery.js");
|
|
9
|
+
function evaluateFoundationRemoval(foundationStage, registrationNames) {
|
|
10
|
+
if (registrationNames.length === 0) {
|
|
11
|
+
return {
|
|
12
|
+
message: `[foundation-remove-preflight] foundationStage=${foundationStage}: no Product Slice registrations remain.`,
|
|
13
|
+
success: true,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
message: `[foundation-remove-preflight] foundationStage=${foundationStage}: Foundation removal is blocked by Product Slice registration records: ${registrationNames.join(', ')}. Remove known consumer-stage slice stacks first; investigate every unrecognized record before retrying.`,
|
|
18
|
+
success: false,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function productSliceRegistrationName(foundationStage, parameterName) {
|
|
22
|
+
const prefix = `${(0, discovery_js_1.productSliceRegistrationRoot)(foundationStage)}/`;
|
|
23
|
+
if (!parameterName?.startsWith(prefix)) {
|
|
24
|
+
return `[unrecognized registration] ${parameterName ?? '<missing parameter name>'}`;
|
|
25
|
+
}
|
|
26
|
+
const relativeName = parameterName.slice(prefix.length);
|
|
27
|
+
return /^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/.test(relativeName)
|
|
28
|
+
? relativeName
|
|
29
|
+
: `[unrecognized registration] ${parameterName}`;
|
|
30
|
+
}
|
|
31
|
+
const executor = async (options) => {
|
|
32
|
+
const region = options.region?.trim() ||
|
|
33
|
+
process.env.AWS_REGION?.trim() ||
|
|
34
|
+
process.env.AWS_DEFAULT_REGION?.trim();
|
|
35
|
+
const client = new client_ssm_1.SSMClient({
|
|
36
|
+
...(options.profile
|
|
37
|
+
? { credentials: (0, credential_providers_1.fromIni)({ profile: options.profile }) }
|
|
38
|
+
: {}),
|
|
39
|
+
...(region ? { region } : {}),
|
|
40
|
+
});
|
|
41
|
+
const registrations = [];
|
|
42
|
+
let nextToken;
|
|
43
|
+
try {
|
|
44
|
+
do {
|
|
45
|
+
const response = await client.send(new client_ssm_1.GetParametersByPathCommand({
|
|
46
|
+
NextToken: nextToken,
|
|
47
|
+
Path: (0, discovery_js_1.productSliceRegistrationRoot)(options.stage),
|
|
48
|
+
Recursive: true,
|
|
49
|
+
}));
|
|
50
|
+
registrations.push(...(response.Parameters ?? []).map(({ Name }) => productSliceRegistrationName(options.stage, Name)));
|
|
51
|
+
nextToken = response.NextToken;
|
|
52
|
+
} while (nextToken);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
devkit_1.logger.error(`[foundation-remove-preflight] foundationStage=${options.stage}: unable to inspect Product Slice registrations. ${error instanceof Error ? error.message : String(error)}`);
|
|
56
|
+
return { success: false };
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
client.destroy();
|
|
60
|
+
}
|
|
61
|
+
const result = evaluateFoundationRemoval(options.stage, registrations.sort());
|
|
62
|
+
if (result.success)
|
|
63
|
+
devkit_1.logger.info(result.message);
|
|
64
|
+
else
|
|
65
|
+
devkit_1.logger.error(result.message);
|
|
66
|
+
return { success: result.success };
|
|
67
|
+
};
|
|
68
|
+
exports.default = executor;
|
|
69
|
+
//# sourceMappingURL=foundation-remove-preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundation-remove-preflight.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/foundation-remove-preflight/foundation-remove-preflight.ts"],"names":[],"mappings":";;AAWA,8DAcC;AAED,oEAYC;AAvCD,oDAA4E;AAC5E,wEAAwD;AACxD,uCAA0D;AAC1D,gEAA6E;AAQ7E,SAAgB,yBAAyB,CACvC,eAAuB,EACvB,iBAAoC;IAEpC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,iDAAiD,eAAe,0CAA0C;YACnH,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO,EAAE,iDAAiD,eAAe,0EAA0E,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,0GAA0G;QACzR,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAED,SAAgB,4BAA4B,CAC1C,eAAuB,EACvB,aAAiC;IAEjC,MAAM,MAAM,GAAG,GAAG,IAAA,2CAA4B,EAAC,eAAe,CAAC,GAAG,CAAC;IACnE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,OAAO,+BAA+B,aAAa,IAAI,0BAA0B,EAAE,CAAC;IACtF,CAAC;IACD,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxD,OAAO,0CAA0C,CAAC,IAAI,CAAC,YAAY,CAAC;QAClE,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,+BAA+B,aAAa,EAAE,CA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iDAAiD,OAAO,CAAC,KAAK,oDAAoD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC3K,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,yBAAyB,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9E,IAAI,MAAM,CAAC,OAAO;QAAE,eAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;;QAC3C,eAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Empire Builder Kit Foundation removal preflight",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"stage": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
11
|
+
"default": "development"
|
|
12
|
+
},
|
|
13
|
+
"region": { "type": "string" },
|
|
14
|
+
"profile": { "type": "string" }
|
|
15
|
+
},
|
|
16
|
+
"required": ["stage"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
interface GitHubBootstrapExecutorOptions {
|
|
3
|
+
apply?: boolean;
|
|
4
|
+
productionReviewerIds?: string;
|
|
5
|
+
repository?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const executor: PromiseExecutor<GitHubBootstrapExecutorOptions>;
|
|
8
|
+
export default executor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const index_js_1 = require("../../git-policy/index.js");
|
|
5
|
+
const index_js_2 = require("../../repository-policy/index.js");
|
|
6
|
+
function parseReviewerIds(value) {
|
|
7
|
+
if (!value?.trim())
|
|
8
|
+
return [];
|
|
9
|
+
return value.split(',').map((item) => Number(item.trim()));
|
|
10
|
+
}
|
|
11
|
+
const executor = async (options, context) => {
|
|
12
|
+
try {
|
|
13
|
+
const policy = (0, index_js_2.readRepositoryOperatingPolicy)(context.root);
|
|
14
|
+
const report = await (0, index_js_1.runGitHubBootstrap)({
|
|
15
|
+
apply: options.apply === true,
|
|
16
|
+
productionApprovalMode: policy.productionApproval.mode,
|
|
17
|
+
productionReviewerIds: parseReviewerIds(options.productionReviewerIds),
|
|
18
|
+
repository: options.repository?.trim() || process.env.GH_REPO?.trim() || '',
|
|
19
|
+
token: process.env.GH_TOKEN?.trim() || process.env.GITHUB_TOKEN?.trim() || '',
|
|
20
|
+
});
|
|
21
|
+
devkit_1.logger.info(JSON.stringify(report, null, 2));
|
|
22
|
+
return { success: options.apply ? report.ready : true };
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
devkit_1.logger.error(error instanceof Error ? error.message : String(error));
|
|
26
|
+
return { success: false };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.default = executor;
|
|
30
|
+
//# sourceMappingURL=github-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-bootstrap.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/github-bootstrap/github-bootstrap.ts"],"names":[],"mappings":";;AAAA,uCAA0D;AAC1D,wDAA+D;AAC/D,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,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Empire Builder Kit GitHub bootstrap",
|
|
5
|
+
"description": "Report or explicitly apply protected repository rules and environments without creating secrets, branches, or credentials.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
|
|
12
|
+
"description": "Explicit GitHub owner/repository target."
|
|
13
|
+
},
|
|
14
|
+
"apply": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": false,
|
|
17
|
+
"description": "Apply the reported GitHub settings. Omit for the default read-only report."
|
|
18
|
+
},
|
|
19
|
+
"productionReviewerIds": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"pattern": "^[1-9][0-9]*(,[1-9][0-9]*)*$",
|
|
22
|
+
"description": "Optional comma-separated GitHub user IDs when committed Repository Operating Policy selects environment-reviewer mode. Existing reviewers are preserved when omitted."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
|
|
4
|
+
const executor = (options, context) => (0, run_sst_command_js_1.runSstCommand)('refresh', options, context);
|
|
5
|
+
exports.default = executor;
|
|
6
|
+
//# sourceMappingURL=refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/refresh/refresh.ts"],"names":[],"mappings":";;AACA,4EAG6C;AAE7C,MAAM,QAAQ,GAAyC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC1E,IAAA,kCAAa,EAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAE7C,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
|
|
4
|
+
const executor = (options, context) => (0, run_sst_command_js_1.runSstCommand)('remove', options, context);
|
|
5
|
+
exports.default = executor;
|
|
6
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/remove/remove.ts"],"names":[],"mappings":";;AACA,4EAG6C;AAE7C,MAAM,QAAQ,GAAyC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC1E,IAAA,kCAAa,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAE5C,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { type FoundationStageResolution } from '../../foundation/stages.js';
|
|
3
|
+
export type SstLifecycleCommand = 'deploy' | 'dev' | 'refresh' | 'remove' | 'unlock';
|
|
4
|
+
export interface SstLifecycleOptions {
|
|
5
|
+
args?: string[];
|
|
6
|
+
cwd?: string;
|
|
7
|
+
foundationStage?: string;
|
|
8
|
+
profile?: string;
|
|
9
|
+
stage: string;
|
|
10
|
+
stageMode: 'consumer' | 'foundation';
|
|
11
|
+
target?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SstCommandInvocation {
|
|
14
|
+
args: string[];
|
|
15
|
+
cwd: string;
|
|
16
|
+
environment: {
|
|
17
|
+
EBK_CONSUMER_STAGE: string;
|
|
18
|
+
EBK_FOUNDATION_STAGE: string;
|
|
19
|
+
EBK_PRODUCTION_FOUNDATION_PROFILE?: string;
|
|
20
|
+
};
|
|
21
|
+
executable: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function createSstChildEnvironment(ambient: NodeJS.ProcessEnv, invocation: SstCommandInvocation['environment']): NodeJS.ProcessEnv;
|
|
24
|
+
export declare function assertSafeSstForwardedArguments(args: readonly string[]): void;
|
|
25
|
+
export declare function resolveSstDevMode(environment: NodeJS.ProcessEnv, forwardedArguments?: readonly string[]): 'basic' | 'mono' | undefined;
|
|
26
|
+
export declare function assertSstLifecyclePolicy(command: SstLifecycleCommand, stage: string, environment?: NodeJS.ProcessEnv): void;
|
|
27
|
+
export declare function resolveSstLifecycleStages(options: SstLifecycleOptions, environment?: NodeJS.ProcessEnv): FoundationStageResolution;
|
|
28
|
+
export declare function buildSstCommandInvocation(command: SstLifecycleCommand, options: SstLifecycleOptions, context: ExecutorContext, environment?: NodeJS.ProcessEnv): SstCommandInvocation;
|
|
29
|
+
export declare function runSstCommand(command: SstLifecycleCommand, options: SstLifecycleOptions, context: ExecutorContext): Promise<{
|
|
30
|
+
success: boolean;
|
|
31
|
+
}>;
|