@empire-builder-kit/nx 1.0.0-rc.44 → 1.0.0-rc.45
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/package.json +3 -3
- package/src/blueprints/external-sandbox.d.ts +1 -1
- package/src/cli/main.d.ts +11 -5
- package/src/cli/main.js +88 -29
- package/src/container-images.d.ts +1 -1
- package/src/container-images.js +1 -1
- package/src/executors/deployment-plan/deployment-plan.js +5 -1
- package/src/executors/deployment-plan/schema.json +1 -1
- package/src/executors/fleet/fleet.js +4 -0
- package/src/executors/fleet/schema.json +1 -1
- package/src/executors/local-deploy/federated-credential-transport.d.ts +4 -3
- package/src/executors/local-deploy/federated-credential-transport.js +15 -5
- package/src/foundation/cost-estimate.d.ts +8 -3
- package/src/foundation/cost-estimate.js +42 -19
- package/src/foundation/index.d.ts +1 -0
- package/src/foundation/index.js +1 -0
- package/src/foundation/local-private-smoke-access.js +6 -0
- package/src/foundation/logging.d.ts +3 -1
- package/src/foundation/logging.js +8 -1
- package/src/foundation/observability.d.ts +42 -0
- package/src/foundation/observability.js +181 -0
- package/src/foundation/preflight.js +1 -1
- package/src/generators/function/function.js +5 -2
- package/src/generators/observability-infrastructure.d.ts +2 -0
- package/src/generators/observability-infrastructure.js +31 -0
- package/src/generators/observability-policy.d.ts +4 -0
- package/src/generators/observability-policy.js +23 -0
- package/src/generators/preset/dependency-overrides.d.ts +17 -6
- package/src/generators/preset/dependency-overrides.js +17 -6
- package/src/generators/preset/tool-versions.d.ts +2 -2
- package/src/generators/preset/tool-versions.js +2 -2
- package/src/generators/preset/workspace-files-adopter-skills.js +28 -17
- package/src/generators/preset/workspace-files-agent-development.d.ts +9 -0
- package/src/generators/preset/workspace-files-agent-development.js +42 -0
- package/src/generators/preset/workspace-files-thin-deploy.js +12 -3
- package/src/generators/preset/workspace-files-thin-docs.js +10 -22
- package/src/generators/preset/workspace-files.d.ts +1 -0
- package/src/generators/preset/workspace-files.js +89 -7
- package/src/generators/slice/built-in-plan-alarm-identity.d.ts +173 -0
- package/src/generators/slice/built-in-plan-alarm-identity.js +202 -0
- package/src/generators/slice/built-in-plan-api-contract-files.js +136 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +1 -1
- package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +6 -0
- package/src/generators/slice/built-in-plan-event-contract-literal.js +52 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js +304 -144
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +2 -2
- package/src/generators/slice/built-in-plan-metadata-files.js +33 -1
- package/src/generators/slice/built-in-plan-operations-files.js +106 -6
- package/src/generators/slice/built-in-plan-project-files.js +1 -0
- package/src/generators/slice/built-in-plan-release-files.js +2 -43
- package/src/generators/slice/built-in-plan-reliability-files.js +222 -236
- package/src/generators/slice/built-in-plan-shared.d.ts +29 -3
- package/src/generators/slice/built-in-plan-shared.js +29 -2
- package/src/generators/slice/built-in-plan-web-files.js +18 -1
- package/src/generators/slice/built-in-plan.js +1 -0
- package/src/generators/slice/slice.js +2 -0
- package/src/generators/upgrade/upgrade.d.ts +4 -3
- package/src/generators/upgrade/upgrade.js +50 -26
- package/src/generators/workload/frozen-container.d.ts +1 -1
- package/src/generators/workload/workload.js +5 -1
- package/src/local-dev/dev-command-core.d.ts +24 -3
- package/src/local-dev/dev-command-core.js +124 -12
- package/src/local-dev/errors.d.ts +19 -1
- package/src/local-dev/errors.js +18 -1
- package/src/local-dev/fleet-client.d.ts +64 -6
- package/src/local-dev/fleet-client.js +189 -15
- package/src/local-dev/fleet-process.d.ts +47 -2
- package/src/local-dev/fleet-process.js +248 -31
- package/src/local-dev/fleet-runtime.d.ts +37 -0
- package/src/local-dev/fleet-runtime.js +127 -69
- package/src/local-dev/fleet-session.d.ts +1 -0
- package/src/local-dev/fleet-session.js +42 -3
- package/src/local-dev/fleet-state.d.ts +5 -0
- package/src/local-dev/fleet-state.js +11 -2
- package/src/local-dev/fleet-supervisor.d.ts +6 -0
- package/src/local-dev/fleet-supervisor.js +49 -1
- package/src/local-dev/slice-runner.d.ts +19 -1
- package/src/local-dev/slice-runner.js +290 -91
- package/src/repository-policy/deployment-plan.d.ts +1 -1
- package/src/repository-policy/deployment-plan.js +16 -1
- package/src/secrets/generated-aws-control-plane.d.ts +11 -1
- package/src/secrets/generated-aws-control-plane.js +92 -29
- package/src/secrets/operator.d.ts +3 -2
- package/src/secrets/operator.js +27 -5
- package/src/supply-chain/generated-files.js +9 -0
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.renderProductApiContractFiles = renderProductApiContractFiles;
|
|
4
4
|
const api_contract_1 = require("@empire-builder-kit/runtime/api-contract");
|
|
5
5
|
const index_js_1 = require("../../api-contract/index.js");
|
|
6
|
+
const built_in_plan_event_contract_literal_js_1 = require("./built-in-plan-event-contract-literal.js");
|
|
6
7
|
const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
|
|
7
8
|
const local_source_identity_js_1 = require("./local-source-identity.js");
|
|
8
9
|
// Shared by the machine-readable contract and the generated operation source.
|
|
@@ -2040,6 +2041,7 @@ database code, or other implementation paths.
|
|
|
2040
2041
|
} from 'node:fs';
|
|
2041
2042
|
import { createRequire } from 'node:module';
|
|
2042
2043
|
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
2044
|
+
import ts from 'typescript';
|
|
2043
2045
|
|
|
2044
2046
|
const require = createRequire(import.meta.url);
|
|
2045
2047
|
const {
|
|
@@ -2211,6 +2213,139 @@ function validateContractExports(root, packageJson, publications) {
|
|
|
2211
2213
|
}
|
|
2212
2214
|
}
|
|
2213
2215
|
|
|
2216
|
+
${built_in_plan_event_contract_literal_js_1.EVENT_CONTRACT_LITERAL_SOURCE}
|
|
2217
|
+
function producerEventContract(producer, slice) {
|
|
2218
|
+
const path = join(producer.root, 'contracts', 'events.ts');
|
|
2219
|
+
if (!existsSync(path)) {
|
|
2220
|
+
throw new Error(
|
|
2221
|
+
'Producer ' + slice + ' publishes no contracts/events.ts EventContractSchema.',
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
const file = ts.createSourceFile(
|
|
2225
|
+
path,
|
|
2226
|
+
readFileSync(path, 'utf8'),
|
|
2227
|
+
ts.ScriptTarget.ESNext,
|
|
2228
|
+
true,
|
|
2229
|
+
ts.ScriptKind.TS,
|
|
2230
|
+
);
|
|
2231
|
+
let schema;
|
|
2232
|
+
for (const statement of file.statements) {
|
|
2233
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
2234
|
+
for (const variable of statement.declarationList.declarations) {
|
|
2235
|
+
if (
|
|
2236
|
+
ts.isIdentifier(variable.name) &&
|
|
2237
|
+
variable.name.text === 'EventContractSchema' &&
|
|
2238
|
+
variable.initializer
|
|
2239
|
+
) {
|
|
2240
|
+
if (schema !== undefined) {
|
|
2241
|
+
throw new Error(
|
|
2242
|
+
'Producer ' + slice + ' EventContractSchema export is ambiguous.',
|
|
2243
|
+
);
|
|
2244
|
+
}
|
|
2245
|
+
schema = eventLiteral(variable.initializer);
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
if (
|
|
2250
|
+
schema?.kind !== 'ebk-event-contract-schema' ||
|
|
2251
|
+
schema.schemaVersion !== 1 ||
|
|
2252
|
+
schema.slice !== slice ||
|
|
2253
|
+
!Array.isArray(schema.events)
|
|
2254
|
+
) {
|
|
2255
|
+
throw new Error(
|
|
2256
|
+
'Producer ' +
|
|
2257
|
+
slice +
|
|
2258
|
+
' contracts/events.ts must export one canonical v1 EventContractSchema.',
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
return schema;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
// Bind each declared cross-Slice subscription to the producer's published
|
|
2265
|
+
// EventContractSchema, so a removed, renamed or re-versioned event fails here
|
|
2266
|
+
// instead of silently stopping delivery.
|
|
2267
|
+
async function checkEventSubscriptions(dependencies, projects) {
|
|
2268
|
+
const subscriptionPath = join(
|
|
2269
|
+
projectRoot,
|
|
2270
|
+
'contracts',
|
|
2271
|
+
'event-subscriptions.json',
|
|
2272
|
+
);
|
|
2273
|
+
if (!existsSync(subscriptionPath)) {
|
|
2274
|
+
throw new Error(
|
|
2275
|
+
'contracts/event-subscriptions.json is missing. Restore the seeded ' +
|
|
2276
|
+
'declaration with schemaVersion 1 and an empty subscriptions list.',
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
// The managed infrastructure validator is the one authority for the
|
|
2280
|
+
// declaration shape; this check runs it exactly as deployment does.
|
|
2281
|
+
const validator = await import(
|
|
2282
|
+
'data:text/javascript;base64,' +
|
|
2283
|
+
Buffer.from(
|
|
2284
|
+
ts.transpileModule(
|
|
2285
|
+
readFileSync(
|
|
2286
|
+
join(projectRoot, 'infra', 'event-subscriptions.ts'),
|
|
2287
|
+
'utf8',
|
|
2288
|
+
),
|
|
2289
|
+
{
|
|
2290
|
+
compilerOptions: {
|
|
2291
|
+
module: ts.ModuleKind.ESNext,
|
|
2292
|
+
target: ts.ScriptTarget.ES2022,
|
|
2293
|
+
},
|
|
2294
|
+
},
|
|
2295
|
+
).outputText,
|
|
2296
|
+
).toString('base64')
|
|
2297
|
+
);
|
|
2298
|
+
const subscriptions = validator.crossSliceEventSubscriptions(
|
|
2299
|
+
readJson(subscriptionPath),
|
|
2300
|
+
dependencies,
|
|
2301
|
+
);
|
|
2302
|
+
for (const subscription of subscriptions) {
|
|
2303
|
+
const producer = projects.get(subscription.source);
|
|
2304
|
+
if (
|
|
2305
|
+
!producer ||
|
|
2306
|
+
!dependencies.consumes.includes(producer.packageJson.name + '/contracts')
|
|
2307
|
+
) {
|
|
2308
|
+
throw new Error(
|
|
2309
|
+
'Subscribed source ' +
|
|
2310
|
+
subscription.source +
|
|
2311
|
+
' is not a consumed Product Slice contracts package.',
|
|
2312
|
+
);
|
|
2313
|
+
}
|
|
2314
|
+
const schema = producerEventContract(producer, subscription.source);
|
|
2315
|
+
for (const detailType of subscription.detailTypes) {
|
|
2316
|
+
const published = schema.events.filter(
|
|
2317
|
+
(event) => event?.detailType === detailType,
|
|
2318
|
+
);
|
|
2319
|
+
if (
|
|
2320
|
+
published.length !== 1 ||
|
|
2321
|
+
published[0].source !== subscription.source
|
|
2322
|
+
) {
|
|
2323
|
+
throw new Error(
|
|
2324
|
+
'Producer ' +
|
|
2325
|
+
subscription.source +
|
|
2326
|
+
' does not publish ' +
|
|
2327
|
+
detailType +
|
|
2328
|
+
' in its EventContractSchema. Restore the producer event or ' +
|
|
2329
|
+
'remove the subscription from contracts/event-subscriptions.json.',
|
|
2330
|
+
);
|
|
2331
|
+
}
|
|
2332
|
+
if (!subscription.schemaVersions.includes(published[0].schemaVersion)) {
|
|
2333
|
+
throw new Error(
|
|
2334
|
+
'Producer ' +
|
|
2335
|
+
subscription.source +
|
|
2336
|
+
' publishes ' +
|
|
2337
|
+
detailType +
|
|
2338
|
+
' schemaVersion ' +
|
|
2339
|
+
published[0].schemaVersion +
|
|
2340
|
+
', which ${name} does not subscribe to. Accept that version ' +
|
|
2341
|
+
'in api/event-consumer.ts, then declare it in ' +
|
|
2342
|
+
'contracts/event-subscriptions.json.',
|
|
2343
|
+
);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2214
2349
|
const declaration = readJson(declarationPath);
|
|
2215
2350
|
if (
|
|
2216
2351
|
!declaration ||
|
|
@@ -2345,6 +2480,7 @@ for (const publication of resolution.contracts) {
|
|
|
2345
2480
|
const current = [...(ownership.contracts?.consumes ?? [])].sort();
|
|
2346
2481
|
const expected = [...normalized.contracts.consumes];
|
|
2347
2482
|
if (action === 'check') {
|
|
2483
|
+
await checkEventSubscriptions(declaration, projects);
|
|
2348
2484
|
if (JSON.stringify(current) !== JSON.stringify(expected)) {
|
|
2349
2485
|
throw new Error(
|
|
2350
2486
|
'Contract declarations are out of sync. Run ' +
|
|
@@ -300,7 +300,7 @@ RUN --network=none pnpm --config.inject-workspace-packages=true --config.store-d
|
|
|
300
300
|
|
|
301
301
|
FROM ${frozen_container_js_1.WORKLOAD_CONTAINER_NODE_IMAGE}
|
|
302
302
|
WORKDIR /app
|
|
303
|
-
ADD --chown=node:node --chmod=0444 --checksum=sha256:
|
|
303
|
+
ADD --chown=node:node --chmod=0444 --checksum=sha256:90a6f1a7978a1b1b096dca6c57511ca48d3b8cf052f8e704baf358f34ea2f21b https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem ./rds-global-bundle.pem
|
|
304
304
|
COPY --from=build --chown=node:node /opt/migration ./
|
|
305
305
|
COPY --chown=node:node packages/${name}/jobs/database-lifecycle-logging.mjs ./jobs/database-lifecycle-logging.mjs
|
|
306
306
|
COPY --chown=node:node packages/${name}/jobs/bootstrap-database.mjs ./jobs/bootstrap-database.mjs
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Literal-only evaluator for a Slice's canonical EventContractSchema export.
|
|
3
|
+
* Release compatibility and the cross-Slice subscription check render the
|
|
4
|
+
* same source so both read a producer contract identically.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EVENT_CONTRACT_LITERAL_SOURCE = "const eventLiteral = (node) => {\n while (\n ts.isAsExpression(node) ||\n ts.isSatisfiesExpression(node) ||\n ts.isParenthesizedExpression(node)\n ) {\n node = node.expression;\n }\n if (ts.isObjectLiteralExpression(node)) {\n return Object.fromEntries(\n node.properties.map((property) => {\n if (\n !ts.isPropertyAssignment(property) ||\n !(\n ts.isIdentifier(property.name) ||\n ts.isStringLiteral(property.name)\n )\n ) {\n throw new Error(\n 'EventContractSchema accepts only explicit literal properties.',\n );\n }\n return [property.name.text, eventLiteral(property.initializer)];\n }),\n );\n }\n if (ts.isArrayLiteralExpression(node)) {\n return node.elements.map(eventLiteral);\n }\n if (ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {\n return ts.isNumericLiteral(node) ? Number(node.text) : node.text;\n }\n if (\n node.kind === ts.SyntaxKind.TrueKeyword ||\n node.kind === ts.SyntaxKind.FalseKeyword\n ) {\n return node.kind === ts.SyntaxKind.TrueKeyword;\n }\n throw new Error(\n 'EventContractSchema must remain a canonical literal-only export.',\n );\n};\n";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EVENT_CONTRACT_LITERAL_SOURCE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Literal-only evaluator for a Slice's canonical EventContractSchema export.
|
|
6
|
+
* Release compatibility and the cross-Slice subscription check render the
|
|
7
|
+
* same source so both read a producer contract identically.
|
|
8
|
+
*/
|
|
9
|
+
exports.EVENT_CONTRACT_LITERAL_SOURCE = `const eventLiteral = (node) => {
|
|
10
|
+
while (
|
|
11
|
+
ts.isAsExpression(node) ||
|
|
12
|
+
ts.isSatisfiesExpression(node) ||
|
|
13
|
+
ts.isParenthesizedExpression(node)
|
|
14
|
+
) {
|
|
15
|
+
node = node.expression;
|
|
16
|
+
}
|
|
17
|
+
if (ts.isObjectLiteralExpression(node)) {
|
|
18
|
+
return Object.fromEntries(
|
|
19
|
+
node.properties.map((property) => {
|
|
20
|
+
if (
|
|
21
|
+
!ts.isPropertyAssignment(property) ||
|
|
22
|
+
!(
|
|
23
|
+
ts.isIdentifier(property.name) ||
|
|
24
|
+
ts.isStringLiteral(property.name)
|
|
25
|
+
)
|
|
26
|
+
) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
'EventContractSchema accepts only explicit literal properties.',
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return [property.name.text, eventLiteral(property.initializer)];
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
if (ts.isArrayLiteralExpression(node)) {
|
|
36
|
+
return node.elements.map(eventLiteral);
|
|
37
|
+
}
|
|
38
|
+
if (ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {
|
|
39
|
+
return ts.isNumericLiteral(node) ? Number(node.text) : node.text;
|
|
40
|
+
}
|
|
41
|
+
if (
|
|
42
|
+
node.kind === ts.SyntaxKind.TrueKeyword ||
|
|
43
|
+
node.kind === ts.SyntaxKind.FalseKeyword
|
|
44
|
+
) {
|
|
45
|
+
return node.kind === ts.SyntaxKind.TrueKeyword;
|
|
46
|
+
}
|
|
47
|
+
throw new Error(
|
|
48
|
+
'EventContractSchema must remain a canonical literal-only export.',
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
`;
|
|
52
|
+
//# sourceMappingURL=built-in-plan-event-contract-literal.js.map
|