@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.
Files changed (185) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.md +25 -0
  4. package/executors.json +54 -0
  5. package/generators.json +35 -0
  6. package/migrations/standard-pre-v1-to-v1.md +11 -0
  7. package/package.json +66 -0
  8. package/src/blueprints/execution.d.ts +31 -0
  9. package/src/blueprints/execution.js +166 -0
  10. package/src/blueprints/execution.js.map +1 -0
  11. package/src/blueprints/index.d.ts +5 -0
  12. package/src/blueprints/index.js +9 -0
  13. package/src/blueprints/index.js.map +1 -0
  14. package/src/blueprints/inputs.d.ts +43 -0
  15. package/src/blueprints/inputs.js +103 -0
  16. package/src/blueprints/inputs.js.map +1 -0
  17. package/src/blueprints/manifest.d.ts +241 -0
  18. package/src/blueprints/manifest.js +369 -0
  19. package/src/blueprints/manifest.js.map +1 -0
  20. package/src/blueprints/resolver.d.ts +28 -0
  21. package/src/blueprints/resolver.js +214 -0
  22. package/src/blueprints/resolver.js.map +1 -0
  23. package/src/blueprints/transitions.d.ts +20 -0
  24. package/src/blueprints/transitions.js +61 -0
  25. package/src/blueprints/transitions.js.map +1 -0
  26. package/src/executors/deploy/deploy.d.ts +4 -0
  27. package/src/executors/deploy/deploy.js +6 -0
  28. package/src/executors/deploy/deploy.js.map +1 -0
  29. package/src/executors/dev/dev.d.ts +4 -0
  30. package/src/executors/dev/dev.js +6 -0
  31. package/src/executors/dev/dev.js.map +1 -0
  32. package/src/executors/dev-doctor/dev-doctor.d.ts +18 -0
  33. package/src/executors/dev-doctor/dev-doctor.js +145 -0
  34. package/src/executors/dev-doctor/dev-doctor.js.map +1 -0
  35. package/src/executors/dev-doctor/schema.json +17 -0
  36. package/src/executors/dev-setup/dev-setup.d.ts +11 -0
  37. package/src/executors/dev-setup/dev-setup.js +454 -0
  38. package/src/executors/dev-setup/dev-setup.js.map +1 -0
  39. package/src/executors/dev-setup/schema.json +16 -0
  40. package/src/executors/fleet/fleet.d.ts +51 -0
  41. package/src/executors/fleet/fleet.js +529 -0
  42. package/src/executors/fleet/fleet.js.map +1 -0
  43. package/src/executors/fleet/schema.json +25 -0
  44. package/src/executors/foundation-preflight/foundation-preflight.d.ts +15 -0
  45. package/src/executors/foundation-preflight/foundation-preflight.js +94 -0
  46. package/src/executors/foundation-preflight/foundation-preflight.js.map +1 -0
  47. package/src/executors/foundation-preflight/schema.json +31 -0
  48. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.d.ts +13 -0
  49. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +69 -0
  50. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js.map +1 -0
  51. package/src/executors/foundation-remove-preflight/schema.json +17 -0
  52. package/src/executors/refresh/refresh.d.ts +4 -0
  53. package/src/executors/refresh/refresh.js +6 -0
  54. package/src/executors/refresh/refresh.js.map +1 -0
  55. package/src/executors/remove/remove.d.ts +4 -0
  56. package/src/executors/remove/remove.js +6 -0
  57. package/src/executors/remove/remove.js.map +1 -0
  58. package/src/executors/sst-lifecycle/run-sst-command.d.ts +28 -0
  59. package/src/executors/sst-lifecycle/run-sst-command.js +154 -0
  60. package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -0
  61. package/src/executors/sst-lifecycle/schema.json +45 -0
  62. package/src/executors/unlock/unlock.d.ts +4 -0
  63. package/src/executors/unlock/unlock.js +6 -0
  64. package/src/executors/unlock/unlock.js.map +1 -0
  65. package/src/foundation/aurora-logical-database.d.ts +76 -0
  66. package/src/foundation/aurora-logical-database.js +419 -0
  67. package/src/foundation/aurora-logical-database.js.map +1 -0
  68. package/src/foundation/discovery.d.ts +55 -0
  69. package/src/foundation/discovery.js +55 -0
  70. package/src/foundation/discovery.js.map +1 -0
  71. package/src/foundation/index.d.ts +6 -0
  72. package/src/foundation/index.js +10 -0
  73. package/src/foundation/index.js.map +1 -0
  74. package/src/foundation/local-database-contract.d.ts +30 -0
  75. package/src/foundation/local-database-contract.js +75 -0
  76. package/src/foundation/local-database-contract.js.map +1 -0
  77. package/src/foundation/preflight.d.ts +31 -0
  78. package/src/foundation/preflight.js +114 -0
  79. package/src/foundation/preflight.js.map +1 -0
  80. package/src/foundation/provision-database-bindings.d.ts +30 -0
  81. package/src/foundation/provision-database-bindings.js +113 -0
  82. package/src/foundation/provision-database-bindings.js.map +1 -0
  83. package/src/foundation/provision-logical-database.d.ts +26 -0
  84. package/src/foundation/provision-logical-database.js +162 -0
  85. package/src/foundation/provision-logical-database.js.map +1 -0
  86. package/src/foundation/requirements.d.ts +37 -0
  87. package/src/foundation/requirements.js +141 -0
  88. package/src/foundation/requirements.js.map +1 -0
  89. package/src/foundation/stages.d.ts +14 -0
  90. package/src/foundation/stages.js +51 -0
  91. package/src/foundation/stages.js.map +1 -0
  92. package/src/generators/function/function.d.ts +13 -0
  93. package/src/generators/function/function.js +71 -0
  94. package/src/generators/function/function.js.map +1 -0
  95. package/src/generators/function/schema.d.ts +5 -0
  96. package/src/generators/function/schema.json +20 -0
  97. package/src/generators/job/job.d.ts +4 -0
  98. package/src/generators/job/job.js +5 -0
  99. package/src/generators/job/job.js.map +1 -0
  100. package/src/generators/preset/generator.d.ts +5 -0
  101. package/src/generators/preset/generator.js +41 -0
  102. package/src/generators/preset/generator.js.map +1 -0
  103. package/src/generators/preset/schema.d.ts +4 -0
  104. package/src/generators/preset/schema.json +22 -0
  105. package/src/generators/preset/workspace-files.d.ts +18 -0
  106. package/src/generators/preset/workspace-files.js +895 -0
  107. package/src/generators/preset/workspace-files.js.map +1 -0
  108. package/src/generators/service/service.d.ts +4 -0
  109. package/src/generators/service/service.js +5 -0
  110. package/src/generators/service/service.js.map +1 -0
  111. package/src/generators/slice/schema.d.ts +7 -0
  112. package/src/generators/slice/schema.json +38 -0
  113. package/src/generators/slice/slice.d.ts +26 -0
  114. package/src/generators/slice/slice.js +1676 -0
  115. package/src/generators/slice/slice.js.map +1 -0
  116. package/src/generators/upgrade/schema.d.ts +8 -0
  117. package/src/generators/upgrade/schema.json +31 -0
  118. package/src/generators/upgrade/upgrade.d.ts +27 -0
  119. package/src/generators/upgrade/upgrade.js +666 -0
  120. package/src/generators/upgrade/upgrade.js.map +1 -0
  121. package/src/generators/workload/schema.d.ts +6 -0
  122. package/src/generators/workload/schema.json +21 -0
  123. package/src/generators/workload/workload.d.ts +16 -0
  124. package/src/generators/workload/workload.js +157 -0
  125. package/src/generators/workload/workload.js.map +1 -0
  126. package/src/index.d.ts +5 -0
  127. package/src/index.js +9 -0
  128. package/src/index.js.map +1 -0
  129. package/src/local-dev/contracts.d.ts +31 -0
  130. package/src/local-dev/contracts.js +126 -0
  131. package/src/local-dev/contracts.js.map +1 -0
  132. package/src/local-dev/gateway-daemon.d.ts +4 -0
  133. package/src/local-dev/gateway-daemon.js +39 -0
  134. package/src/local-dev/gateway-daemon.js.map +1 -0
  135. package/src/local-dev/gateway.d.ts +60 -0
  136. package/src/local-dev/gateway.js +368 -0
  137. package/src/local-dev/gateway.js.map +1 -0
  138. package/src/local-dev/identity.d.ts +16 -0
  139. package/src/local-dev/identity.js +101 -0
  140. package/src/local-dev/identity.js.map +1 -0
  141. package/src/local-dev/index.d.ts +7 -0
  142. package/src/local-dev/index.js +11 -0
  143. package/src/local-dev/index.js.map +1 -0
  144. package/src/local-dev/portless.d.ts +15 -0
  145. package/src/local-dev/portless.js +115 -0
  146. package/src/local-dev/portless.js.map +1 -0
  147. package/src/local-dev/ports.d.ts +10 -0
  148. package/src/local-dev/ports.js +39 -0
  149. package/src/local-dev/ports.js.map +1 -0
  150. package/src/local-dev/proxy.d.ts +37 -0
  151. package/src/local-dev/proxy.js +271 -0
  152. package/src/local-dev/proxy.js.map +1 -0
  153. package/src/local-dev/tls.d.ts +24 -0
  154. package/src/local-dev/tls.js +294 -0
  155. package/src/local-dev/tls.js.map +1 -0
  156. package/src/ownership/composition.d.ts +16 -0
  157. package/src/ownership/composition.js +125 -0
  158. package/src/ownership/composition.js.map +1 -0
  159. package/src/ownership/foundation-record.d.ts +66 -0
  160. package/src/ownership/foundation-record.js +108 -0
  161. package/src/ownership/foundation-record.js.map +1 -0
  162. package/src/ownership/hash.d.ts +2 -0
  163. package/src/ownership/hash.js +10 -0
  164. package/src/ownership/hash.js.map +1 -0
  165. package/src/ownership/index.d.ts +6 -0
  166. package/src/ownership/index.js +10 -0
  167. package/src/ownership/index.js.map +1 -0
  168. package/src/ownership/json-ownership.d.ts +13 -0
  169. package/src/ownership/json-ownership.js +147 -0
  170. package/src/ownership/json-ownership.js.map +1 -0
  171. package/src/ownership/record.d.ts +186 -0
  172. package/src/ownership/record.js +336 -0
  173. package/src/ownership/record.js.map +1 -0
  174. package/src/ownership/workspace-record.d.ts +66 -0
  175. package/src/ownership/workspace-record.js +108 -0
  176. package/src/ownership/workspace-record.js.map +1 -0
  177. package/src/schemas/blueprint-input-schema-v1.json +23 -0
  178. package/src/schemas/blueprint-v1.json +170 -0
  179. package/src/schemas/foundation-ownership-v2.json +42 -0
  180. package/src/schemas/foundation-requirement-v1.json +32 -0
  181. package/src/schemas/generated-ownership-v2.json +117 -0
  182. package/src/schemas/workspace-ownership-v2.json +42 -0
  183. package/src/validation.d.ts +14 -0
  184. package/src/validation.js +14 -0
  185. package/src/validation.js.map +1 -0
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const preflight_js_1 = require("../../foundation/preflight.js");
5
+ const discovery_js_1 = require("../../foundation/discovery.js");
6
+ const stages_js_1 = require("../../foundation/stages.js");
7
+ const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
8
+ async function deployFoundation(options, context, foundationStage) {
9
+ const project = options.foundationProject?.trim() || 'foundation';
10
+ const root = context.projectsConfigurations?.projects[project]?.root;
11
+ if (!root) {
12
+ devkit_1.logger.error(`[foundation-preflight] Foundation project ${project} is not registered in the Nx workspace.`);
13
+ return false;
14
+ }
15
+ devkit_1.logger.info(`[foundation-preflight] deploying ${project} at canonical stage ${foundationStage}.`);
16
+ const result = await (0, run_sst_command_js_1.runSstCommand)('deploy', {
17
+ cwd: root,
18
+ ...(options.profile?.trim() ? { profile: options.profile.trim() } : {}),
19
+ stage: foundationStage,
20
+ stageMode: 'foundation',
21
+ }, { ...context, projectName: project });
22
+ return result.success;
23
+ }
24
+ const executor = async (options, context) => {
25
+ let stages;
26
+ try {
27
+ stages = (0, stages_js_1.resolveFoundationStages)({
28
+ consumerStage: options.stage,
29
+ foundationStage: options.foundationStage ?? process.env.EBK_FOUNDATION_STAGE,
30
+ });
31
+ }
32
+ catch (error) {
33
+ devkit_1.logger.error(error instanceof Error ? error.message : String(error));
34
+ return { success: false };
35
+ }
36
+ const requestedRegion = options.region?.trim() ||
37
+ process.env.AWS_REGION?.trim() ||
38
+ process.env.AWS_DEFAULT_REGION?.trim();
39
+ const reader = (0, preflight_js_1.createFoundationParameterReader)({
40
+ profile: options.profile,
41
+ region: requestedRegion,
42
+ });
43
+ let region = requestedRegion ?? 'default';
44
+ try {
45
+ region = await reader.resolveRegion();
46
+ let report = await (0, preflight_js_1.evaluateFoundationPreflight)({
47
+ consumerStage: stages.consumerStage,
48
+ foundationStage: stages.foundationStage,
49
+ readParameters: reader.read,
50
+ region,
51
+ requirement: {
52
+ capabilities: options.capabilities ?? discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.capabilities,
53
+ contract: options.contract ?? discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.contract,
54
+ },
55
+ });
56
+ if (report.state === 'absent' &&
57
+ options.deployIfMissing === true &&
58
+ !stages.mapped) {
59
+ const deployed = await deployFoundation(options, context, stages.foundationStage);
60
+ if (!deployed)
61
+ return { success: false };
62
+ report = await (0, preflight_js_1.evaluateFoundationPreflight)({
63
+ consumerStage: stages.consumerStage,
64
+ foundationStage: stages.foundationStage,
65
+ readParameters: reader.read,
66
+ region,
67
+ requirement: {
68
+ capabilities: options.capabilities ??
69
+ discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.capabilities,
70
+ contract: options.contract ?? discovery_js_1.STANDARD_FOUNDATION_REQUIREMENT.contract,
71
+ },
72
+ });
73
+ }
74
+ const message = (0, preflight_js_1.formatFoundationPreflightReport)(report);
75
+ if (report.ok) {
76
+ devkit_1.logger.info(message);
77
+ }
78
+ else {
79
+ devkit_1.logger.error(message);
80
+ }
81
+ return { success: report.ok || options.advisory === true };
82
+ }
83
+ catch (error) {
84
+ const message = error instanceof Error ? error.message : String(error);
85
+ if (options.advisory === true) {
86
+ devkit_1.logger.warn(`[foundation-preflight] consumerStage=${stages.consumerStage} foundationStage=${stages.foundationStage} region=${region}: skipped because AWS SSM lookup is unavailable. ${message}`);
87
+ return { success: true };
88
+ }
89
+ devkit_1.logger.error(`[foundation-preflight] consumerStage=${stages.consumerStage} foundationStage=${stages.foundationStage} region=${region}: AWS SSM lookup failed. ${message}`);
90
+ return { success: false };
91
+ }
92
+ };
93
+ exports.default = executor;
94
+ //# sourceMappingURL=foundation-preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundation-preflight.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/foundation-preflight/foundation-preflight.ts"],"names":[],"mappings":";;AAAA,uCAAgF;AAChF,gEAIuC;AACvC,gEAAgF;AAEhF,0DAAqE;AACrE,4EAAoE;AAcpE,KAAK,UAAU,gBAAgB,CAC7B,OAAmC,EACnC,OAAwB,EACxB,eAAuB;IAEvB,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,YAAY,CAAC;IAClE,MAAM,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IACrE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,eAAM,CAAC,KAAK,CACV,6CAA6C,OAAO,yCAAyC,CAC9F,CAAC;QACF,OAAO,KAAK,CAAC;IACf,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AAC;QACxD,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC9B,eAAM,CAAC,IAAI,CACT,wCAAwC,MAAM,CAAC,aAAa,oBAAoB,MAAM,CAAC,eAAe,WAAW,MAAM,oDAAoD,OAAO,EAAE,CACrL,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QACD,eAAM,CAAC,KAAK,CACV,wCAAwC,MAAM,CAAC,aAAa,oBAAoB,MAAM,CAAC,eAAe,WAAW,MAAM,4BAA4B,OAAO,EAAE,CAC7J,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "Empire Builder Kit Foundation preflight",
5
+ "description": "Validate the deployed Standard Foundation discovery contract before operating a Product Slice.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "stage": {
10
+ "type": "string",
11
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
12
+ "default": "development"
13
+ },
14
+ "foundationStage": {
15
+ "type": "string",
16
+ "pattern": "^[a-z0-9][a-z0-9-]*$"
17
+ },
18
+ "region": { "type": "string" },
19
+ "profile": { "type": "string" },
20
+ "contract": { "type": "string", "default": "^1.0.0" },
21
+ "capabilities": {
22
+ "type": "array",
23
+ "items": { "type": "string" },
24
+ "uniqueItems": true
25
+ },
26
+ "advisory": { "type": "boolean", "default": false },
27
+ "deployIfMissing": { "type": "boolean", "default": false },
28
+ "foundationProject": { "type": "string", "default": "foundation" }
29
+ },
30
+ "required": ["stage"]
31
+ }
@@ -0,0 +1,13 @@
1
+ import { type PromiseExecutor } from '@nx/devkit';
2
+ interface FoundationRemovePreflightOptions {
3
+ profile?: string;
4
+ region?: string;
5
+ stage: string;
6
+ }
7
+ export declare function evaluateFoundationRemoval(foundationStage: string, registrationNames: readonly string[]): {
8
+ message: string;
9
+ success: boolean;
10
+ };
11
+ export declare function productSliceRegistrationName(foundationStage: string, parameterName: string | undefined): string;
12
+ declare const executor: PromiseExecutor<FoundationRemovePreflightOptions>;
13
+ export default executor;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.evaluateFoundationRemoval = evaluateFoundationRemoval;
4
+ exports.productSliceRegistrationName = productSliceRegistrationName;
5
+ const client_ssm_1 = require("@aws-sdk/client-ssm");
6
+ const credential_providers_1 = require("@aws-sdk/credential-providers");
7
+ const devkit_1 = require("@nx/devkit");
8
+ const discovery_js_1 = require("../../foundation/discovery.js");
9
+ function evaluateFoundationRemoval(foundationStage, registrationNames) {
10
+ if (registrationNames.length === 0) {
11
+ return {
12
+ message: `[foundation-remove-preflight] foundationStage=${foundationStage}: no Product Slice registrations remain.`,
13
+ success: true,
14
+ };
15
+ }
16
+ return {
17
+ message: `[foundation-remove-preflight] foundationStage=${foundationStage}: Foundation removal is blocked by Product Slice registration records: ${registrationNames.join(', ')}. Remove known consumer-stage slice stacks first; investigate every unrecognized record before retrying.`,
18
+ success: false,
19
+ };
20
+ }
21
+ function productSliceRegistrationName(foundationStage, parameterName) {
22
+ const prefix = `${(0, discovery_js_1.productSliceRegistrationRoot)(foundationStage)}/`;
23
+ if (!parameterName?.startsWith(prefix)) {
24
+ return `[unrecognized registration] ${parameterName ?? '<missing parameter name>'}`;
25
+ }
26
+ const relativeName = parameterName.slice(prefix.length);
27
+ return /^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/.test(relativeName)
28
+ ? relativeName
29
+ : `[unrecognized registration] ${parameterName}`;
30
+ }
31
+ const executor = async (options) => {
32
+ const region = options.region?.trim() ||
33
+ process.env.AWS_REGION?.trim() ||
34
+ process.env.AWS_DEFAULT_REGION?.trim();
35
+ const client = new client_ssm_1.SSMClient({
36
+ ...(options.profile
37
+ ? { credentials: (0, credential_providers_1.fromIni)({ profile: options.profile }) }
38
+ : {}),
39
+ ...(region ? { region } : {}),
40
+ });
41
+ const registrations = [];
42
+ let nextToken;
43
+ try {
44
+ do {
45
+ const response = await client.send(new client_ssm_1.GetParametersByPathCommand({
46
+ NextToken: nextToken,
47
+ Path: (0, discovery_js_1.productSliceRegistrationRoot)(options.stage),
48
+ Recursive: true,
49
+ }));
50
+ registrations.push(...(response.Parameters ?? []).map(({ Name }) => productSliceRegistrationName(options.stage, Name)));
51
+ nextToken = response.NextToken;
52
+ } while (nextToken);
53
+ }
54
+ catch (error) {
55
+ devkit_1.logger.error(`[foundation-remove-preflight] foundationStage=${options.stage}: unable to inspect Product Slice registrations. ${error instanceof Error ? error.message : String(error)}`);
56
+ return { success: false };
57
+ }
58
+ finally {
59
+ client.destroy();
60
+ }
61
+ const result = evaluateFoundationRemoval(options.stage, registrations.sort());
62
+ if (result.success)
63
+ devkit_1.logger.info(result.message);
64
+ else
65
+ devkit_1.logger.error(result.message);
66
+ return { success: result.success };
67
+ };
68
+ exports.default = executor;
69
+ //# sourceMappingURL=foundation-remove-preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundation-remove-preflight.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/foundation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C,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9E,IAAI,MAAM,CAAC,OAAO;QAAE,eAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;;QAC3C,eAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "Empire Builder Kit Foundation removal preflight",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "stage": {
9
+ "type": "string",
10
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
11
+ "default": "development"
12
+ },
13
+ "region": { "type": "string" },
14
+ "profile": { "type": "string" }
15
+ },
16
+ "required": ["stage"]
17
+ }
@@ -0,0 +1,4 @@
1
+ import type { PromiseExecutor } from '@nx/devkit';
2
+ import { type SstLifecycleOptions } from '../sst-lifecycle/run-sst-command.js';
3
+ declare const executor: PromiseExecutor<SstLifecycleOptions>;
4
+ export default executor;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
4
+ const executor = (options, context) => (0, run_sst_command_js_1.runSstCommand)('refresh', options, context);
5
+ exports.default = executor;
6
+ //# sourceMappingURL=refresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/refresh/refresh.ts"],"names":[],"mappings":";;AACA,4EAG6C;AAE7C,MAAM,QAAQ,GAAyC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC1E,IAAA,kCAAa,EAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAE7C,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { PromiseExecutor } from '@nx/devkit';
2
+ import { type SstLifecycleOptions } from '../sst-lifecycle/run-sst-command.js';
3
+ declare const executor: PromiseExecutor<SstLifecycleOptions>;
4
+ export default executor;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const run_sst_command_js_1 = require("../sst-lifecycle/run-sst-command.js");
4
+ const executor = (options, context) => (0, run_sst_command_js_1.runSstCommand)('remove', options, context);
5
+ exports.default = executor;
6
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/remove/remove.ts"],"names":[],"mappings":";;AACA,4EAG6C;AAE7C,MAAM,QAAQ,GAAyC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC1E,IAAA,kCAAa,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAE5C,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type ExecutorContext } from '@nx/devkit';
2
+ import { type FoundationStageResolution } from '../../foundation/stages.js';
3
+ export type SstLifecycleCommand = 'deploy' | 'dev' | 'refresh' | 'remove' | 'unlock';
4
+ export interface SstLifecycleOptions {
5
+ args?: string[];
6
+ cwd?: string;
7
+ foundationStage?: string;
8
+ profile?: string;
9
+ stage: string;
10
+ stageMode: 'consumer' | 'foundation';
11
+ target?: string;
12
+ }
13
+ export interface SstCommandInvocation {
14
+ args: string[];
15
+ cwd: string;
16
+ environment: {
17
+ EBK_CONSUMER_STAGE: string;
18
+ EBK_FOUNDATION_STAGE: string;
19
+ };
20
+ executable: string;
21
+ }
22
+ export declare function assertSafeSstForwardedArguments(args: readonly string[]): void;
23
+ export declare function assertSstLifecyclePolicy(command: SstLifecycleCommand, stage: string, environment?: NodeJS.ProcessEnv): void;
24
+ export declare function resolveSstLifecycleStages(options: SstLifecycleOptions, environment?: NodeJS.ProcessEnv): FoundationStageResolution;
25
+ export declare function buildSstCommandInvocation(command: SstLifecycleCommand, options: SstLifecycleOptions, context: ExecutorContext, environment?: NodeJS.ProcessEnv): SstCommandInvocation;
26
+ export declare function runSstCommand(command: SstLifecycleCommand, options: SstLifecycleOptions, context: ExecutorContext): Promise<{
27
+ success: boolean;
28
+ }>;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSafeSstForwardedArguments = assertSafeSstForwardedArguments;
4
+ exports.assertSstLifecyclePolicy = assertSstLifecyclePolicy;
5
+ exports.resolveSstLifecycleStages = resolveSstLifecycleStages;
6
+ exports.buildSstCommandInvocation = buildSstCommandInvocation;
7
+ exports.runSstCommand = runSstCommand;
8
+ const devkit_1 = require("@nx/devkit");
9
+ const node_child_process_1 = require("node:child_process");
10
+ const node_path_1 = require("node:path");
11
+ const stages_js_1 = require("../../foundation/stages.js");
12
+ const PROTECTED_STAGES = new Set(['staging', 'production']);
13
+ const RESERVED_FORWARDED_OPTIONS = new Set([
14
+ '--config',
15
+ '--profile',
16
+ '--stage',
17
+ '--target',
18
+ ]);
19
+ function assertSafeSstForwardedArguments(args) {
20
+ const reserved = args.find((argument) => {
21
+ const option = argument.split('=', 1)[0].toLowerCase();
22
+ return RESERVED_FORWARDED_OPTIONS.has(option);
23
+ });
24
+ if (reserved) {
25
+ const option = reserved.split('=', 1)[0].toLowerCase();
26
+ throw new Error(`SST forwarded arguments cannot override lifecycle option ${option}. Use the corresponding Nx executor option instead.`);
27
+ }
28
+ }
29
+ function assertSstLifecyclePolicy(command, stage, environment = process.env) {
30
+ if (!PROTECTED_STAGES.has(stage))
31
+ return;
32
+ if (command === 'dev') {
33
+ throw new Error(`SST dev is not permitted for protected stage ${stage}.`);
34
+ }
35
+ const repository = environment.GITHUB_REPOSITORY;
36
+ const expectedWorkflowRef = repository
37
+ ? `${repository}/.github/workflows/deploy.yml@refs/heads/main`
38
+ : undefined;
39
+ const trustedWorkflow = Boolean(repository) &&
40
+ environment.GITHUB_ACTIONS === 'true' &&
41
+ environment.GITHUB_EVENT_NAME === 'workflow_dispatch' &&
42
+ environment.GITHUB_REF === 'refs/heads/main' &&
43
+ environment.GITHUB_WORKFLOW_REF === expectedWorkflowRef;
44
+ if (!trustedWorkflow) {
45
+ throw new Error(`SST ${command} for protected stage ${stage} must run from the main-branch deploy workflow.`);
46
+ }
47
+ if (command === 'remove' &&
48
+ stage === 'production' &&
49
+ environment.EBK_ALLOW_PRODUCTION_REMOVE !== 'true') {
50
+ throw new Error('Production removal requires EBK_ALLOW_PRODUCTION_REMOVE=true in the protected production environment.');
51
+ }
52
+ }
53
+ function resolveSstLifecycleStages(options, environment = process.env) {
54
+ if (options.stageMode === 'foundation') {
55
+ const stage = (0, stages_js_1.requireFoundationStage)(options.stage);
56
+ if (options.foundationStage?.trim() &&
57
+ (0, stages_js_1.requireFoundationStage)(options.foundationStage) !== stage) {
58
+ throw new Error(`Foundation lifecycle stage ${stage} cannot target Foundation stage ${options.foundationStage.trim()}.`);
59
+ }
60
+ return {
61
+ consumerStage: stage,
62
+ foundationStage: stage,
63
+ mapped: false,
64
+ };
65
+ }
66
+ if (options.stageMode !== 'consumer') {
67
+ throw new Error('SST lifecycle stageMode must be consumer or foundation.');
68
+ }
69
+ return (0, stages_js_1.resolveFoundationStages)({
70
+ consumerStage: options.stage,
71
+ foundationStage: options.foundationStage ?? environment.EBK_FOUNDATION_STAGE,
72
+ });
73
+ }
74
+ function buildSstCommandInvocation(command, options, context, environment = process.env) {
75
+ const configuredRoot = context.projectName
76
+ ? context.projectsConfigurations?.projects[context.projectName]?.root
77
+ : undefined;
78
+ const configuredCwd = options.cwd ?? configuredRoot ?? context.root;
79
+ const cwd = (0, node_path_1.isAbsolute)(configuredCwd)
80
+ ? configuredCwd
81
+ : (0, node_path_1.join)(context.root, configuredCwd);
82
+ const stages = resolveSstLifecycleStages(options, environment);
83
+ if (options.stageMode === 'consumer' &&
84
+ command === 'deploy' &&
85
+ stages.mapped) {
86
+ throw new Error(`Full deploy is not permitted for mapped consumer stage ${stages.consumerStage}. Use dev against the ${stages.foundationStage} Foundation until preview routing is supported.`);
87
+ }
88
+ assertSstLifecyclePolicy(command, stages.consumerStage, environment);
89
+ const args = [command, '--stage', stages.consumerStage];
90
+ if (options.profile) {
91
+ args.push('--profile', options.profile);
92
+ }
93
+ if (options.target) {
94
+ args.push('--target', options.target);
95
+ }
96
+ if (options.args) {
97
+ assertSafeSstForwardedArguments(options.args);
98
+ args.push(...options.args);
99
+ }
100
+ return {
101
+ args: [
102
+ (0, node_path_1.join)(context.root, 'node_modules', 'sst', 'bin', 'sst.mjs'),
103
+ ...args,
104
+ ],
105
+ cwd,
106
+ environment: {
107
+ EBK_CONSUMER_STAGE: stages.consumerStage,
108
+ EBK_FOUNDATION_STAGE: stages.foundationStage,
109
+ },
110
+ executable: process.execPath,
111
+ };
112
+ }
113
+ async function runSstCommand(command, options, context) {
114
+ let invocation;
115
+ try {
116
+ invocation = buildSstCommandInvocation(command, options, context);
117
+ }
118
+ catch (error) {
119
+ devkit_1.logger.error(error instanceof Error ? error.message : String(error));
120
+ return { success: false };
121
+ }
122
+ devkit_1.logger.info(`Running workspace SST: ${command} --stage ${invocation.environment.EBK_CONSUMER_STAGE} foundationStage=${invocation.environment.EBK_FOUNDATION_STAGE} (${invocation.cwd})`);
123
+ return new Promise((resolve) => {
124
+ const child = (0, node_child_process_1.spawn)(invocation.executable, invocation.args, {
125
+ cwd: invocation.cwd,
126
+ env: { ...process.env, ...invocation.environment },
127
+ shell: false,
128
+ stdio: 'inherit',
129
+ });
130
+ let settled = false;
131
+ const settle = (success) => {
132
+ if (settled)
133
+ return;
134
+ settled = true;
135
+ resolve({ success });
136
+ };
137
+ child.on('error', (error) => {
138
+ devkit_1.logger.error(`Failed to start workspace SST: ${error.message}`);
139
+ settle(false);
140
+ });
141
+ child.on('close', (code, signal) => {
142
+ if (code !== 0) {
143
+ devkit_1.logger.error(signal
144
+ ? `SST ${command} terminated with signal ${signal}.`
145
+ : `SST ${command} exited with status ${code ?? 'unknown'}.`);
146
+ if (command === 'deploy' || command === 'remove') {
147
+ devkit_1.logger.error(`If the stack is locked, run pnpm nx run ${context.projectName ?? '<project>'}:unlock --stage=${options.stage}.`);
148
+ }
149
+ }
150
+ settle(code === 0);
151
+ });
152
+ });
153
+ }
154
+ //# sourceMappingURL=run-sst-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-sst-command.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/sst-lifecycle/run-sst-command.ts"],"names":[],"mappings":";;AAwCA,0EAWC;AAED,4DAiCC;AAED,8DA4BC;AAED,8DAiDC;AAED,sCAoDC;AA7ND,uCAA0D;AAC1D,2DAA2C;AAC3C,yCAA6C;AAC7C,0DAIoC;AAyBpC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAC5D,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC;IACzC,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEH,SAAgB,+BAA+B,CAAC,IAAuB;IACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,OAAO,0BAA0B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CACb,4DAA4D,MA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AAE,CAAC;gBACf,eAAM,CAAC,KAAK,CACV,MAAM;oBACJ,CAAC,CAAC,OAAO,OAAO,2BAA2B,MAAM,GAAG;oBACpD,CAAC,CAAC,OAAO,OAAO,uBAAuB,IAAI,IAAI,SAAS,GAAG,CAC9D,CAAC;gBACF,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACjD,eAAM,CAAC,KAAK,CACV,2CAA2C,OAAO,CAAC,WAAW,IAAI,WAAW,mBAAmB,OAAO,CAAC,KAAK,GAAG,CACjH,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "Empire Builder Kit SST lifecycle executor",
5
+ "description": "Run a supported SST lifecycle action through the workspace-pinned binary.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "cwd": {
10
+ "type": "string",
11
+ "description": "Working directory containing sst.config.ts. Defaults to the Nx project root."
12
+ },
13
+ "stage": {
14
+ "type": "string",
15
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
16
+ "description": "SST stage name.",
17
+ "default": "development"
18
+ },
19
+ "stageMode": {
20
+ "type": "string",
21
+ "enum": ["consumer", "foundation"],
22
+ "description": "Whether --stage names a Product Slice consumer stage or a canonical Foundation stage."
23
+ },
24
+ "foundationStage": {
25
+ "type": "string",
26
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
27
+ "description": "Optional explicit Foundation stage. Consumer personal/preview stages may use only development."
28
+ },
29
+ "profile": {
30
+ "type": "string",
31
+ "description": "Optional AWS profile passed to SST."
32
+ },
33
+ "target": {
34
+ "type": "string",
35
+ "description": "Optional SST target selector."
36
+ },
37
+ "args": {
38
+ "type": "array",
39
+ "description": "Additional arguments passed to SST. Cannot override --stage, --profile, --target, or --config; use the executor options instead.",
40
+ "items": { "type": "string" },
41
+ "default": []
42
+ }
43
+ },
44
+ "required": ["stage", "stageMode"]
45
+ }
@@ -0,0 +1,4 @@
1
+ import type { PromiseExecutor } from '@nx/devkit';
2
+ import { type SstLifecycleOptions } from '../sst-lifecycle/run-sst-command.js';
3
+ declare const executor: PromiseExecutor<SstLifecycleOptions>;
4
+ export default executor;
@@ -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)('unlock', options, context);
5
+ exports.default = executor;
6
+ //# sourceMappingURL=unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unlock.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/unlock/unlock.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,76 @@
1
+ import type { ExecuteStatementCommand, RDSDataClient } from '@aws-sdk/client-rds-data';
2
+ export interface AuroraLogicalDbInputs {
3
+ clusterArn: string;
4
+ masterSecretArn: string;
5
+ database: string;
6
+ readwriteRole: string;
7
+ readonlyRole: string;
8
+ removalPolicy?: 'retain' | 'destroy';
9
+ rotationToken?: string;
10
+ }
11
+ export interface AuroraLogicalDbState extends AuroraLogicalDbInputs {
12
+ readwritePassword: string;
13
+ readonlyPassword: string;
14
+ id: string;
15
+ }
16
+ export interface DataApiExecutor {
17
+ execute(database: string, sql: string): Promise<void>;
18
+ exists(database: string, existsSql: string): Promise<boolean>;
19
+ }
20
+ type ExecuteStatementCommandConstructor = new (input: ConstructorParameters<typeof ExecuteStatementCommand>[0]) => ExecuteStatementCommand;
21
+ export declare class RdsDataApiExecutor implements DataApiExecutor {
22
+ private readonly client;
23
+ private readonly resourceArn;
24
+ private readonly secretArn;
25
+ private readonly ExecuteStatementCommand;
26
+ constructor(client: RDSDataClient, resourceArn: string, secretArn: string, ExecuteStatementCommand: ExecuteStatementCommandConstructor);
27
+ execute(database: string, sql: string): Promise<void>;
28
+ exists(database: string, existsSql: string): Promise<boolean>;
29
+ }
30
+ export declare function createDatabaseSql(database: string): string;
31
+ export declare function databaseExistsSql(database: string): string;
32
+ export declare function roleExistsSql(role: string): string;
33
+ export declare function createRoleSql(role: string, password: string): string;
34
+ export declare function alterRolePasswordSql(role: string, password: string): string;
35
+ export declare function grantScopedAccessSql(database: string, readwriteRole: string, readonlyRole: string): string[];
36
+ export type PasswordGenerator = () => string;
37
+ export interface PulumiCreateResult {
38
+ id: string;
39
+ outs?: Record<string, unknown>;
40
+ }
41
+ export interface PulumiUpdateResult {
42
+ outs?: Record<string, unknown>;
43
+ }
44
+ export interface AuroraLogicalDbProviderOptions {
45
+ executorFactory?: (inputs: AuroraLogicalDbInputs) => DataApiExecutor;
46
+ passwordGenerator?: PasswordGenerator;
47
+ }
48
+ export declare class AuroraLogicalDbProvider {
49
+ private readonly executorFactory?;
50
+ private readonly passwordGenerator;
51
+ constructor(options?: AuroraLogicalDbProviderOptions);
52
+ private buildExecutor;
53
+ private generateSecret;
54
+ create(inputs: AuroraLogicalDbInputs): Promise<PulumiCreateResult>;
55
+ private createInternal;
56
+ update(_id: string, olds: AuroraLogicalDbState, news: AuroraLogicalDbInputs): Promise<PulumiUpdateResult>;
57
+ private updateInternal;
58
+ delete(_id: string, props: AuroraLogicalDbState): Promise<void>;
59
+ private deleteInternal;
60
+ }
61
+ export interface AuroraLogicalDbResource {
62
+ readwritePassword: unknown;
63
+ readonlyPassword: unknown;
64
+ [key: string]: unknown;
65
+ }
66
+ export interface AuroraLogicalDbResourceOptions {
67
+ additionalSecretOutputs?: string[];
68
+ [key: string]: unknown;
69
+ }
70
+ export interface CreateAuroraLogicalDbOptions {
71
+ name: string;
72
+ args: AuroraLogicalDbInputs | Record<string, unknown>;
73
+ opts?: AuroraLogicalDbResourceOptions;
74
+ }
75
+ export declare function createAuroraLogicalDbResource(options: CreateAuroraLogicalDbOptions): AuroraLogicalDbResource;
76
+ export {};