@empire-builder-kit/nx 1.0.0-beta.4
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 +25 -0
- package/executors.json +54 -0
- package/generators.json +35 -0
- package/migrations/standard-pre-v1-to-v1.md +11 -0
- package/package.json +66 -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 +241 -0
- package/src/blueprints/manifest.js +369 -0
- package/src/blueprints/manifest.js.map +1 -0
- package/src/blueprints/resolver.d.ts +28 -0
- package/src/blueprints/resolver.js +214 -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/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 +18 -0
- package/src/executors/dev-doctor/dev-doctor.js +145 -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 +51 -0
- package/src/executors/fleet/fleet.js +529 -0
- package/src/executors/fleet/fleet.js.map +1 -0
- package/src/executors/fleet/schema.json +25 -0
- package/src/executors/foundation-preflight/foundation-preflight.d.ts +15 -0
- package/src/executors/foundation-preflight/foundation-preflight.js +94 -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-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/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 +28 -0
- package/src/executors/sst-lifecycle/run-sst-command.js +154 -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/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 +162 -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 +895 -0
- package/src/generators/preset/workspace-files.js.map +1 -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 +1676 -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 +666 -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/index.d.ts +5 -0
- package/src/index.js +9 -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/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/schemas/blueprint-input-schema-v1.json +23 -0
- package/src/schemas/blueprint-v1.json +170 -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/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
|
@@ -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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;SACtB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,mBAAmB,EAAE,UAAU;QAC/B,iBAAiB;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EACJ,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,uBAAuB;KACxE,CAAC;AACJ,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)('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,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,18 @@
|
|
|
1
|
+
import { type ExecutorContext, type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
interface DevDoctorOptions {
|
|
3
|
+
appData?: string;
|
|
4
|
+
hostname?: string;
|
|
5
|
+
stage?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DevDoctorResult {
|
|
8
|
+
certificateExpires?: string;
|
|
9
|
+
gateway: 'missing' | 'ready';
|
|
10
|
+
hostname: string;
|
|
11
|
+
portless: 'configured' | 'not-configured';
|
|
12
|
+
resolver: readonly string[];
|
|
13
|
+
tls: 'missing' | 'ready';
|
|
14
|
+
trust: 'missing' | 'ready';
|
|
15
|
+
}
|
|
16
|
+
export declare function inspectLocalDevelopment(options: DevDoctorOptions, context: Pick<ExecutorContext, 'projectName' | 'root'>): Promise<DevDoctorResult>;
|
|
17
|
+
declare const executor: PromiseExecutor<DevDoctorOptions>;
|
|
18
|
+
export default executor;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inspectLocalDevelopment = inspectLocalDevelopment;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_os_1 = require("node:os");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const gateway_js_1 = require("../../local-dev/gateway.js");
|
|
11
|
+
const identity_js_1 = require("../../local-dev/identity.js");
|
|
12
|
+
const tls_js_1 = require("../../local-dev/tls.js");
|
|
13
|
+
function inspectCertificateTrust(rootCertificatePath, intermediateCertificatePath, leafCertificatePath, hostname) {
|
|
14
|
+
try {
|
|
15
|
+
if ((0, node_os_1.platform)() === 'darwin') {
|
|
16
|
+
(0, node_child_process_1.execFileSync)('security', [
|
|
17
|
+
'verify-cert',
|
|
18
|
+
'-L',
|
|
19
|
+
'-q',
|
|
20
|
+
'-c',
|
|
21
|
+
leafCertificatePath,
|
|
22
|
+
'-c',
|
|
23
|
+
intermediateCertificatePath,
|
|
24
|
+
'-p',
|
|
25
|
+
'ssl',
|
|
26
|
+
'-n',
|
|
27
|
+
hostname,
|
|
28
|
+
], { stdio: 'pipe' });
|
|
29
|
+
return 'ready';
|
|
30
|
+
}
|
|
31
|
+
const expected = new node_crypto_1.X509Certificate((0, node_fs_1.readFileSync)(rootCertificatePath))
|
|
32
|
+
.fingerprint256;
|
|
33
|
+
if ((0, node_os_1.platform)() === 'win32') {
|
|
34
|
+
(0, node_child_process_1.execFileSync)('certutil', [
|
|
35
|
+
'-user',
|
|
36
|
+
'-store',
|
|
37
|
+
'Root',
|
|
38
|
+
new node_crypto_1.X509Certificate((0, node_fs_1.readFileSync)(rootCertificatePath)).fingerprint.replace(/:/g, ''),
|
|
39
|
+
], { stdio: 'pipe' });
|
|
40
|
+
return 'ready';
|
|
41
|
+
}
|
|
42
|
+
const pem = (0, node_child_process_1.execFileSync)('certutil', [
|
|
43
|
+
'-L',
|
|
44
|
+
'-d',
|
|
45
|
+
`sql:${(0, node_path_1.join)((0, node_os_1.homedir)(), '.pki', 'nssdb')}`,
|
|
46
|
+
'-n',
|
|
47
|
+
'Empire Builder Kit Local Root',
|
|
48
|
+
'-a',
|
|
49
|
+
], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
|
|
50
|
+
return new node_crypto_1.X509Certificate(pem).fingerprint256 === expected
|
|
51
|
+
? 'ready'
|
|
52
|
+
: 'missing';
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return 'missing';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function inspectLocalDevelopment(options, context) {
|
|
59
|
+
const hostname = options.hostname?.trim() ||
|
|
60
|
+
(0, identity_js_1.createFleetHostname)((0, identity_js_1.createFleetId)({
|
|
61
|
+
checkoutPath: context.root,
|
|
62
|
+
stage: options.stage ?? 'personal',
|
|
63
|
+
workspaceName: context.projectName ?? 'workspace',
|
|
64
|
+
}));
|
|
65
|
+
const resolver = await (0, identity_js_1.resolveFleetHostname)(hostname);
|
|
66
|
+
const paths = (0, tls_js_1.localTlsPaths)(options.appData);
|
|
67
|
+
if (!(0, node_fs_1.existsSync)(paths.rootCertificate) ||
|
|
68
|
+
!(0, node_fs_1.existsSync)(paths.leafCertificate) ||
|
|
69
|
+
!(0, node_fs_1.existsSync)(paths.leafKey) ||
|
|
70
|
+
!(0, node_fs_1.existsSync)(paths.capability)) {
|
|
71
|
+
return {
|
|
72
|
+
gateway: 'missing',
|
|
73
|
+
hostname,
|
|
74
|
+
portless: 'not-configured',
|
|
75
|
+
resolver,
|
|
76
|
+
tls: 'missing',
|
|
77
|
+
trust: 'missing',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
(0, tls_js_1.assertPrivateKeyPermissions)(paths.leafKey);
|
|
81
|
+
(0, tls_js_1.assertPrivateKeyPermissions)(paths.intermediateKey);
|
|
82
|
+
const certificate = new node_crypto_1.X509Certificate((0, node_fs_1.readFileSync)(paths.leafCertificate));
|
|
83
|
+
if (!certificate.checkHost(hostname)) {
|
|
84
|
+
throw new Error(`EBK gateway certificate does not cover ${hostname}. Rerun dev-setup --upgrade --trust with the matching hostSuffix.`);
|
|
85
|
+
}
|
|
86
|
+
if (certificate.validToDate.getTime() <= Date.now()) {
|
|
87
|
+
throw new Error(`EBK gateway certificate expired at ${certificate.validTo}.`);
|
|
88
|
+
}
|
|
89
|
+
let gateway = 'missing';
|
|
90
|
+
try {
|
|
91
|
+
await (0, gateway_js_1.sendGatewayCommand)(paths.gatewaySocket, {
|
|
92
|
+
action: 'heartbeat',
|
|
93
|
+
capability: (0, node_fs_1.readFileSync)(paths.capability, 'utf8').trim(),
|
|
94
|
+
hostname,
|
|
95
|
+
sessionId: '__doctor__',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
// A healthy gateway rejects the deliberately absent doctor session. A
|
|
100
|
+
// connection failure means the gateway itself is unavailable.
|
|
101
|
+
if (error instanceof Error &&
|
|
102
|
+
error.message.includes('no matching registration')) {
|
|
103
|
+
gateway = 'ready';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
certificateExpires: certificate.validTo,
|
|
108
|
+
gateway,
|
|
109
|
+
hostname,
|
|
110
|
+
portless: (() => {
|
|
111
|
+
try {
|
|
112
|
+
const state = JSON.parse((0, node_fs_1.readFileSync)(paths.gatewayState, 'utf8'));
|
|
113
|
+
return state.portless ? 'configured' : 'not-configured';
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return 'not-configured';
|
|
117
|
+
}
|
|
118
|
+
})(),
|
|
119
|
+
resolver,
|
|
120
|
+
tls: 'ready',
|
|
121
|
+
trust: inspectCertificateTrust(paths.rootCertificate, paths.intermediateCertificate, paths.leafCertificate, hostname),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const executor = async (options, context) => {
|
|
125
|
+
try {
|
|
126
|
+
const result = await inspectLocalDevelopment(options, context);
|
|
127
|
+
devkit_1.logger.info(`[dev-doctor] ${JSON.stringify(result, null, 2)}`);
|
|
128
|
+
if (result.tls === 'missing') {
|
|
129
|
+
devkit_1.logger.warn('Run dev-setup, inspect the generated root, then explicitly rerun with --trust.');
|
|
130
|
+
}
|
|
131
|
+
if (result.gateway === 'missing') {
|
|
132
|
+
devkit_1.logger.warn('The portless gateway is unavailable; HTTPS explicit-port fallback remains possible because resolver validation passed.');
|
|
133
|
+
}
|
|
134
|
+
if (result.trust === 'missing') {
|
|
135
|
+
devkit_1.logger.warn('The EBK root is not trusted in the detected user/browser trust store. Review it and run dev-setup --trust explicitly.');
|
|
136
|
+
}
|
|
137
|
+
return { success: result.tls === 'ready' && result.trust === 'ready' };
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
devkit_1.logger.error(`[dev-doctor] ${error instanceof Error ? error.message : String(error)}`);
|
|
141
|
+
return { success: false };
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
exports.default = executor;
|
|
145
|
+
//# sourceMappingURL=dev-doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-doctor.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/dev-doctor/dev-doctor.ts"],"names":[],"mappings":";;AAoGA,0DAoFC;AAxLD,uCAAgF;AAChF,2DAAkD;AAClD,6CAA8C;AAC9C,qCAAmD;AACnD,qCAA4C;AAC5C,yCAAiC;AACjC,2DAGoC;AACpC,6DAIqC;AACrC,mDAGgC;AAkBhC,SAAS,uBAAuB,CAC9B,mBAA2B,EAC3B,2BAAmC,EACnC,mBAA2B,EAC3B,QAAgB;IAEhB,IAAI,CAAC;QACH,IAAI,IAAA,kBAAQ,GAAE,KAAK,QAAQ,EAAE,CAAC;YAC5B,IAAA,iCAAY,EACV,UAAU,EACV;gBACE,aAAa;gBACb,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,mBAAmB;gBACnB,IAAI;gBACJ,2BAA2B;gBAC3B,IAAI;gBACJ,KAAK;gBACL,IAAI;gBACJ,QAAQ;aACT,EACD,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,6BAAe,CAAC,IAAA,sBAAY,EAAC,mBAAmB,CAAC,CAAC;aACpE,cAAc,CAAC;QAClB,IAAI,IAAA,kBAAQ,GAAE,KAAK,OAAO,EAAE,CAAC;YAC3B,IAAA,iCAAY,EACV,UAAU,EACV;gBACE,OAAO;gBACP,QAAQ;gBACR,MAAM;gBACN,IAAI,6BAAe,CACjB,IAAA,sBAAY,EAAC,mBAAmB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,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,eAAM,CAAC,IAAI,CACT,uHAAuH,CACxH,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,OAAO,IAAI,MAAM,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CACV,gBAAgB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACzE,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,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 local development doctor",
|
|
5
|
+
"description": "Inspect resolver, certificate, key-permission, and gateway health without mutation.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"appData": { "type": "string" },
|
|
10
|
+
"hostname": { "type": "string" },
|
|
11
|
+
"stage": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
14
|
+
"default": "personal"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
interface DevSetupOptions {
|
|
3
|
+
appData?: string;
|
|
4
|
+
hostSuffix?: string;
|
|
5
|
+
portless?: boolean;
|
|
6
|
+
remove?: boolean;
|
|
7
|
+
trust?: boolean;
|
|
8
|
+
upgrade?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const executor: PromiseExecutor<DevSetupOptions>;
|
|
11
|
+
export default executor;
|