@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,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BUILTIN_BLUEPRINT_NAME = exports.BUILTIN_BLUEPRINT_REFERENCE = void 0;
|
|
4
|
+
exports.parseBlueprintPackageReference = parseBlueprintPackageReference;
|
|
5
|
+
exports.resolveBlueprint = resolveBlueprint;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const semver_1 = require("semver");
|
|
9
|
+
const inputs_js_1 = require("./inputs.js");
|
|
10
|
+
const manifest_js_1 = require("./manifest.js");
|
|
11
|
+
exports.BUILTIN_BLUEPRINT_REFERENCE = 'standard';
|
|
12
|
+
exports.BUILTIN_BLUEPRINT_NAME = '@empire-builder-kit/blueprint-standard';
|
|
13
|
+
const builtInInputSchema = {
|
|
14
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
properties: {},
|
|
17
|
+
type: 'object',
|
|
18
|
+
};
|
|
19
|
+
function readEngineVersion() {
|
|
20
|
+
const packageJsonPath = (0, node_path_1.join)(__dirname, '../../package.json');
|
|
21
|
+
const packageJson = readJson(packageJsonPath, '@empire-builder-kit/nx package.json');
|
|
22
|
+
if (typeof packageJson !== 'object' ||
|
|
23
|
+
packageJson === null ||
|
|
24
|
+
!('version' in packageJson) ||
|
|
25
|
+
!(0, manifest_js_1.isExactSemanticVersion)(packageJson.version)) {
|
|
26
|
+
throw new Error(`Unable to resolve the installed @empire-builder-kit/nx version from ${packageJsonPath}.`);
|
|
27
|
+
}
|
|
28
|
+
return packageJson.version;
|
|
29
|
+
}
|
|
30
|
+
function createBuiltInManifest(engineVersion) {
|
|
31
|
+
const engine = (0, semver_1.parse)(engineVersion);
|
|
32
|
+
if (!engine) {
|
|
33
|
+
throw new Error(`EBK engine version ${engineVersion} is not valid SemVer.`);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
$schema: 'https://empirebuilderkit.dev/schemas/blueprint-v1.json',
|
|
37
|
+
engine: engineVersion,
|
|
38
|
+
foundation: {
|
|
39
|
+
capabilities: [
|
|
40
|
+
'network',
|
|
41
|
+
'routing',
|
|
42
|
+
'postgres',
|
|
43
|
+
'identity',
|
|
44
|
+
'events',
|
|
45
|
+
'observability',
|
|
46
|
+
'configuration',
|
|
47
|
+
'deployment',
|
|
48
|
+
],
|
|
49
|
+
contract: '^1',
|
|
50
|
+
},
|
|
51
|
+
generator: './built-in/standard.js',
|
|
52
|
+
inputs: './built-in/standard-inputs.json',
|
|
53
|
+
kind: 'slice',
|
|
54
|
+
...(engine.major === 1
|
|
55
|
+
? {
|
|
56
|
+
migrations: [
|
|
57
|
+
{
|
|
58
|
+
affectedManagedSurfaces: ['standard-product-slice'],
|
|
59
|
+
contracts: { consumes: [], publishes: [] },
|
|
60
|
+
databaseChange: 'manual',
|
|
61
|
+
dependencyChanges: [
|
|
62
|
+
'Reinstall the v1 framework and adopter dependencies in a clean workspace.',
|
|
63
|
+
],
|
|
64
|
+
from: '>=0.0.0-0 <1.0.0-0',
|
|
65
|
+
id: 'standard-pre-v1-to-v1',
|
|
66
|
+
infrastructureChanges: [
|
|
67
|
+
'Deploy a replacement v1 Product Slice before retiring the pre-v1 deployment.',
|
|
68
|
+
],
|
|
69
|
+
maintenanceWindowRequired: false,
|
|
70
|
+
manualSuccession: './migrations/standard-pre-v1-to-v1.md',
|
|
71
|
+
planSchemaVersion: 1,
|
|
72
|
+
preflight: ['workspace-health', 'foundation:verify'],
|
|
73
|
+
rollback: {
|
|
74
|
+
afterPointOfNoReturn: 'Restore from the retained source deployment and database backup.',
|
|
75
|
+
beforePointOfNoReturn: 'Route traffic back to the retained pre-v1 deployment.',
|
|
76
|
+
pointOfNoReturn: 'Writes resume after traffic moves to the v1 replacement.',
|
|
77
|
+
},
|
|
78
|
+
to: engineVersion,
|
|
79
|
+
verification: ['verify'],
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
: {}),
|
|
84
|
+
name: exports.BUILTIN_BLUEPRINT_NAME,
|
|
85
|
+
type: manifest_js_1.BLUEPRINT_PACKAGE_TYPE,
|
|
86
|
+
verification: ['verify'],
|
|
87
|
+
version: engineVersion,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function readJson(filePath, label) {
|
|
91
|
+
try {
|
|
92
|
+
return JSON.parse((0, node_fs_1.readFileSync)(filePath, 'utf8'));
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw new Error(`Unable to read ${label} at ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function resolvePackageFile(packageRoot, packagePath) {
|
|
99
|
+
const resolvedRoot = (0, node_path_1.resolve)(packageRoot);
|
|
100
|
+
const resolvedPath = (0, node_path_1.resolve)(resolvedRoot, packagePath);
|
|
101
|
+
const relativePath = (0, node_path_1.relative)(resolvedRoot, resolvedPath);
|
|
102
|
+
if (relativePath === '' ||
|
|
103
|
+
relativePath.startsWith('..') ||
|
|
104
|
+
(0, node_path_1.isAbsolute)(relativePath)) {
|
|
105
|
+
throw new Error(`Blueprint package path ${packagePath} escapes package root ${resolvedRoot}.`);
|
|
106
|
+
}
|
|
107
|
+
if (!(0, node_fs_1.existsSync)(resolvedPath)) {
|
|
108
|
+
throw new Error(`Blueprint package file does not exist: ${resolvedPath}`);
|
|
109
|
+
}
|
|
110
|
+
return resolvedPath;
|
|
111
|
+
}
|
|
112
|
+
function isTrusted(name, policy) {
|
|
113
|
+
return (policy?.packages ?? []).some((entry) => {
|
|
114
|
+
if (entry.endsWith('/*')) {
|
|
115
|
+
return name.startsWith(`${entry.slice(0, -1)}`);
|
|
116
|
+
}
|
|
117
|
+
return entry === name;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function resolveManifestAssets(packageRoot, manifest) {
|
|
121
|
+
for (const migration of manifest.migrations ?? []) {
|
|
122
|
+
resolvePackageFile(packageRoot, migration.manualSuccession);
|
|
123
|
+
if (migration.executor) {
|
|
124
|
+
resolvePackageFile(packageRoot, migration.executor);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (const secret of manifest.secrets ?? []) {
|
|
128
|
+
resolvePackageFile(packageRoot, secret.documentation);
|
|
129
|
+
if (secret.schema) {
|
|
130
|
+
resolvePackageFile(packageRoot, secret.schema);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function parseBlueprintPackageReference(reference) {
|
|
135
|
+
const versionSeparator = reference.lastIndexOf('@');
|
|
136
|
+
if (versionSeparator <= 0) {
|
|
137
|
+
throw new Error(`Blueprint reference ${reference} must pin an exact version (for example @vendor/ebk-blueprint-billing@1.2.0).`);
|
|
138
|
+
}
|
|
139
|
+
const name = reference.slice(0, versionSeparator);
|
|
140
|
+
const version = reference.slice(versionSeparator + 1);
|
|
141
|
+
if (!name || !(0, manifest_js_1.isExactSemanticVersion)(version)) {
|
|
142
|
+
throw new Error(`Blueprint reference ${reference} must contain a valid package name and exact semantic version.`);
|
|
143
|
+
}
|
|
144
|
+
return { name, version };
|
|
145
|
+
}
|
|
146
|
+
function resolveBlueprint({ engineVersion, localPackages = {}, reference = exports.BUILTIN_BLUEPRINT_REFERENCE, trust, workspaceRoot, }) {
|
|
147
|
+
const resolvedEngineVersion = engineVersion ?? readEngineVersion();
|
|
148
|
+
if (reference === exports.BUILTIN_BLUEPRINT_REFERENCE) {
|
|
149
|
+
const packageRoot = (0, node_path_1.resolve)(__dirname, '../..');
|
|
150
|
+
const manifestResult = (0, manifest_js_1.validateBlueprintManifest)(createBuiltInManifest(resolvedEngineVersion));
|
|
151
|
+
if (!manifestResult.valid) {
|
|
152
|
+
throw new Error(`Invalid built-in Blueprint manifest:\n${manifestResult.issues
|
|
153
|
+
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
154
|
+
.join('\n')}`);
|
|
155
|
+
}
|
|
156
|
+
const manifest = manifestResult.value;
|
|
157
|
+
resolveManifestAssets(packageRoot, manifest);
|
|
158
|
+
return {
|
|
159
|
+
inputSchema: builtInInputSchema,
|
|
160
|
+
manifest,
|
|
161
|
+
packageRoot,
|
|
162
|
+
source: 'built-in',
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const parsed = parseBlueprintPackageReference(reference);
|
|
166
|
+
if (!isTrusted(parsed.name, trust)) {
|
|
167
|
+
throw new Error(`Blueprint package ${parsed.name} is not trusted. Add its exact name or scope wildcard to the workspace Blueprint trust policy before generation.`);
|
|
168
|
+
}
|
|
169
|
+
const localRoot = localPackages[parsed.name];
|
|
170
|
+
const packageRoot = localRoot
|
|
171
|
+
? (0, node_path_1.resolve)(workspaceRoot, localRoot)
|
|
172
|
+
: (0, node_path_1.join)(workspaceRoot, 'node_modules', ...parsed.name.split('/'));
|
|
173
|
+
const packageJsonPath = (0, node_path_1.join)(packageRoot, 'package.json');
|
|
174
|
+
if (!(0, node_fs_1.existsSync)(packageJsonPath)) {
|
|
175
|
+
throw new Error(`Blueprint package ${parsed.name}@${parsed.version} is not installed in the workspace and was not provided as a local package.`);
|
|
176
|
+
}
|
|
177
|
+
const packageJson = readJson(packageJsonPath, 'Blueprint package.json');
|
|
178
|
+
if (typeof packageJson !== 'object' ||
|
|
179
|
+
packageJson === null ||
|
|
180
|
+
!('name' in packageJson) ||
|
|
181
|
+
!('version' in packageJson)) {
|
|
182
|
+
throw new Error(`Blueprint package metadata is malformed: ${packageJsonPath}`);
|
|
183
|
+
}
|
|
184
|
+
if (packageJson.name !== parsed.name ||
|
|
185
|
+
packageJson.version !== parsed.version) {
|
|
186
|
+
throw new Error(`Resolved Blueprint package identity ${String(packageJson.name)}@${String(packageJson.version)} does not match requested ${parsed.name}@${parsed.version}.`);
|
|
187
|
+
}
|
|
188
|
+
const manifestPath = (0, node_path_1.join)((0, node_path_1.dirname)(packageJsonPath), 'ebk-blueprint.json');
|
|
189
|
+
const manifestResult = (0, manifest_js_1.validateBlueprintManifest)(readJson(manifestPath, 'Blueprint manifest'));
|
|
190
|
+
if (!manifestResult.valid) {
|
|
191
|
+
throw new Error(`Invalid Blueprint manifest:\n${manifestResult.issues
|
|
192
|
+
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
193
|
+
.join('\n')}`);
|
|
194
|
+
}
|
|
195
|
+
if (manifestResult.value.name !== parsed.name ||
|
|
196
|
+
manifestResult.value.version !== parsed.version) {
|
|
197
|
+
throw new Error(`Blueprint manifest identity ${manifestResult.value.name}@${manifestResult.value.version} does not match requested ${parsed.name}@${parsed.version}.`);
|
|
198
|
+
}
|
|
199
|
+
if (!(0, semver_1.satisfies)(resolvedEngineVersion, manifestResult.value.engine)) {
|
|
200
|
+
throw new Error(`Blueprint ${parsed.name}@${parsed.version} requires EBK engine ${manifestResult.value.engine}, but this workspace provides ${resolvedEngineVersion}.`);
|
|
201
|
+
}
|
|
202
|
+
resolveManifestAssets(packageRoot, manifestResult.value);
|
|
203
|
+
const inputSchemaPath = resolvePackageFile(packageRoot, manifestResult.value.inputs);
|
|
204
|
+
const inputSchemaResult = (0, inputs_js_1.validateBlueprintInputSchema)(readJson(inputSchemaPath, 'Blueprint input schema'));
|
|
205
|
+
if (!inputSchemaResult.valid) {
|
|
206
|
+
throw new Error(`Invalid Blueprint input schema:\n${inputSchemaResult.issues
|
|
207
|
+
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
|
208
|
+
.join('\n')}`);
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
generatorPath: resolvePackageFile(packageRoot, manifestResult.value.generator),
|
|
212
|
+
inputSchema: inputSchemaResult.value,
|
|
213
|
+
manifest: manifestResult.value,
|
|
214
|
+
packageRoot,
|
|
215
|
+
source: localRoot ? 'local' : 'installed',
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../../packages/nx/src/blueprints/resolver.ts"],"names":[],"mappings":";;;AAkMA,wEAmBC;AAED,4CA0HC;AAjVD,qCAAmD;AACnD,yCAAyE;AACzE,mCAA0C;AAC1C,2CAGqB;AACrB,+CAKuB;AAEV,QAAA,2BAA2B,GAAG,UAAmB,CAAC;AAClD,QAAA,sBAAsB,GACjC,wCAAiD,CAAC;AA4BpD,MAAM,kBAAkB,GAAyB;IAC/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CAAC,OAAO,CAAC,CAAC,CAAC,WAAW;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BlueprintManifest, BlueprintMigrationDeclaration } from './manifest.js';
|
|
2
|
+
export interface BlueprintIdentity {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
}
|
|
6
|
+
export type BlueprintTransitionResult = {
|
|
7
|
+
compatibilityLine: string;
|
|
8
|
+
kind: 'compatible';
|
|
9
|
+
} | {
|
|
10
|
+
compatibilityLine: string;
|
|
11
|
+
kind: 'manual-succession';
|
|
12
|
+
migration: BlueprintMigrationDeclaration;
|
|
13
|
+
} | {
|
|
14
|
+
availableMigrations: BlueprintMigrationDeclaration[];
|
|
15
|
+
compatibilityLine: string;
|
|
16
|
+
kind: 'blocked';
|
|
17
|
+
reason: 'ambiguous-migrations' | 'blueprint-identity-change' | 'source-range-mismatch' | 'undeclared';
|
|
18
|
+
};
|
|
19
|
+
export declare function blueprintCompatibilityLine(version: string): string;
|
|
20
|
+
export declare function classifyBlueprintTransition(current: BlueprintIdentity, target: BlueprintManifest): BlueprintTransitionResult;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blueprintCompatibilityLine = blueprintCompatibilityLine;
|
|
4
|
+
exports.classifyBlueprintTransition = classifyBlueprintTransition;
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
function blueprintCompatibilityLine(version) {
|
|
7
|
+
const parsed = (0, semver_1.parse)(version);
|
|
8
|
+
if (!parsed) {
|
|
9
|
+
throw new Error(`Blueprint version ${version} is not valid SemVer.`);
|
|
10
|
+
}
|
|
11
|
+
return parsed.major === 0 ? `0.${parsed.minor}.x` : `${parsed.major}.x`;
|
|
12
|
+
}
|
|
13
|
+
function classifyBlueprintTransition(current, target) {
|
|
14
|
+
const currentVersion = (0, semver_1.parse)(current.version);
|
|
15
|
+
const targetVersion = (0, semver_1.parse)(target.version);
|
|
16
|
+
if (!currentVersion) {
|
|
17
|
+
throw new Error(`Recorded Blueprint version ${current.version} is not valid SemVer.`);
|
|
18
|
+
}
|
|
19
|
+
if (!targetVersion) {
|
|
20
|
+
throw new Error(`Requested Blueprint version ${target.version} is not valid SemVer.`);
|
|
21
|
+
}
|
|
22
|
+
const compatibilityLine = blueprintCompatibilityLine(current.version);
|
|
23
|
+
if (current.name !== target.name) {
|
|
24
|
+
return {
|
|
25
|
+
availableMigrations: target.migrations ?? [],
|
|
26
|
+
compatibilityLine,
|
|
27
|
+
kind: 'blocked',
|
|
28
|
+
reason: 'blueprint-identity-change',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const compatible = currentVersion.major === targetVersion.major &&
|
|
32
|
+
(currentVersion.major !== 0 ||
|
|
33
|
+
currentVersion.minor === targetVersion.minor);
|
|
34
|
+
if (compatible)
|
|
35
|
+
return { compatibilityLine, kind: 'compatible' };
|
|
36
|
+
const migrations = target.migrations ?? [];
|
|
37
|
+
if (migrations.length === 0) {
|
|
38
|
+
return {
|
|
39
|
+
availableMigrations: [],
|
|
40
|
+
compatibilityLine,
|
|
41
|
+
kind: 'blocked',
|
|
42
|
+
reason: 'undeclared',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const matches = migrations.filter((migration) => migration.to === target.version &&
|
|
46
|
+
(0, semver_1.satisfies)(current.version, migration.from, { includePrerelease: true }));
|
|
47
|
+
if (matches.length === 1) {
|
|
48
|
+
return {
|
|
49
|
+
compatibilityLine,
|
|
50
|
+
kind: 'manual-succession',
|
|
51
|
+
migration: matches[0],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
availableMigrations: migrations,
|
|
56
|
+
compatibilityLine,
|
|
57
|
+
kind: 'blocked',
|
|
58
|
+
reason: matches.length > 1 ? 'ambiguous-migrations' : 'source-range-mismatch',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=transitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../../../../packages/nx/src/blueprints/transitions.ts"],"names":[],"mappings":";;AAgCA,gEAMC;AAED,kEA2DC;AAnGD,mCAA0C;AAgC1C,SAAgB,0BAA0B,CAAC,OAAe;IACxD,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAAO,uBAAuB,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC;AAC1E,CAAC;AAED,SAAgB,2BAA2B,CACzC,OAA0B,EAC1B,MAAyB;IAEzB,MAAM,cAAc,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,8BAA8B,OAAO,CAAC,OAAO,uBAAuB,CACrE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,+BAA+B,MAAM,CAAC,OAAO,uBAAuB,CACrE,CAAC;IACJ,CAAC;IACD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;QACjC,OAAO;YACL,mBAAmB,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE;YAC5C,iBAAiB;YACjB,IAAI,E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Property(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)('deploy', options, context);
|
|
5
|
+
exports.default = executor;
|
|
6
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/deploy/deploy.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,9 @@
|
|
|
1
|
+
import { type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
import { type ProtectedDeploymentAction, type ProtectedDeploymentStage } from '../../repository-policy/index.js';
|
|
3
|
+
interface DeploymentPlanOptions {
|
|
4
|
+
action: ProtectedDeploymentAction;
|
|
5
|
+
project?: string;
|
|
6
|
+
stage: ProtectedDeploymentStage;
|
|
7
|
+
}
|
|
8
|
+
declare const executor: PromiseExecutor<DeploymentPlanOptions>;
|
|
9
|
+
export default executor;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_fs_1 = require("node:fs");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const index_js_1 = require("../../repository-policy/index.js");
|
|
6
|
+
const index_js_2 = require("../../work-markers/index.js");
|
|
7
|
+
function writeGithubOutputs(plan) {
|
|
8
|
+
const output = process.env.GITHUB_OUTPUT?.trim();
|
|
9
|
+
if (!output)
|
|
10
|
+
return;
|
|
11
|
+
(0, node_fs_1.appendFileSync)(output, [
|
|
12
|
+
`foundation_project=${plan.foundationProject ?? ''}`,
|
|
13
|
+
`foundation_profile=${plan.effectiveProductionProfile ?? ''}`,
|
|
14
|
+
`has_slices=${plan.sliceProjects.length > 0 ? 'true' : 'false'}`,
|
|
15
|
+
`ordered_projects=${plan.orderedProjects.join(',')}`,
|
|
16
|
+
`slice_projects=${plan.sliceProjects.join(',')}`,
|
|
17
|
+
'',
|
|
18
|
+
].join('\n'), 'utf8');
|
|
19
|
+
}
|
|
20
|
+
const executor = async (options, context) => {
|
|
21
|
+
try {
|
|
22
|
+
if (options.action === 'deploy' || options.action === 'refresh') {
|
|
23
|
+
const markerReport = (0, index_js_2.scanWorkMarkers)(context.root);
|
|
24
|
+
devkit_1.logger.info((0, index_js_2.formatWorkMarkerReport)(markerReport));
|
|
25
|
+
(0, index_js_2.assertWorkMarkerReport)(markerReport, { protectedPromotion: true });
|
|
26
|
+
}
|
|
27
|
+
const policy = (0, index_js_1.readRepositoryOperatingPolicy)(context.root);
|
|
28
|
+
const plan = (0, index_js_1.createProtectedDeploymentPlan)(policy, {
|
|
29
|
+
action: options.action,
|
|
30
|
+
projects: Object.entries(context.projectsConfigurations?.projects ?? {}).map(([name, project]) => ({
|
|
31
|
+
name,
|
|
32
|
+
tags: project.tags,
|
|
33
|
+
targets: project.targets,
|
|
34
|
+
})),
|
|
35
|
+
...(options.project?.trim()
|
|
36
|
+
? { requestedProject: options.project.trim() }
|
|
37
|
+
: {}),
|
|
38
|
+
stage: options.stage,
|
|
39
|
+
});
|
|
40
|
+
devkit_1.logger.info(`[ebk-deployment-plan] validated before AWS access\n${JSON.stringify(plan, null, 2)}`);
|
|
41
|
+
writeGithubOutputs(plan);
|
|
42
|
+
return { success: true };
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
devkit_1.logger.error(error instanceof Error ? error.message : String(error));
|
|
46
|
+
return { success: false };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.default = executor;
|
|
50
|
+
//# sourceMappingURL=deployment-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-plan.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/deployment-plan/deployment-plan.ts"],"names":[],"mappings":";;AAAA,qCAAyC;AACzC,uCAA0D;AAC1D,+DAK0C;AAC1C,0DAIqC;AAQrC,SAAS,kBAAkB,CAAC,IAK3B;IACC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,IAAA,wBAAc,EACZ,MAAM,EACN;QACE,sBAAsB,IAAI,CAAC,iBAAiB,IAAI,EAAE,EAAE;QACpD,sBAAsB,IAAI,CAAC,0BAA0B,IAAI,EAAE,EAAE;QAC7D,cAAc,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE;QAChE,oBAAoB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACpD,kBAAkB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAChD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAA2C,KAAK,EAC5D,OAAO,EACP,OAAO,EACP,EAAE;IACF,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChE,MAAM,YAAY,GAAG,IAAA,0BAAe,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnD,eAAM,CAAC,IAAI,CAAC,IAAA,iCAAsB,EAAC,YAAY,CAAC,CAAC,CAAC;YAClD,IAAA,iCAAsB,EAAC,YAAY,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,MAAM,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2,
|
|
4
|
+
"title": "Empire Builder Kit protected deployment plan",
|
|
5
|
+
"description": "Validate the complete protected project set before any AWS credentials or mutation are available.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"action": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"enum": ["deploy", "refresh", "remove", "unlock"]
|
|
12
|
+
},
|
|
13
|
+
"stage": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["staging", "production"]
|
|
16
|
+
},
|
|
17
|
+
"project": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
20
|
+
"description": "Required only for explicit remove or unlock recovery. Deploy and refresh derive their complete set from policy."
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": ["action", "stage"]
|
|
24
|
+
}
|
|
@@ -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)('dev', options, context);
|
|
5
|
+
exports.default = executor;
|
|
6
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/dev/dev.ts"],"names":[],"mappings":";;AACA,4EAG6C;AAE7C,MAAM,QAAQ,GAAyC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC1E,IAAA,kCAAa,EAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEzC,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ExecutorContext, type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
import { probeEphemeralTlsEndpoint, probeTlsEndpoint } from '../../local-dev/effects.js';
|
|
3
|
+
import { sendGatewayCommand } from '../../local-dev/gateway.js';
|
|
4
|
+
import { resolveFleetHostname } from '../../local-dev/identity.js';
|
|
5
|
+
interface DevDoctorOptions {
|
|
6
|
+
appData?: string;
|
|
7
|
+
hostname?: string;
|
|
8
|
+
stage?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DevDoctorResult {
|
|
11
|
+
certificateExpires?: string;
|
|
12
|
+
connectivity: 'missing' | 'ready';
|
|
13
|
+
gateway: 'missing' | 'ready';
|
|
14
|
+
hostname: string;
|
|
15
|
+
issues: readonly string[];
|
|
16
|
+
portless: 'not-configured' | 'ready' | 'unreachable';
|
|
17
|
+
resolver: readonly string[];
|
|
18
|
+
tls: 'missing' | 'ready';
|
|
19
|
+
trust: 'missing' | 'ready';
|
|
20
|
+
}
|
|
21
|
+
interface DevDoctorDependencies {
|
|
22
|
+
inspectTrust?: typeof inspectCertificateTrust;
|
|
23
|
+
probeExplicitTls?: typeof probeEphemeralTlsEndpoint;
|
|
24
|
+
probePortlessTls?: typeof probeTlsEndpoint;
|
|
25
|
+
resolveHostname?: typeof resolveFleetHostname;
|
|
26
|
+
send?: typeof sendGatewayCommand;
|
|
27
|
+
}
|
|
28
|
+
export declare function inspectCertificateTrust(rootCertificatePath: string, intermediateCertificatePath: string, leafCertificatePath: string, hostname: string): DevDoctorResult['trust'];
|
|
29
|
+
export declare function inspectLocalDevelopment(options: DevDoctorOptions, context: Pick<ExecutorContext, 'projectName' | 'root'>, dependencies?: DevDoctorDependencies): Promise<DevDoctorResult>;
|
|
30
|
+
declare const executor: PromiseExecutor<DevDoctorOptions>;
|
|
31
|
+
export default executor;
|