@fjall/deploy-core 0.89.5 → 0.89.6
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 +50 -21
- package/README.md +25 -0
- package/dist/.minified +1 -0
- package/dist/src/__test-utils__/awsMockHelpers.d.ts +20 -0
- package/dist/src/__test-utils__/awsMockHelpers.js +1 -0
- package/dist/src/__test-utils__/index.d.ts +1 -0
- package/dist/src/__test-utils__/index.js +1 -0
- package/dist/src/aws/AwsProvider.js +0 -1
- package/dist/src/aws/SimpleAwsProvider.js +1 -70
- package/dist/src/aws/index.d.ts +4 -2
- package/dist/src/aws/index.js +1 -3
- package/dist/src/aws/organisations/accounts.js +10 -10
- package/dist/src/aws/organisations/backup.js +4 -2
- package/dist/src/aws/organisations/costAllocation.js +4 -2
- package/dist/src/aws/organisations/delegatedAdmin.d.ts +9 -0
- package/dist/src/aws/organisations/delegatedAdmin.js +43 -0
- package/dist/src/aws/organisations/identityCentre.d.ts +1 -1
- package/dist/src/aws/organisations/identityCentre.js +6 -2
- package/dist/src/aws/organisations/index.d.ts +4 -3
- package/dist/src/aws/organisations/index.js +1 -12
- package/dist/src/aws/organisations/ipam.js +4 -2
- package/dist/src/aws/organisations/organisation.js +27 -18
- package/dist/src/aws/organisations/organisationalUnits.d.ts +26 -6
- package/dist/src/aws/organisations/organisationalUnits.js +149 -35
- package/dist/src/aws/organisations/policies.js +4 -3
- package/dist/src/aws/organisations/ram.js +6 -2
- package/dist/src/aws/organisations/serviceAccess.js +12 -6
- package/dist/src/aws/organisations/trustedAccess.js +6 -2
- package/dist/src/aws/organisations/types.d.ts +23 -1
- package/dist/src/aws/organisations/types.js +1 -16
- package/dist/src/aws/utils/__tests__/cloudformationTestHelpers.d.ts +6 -0
- package/dist/src/aws/utils/__tests__/cloudformationTestHelpers.js +1 -0
- package/dist/src/aws/utils/cloudformationEventHelpers.d.ts +48 -0
- package/dist/src/aws/utils/cloudformationEventHelpers.js +1 -0
- package/dist/src/aws/utils/cloudformationEventTypes.d.ts +45 -0
- package/dist/src/aws/utils/cloudformationEventTypes.js +1 -0
- package/dist/src/aws/utils/cloudformationEvents.d.ts +8 -54
- package/dist/src/aws/utils/cloudformationEvents.js +1 -596
- package/dist/src/aws/utils/index.d.ts +5 -0
- package/dist/src/aws/utils/index.js +1 -0
- package/dist/src/aws/utils/stackStatus.js +1 -90
- package/dist/src/events/index.d.ts +13 -0
- package/dist/src/events/index.js +1 -0
- package/dist/src/index.d.ts +34 -17
- package/dist/src/index.js +41 -21
- package/dist/src/orchestration/__tests__/cascadeTestHelpers.d.ts +12 -0
- package/dist/src/orchestration/__tests__/cascadeTestHelpers.js +78 -0
- package/dist/src/orchestration/activeDeploymentGuard.d.ts +10 -0
- package/dist/src/orchestration/activeDeploymentGuard.js +39 -0
- package/dist/src/orchestration/applicationDeploy.js +46 -229
- package/dist/src/orchestration/applicationDeployHelpers.d.ts +39 -0
- package/dist/src/orchestration/applicationDeployHelpers.js +223 -0
- package/dist/src/orchestration/applicationDestroy.d.ts +14 -0
- package/dist/src/orchestration/applicationDestroy.js +131 -0
- package/dist/src/orchestration/builders/dockerBuilder.d.ts +17 -0
- package/dist/src/orchestration/builders/dockerBuilder.js +98 -0
- package/dist/src/orchestration/builders/frameworkRegistry.d.ts +23 -0
- package/dist/src/orchestration/builders/frameworkRegistry.js +1 -0
- package/dist/src/orchestration/builders/index.d.ts +4 -0
- package/dist/src/orchestration/builders/index.js +1 -0
- package/dist/src/orchestration/builders/openNextBuilder.d.ts +21 -0
- package/dist/src/orchestration/builders/openNextBuilder.js +144 -0
- package/dist/src/orchestration/cascadeDestroyHelpers.d.ts +30 -0
- package/dist/src/orchestration/cascadeDestroyHelpers.js +1 -0
- package/dist/src/orchestration/cascadeHelpers.d.ts +46 -0
- package/dist/src/orchestration/cascadeHelpers.js +160 -0
- package/dist/src/orchestration/contextHelpers.d.ts +46 -2
- package/dist/src/orchestration/contextHelpers.js +93 -1
- package/dist/src/orchestration/destroy.d.ts +13 -0
- package/dist/src/orchestration/destroy.js +67 -0
- package/dist/src/orchestration/detectionPipeline.d.ts +2 -11
- package/dist/src/orchestration/detectionPipeline.js +29 -10
- package/dist/src/orchestration/dockerBuildHelper.d.ts +10 -0
- package/dist/src/orchestration/dockerBuildHelper.js +49 -0
- package/dist/src/orchestration/dockerInterface.d.ts +4 -2
- package/dist/src/orchestration/index.d.ts +8 -1
- package/dist/src/orchestration/index.js +1 -3
- package/dist/src/orchestration/manifestSecretParser.d.ts +11 -0
- package/dist/src/orchestration/manifestSecretParser.js +1 -0
- package/dist/src/orchestration/openNextBuild.d.ts +28 -0
- package/dist/src/orchestration/openNextBuild.js +243 -0
- package/dist/src/orchestration/organisationDeploy.js +110 -233
- package/dist/src/orchestration/organisationDestroy.d.ts +24 -0
- package/dist/src/orchestration/organisationDestroy.js +189 -0
- package/dist/src/orchestration/organisationSetup.d.ts +6 -4
- package/dist/src/orchestration/organisationSetup.js +28 -8
- package/dist/src/orchestration/resolveOperation.js +68 -6
- package/dist/src/orchestration/serviceFactory.d.ts +4 -0
- package/dist/src/orchestration/serviceFactory.js +1 -16
- package/dist/src/orchestration/spawnHelpers.d.ts +47 -0
- package/dist/src/orchestration/spawnHelpers.js +1 -0
- package/dist/src/orchestration/stackCleanup.d.ts +39 -0
- package/dist/src/orchestration/stackCleanup.js +1 -0
- package/dist/src/orchestration/welcomeImageHelper.d.ts +15 -0
- package/dist/src/orchestration/welcomeImageHelper.js +64 -0
- package/dist/src/services/application/ApplicationStackService.d.ts +21 -30
- package/dist/src/services/application/ApplicationStackService.js +16 -234
- package/dist/src/services/application/applicationStackHelpers.d.ts +46 -0
- package/dist/src/services/application/applicationStackHelpers.js +248 -0
- package/dist/src/services/application/index.d.ts +1 -0
- package/dist/src/services/application/index.js +1 -1
- package/dist/src/services/index.d.ts +6 -0
- package/dist/src/services/index.js +1 -0
- package/dist/src/services/infrastructure/CdkArgumentBuilder.js +1 -67
- package/dist/src/services/infrastructure/CdkCommandRunner.d.ts +10 -2
- package/dist/src/services/infrastructure/CdkCommandRunner.js +18 -15
- package/dist/src/services/infrastructure/CdkErrorFormatter.js +16 -194
- package/dist/src/services/infrastructure/CdkEventMonitoring.js +1 -41
- package/dist/src/services/infrastructure/CdkOutputAnalyser.js +1 -1
- package/dist/src/services/infrastructure/CdkOutputParser.js +2 -33
- package/dist/src/services/infrastructure/CdkProcessManager.d.ts +5 -0
- package/dist/src/services/infrastructure/CdkProcessManager.js +81 -47
- package/dist/src/services/infrastructure/CdkService.d.ts +7 -53
- package/dist/src/services/infrastructure/CdkService.js +41 -83
- package/dist/src/services/infrastructure/CdkServiceTypes.d.ts +50 -0
- package/dist/src/services/infrastructure/CdkServiceTypes.js +0 -0
- package/dist/src/services/infrastructure/CloudFormationService.js +9 -10
- package/dist/src/services/infrastructure/ICdkProcessManager.d.ts +27 -0
- package/dist/src/services/infrastructure/ICdkProcessManager.js +1 -0
- package/dist/src/services/infrastructure/__tests__/cloudFormationTestHelpers.d.ts +9 -0
- package/dist/src/services/infrastructure/__tests__/cloudFormationTestHelpers.js +1 -0
- package/dist/src/services/infrastructure/cdkServiceHelpers.d.ts +9 -0
- package/dist/src/services/infrastructure/cdkServiceHelpers.js +1 -0
- package/dist/src/services/infrastructure/constructMapEnrichment.d.ts +7 -0
- package/dist/src/services/infrastructure/constructMapEnrichment.js +1 -0
- package/dist/src/services/infrastructure/index.d.ts +3 -1
- package/dist/src/services/infrastructure/index.js +1 -7
- package/dist/src/services/supporting/TemplateHashService.js +1 -1
- package/dist/src/services/supporting/helpers.js +1 -81
- package/dist/src/services/supporting/index.js +1 -3
- package/dist/src/steps/index.d.ts +1 -0
- package/dist/src/steps/index.js +1 -0
- package/dist/src/steps/stepRegistry.d.ts +71 -0
- package/dist/src/steps/stepRegistry.js +505 -0
- package/dist/src/types/FjallState.js +1 -118
- package/dist/src/types/ProgressEvent.js +1 -48
- package/dist/src/types/application/ApplicationServiceTypes.js +1 -30
- package/dist/src/types/application/index.js +1 -1
- package/dist/src/types/callbacks.d.ts +76 -4
- package/dist/src/types/callbacks.js +0 -1
- package/dist/src/types/constants.d.ts +2 -0
- package/dist/src/types/constants.js +1 -6
- package/dist/src/types/credentials.js +0 -1
- package/dist/src/types/deployment/DeploymentServiceTypes.d.ts +5 -2
- package/dist/src/types/deployment/DeploymentServiceTypes.js +1 -1
- package/dist/src/types/deployment/DeploymentTypes.js +0 -1
- package/dist/src/types/deployment/cloudformation.js +0 -1
- package/dist/src/types/deployment/index.d.ts +3 -1
- package/dist/src/types/deployment/index.js +1 -1
- package/dist/src/types/deployment/parallel.js +1 -10
- package/dist/src/types/deploymentEventSchema.d.ts +158 -0
- package/dist/src/types/deploymentEventSchema.js +1 -0
- package/dist/src/types/detection.d.ts +22 -0
- package/dist/src/types/detection.js +1 -0
- package/dist/src/types/entitlements.d.ts +31 -0
- package/dist/src/types/entitlements.js +0 -0
- package/dist/src/types/errors/CdkError.js +1 -20
- package/dist/src/types/errors/ServiceError.d.ts +2 -1
- package/dist/src/types/errors/ServiceError.js +1 -119
- package/dist/src/types/errors/index.d.ts +2 -0
- package/dist/src/types/errors/index.js +1 -0
- package/dist/src/types/events.d.ts +3 -9
- package/dist/src/types/events.js +0 -5
- package/dist/src/types/frameworkBuilder.d.ts +96 -0
- package/dist/src/types/frameworkBuilder.js +8 -0
- package/dist/src/types/index.d.ts +19 -4
- package/dist/src/types/index.js +1 -9
- package/dist/src/types/operations.d.ts +3 -2
- package/dist/src/types/operations.js +1 -285
- package/dist/src/types/orgConfig.d.ts +2 -10
- package/dist/src/types/orgConfig.js +0 -11
- package/dist/src/types/params.d.ts +60 -1
- package/dist/src/types/patternDetection.d.ts +14 -16
- package/dist/src/types/patternDetection.js +14 -18
- package/dist/src/types/patternTypes.d.ts +19 -0
- package/dist/src/types/patternTypes.js +1 -0
- package/dist/src/types/stepDefinitions.d.ts +163 -0
- package/dist/src/types/stepDefinitions.js +98 -0
- package/dist/src/types/validation.js +0 -1
- package/dist/src/util/dockerfileDetection.d.ts +5 -0
- package/dist/src/util/dockerfileDetection.js +1 -0
- package/dist/src/util/index.d.ts +4 -3
- package/dist/src/util/index.js +1 -3
- package/dist/src/util/sequencedCallbacks.d.ts +44 -0
- package/dist/src/util/sequencedCallbacks.js +1 -0
- package/package.json +49 -8
- package/dist/src/aws/utils/CloudFormationFailureAnalyser.d.ts +0 -32
- package/dist/src/aws/utils/CloudFormationFailureAnalyser.js +0 -228
- package/dist/src/aws/utils/errors.d.ts +0 -26
- package/dist/src/aws/utils/errors.js +0 -59
- package/dist/src/util/fsHelpers.d.ts +0 -4
- package/dist/src/util/fsHelpers.js +0 -16
- package/dist/src/util/securityHelpers.d.ts +0 -31
- package/dist/src/util/securityHelpers.js +0 -124
- package/dist/src/util/singleton.d.ts +0 -2
- package/dist/src/util/singleton.js +0 -9
- package/dist/src/util/sleep.d.ts +0 -4
- package/dist/src/util/sleep.js +0 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Result } from "@fjall/generator";
|
|
2
|
+
import type { CdkOptions, CdkOutput } from "./CdkService.js";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for CDK process management, enabling constructor injection.
|
|
5
|
+
*
|
|
6
|
+
* The concrete CdkProcessManager uses `import.meta.url` to resolve the
|
|
7
|
+
* `aws-cdk` binary from the calling package's node_modules. By programming
|
|
8
|
+
* against this interface, callers (CLI, webapp worker) can provide their
|
|
9
|
+
* own implementation with the correct binary resolution context.
|
|
10
|
+
*/
|
|
11
|
+
export interface ICdkProcessManager {
|
|
12
|
+
/** Run a CDK command and capture stdout/stderr output. */
|
|
13
|
+
runCdkCommand(workingDir: string, args: string[], options?: CdkOptions & {
|
|
14
|
+
ignoreExitCode?: boolean;
|
|
15
|
+
skipProjectCheck?: boolean;
|
|
16
|
+
extraEnv?: Record<string, string>;
|
|
17
|
+
combineOutput?: boolean;
|
|
18
|
+
}): Promise<Result<CdkOutput, string>>;
|
|
19
|
+
/** Run a CDK command with stdio passed through to the terminal. */
|
|
20
|
+
runCdkCommandPassthrough(workingDir: string, args: string[], options?: CdkOptions & {
|
|
21
|
+
ignoreExitCode?: boolean;
|
|
22
|
+
}): Promise<Result<CdkOutput, string>>;
|
|
23
|
+
/** Kill all tracked child processes and clean up resources. */
|
|
24
|
+
cleanup(): void;
|
|
25
|
+
/** Clean up resources and deregister process signal handlers. */
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AwsProvider } from "../../../aws/AwsProvider.js";
|
|
2
|
+
import { CloudFormationService } from "../CloudFormationService.js";
|
|
3
|
+
export declare function createCfnService(): {
|
|
4
|
+
service: CloudFormationService;
|
|
5
|
+
mockSend: import("vitest").Mock<(...args: any[]) => any>;
|
|
6
|
+
mockAws: AwsProvider;
|
|
7
|
+
};
|
|
8
|
+
export declare function createValidationError(message: string): Error;
|
|
9
|
+
export declare function createStackNotFoundError(): Error;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{vi as e}from"vitest";import{createAwsError as o}from"../../../__test-utils__/awsMockHelpers.js";import{CloudFormationService as n}from"../CloudFormationService.js";function u(){const r=e.fn(),t={getClient:e.fn().mockReturnValue({send:r})};return{service:new n(t),mockSend:r,mockAws:t}}function c(r){return o("ValidationError",r)}function f(){return c("Stack with id my-stack does not exist")}export{u as createCfnService,f as createStackNotFoundError,c as createValidationError};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeploymentContext } from "../../types/deployment/DeploymentTypes.js";
|
|
2
|
+
import type { CdkContext } from "./CdkServiceTypes.js";
|
|
3
|
+
/** Delay before falling back to the predicted stack name for CloudFormation monitoring */
|
|
4
|
+
export declare const STACK_DETECTION_FALLBACK_MS = 5000;
|
|
5
|
+
export declare function resolveStackName(stackPattern: string | undefined, context: DeploymentContext): string | undefined;
|
|
6
|
+
export declare function getFallbackStackName(context: DeploymentContext): string;
|
|
7
|
+
export declare function buildDeploymentCdkContext(context: DeploymentContext, accountId: string | undefined, region: string, options?: {
|
|
8
|
+
includeImageVersion?: boolean;
|
|
9
|
+
}): CdkContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getApplicationStackName as r,getOrganisationStackName as p,isApplicationStack as d}from"../../types/operations.js";const l=5e3;function t(e,o){if(e&&!e.includes("*"))return e;if(e){const a=e.match(/\*?(\w+)\*?/);if(a?.[1]){const n=a[1],i=o.target??"app";return d(n)?r(i,n):`${i}${n}`}return e}}function u(e){const o=e.deployType;return o==="organisation"||o==="platform"||o==="account"?p(o):`${e.target??"app"}Network`}function m(e,o,a,n){return{accountId:o,region:a,managedAccount:e.isManagedAccount,...n?.includeImageVersion!==!1&&{imageVersion:e.imageVersion},orgId:e.orgId,rootId:e.rootId,managementAccountId:e.managementAccountId,ipamPoolId:e.ipamPoolId,fjallOrgId:e.fjallOrgId,fjallOidcConfigured:e.fjallOidcConfigured?"true":void 0,orgConfig:e.orgConfig}}export{l as STACK_DETECTION_FALLBACK_MS,m as buildDeploymentCdkContext,u as getFallbackStackName,t as resolveStackName};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResourceEvent } from "../../aws/utils/cloudformationEvents.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read the construct map from fjall-manifest.json (written during synth)
|
|
4
|
+
* and return a wrapped callback that enriches resource events with
|
|
5
|
+
* group and constructPath fields.
|
|
6
|
+
*/
|
|
7
|
+
export declare function wrapWithConstructMapEnrichment(projectPath: string, onResourceProgress?: (event: ResourceEvent) => void): ((event: ResourceEvent) => void) | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as u,readFileSync as s}from"fs";import{join as p}from"path";import{logger as i}from"@fjall/util/logger";import{enrichFromConstructMap as a,recordToConstructMap as f,FJALL_MANIFEST_FILENAME as d}from"@fjall/util/constructMap";import{getErrorMessage as m}from"@fjall/util";function C(n,c){if(!c)return;const t=p(n,"cdk.out",d);let e;try{if(u(t)){const r=JSON.parse(s(t,"utf-8")),o=typeof r=="object"&&r!==null?r.resourceMap:void 0;h(o)&&(e=f(o)),e&&e.size>0&&i.debug("CdkService",`Loaded construct map with ${e.size} entries`)}}catch(r){i.debug("CdkService",`Could not read construct map: ${m(r)}`)}return!e||e.size===0?c:r=>{const o=a(r.logicalId,r.resourceType,e);c({...r,...o.group!==void 0?{group:o.group}:{},...o.constructPath!==void 0?{constructPath:o.constructPath}:{}})}}function h(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;const c=Object.values(n);if(c.length===0)return!0;const t=c[0];return typeof t=="object"&&t!==null&&"constructPath"in t&&"group"in t&&"resourceType"in t}export{C as wrapWithConstructMapEnrichment};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { CdkService } from "./CdkService.js";
|
|
2
|
-
export type {
|
|
2
|
+
export type { CheckDifferencesResult } from "./CdkCommandRunner.js";
|
|
3
|
+
export type { CdkContext, CdkOptions, CdkOutput, CdkServiceOptions } from "./CdkServiceTypes.js";
|
|
4
|
+
export type { ICdkProcessManager } from "./ICdkProcessManager.js";
|
|
3
5
|
export { CdkArgumentBuilder } from "./CdkArgumentBuilder.js";
|
|
4
6
|
export { CdkProcessManager } from "./CdkProcessManager.js";
|
|
5
7
|
export { CdkEventMonitor, startStackMonitoring, DEFAULT_DEPLOY_TIMEOUT_MS } from "./CdkEventMonitoring.js";
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { CdkArgumentBuilder } from "./CdkArgumentBuilder.js";
|
|
3
|
-
export { CdkProcessManager } from "./CdkProcessManager.js";
|
|
4
|
-
export { CdkEventMonitor, startStackMonitoring, DEFAULT_DEPLOY_TIMEOUT_MS } from "./CdkEventMonitoring.js";
|
|
5
|
-
export { isCdkError, formatInfrastructureError, getStructuralHint, getSourceContext } from "./CdkErrorFormatter.js";
|
|
6
|
-
export { hasCdkDifferences, parseDiffOutput } from "./CdkOutputParser.js";
|
|
7
|
-
export { CloudFormationService, CloudFormationError } from "./CloudFormationService.js";
|
|
1
|
+
import{CdkService as t}from"./CdkService.js";import{CdkArgumentBuilder as f}from"./CdkArgumentBuilder.js";import{CdkProcessManager as n}from"./CdkProcessManager.js";import{CdkEventMonitor as m,startStackMonitoring as u,DEFAULT_DEPLOY_TIMEOUT_MS as d}from"./CdkEventMonitoring.js";import{isCdkError as C,formatInfrastructureError as c,getStructuralHint as s,getSourceContext as x}from"./CdkErrorFormatter.js";import{hasCdkDifferences as E,parseDiffOutput as S}from"./CdkOutputParser.js";import{CloudFormationService as M,CloudFormationError as l}from"./CloudFormationService.js";export{f as CdkArgumentBuilder,m as CdkEventMonitor,n as CdkProcessManager,t as CdkService,l as CloudFormationError,M as CloudFormationService,d as DEFAULT_DEPLOY_TIMEOUT_MS,c as formatInfrastructureError,x as getSourceContext,s as getStructuralHint,E as hasCdkDifferences,C as isCdkError,S as parseDiffOutput,u as startStackMonitoring};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { createHash } from "crypto";
|
|
8
8
|
import { readFile, readdir } from "fs/promises";
|
|
9
9
|
import { join, basename } from "path";
|
|
10
|
-
import { fileExists } from "
|
|
10
|
+
import { fileExists } from "@fjall/util/fsHelpers";
|
|
11
11
|
import { success, failure } from "@fjall/generator";
|
|
12
12
|
import { BaseServiceError } from "../../types/errors/ServiceError.js";
|
|
13
13
|
import { readStateFile, writeStateFile, createEmptyState, updateTemplateHash, getStateFilePath } from "../../types/FjallState.js";
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Emits a progress event through the callbacks if available.
|
|
3
|
-
*/
|
|
4
|
-
export function emitProgress(callbacks, message, type = "info") {
|
|
5
|
-
callbacks?.onProgress?.({ type, message });
|
|
6
|
-
}
|
|
7
|
-
/** Progress message constants — avoids magic string repetition */
|
|
8
|
-
export const PROGRESS_MESSAGES = Object.freeze({
|
|
9
|
-
BUILD: "Building Next.js application",
|
|
10
|
-
SYNTH: "Synthesising infrastructure",
|
|
11
|
-
HASH: "Comparing template hashes",
|
|
12
|
-
DOCKER: "Validating Docker configuration",
|
|
13
|
-
SECRETS: "Validating SSM secrets"
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* Parse Next.js/OpenNext build output to extract meaningful phase transitions.
|
|
17
|
-
* Returns a clean status message for display instead of raw build output.
|
|
18
|
-
*
|
|
19
|
-
* Only updates when a meaningful phase change is detected to avoid UI flicker.
|
|
20
|
-
*/
|
|
21
|
-
export function parseBuildPhase(message, currentPhase) {
|
|
22
|
-
const lowerMessage = message.toLowerCase();
|
|
23
|
-
if (lowerMessage.includes("creating next.js build") ||
|
|
24
|
-
lowerMessage.includes("creating an optimised production build")) {
|
|
25
|
-
return "Creating production build...";
|
|
26
|
-
}
|
|
27
|
-
if (lowerMessage.includes("compiling")) {
|
|
28
|
-
return "Compiling...";
|
|
29
|
-
}
|
|
30
|
-
if (lowerMessage.includes("linting")) {
|
|
31
|
-
return "Linting...";
|
|
32
|
-
}
|
|
33
|
-
if (lowerMessage.includes("checking validity of types")) {
|
|
34
|
-
return "Type checking...";
|
|
35
|
-
}
|
|
36
|
-
if (lowerMessage.includes("collecting page data")) {
|
|
37
|
-
return "Collecting page data...";
|
|
38
|
-
}
|
|
39
|
-
if (lowerMessage.includes("generating static pages")) {
|
|
40
|
-
return "Generating static pages...";
|
|
41
|
-
}
|
|
42
|
-
if (lowerMessage.includes("finalizing page optimization")) {
|
|
43
|
-
return "Optimising pages...";
|
|
44
|
-
}
|
|
45
|
-
if (lowerMessage.includes("open-next build complete") ||
|
|
46
|
-
lowerMessage.includes("build completed")) {
|
|
47
|
-
return "Build complete";
|
|
48
|
-
}
|
|
49
|
-
if (lowerMessage.includes("bundling")) {
|
|
50
|
-
return "Bundling functions...";
|
|
51
|
-
}
|
|
52
|
-
if (lowerMessage.includes("copying assets")) {
|
|
53
|
-
return "Copying assets...";
|
|
54
|
-
}
|
|
55
|
-
return currentPhase;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Build the StepContext build configuration from a buildConfig object.
|
|
59
|
-
* Extracts the database-related fields with defaults.
|
|
60
|
-
*/
|
|
61
|
-
export function buildStepContextBuildConfig(buildConfig) {
|
|
62
|
-
if (!buildConfig)
|
|
63
|
-
return undefined;
|
|
64
|
-
return {
|
|
65
|
-
requiresDatabase: buildConfig.requiresDatabase ?? false,
|
|
66
|
-
databaseEnvVar: buildConfig.databaseEnvVar ?? "DATABASE_URL"
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Convert CloudFormation outputs array to a key-value record.
|
|
71
|
-
* Filters out outputs without keys and handles undefined values.
|
|
72
|
-
*/
|
|
73
|
-
export function convertCloudFormationOutputsToRecord(outputs) {
|
|
74
|
-
const result = {};
|
|
75
|
-
for (const output of outputs) {
|
|
76
|
-
if (output.OutputKey && output.OutputValue !== undefined) {
|
|
77
|
-
result[output.OutputKey] = output.OutputValue;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
1
|
+
function n(i,t,e="info"){i?.onProgress?.({type:e,message:t})}const r=Object.freeze({BUILD:"Building Next.js application",SYNTH:"Synthesising infrastructure",HASH:"Comparing template hashes",DOCKER:"Validating Docker configuration",SECRETS:"Validating SSM secrets"});function u(i,t){const e=i.toLowerCase();return e.includes("creating next.js build")||e.includes("creating an optimised production build")?"Creating production build...":e.includes("compiling")?"Compiling...":e.includes("linting")?"Linting...":e.includes("checking validity of types")?"Type checking...":e.includes("collecting page data")?"Collecting page data...":e.includes("generating static pages")?"Generating static pages...":e.includes("finalizing page optimization")?"Optimising pages...":e.includes("open-next build complete")||e.includes("build completed")?"Build complete":e.includes("bundling")?"Bundling functions...":e.includes("copying assets")?"Copying assets...":t}function s(i){if(i)return{requiresDatabase:i.requiresDatabase??!1,databaseEnvVar:i.databaseEnvVar??"DATABASE_URL"}}function a(i){const t={};for(const e of i)e.OutputKey&&e.OutputValue!==void 0&&(t[e.OutputKey]=e.OutputValue);return t}export{r as PROGRESS_MESSAGES,s as buildStepContextBuildConfig,a as convertCloudFormationOutputsToRecord,n as emitProgress,u as parseBuildPhase};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { CdkContextBuilder } from "./CdkContextBuilder.js";
|
|
3
|
-
export { emitProgress, PROGRESS_MESSAGES, parseBuildPhase, buildStepContextBuildConfig, convertCloudFormationOutputsToRecord } from "./helpers.js";
|
|
1
|
+
import{TemplateHashService as r,TemplateHashError as t}from"./TemplateHashService.js";import{CdkContextBuilder as p}from"./CdkContextBuilder.js";import{emitProgress as d,PROGRESS_MESSAGES as l,parseBuildPhase as m,buildStepContextBuildConfig as s,convertCloudFormationOutputsToRecord as u}from"./helpers.js";export{p as CdkContextBuilder,l as PROGRESS_MESSAGES,t as TemplateHashError,r as TemplateHashService,s as buildStepContextBuildConfig,u as convertCloudFormationOutputsToRecord,d as emitProgress,m as parseBuildPhase};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StepRegistry, getDestroyStepId } from "./stepRegistry.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StepRegistry as r,getDestroyStepId as o}from"./stepRegistry.js";export{r as StepRegistry,o as getDestroyStepId};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type StepDefinition, type StepDeploymentType, type Operation, type StepContext } from "../types/index.js";
|
|
2
|
+
import type { AppResourceFlags } from "../types/index.js";
|
|
3
|
+
import type { PatternType } from "@fjall/generator";
|
|
4
|
+
/**
|
|
5
|
+
* Get the destroy step ID for a given stack type
|
|
6
|
+
*/
|
|
7
|
+
export declare function getDestroyStepId(stackType: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Step registry providing step filtering and registry logic.
|
|
10
|
+
* Step definitions (STEP_IDS, STEP_NAMES, StepDefinition, StepContext)
|
|
11
|
+
* live in types/stepDefinitions.ts — the single source of truth.
|
|
12
|
+
*
|
|
13
|
+
* This class was moved from CLI to deploy-core so both CLI and webapp
|
|
14
|
+
* can use the same step registry.
|
|
15
|
+
*/
|
|
16
|
+
export declare class StepRegistry {
|
|
17
|
+
/**
|
|
18
|
+
* Unified deployment steps for ALL deployment types
|
|
19
|
+
* Key format: "{deploymentType}-{operation}"
|
|
20
|
+
*/
|
|
21
|
+
private static readonly DEPLOYMENT_STEPS;
|
|
22
|
+
/**
|
|
23
|
+
* Get filtered steps based on deployment context
|
|
24
|
+
* This is the SINGLE method for getting steps for ANY deployment
|
|
25
|
+
*/
|
|
26
|
+
static getSteps(context: StepContext): StepDefinition[];
|
|
27
|
+
/**
|
|
28
|
+
* Get step names for UI display
|
|
29
|
+
*/
|
|
30
|
+
static getStepNames(context: StepContext): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Get the index of a specific step in the filtered list
|
|
33
|
+
*/
|
|
34
|
+
static getStepIndex(stepId: string, context: StepContext): number;
|
|
35
|
+
/**
|
|
36
|
+
* Get a step by ID from all steps
|
|
37
|
+
*/
|
|
38
|
+
static getStepById(stepId: string, deploymentType?: StepDeploymentType): StepDefinition | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a step should be included based on context
|
|
41
|
+
*/
|
|
42
|
+
static isStepIncluded(stepId: string, context: StepContext): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Convenience method for creating context
|
|
45
|
+
*/
|
|
46
|
+
static createContext(deploymentType: StepDeploymentType, operation: Operation, options?: {
|
|
47
|
+
deployOnly?: boolean;
|
|
48
|
+
infraOnly?: boolean;
|
|
49
|
+
isManagedAccount?: boolean;
|
|
50
|
+
hasDockerfile?: boolean;
|
|
51
|
+
pattern?: PatternType | null;
|
|
52
|
+
builderName?: string;
|
|
53
|
+
resources?: AppResourceFlags;
|
|
54
|
+
}): StepContext;
|
|
55
|
+
/**
|
|
56
|
+
* Get all deployment types
|
|
57
|
+
*/
|
|
58
|
+
static getDeploymentTypes(): StepDeploymentType[];
|
|
59
|
+
/**
|
|
60
|
+
* Get stack names for a deployment type
|
|
61
|
+
*/
|
|
62
|
+
static getStackNames(deploymentType: StepDeploymentType): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Get infrastructure step IDs for skipping
|
|
65
|
+
*/
|
|
66
|
+
static getInfraStepIds(): string[];
|
|
67
|
+
/**
|
|
68
|
+
* Get Docker step IDs for skipping
|
|
69
|
+
*/
|
|
70
|
+
static getDockerStepIds(): string[];
|
|
71
|
+
}
|