@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,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.foundationRequirementSchema = exports.STANDARD_FOUNDATION_CAPABILITIES = exports.STANDARD_FOUNDATION_CONTRACT_VERSION = void 0;
|
|
4
|
+
exports.isStandardFoundationCapability = isStandardFoundationCapability;
|
|
5
|
+
exports.validateFoundationRequirement = validateFoundationRequirement;
|
|
6
|
+
exports.validateFoundationCompatibility = validateFoundationCompatibility;
|
|
7
|
+
const validation_js_1 = require("../validation.js");
|
|
8
|
+
const semver_1 = require("semver");
|
|
9
|
+
exports.STANDARD_FOUNDATION_CONTRACT_VERSION = 1;
|
|
10
|
+
exports.STANDARD_FOUNDATION_CAPABILITIES = [
|
|
11
|
+
'network',
|
|
12
|
+
'routing',
|
|
13
|
+
'container-compute',
|
|
14
|
+
'postgres',
|
|
15
|
+
'identity',
|
|
16
|
+
'events',
|
|
17
|
+
'observability',
|
|
18
|
+
'configuration',
|
|
19
|
+
'deployment',
|
|
20
|
+
];
|
|
21
|
+
const capabilitySet = new Set(exports.STANDARD_FOUNDATION_CAPABILITIES);
|
|
22
|
+
function isStandardFoundationCapability(value) {
|
|
23
|
+
return typeof value === 'string' && capabilitySet.has(value);
|
|
24
|
+
}
|
|
25
|
+
function validateFoundationRequirement(value, path = 'foundation') {
|
|
26
|
+
const issues = [];
|
|
27
|
+
if (!(0, validation_js_1.isRecord)(value)) {
|
|
28
|
+
return {
|
|
29
|
+
valid: false,
|
|
30
|
+
issues: [{ message: 'must be an object', path }],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (typeof value.contract !== 'string' ||
|
|
34
|
+
value.contract.trim() === '' ||
|
|
35
|
+
(0, semver_1.validRange)(value.contract) === null) {
|
|
36
|
+
issues.push({
|
|
37
|
+
message: 'must be a valid semantic-version range',
|
|
38
|
+
path: `${path}.contract`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (!Array.isArray(value.capabilities)) {
|
|
42
|
+
issues.push({ message: 'must be an array', path: `${path}.capabilities` });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const seen = new Set();
|
|
46
|
+
value.capabilities.forEach((capability, index) => {
|
|
47
|
+
if (!isStandardFoundationCapability(capability)) {
|
|
48
|
+
issues.push({
|
|
49
|
+
message: `must be one of ${exports.STANDARD_FOUNDATION_CAPABILITIES.join(', ')}`,
|
|
50
|
+
path: `${path}.capabilities[${index}]`,
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (seen.has(capability)) {
|
|
55
|
+
issues.push({
|
|
56
|
+
message: 'must not contain duplicate capabilities',
|
|
57
|
+
path: `${path}.capabilities[${index}]`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
seen.add(capability);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return (0, validation_js_1.validationResult)(value, issues);
|
|
64
|
+
}
|
|
65
|
+
function validateFoundationCompatibility(requirement, foundation) {
|
|
66
|
+
const issues = [];
|
|
67
|
+
const requirementResult = validateFoundationRequirement(requirement);
|
|
68
|
+
if (!requirementResult.valid) {
|
|
69
|
+
issues.push(...requirementResult.issues);
|
|
70
|
+
}
|
|
71
|
+
if (!(0, validation_js_1.isRecord)(foundation)) {
|
|
72
|
+
return {
|
|
73
|
+
valid: false,
|
|
74
|
+
issues: [
|
|
75
|
+
...issues,
|
|
76
|
+
{ message: 'must be an object', path: 'foundationDescriptor' },
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (typeof foundation.contractVersion !== 'string' ||
|
|
81
|
+
(0, semver_1.valid)(foundation.contractVersion) === null) {
|
|
82
|
+
issues.push({
|
|
83
|
+
message: 'must be an exact semantic version',
|
|
84
|
+
path: 'foundationDescriptor.contractVersion',
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (!Array.isArray(foundation.capabilities)) {
|
|
88
|
+
issues.push({
|
|
89
|
+
message: 'must be an array',
|
|
90
|
+
path: 'foundationDescriptor.capabilities',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
foundation.capabilities.forEach((capability, index) => {
|
|
95
|
+
if (!isStandardFoundationCapability(capability)) {
|
|
96
|
+
issues.push({
|
|
97
|
+
message: `must be one of ${exports.STANDARD_FOUNDATION_CAPABILITIES.join(', ')}`,
|
|
98
|
+
path: `foundationDescriptor.capabilities[${index}]`,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (requirementResult.valid &&
|
|
104
|
+
typeof foundation.contractVersion === 'string' &&
|
|
105
|
+
(0, semver_1.valid)(foundation.contractVersion) !== null &&
|
|
106
|
+
!(0, semver_1.satisfies)(foundation.contractVersion, requirementResult.value.contract)) {
|
|
107
|
+
issues.push({
|
|
108
|
+
message: `version ${foundation.contractVersion} does not satisfy ${requirementResult.value.contract}`,
|
|
109
|
+
path: 'foundationDescriptor.contractVersion',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (requirementResult.valid && Array.isArray(foundation.capabilities)) {
|
|
113
|
+
const available = new Set(foundation.capabilities);
|
|
114
|
+
for (const capability of requirementResult.value.capabilities) {
|
|
115
|
+
if (!available.has(capability)) {
|
|
116
|
+
issues.push({
|
|
117
|
+
message: `required capability ${capability} is missing`,
|
|
118
|
+
path: 'foundationDescriptor.capabilities',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return (0, validation_js_1.validationResult)(foundation, issues);
|
|
124
|
+
}
|
|
125
|
+
exports.foundationRequirementSchema = {
|
|
126
|
+
$id: 'https://empirebuilderkit.dev/schemas/foundation-requirement-v1.json',
|
|
127
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
128
|
+
additionalProperties: false,
|
|
129
|
+
properties: {
|
|
130
|
+
capabilities: {
|
|
131
|
+
items: { enum: [...exports.STANDARD_FOUNDATION_CAPABILITIES], type: 'string' },
|
|
132
|
+
type: 'array',
|
|
133
|
+
uniqueItems: true,
|
|
134
|
+
},
|
|
135
|
+
contract: { minLength: 1, type: 'string' },
|
|
136
|
+
},
|
|
137
|
+
required: ['contract', 'capabilities'],
|
|
138
|
+
title: 'Empire Builder Kit Standard Foundation Requirement v1',
|
|
139
|
+
type: 'object',
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=requirements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirements.js","sourceRoot":"","sources":["../../../../../packages/nx/src/foundation/requirements.ts"],"names":[],"mappings":";;;AAqCA,wEAIC;AAED,sEAgDC;AAED,0EAuEC;AApKD,oDAK0B;AAC1B,mCAAsD;AAEzC,QAAA,oCAAoC,GAAG,CAAU,CAAC;AAElD,QAAA,gCAAgC,GAAG;IAC9C,SAAS;IACT,SAAS;IACT,mBAAmB;IACnB,UAAU;IACV,UAAU;IACV,QAAQ;IACR,eAAe;IACf,eAAe;IACf,YAAY;CACJ,CAAC;AAeX,MAAM,aAAa,GAAG,IAAI,GAAG,CAAS,wCAAgC,CAAC,CAAC;AAExE,SAAgB,8BAA8B,CAC5C,KAAc;IAEd,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,6BAA6B,CAC3C,KAAc,EACd,IAAI,GAAG,YAAY;IAEnB,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,IAAI,CAAC,IAAA,wBAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;SACjD,CAAC;IACJ,CAAC;IAED,IACE,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAClC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;QAC5B,IAAA,mBAAU,EAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,EACnC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;YACV,OAAO,EAAE,wCAAwC;YACjD,IAAI,EAAE,GAAG,IAAI,WAAW;SACzB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE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oundationStage = (typeof FOUNDATION_STAGES)[number];
|
|
3
|
+
export interface FoundationStageResolution {
|
|
4
|
+
consumerStage: string;
|
|
5
|
+
foundationStage: FoundationStage;
|
|
6
|
+
mapped: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function requireStage(value: string, label?: string): string;
|
|
9
|
+
export declare function isFoundationStage(stage: string): stage is FoundationStage;
|
|
10
|
+
export declare function requireFoundationStage(stage: string): FoundationStage;
|
|
11
|
+
export declare function resolveFoundationStages(options: {
|
|
12
|
+
consumerStage: string;
|
|
13
|
+
foundationStage?: string;
|
|
14
|
+
}): FoundationStageResolution;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FOUNDATION_STAGES = void 0;
|
|
4
|
+
exports.requireStage = requireStage;
|
|
5
|
+
exports.isFoundationStage = isFoundationStage;
|
|
6
|
+
exports.requireFoundationStage = requireFoundationStage;
|
|
7
|
+
exports.resolveFoundationStages = resolveFoundationStages;
|
|
8
|
+
exports.FOUNDATION_STAGES = [
|
|
9
|
+
'development',
|
|
10
|
+
'staging',
|
|
11
|
+
'production',
|
|
12
|
+
];
|
|
13
|
+
const FOUNDATION_STAGE_SET = new Set(exports.FOUNDATION_STAGES);
|
|
14
|
+
function requireStage(value, label = 'Stage') {
|
|
15
|
+
const normalized = value.trim();
|
|
16
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(normalized)) {
|
|
17
|
+
throw new Error(`${label} must use lowercase letters, numbers, and hyphens.`);
|
|
18
|
+
}
|
|
19
|
+
return normalized;
|
|
20
|
+
}
|
|
21
|
+
function isFoundationStage(stage) {
|
|
22
|
+
return FOUNDATION_STAGE_SET.has(stage);
|
|
23
|
+
}
|
|
24
|
+
function requireFoundationStage(stage) {
|
|
25
|
+
const normalized = requireStage(stage, 'Foundation stage');
|
|
26
|
+
if (!isFoundationStage(normalized)) {
|
|
27
|
+
throw new Error(`Foundation stage ${normalized} is not canonical. Use development, staging, or production.`);
|
|
28
|
+
}
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
function resolveFoundationStages(options) {
|
|
32
|
+
const consumerStage = requireStage(options.consumerStage, 'Consumer stage');
|
|
33
|
+
const expectedFoundationStage = isFoundationStage(consumerStage)
|
|
34
|
+
? consumerStage
|
|
35
|
+
: 'development';
|
|
36
|
+
const foundationStage = options.foundationStage?.trim()
|
|
37
|
+
? requireFoundationStage(options.foundationStage)
|
|
38
|
+
: expectedFoundationStage;
|
|
39
|
+
if (foundationStage !== expectedFoundationStage) {
|
|
40
|
+
if (isFoundationStage(consumerStage)) {
|
|
41
|
+
throw new Error(`Consumer stage ${consumerStage} must use Foundation stage ${consumerStage}.`);
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`Personal or preview consumer stage ${consumerStage} may use only the development Foundation.`);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
consumerStage,
|
|
47
|
+
foundationStage,
|
|
48
|
+
mapped: consumerStage !== foundationStage,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=stages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stages.js","sourceRoot":"","sources":["../../../../../packages/nx/src/foundation/stages.ts"],"names":[],"mappings":";;;AAgBA,oCAQC;AAED,8CAEC;AAED,wDAQC;AAED,0DA4BC;AApEY,QAAA,iBAAiB,GAAG;IAC/B,aAAa;IACb,SAAS;IACT,YAAY;CACJ,CAAC;AAUX,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAS,yBAAiB,CAAC,CAAC;AAEhE,SAAgB,YAAY,CAAC,KAAa,EAAE,KAAK,GAAG,OAAO;IACzD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,GAA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kit';
|
|
2
|
+
import type { FunctionGeneratorSchema } from './schema.js';
|
|
3
|
+
export interface FunctionFilePlan {
|
|
4
|
+
files: Readonly<Record<string, string>>;
|
|
5
|
+
paths: Array<{
|
|
6
|
+
mode?: 'managed' | 'seeded';
|
|
7
|
+
path: string;
|
|
8
|
+
}>;
|
|
9
|
+
register: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createFunctionFilePlan(slice: string, name: string): FunctionFilePlan;
|
|
12
|
+
export declare function functionGenerator(tree: Tree, options: FunctionGeneratorSchema): Promise<void>;
|
|
13
|
+
export default functionGenerator;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFunctionFilePlan = createFunctionFilePlan;
|
|
4
|
+
exports.functionGenerator = functionGenerator;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const index_js_1 = require("../../ownership/index.js");
|
|
8
|
+
function requireName(value, label) {
|
|
9
|
+
const normalized = value.trim();
|
|
10
|
+
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(normalized)) {
|
|
11
|
+
throw new Error(`${label} must start with a lowercase letter and use only lowercase letters, numbers, and hyphens.`);
|
|
12
|
+
}
|
|
13
|
+
return normalized;
|
|
14
|
+
}
|
|
15
|
+
function pascal(value) {
|
|
16
|
+
return value
|
|
17
|
+
.split('-')
|
|
18
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
19
|
+
.join('');
|
|
20
|
+
}
|
|
21
|
+
function replaceMarker(tree, path, marker, line) {
|
|
22
|
+
const source = tree.read(path, 'utf8');
|
|
23
|
+
if (source === null || !source.includes(marker)) {
|
|
24
|
+
throw new Error(`Product Slice composition marker ${marker} is missing from ${path}.`);
|
|
25
|
+
}
|
|
26
|
+
tree.write(path, source.replace(marker, `${line}\n${marker}`));
|
|
27
|
+
}
|
|
28
|
+
function createFunctionFilePlan(slice, name) {
|
|
29
|
+
const symbol = `${pascal(slice)}${pascal(name)}Function`;
|
|
30
|
+
const register = `register${symbol}`;
|
|
31
|
+
return {
|
|
32
|
+
files: {
|
|
33
|
+
[`api/${name}.ts`]: `import { createHttpJsonHandler } from '@empire-builder-kit/runtime';\n\nexport const handler = createHttpJsonHandler({\n app: '${slice}',\n operation: '${name}',\n async handle({ context }) {\n return { actor: context.actor?.id ?? null, function: '${name}', ok: true };\n },\n});\n`,
|
|
34
|
+
[`api/${name}.spec.ts`]: `import { describe, expect, it } from 'vitest';\nimport { handler } from './${name}.js';\n\ndescribe('${name} function', () => {\n it('returns its generated identity', async () => {\n const response = await handler({ requestContext: { requestId: 'test-request' } });\n expect(response.statusCode).toBe(200);\n expect(JSON.parse(response.body).data).toMatchObject({ function: '${name}', ok: true });\n });\n});\n`,
|
|
35
|
+
[`infra/functions/${name}.ts`]: `export function ${register}(api: any) {\n api.route('ANY /functions/${name}', {\n environment: { EBK_STAGE: $app.stage },\n handler: 'api/${name}.handler',\n logging: { format: 'json', retention: '1 month' },\n });\n}\n`,
|
|
36
|
+
},
|
|
37
|
+
paths: [
|
|
38
|
+
{ mode: 'seeded', path: `api/${name}.ts` },
|
|
39
|
+
{ mode: 'seeded', path: `api/${name}.spec.ts` },
|
|
40
|
+
{ path: `infra/functions/${name}.ts` },
|
|
41
|
+
],
|
|
42
|
+
register,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async function functionGenerator(tree, options) {
|
|
46
|
+
const slice = requireName(options.slice, 'Product Slice name');
|
|
47
|
+
const name = requireName(options.name, 'Function name');
|
|
48
|
+
const sliceRoot = node_path_1.posix.join('packages', slice);
|
|
49
|
+
const handlerPath = node_path_1.posix.join(sliceRoot, 'api', `${name}.ts`);
|
|
50
|
+
const infraPath = node_path_1.posix.join(sliceRoot, 'infra/functions', `${name}.ts`);
|
|
51
|
+
const productPath = node_path_1.posix.join(sliceRoot, 'infra/product.ts');
|
|
52
|
+
if (!tree.exists(productPath))
|
|
53
|
+
throw new Error(`${slice} is not an EBK v1 Product Slice.`);
|
|
54
|
+
if (tree.exists(handlerPath) || tree.exists(infraPath)) {
|
|
55
|
+
throw new Error(`Function ${name} already exists in Product Slice ${slice}.`);
|
|
56
|
+
}
|
|
57
|
+
const plan = createFunctionFilePlan(slice, name);
|
|
58
|
+
for (const [path, contents] of Object.entries(plan.files)) {
|
|
59
|
+
tree.write(node_path_1.posix.join(sliceRoot, path), contents);
|
|
60
|
+
}
|
|
61
|
+
replaceMarker(tree, productPath, '// <ebk:composition-imports:end>', `import { ${plan.register} } from './functions/${name}.js';`);
|
|
62
|
+
replaceMarker(tree, productPath, '// <ebk:function-registrations:end>', ` ${plan.register}(api);`);
|
|
63
|
+
if (!options.skipFormat)
|
|
64
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
65
|
+
(0, index_js_1.recordCompositionOwnership)(tree, {
|
|
66
|
+
paths: [...plan.paths, { path: 'infra/product.ts' }],
|
|
67
|
+
slice,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
exports.default = functionGenerator;
|
|
71
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/generators/function/function.ts"],"names":[],"mappings":";;AA2CA,wDAmBC;AAED,8CAwCC;AAxGD,uCAAoD;AACpD,yCAAkC;AAClC,uDAAsE;AAGtE,SAAS,WAAW,CAAC,KAAa,EAAE,KAAa;IAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,2FAA2F,CACpG,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,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AC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,iBAAK,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IACD,aAAa,CACX,IAAI,EACJ,WAAW,EACX,kCAAkC,EAClC,YAAY,IAAI,CAAC,QAAQ,wBAAwB,IAAI,OAAO,CAC7D,CAAC;IACF,aAAa,CACX,IAAI,EACJ,WAAW,EACX,qCAAqC,EACrC,KAAK,IAAI,CAAC,QAAQ,QAAQ,CAC3B,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,UAAU;QAAE,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACjD,IAAA,qCAA0B,EAAC,IAAI,EAAE;QAC/B,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QACpD,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "EmpireBuilderKitFunction",
|
|
4
|
+
"title": "Add an HTTP Lambda function to an EBK v1 Product Slice",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"$default": { "$source": "argv", "index": 0 }
|
|
11
|
+
},
|
|
12
|
+
"slice": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Owning Product Slice",
|
|
15
|
+
"x-prompt": "Which Product Slice owns this function?"
|
|
16
|
+
},
|
|
17
|
+
"skipFormat": { "type": "boolean", "default": false }
|
|
18
|
+
},
|
|
19
|
+
"required": ["name", "slice"]
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/generators/job/job.ts"],"names":[],"mappings":";;AAEA,yDAA4D;AAE5D,kBAAe,CAAC,IAAU,EAAE,OAAgC,EAAE,EAAE,CAC9D,IAAA,+BAAiB,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
|
+
import type { PresetGeneratorSchema } from './schema';
|
|
3
|
+
export declare function frameworkPackageVersion(): string;
|
|
4
|
+
export declare function presetGenerator(tree: Tree, options: PresetGeneratorSchema): Promise<void>;
|
|
5
|
+
export default presetGenerator;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.frameworkPackageVersion = frameworkPackageVersion;
|
|
4
|
+
exports.presetGenerator = presetGenerator;
|
|
5
|
+
const prettier_1 = require("prettier");
|
|
6
|
+
const index_js_1 = require("../../ownership/index.js");
|
|
7
|
+
const workspace_files_1 = require("./workspace-files");
|
|
8
|
+
function frameworkPackageVersion() {
|
|
9
|
+
const manifest = require('../../../package.json');
|
|
10
|
+
if (typeof manifest.version !== 'string') {
|
|
11
|
+
throw new Error('Unable to resolve the Empire Builder Kit package version.');
|
|
12
|
+
}
|
|
13
|
+
return manifest.version;
|
|
14
|
+
}
|
|
15
|
+
async function presetGenerator(tree, options) {
|
|
16
|
+
const renderedFiles = (0, workspace_files_1.renderWorkspaceFiles)({
|
|
17
|
+
frameworkVersion: options.frameworkVersion ?? frameworkPackageVersion(),
|
|
18
|
+
name: options.name,
|
|
19
|
+
});
|
|
20
|
+
const files = Object.fromEntries(await Promise.all(Object.entries(renderedFiles).map(async ([path, contents]) => {
|
|
21
|
+
try {
|
|
22
|
+
return [
|
|
23
|
+
path,
|
|
24
|
+
await (0, prettier_1.format)(contents, {
|
|
25
|
+
filepath: path,
|
|
26
|
+
singleQuote: true,
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return [path, contents];
|
|
32
|
+
}
|
|
33
|
+
})));
|
|
34
|
+
for (const [path, contents] of Object.entries(files)) {
|
|
35
|
+
tree.write(path, contents);
|
|
36
|
+
}
|
|
37
|
+
(0, index_js_1.restampFoundationOwnership)(tree);
|
|
38
|
+
(0, index_js_1.restampWorkspaceOwnership)(tree);
|
|
39
|
+
}
|
|
40
|
+
exports.default = presetGenerator;
|
|
41
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/generators/preset/generator.ts"],"names":[],"mappings":";;AASA,0DAQC;AAED,0CAgCC;AAlDD,uCAAoD;AAEpD,uDAGkC;AAClC,uDAAyD;AAEzD,SAAgB,uBAAuB;IACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,uBAAuB,CAA0B,CAAC;IAC3E,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC;AAEM,KAAK,UAAU,eAAe,CACnC,IAAU,EACV,OAA8B;IAE9B,MAAM,aAAa,GAAG,IAAA,sCAAoB,EAAC;QACzC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,uBAAuB,EAAE;QACvE,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE;QAC3D,IAAI,CAAC;YACH,OAAO;gBACL,IAAI;gBACJ,MAAM,IAAA,iBAAc,EAAC,QAAQ,EAAE;oBAC7B,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,IAAI;iBAClB,CAAC;aACM,CAAC;QACb,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAU,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CACH,CACF,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,IAAA,qCAA0B,EAAC,IAAI,CAAC,CAAC;IACjC,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,kBAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "Preset",
|
|
4
|
+
"title": "Empire Builder Kit workspace preset",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Workspace name.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use?"
|
|
15
|
+
},
|
|
16
|
+
"frameworkVersion": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Framework package version written to the generated workspace. Defaults to the preset package version."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["name"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type FoundationOwnershipRecord, type WorkspaceOwnershipRecord } from '../../ownership/index.js';
|
|
2
|
+
export interface WorkspaceFileOptions {
|
|
3
|
+
frameworkVersion: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const WORKSPACE_PROJECT_MANAGED_JSON_POINTERS: readonly ["/name", "/$schema", "/projectType", "/tags", "/targets/deployment-plan", "/targets/dev", "/targets/dev-doctor", "/targets/dev-setup", "/targets/github-bootstrap", "/targets/install-git-hooks", "/targets/verify", "/targets/work-markers", "/targets/workspace-health"];
|
|
7
|
+
export interface FoundationFilePlan {
|
|
8
|
+
files: Readonly<Record<string, string>>;
|
|
9
|
+
ownership: FoundationOwnershipRecord;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkspaceRootFilePlan {
|
|
12
|
+
files: Readonly<Record<string, string>>;
|
|
13
|
+
ownership: WorkspaceOwnershipRecord;
|
|
14
|
+
}
|
|
15
|
+
export declare function renderWorkspaceFiles(options: WorkspaceFileOptions): Readonly<Record<string, string>>;
|
|
16
|
+
export declare function renderWorkspaceRootFilePlan(options: WorkspaceFileOptions): WorkspaceRootFilePlan;
|
|
17
|
+
export declare function renderFoundationFilePlan(options: WorkspaceFileOptions): FoundationFilePlan;
|
|
18
|
+
export declare const WORKSPACE_PACKAGE_MANAGER_VERSION: "10.30.1";
|