@fjall/deploy-core 0.89.2
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 +21 -0
- package/dist/src/aws/AwsProvider.d.ts +39 -0
- package/dist/src/aws/AwsProvider.js +1 -0
- package/dist/src/aws/SimpleAwsProvider.d.ts +22 -0
- package/dist/src/aws/SimpleAwsProvider.js +73 -0
- package/dist/src/aws/index.d.ts +4 -0
- package/dist/src/aws/index.js +3 -0
- package/dist/src/aws/organisations/accounts.d.ts +21 -0
- package/dist/src/aws/organisations/accounts.js +99 -0
- package/dist/src/aws/organisations/backup.d.ts +12 -0
- package/dist/src/aws/organisations/backup.js +28 -0
- package/dist/src/aws/organisations/costAllocation.d.ts +12 -0
- package/dist/src/aws/organisations/costAllocation.js +26 -0
- package/dist/src/aws/organisations/identityCentre.d.ts +8 -0
- package/dist/src/aws/organisations/identityCentre.js +19 -0
- package/dist/src/aws/organisations/index.d.ts +16 -0
- package/dist/src/aws/organisations/index.js +12 -0
- package/dist/src/aws/organisations/ipam.d.ts +7 -0
- package/dist/src/aws/organisations/ipam.js +18 -0
- package/dist/src/aws/organisations/organisation.d.ts +12 -0
- package/dist/src/aws/organisations/organisation.js +94 -0
- package/dist/src/aws/organisations/organisationalUnits.d.ts +19 -0
- package/dist/src/aws/organisations/organisationalUnits.js +125 -0
- package/dist/src/aws/organisations/policies.d.ts +7 -0
- package/dist/src/aws/organisations/policies.js +36 -0
- package/dist/src/aws/organisations/ram.d.ts +7 -0
- package/dist/src/aws/organisations/ram.js +15 -0
- package/dist/src/aws/organisations/serviceAccess.d.ts +7 -0
- package/dist/src/aws/organisations/serviceAccess.js +38 -0
- package/dist/src/aws/organisations/trustedAccess.d.ts +7 -0
- package/dist/src/aws/organisations/trustedAccess.js +15 -0
- package/dist/src/aws/organisations/types.d.ts +29 -0
- package/dist/src/aws/organisations/types.js +16 -0
- package/dist/src/aws/utils/CloudFormationFailureAnalyser.d.ts +32 -0
- package/dist/src/aws/utils/CloudFormationFailureAnalyser.js +228 -0
- package/dist/src/aws/utils/cloudformationEvents.d.ts +98 -0
- package/dist/src/aws/utils/cloudformationEvents.js +596 -0
- package/dist/src/aws/utils/errors.d.ts +26 -0
- package/dist/src/aws/utils/errors.js +59 -0
- package/dist/src/aws/utils/regions.d.ts +1 -0
- package/dist/src/aws/utils/regions.js +1 -0
- package/dist/src/aws/utils/stackStatus.d.ts +23 -0
- package/dist/src/aws/utils/stackStatus.js +90 -0
- package/dist/src/index.d.ts +35 -0
- package/dist/src/index.js +45 -0
- package/dist/src/orchestration/applicationDeploy.d.ts +11 -0
- package/dist/src/orchestration/applicationDeploy.js +327 -0
- package/dist/src/orchestration/contextHelpers.d.ts +9 -0
- package/dist/src/orchestration/contextHelpers.js +14 -0
- package/dist/src/orchestration/deploy.d.ts +10 -0
- package/dist/src/orchestration/deploy.js +42 -0
- package/dist/src/orchestration/detectionPipeline.d.ts +23 -0
- package/dist/src/orchestration/detectionPipeline.js +65 -0
- package/dist/src/orchestration/dockerInterface.d.ts +56 -0
- package/dist/src/orchestration/dockerInterface.js +1 -0
- package/dist/src/orchestration/domainInterface.d.ts +37 -0
- package/dist/src/orchestration/domainInterface.js +1 -0
- package/dist/src/orchestration/index.d.ts +8 -0
- package/dist/src/orchestration/index.js +3 -0
- package/dist/src/orchestration/organisationDeploy.d.ts +16 -0
- package/dist/src/orchestration/organisationDeploy.js +382 -0
- package/dist/src/orchestration/organisationSetup.d.ts +42 -0
- package/dist/src/orchestration/organisationSetup.js +227 -0
- package/dist/src/orchestration/resolveOperation.d.ts +10 -0
- package/dist/src/orchestration/resolveOperation.js +53 -0
- package/dist/src/orchestration/serviceFactory.d.ts +15 -0
- package/dist/src/orchestration/serviceFactory.js +16 -0
- package/dist/src/services/application/ApplicationStackService.d.ts +93 -0
- package/dist/src/services/application/ApplicationStackService.js +436 -0
- package/dist/src/services/application/index.d.ts +1 -0
- package/dist/src/services/application/index.js +1 -0
- package/dist/src/services/infrastructure/CdkArgumentBuilder.d.ts +12 -0
- package/dist/src/services/infrastructure/CdkArgumentBuilder.js +67 -0
- package/dist/src/services/infrastructure/CdkCommandRunner.d.ts +30 -0
- package/dist/src/services/infrastructure/CdkCommandRunner.js +241 -0
- package/dist/src/services/infrastructure/CdkErrorFormatter.d.ts +4 -0
- package/dist/src/services/infrastructure/CdkErrorFormatter.js +194 -0
- package/dist/src/services/infrastructure/CdkEventMonitoring.d.ts +19 -0
- package/dist/src/services/infrastructure/CdkEventMonitoring.js +41 -0
- package/dist/src/services/infrastructure/CdkOutputAnalyser.d.ts +43 -0
- package/dist/src/services/infrastructure/CdkOutputAnalyser.js +125 -0
- package/dist/src/services/infrastructure/CdkOutputParser.d.ts +8 -0
- package/dist/src/services/infrastructure/CdkOutputParser.js +33 -0
- package/dist/src/services/infrastructure/CdkProcessManager.d.ts +20 -0
- package/dist/src/services/infrastructure/CdkProcessManager.js +244 -0
- package/dist/src/services/infrastructure/CdkService.d.ts +71 -0
- package/dist/src/services/infrastructure/CdkService.js +254 -0
- package/dist/src/services/infrastructure/CloudFormationService.d.ts +79 -0
- package/dist/src/services/infrastructure/CloudFormationService.js +249 -0
- package/dist/src/services/infrastructure/index.d.ts +8 -0
- package/dist/src/services/infrastructure/index.js +7 -0
- package/dist/src/services/supporting/CdkContextBuilder.d.ts +49 -0
- package/dist/src/services/supporting/CdkContextBuilder.js +44 -0
- package/dist/src/services/supporting/TemplateHashService.d.ts +67 -0
- package/dist/src/services/supporting/TemplateHashService.js +152 -0
- package/dist/src/services/supporting/helpers.d.ts +46 -0
- package/dist/src/services/supporting/helpers.js +81 -0
- package/dist/src/services/supporting/index.d.ts +3 -0
- package/dist/src/services/supporting/index.js +3 -0
- package/dist/src/types/FjallState.d.ts +50 -0
- package/dist/src/types/FjallState.js +118 -0
- package/dist/src/types/ProgressEvent.d.ts +35 -0
- package/dist/src/types/ProgressEvent.js +48 -0
- package/dist/src/types/apiClient.d.ts +34 -0
- package/dist/src/types/apiClient.js +1 -0
- package/dist/src/types/application/ApplicationServiceTypes.d.ts +56 -0
- package/dist/src/types/application/ApplicationServiceTypes.js +30 -0
- package/dist/src/types/application/index.d.ts +1 -0
- package/dist/src/types/application/index.js +1 -0
- package/dist/src/types/callbacks.d.ts +36 -0
- package/dist/src/types/callbacks.js +1 -0
- package/dist/src/types/constants.d.ts +6 -0
- package/dist/src/types/constants.js +6 -0
- package/dist/src/types/credentials.d.ts +30 -0
- package/dist/src/types/credentials.js +1 -0
- package/dist/src/types/deployment/DeploymentServiceTypes.d.ts +23 -0
- package/dist/src/types/deployment/DeploymentServiceTypes.js +1 -0
- package/dist/src/types/deployment/DeploymentTypes.d.ts +29 -0
- package/dist/src/types/deployment/DeploymentTypes.js +1 -0
- package/dist/src/types/deployment/cloudformation.d.ts +14 -0
- package/dist/src/types/deployment/cloudformation.js +1 -0
- package/dist/src/types/deployment/index.d.ts +5 -0
- package/dist/src/types/deployment/index.js +1 -0
- package/dist/src/types/deployment/parallel.d.ts +46 -0
- package/dist/src/types/deployment/parallel.js +10 -0
- package/dist/src/types/errors/CdkError.d.ts +14 -0
- package/dist/src/types/errors/CdkError.js +20 -0
- package/dist/src/types/errors/ServiceError.d.ts +86 -0
- package/dist/src/types/errors/ServiceError.js +119 -0
- package/dist/src/types/events.d.ts +40 -0
- package/dist/src/types/events.js +5 -0
- package/dist/src/types/index.d.ts +20 -0
- package/dist/src/types/index.js +9 -0
- package/dist/src/types/operations.d.ts +193 -0
- package/dist/src/types/operations.js +285 -0
- package/dist/src/types/orgConfig.d.ts +28 -0
- package/dist/src/types/orgConfig.js +11 -0
- package/dist/src/types/params.d.ts +74 -0
- package/dist/src/types/params.js +1 -0
- package/dist/src/types/patternDetection.d.ts +43 -0
- package/dist/src/types/patternDetection.js +92 -0
- package/dist/src/types/validation.d.ts +12 -0
- package/dist/src/types/validation.js +1 -0
- package/dist/src/util/fsHelpers.d.ts +4 -0
- package/dist/src/util/fsHelpers.js +16 -0
- package/dist/src/util/index.d.ts +3 -0
- package/dist/src/util/index.js +3 -0
- package/dist/src/util/securityHelpers.d.ts +31 -0
- package/dist/src/util/securityHelpers.js +124 -0
- package/dist/src/util/singleton.d.ts +2 -0
- package/dist/src/util/singleton.js +9 -0
- package/dist/src/util/sleep.d.ts +4 -0
- package/dist/src/util/sleep.js +4 -0
- package/package.json +42 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Individual CloudFormation stack output (matches AWS CloudFormation Output structure)
|
|
3
|
+
*/
|
|
4
|
+
export interface StackOutput {
|
|
5
|
+
OutputKey: string;
|
|
6
|
+
OutputValue: string;
|
|
7
|
+
Description?: string;
|
|
8
|
+
ExportName?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Stack outputs as a record for convenient access
|
|
12
|
+
* Values can be string, number, or boolean based on common CloudFormation output types
|
|
13
|
+
*/
|
|
14
|
+
export type StackOutputsRecord = Record<string, string | number | boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { StackOutput, StackOutputsRecord } from "./cloudformation.js";
|
|
2
|
+
export type { DeploymentContext, StepOutput } from "./DeploymentTypes.js";
|
|
3
|
+
export type { ApplicationDeploymentContext, CallerIdentity, ValidationResult } from "./DeploymentServiceTypes.js";
|
|
4
|
+
export type { ParallelDeploymentResult, ParallelDeployGroup, ParallelOperation, ParallelOperationType, ParallelOperationState } from "./parallel.js";
|
|
5
|
+
export { PARALLEL_OPERATION_TYPES } from "./parallel.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PARALLEL_OPERATION_TYPES } from "./parallel.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for parallel deployment operations
|
|
3
|
+
*/
|
|
4
|
+
import type { ApplicationStack } from "../operations.js";
|
|
5
|
+
/**
|
|
6
|
+
* Special parallel operations that aren't CloudFormation stacks
|
|
7
|
+
*/
|
|
8
|
+
export declare const PARALLEL_OPERATION_TYPES: {
|
|
9
|
+
readonly BUILD: "build";
|
|
10
|
+
readonly DOCKER: "docker";
|
|
11
|
+
};
|
|
12
|
+
export type ParallelOperationType = (typeof PARALLEL_OPERATION_TYPES)[keyof typeof PARALLEL_OPERATION_TYPES];
|
|
13
|
+
/**
|
|
14
|
+
* Union type for all operations that can run in parallel
|
|
15
|
+
*/
|
|
16
|
+
export type ParallelOperation = ApplicationStack | ParallelOperationType;
|
|
17
|
+
/**
|
|
18
|
+
* A group of stacks that can be deployed in parallel within a phase
|
|
19
|
+
*/
|
|
20
|
+
export interface ParallelDeployGroup {
|
|
21
|
+
phase: number;
|
|
22
|
+
stacks: readonly ApplicationStack[];
|
|
23
|
+
description: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Result of deploying a single stack within a parallel group
|
|
27
|
+
*/
|
|
28
|
+
export interface ParallelDeploymentResult {
|
|
29
|
+
stack: ApplicationStack;
|
|
30
|
+
success: boolean;
|
|
31
|
+
error?: Error;
|
|
32
|
+
duration: number;
|
|
33
|
+
outputs?: Record<string, string | number | boolean>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* State of a parallel operation for UI tracking.
|
|
37
|
+
* operationId is a string to support both ApplicationStack and arbitrary keys.
|
|
38
|
+
*/
|
|
39
|
+
export interface ParallelOperationState {
|
|
40
|
+
operationId: string;
|
|
41
|
+
status: "pending" | "running" | "complete" | "failed";
|
|
42
|
+
events: unknown[];
|
|
43
|
+
startTime?: number;
|
|
44
|
+
endTime?: number;
|
|
45
|
+
error?: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDK-specific error types
|
|
3
|
+
*/
|
|
4
|
+
import { BaseServiceError } from "./ServiceError.js";
|
|
5
|
+
/**
|
|
6
|
+
* CDK operation error
|
|
7
|
+
*/
|
|
8
|
+
export declare class CdkError extends BaseServiceError {
|
|
9
|
+
readonly errorType: "command_failed" | "bootstrap_required" | "bootstrap_failed" | "synthesis_failed" | "deployment_failed" | "destruction_failed" | "diff_failed" | "timeout" | "cancelled" | "invalid_state" | "permission_denied" | "stack_not_found" | "unknown";
|
|
10
|
+
readonly stackName?: string | undefined;
|
|
11
|
+
readonly exitCode?: number | undefined;
|
|
12
|
+
readonly output?: string | undefined;
|
|
13
|
+
constructor(message: string, errorType: "command_failed" | "bootstrap_required" | "bootstrap_failed" | "synthesis_failed" | "deployment_failed" | "destruction_failed" | "diff_failed" | "timeout" | "cancelled" | "invalid_state" | "permission_denied" | "stack_not_found" | "unknown", stackName?: string | undefined, exitCode?: number | undefined, output?: string | undefined, details?: unknown, recoverable?: boolean);
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDK-specific error types
|
|
3
|
+
*/
|
|
4
|
+
import { BaseServiceError } from "./ServiceError.js";
|
|
5
|
+
/**
|
|
6
|
+
* CDK operation error
|
|
7
|
+
*/
|
|
8
|
+
export class CdkError extends BaseServiceError {
|
|
9
|
+
errorType;
|
|
10
|
+
stackName;
|
|
11
|
+
exitCode;
|
|
12
|
+
output;
|
|
13
|
+
constructor(message, errorType, stackName, exitCode, output, details, recoverable = false) {
|
|
14
|
+
super(`CDK_${errorType.toUpperCase()}`, message, details, recoverable);
|
|
15
|
+
this.errorType = errorType;
|
|
16
|
+
this.stackName = stackName;
|
|
17
|
+
this.exitCode = exitCode;
|
|
18
|
+
this.output = output;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standardised error details type used across all services.
|
|
3
|
+
*/
|
|
4
|
+
export type ServiceErrorDetails = Error | Record<string, unknown> | string | unknown | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Base service error with full context
|
|
7
|
+
*/
|
|
8
|
+
export interface ServiceError {
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly details?: unknown;
|
|
12
|
+
readonly stack?: string;
|
|
13
|
+
readonly recoverable?: boolean;
|
|
14
|
+
readonly cause?: Error;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Base implementation of ServiceError
|
|
18
|
+
*/
|
|
19
|
+
export declare class BaseServiceError extends Error implements ServiceError {
|
|
20
|
+
readonly code: string;
|
|
21
|
+
readonly details?: unknown | undefined;
|
|
22
|
+
readonly recoverable: boolean;
|
|
23
|
+
readonly cause?: Error | undefined;
|
|
24
|
+
constructor(code: string, message: string, details?: unknown | undefined, recoverable?: boolean, cause?: Error | undefined);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validation-specific errors
|
|
28
|
+
*/
|
|
29
|
+
export declare class ValidationError extends BaseServiceError {
|
|
30
|
+
readonly fields?: string[] | undefined;
|
|
31
|
+
readonly rules?: string[] | undefined;
|
|
32
|
+
constructor(message: string, fields?: string[] | undefined, rules?: string[] | undefined, details?: unknown);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Authentication/Authorization errors
|
|
36
|
+
*/
|
|
37
|
+
export declare class AuthError extends BaseServiceError {
|
|
38
|
+
readonly account?: string | undefined;
|
|
39
|
+
readonly reason?: string | undefined;
|
|
40
|
+
constructor(message: string, account?: string | undefined, reason?: string | undefined, details?: unknown);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* AWS-specific errors
|
|
44
|
+
*/
|
|
45
|
+
export declare class AwsError extends BaseServiceError {
|
|
46
|
+
readonly service?: string | undefined;
|
|
47
|
+
readonly operation?: string | undefined;
|
|
48
|
+
readonly awsErrorCode?: string | undefined;
|
|
49
|
+
constructor(message: string, service?: string | undefined, operation?: string | undefined, awsErrorCode?: string | undefined, details?: unknown, recoverable?: boolean);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* CDK/CloudFormation errors
|
|
53
|
+
*/
|
|
54
|
+
export declare class DeploymentError extends BaseServiceError {
|
|
55
|
+
readonly stackName?: string | undefined;
|
|
56
|
+
readonly deploymentPhase?: string | undefined;
|
|
57
|
+
constructor(message: string, stackName?: string | undefined, deploymentPhase?: string | undefined, details?: unknown, recoverable?: boolean);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Network/connectivity errors
|
|
61
|
+
*/
|
|
62
|
+
export declare class NetworkError extends BaseServiceError {
|
|
63
|
+
readonly endpoint?: string | undefined;
|
|
64
|
+
readonly statusCode?: number | undefined;
|
|
65
|
+
constructor(message: string, endpoint?: string | undefined, statusCode?: number | undefined, cause?: Error);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* File system errors
|
|
69
|
+
*/
|
|
70
|
+
export declare class FileSystemError extends BaseServiceError {
|
|
71
|
+
readonly path?: string | undefined;
|
|
72
|
+
readonly operation?: "read" | "write" | "delete" | "exists" | undefined;
|
|
73
|
+
constructor(message: string, path?: string | undefined, operation?: "read" | "write" | "delete" | "exists" | undefined, cause?: Error);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Configuration errors
|
|
77
|
+
*/
|
|
78
|
+
export declare class ConfigError extends BaseServiceError {
|
|
79
|
+
readonly configKey?: string | undefined;
|
|
80
|
+
readonly configPath?: string | undefined;
|
|
81
|
+
constructor(message: string, configKey?: string | undefined, configPath?: string | undefined, details?: unknown);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Convert unknown errors to ServiceError
|
|
85
|
+
*/
|
|
86
|
+
export declare function toServiceError(error: unknown, code?: string): ServiceError;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base implementation of ServiceError
|
|
3
|
+
*/
|
|
4
|
+
export class BaseServiceError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
details;
|
|
7
|
+
recoverable;
|
|
8
|
+
cause;
|
|
9
|
+
constructor(code, message, details, recoverable = false, cause) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.details = details;
|
|
13
|
+
this.recoverable = recoverable;
|
|
14
|
+
this.cause = cause;
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
// Maintain proper stack trace
|
|
17
|
+
if (Error.captureStackTrace) {
|
|
18
|
+
Error.captureStackTrace(this, this.constructor);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Validation-specific errors
|
|
24
|
+
*/
|
|
25
|
+
export class ValidationError extends BaseServiceError {
|
|
26
|
+
fields;
|
|
27
|
+
rules;
|
|
28
|
+
constructor(message, fields, rules, details) {
|
|
29
|
+
super("VALIDATION_ERROR", message, details, false);
|
|
30
|
+
this.fields = fields;
|
|
31
|
+
this.rules = rules;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Authentication/Authorization errors
|
|
36
|
+
*/
|
|
37
|
+
export class AuthError extends BaseServiceError {
|
|
38
|
+
account;
|
|
39
|
+
reason;
|
|
40
|
+
constructor(message, account, reason, details) {
|
|
41
|
+
super("AUTH_ERROR", message, details, false);
|
|
42
|
+
this.account = account;
|
|
43
|
+
this.reason = reason;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* AWS-specific errors
|
|
48
|
+
*/
|
|
49
|
+
export class AwsError extends BaseServiceError {
|
|
50
|
+
service;
|
|
51
|
+
operation;
|
|
52
|
+
awsErrorCode;
|
|
53
|
+
constructor(message, service, operation, awsErrorCode, details, recoverable = false) {
|
|
54
|
+
super("AWS_ERROR", message, details, recoverable);
|
|
55
|
+
this.service = service;
|
|
56
|
+
this.operation = operation;
|
|
57
|
+
this.awsErrorCode = awsErrorCode;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* CDK/CloudFormation errors
|
|
62
|
+
*/
|
|
63
|
+
export class DeploymentError extends BaseServiceError {
|
|
64
|
+
stackName;
|
|
65
|
+
deploymentPhase;
|
|
66
|
+
constructor(message, stackName, deploymentPhase, details, recoverable = false) {
|
|
67
|
+
super("DEPLOYMENT_ERROR", message, details, recoverable);
|
|
68
|
+
this.stackName = stackName;
|
|
69
|
+
this.deploymentPhase = deploymentPhase;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Network/connectivity errors
|
|
74
|
+
*/
|
|
75
|
+
export class NetworkError extends BaseServiceError {
|
|
76
|
+
endpoint;
|
|
77
|
+
statusCode;
|
|
78
|
+
constructor(message, endpoint, statusCode, cause) {
|
|
79
|
+
super("NETWORK_ERROR", message, undefined, true, cause);
|
|
80
|
+
this.endpoint = endpoint;
|
|
81
|
+
this.statusCode = statusCode;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* File system errors
|
|
86
|
+
*/
|
|
87
|
+
export class FileSystemError extends BaseServiceError {
|
|
88
|
+
path;
|
|
89
|
+
operation;
|
|
90
|
+
constructor(message, path, operation, cause) {
|
|
91
|
+
super("FILESYSTEM_ERROR", message, { path, operation }, false, cause);
|
|
92
|
+
this.path = path;
|
|
93
|
+
this.operation = operation;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Configuration errors
|
|
98
|
+
*/
|
|
99
|
+
export class ConfigError extends BaseServiceError {
|
|
100
|
+
configKey;
|
|
101
|
+
configPath;
|
|
102
|
+
constructor(message, configKey, configPath, details) {
|
|
103
|
+
super("CONFIG_ERROR", message, details, false);
|
|
104
|
+
this.configKey = configKey;
|
|
105
|
+
this.configPath = configPath;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Convert unknown errors to ServiceError
|
|
110
|
+
*/
|
|
111
|
+
export function toServiceError(error, code = "UNKNOWN_ERROR") {
|
|
112
|
+
if (error instanceof BaseServiceError) {
|
|
113
|
+
return error;
|
|
114
|
+
}
|
|
115
|
+
if (error instanceof Error) {
|
|
116
|
+
return new BaseServiceError(code, error.message, { name: error.name }, false, error);
|
|
117
|
+
}
|
|
118
|
+
return new BaseServiceError(code, String(error), { rawError: error }, false);
|
|
119
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress event types emitted by the deployment engine.
|
|
3
|
+
* These flow to the caller via DeployCallbacks.
|
|
4
|
+
*/
|
|
5
|
+
export type ProgressEventType = "step" | "info" | "spinner" | "warning" | "debug" | "error";
|
|
6
|
+
export interface ProgressEvent {
|
|
7
|
+
type: ProgressEventType;
|
|
8
|
+
message: string;
|
|
9
|
+
metadata?: {
|
|
10
|
+
source?: string;
|
|
11
|
+
percentage?: number;
|
|
12
|
+
details?: unknown;
|
|
13
|
+
stepIndex?: number;
|
|
14
|
+
totalSteps?: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ResourceEvent {
|
|
18
|
+
logicalId: string;
|
|
19
|
+
physicalId?: string;
|
|
20
|
+
resourceType: string;
|
|
21
|
+
status: string;
|
|
22
|
+
statusReason?: string;
|
|
23
|
+
timestamp: Date;
|
|
24
|
+
}
|
|
25
|
+
export interface AwsAuthResult {
|
|
26
|
+
accountId: string;
|
|
27
|
+
region: string;
|
|
28
|
+
profileName?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CascadeDeploymentResult {
|
|
31
|
+
platformDeployed: boolean;
|
|
32
|
+
domainsDeployed: boolean;
|
|
33
|
+
accountsDeployed: number;
|
|
34
|
+
accountsFailed: number;
|
|
35
|
+
errors: Array<{
|
|
36
|
+
accountId: string;
|
|
37
|
+
error: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export type CascadePhase = "platform" | "domains" | "accounts";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type { AwsCredentials, DeployIdentity } from "./credentials.js";
|
|
2
|
+
export type { DeployCallbacks, StepCompleteStatus } from "./callbacks.js";
|
|
3
|
+
export type { ProgressEvent, ProgressEventType, ResourceEvent, AwsAuthResult, CascadeDeploymentResult, CascadePhase } from "./events.js";
|
|
4
|
+
export type { ApiClientInterface, EntitlementsData } from "./apiClient.js";
|
|
5
|
+
export type { DeployParams, DeployOptions, DeploymentType, DeployResult } from "./params.js";
|
|
6
|
+
export type { OrgConfig, ProviderAccount, SSOSession } from "./orgConfig.js";
|
|
7
|
+
export type { StackOutput, StackOutputsRecord, DeploymentContext, StepOutput, ApplicationDeploymentContext, CallerIdentity } from "./deployment/index.js";
|
|
8
|
+
export type { ValidationResult } from "./validation.js";
|
|
9
|
+
export type { ProgressCallbacks } from "./ProgressEvent.js";
|
|
10
|
+
export { ProgressReporter } from "./ProgressEvent.js";
|
|
11
|
+
export type { ApplicationStack, OrganisationType, DeploymentOperation, ApplicationOperation, OrganisationOperation, DeployOrderOptions, ParallelDeployGroupKey, ParallelDestroyGroupKey } from "./operations.js";
|
|
12
|
+
export { APPLICATION_STACKS, ORGANISATION_TYPES, APPLICATION_DEPLOY_ORDER, APPLICATION_DESTROY_ORDER, OPENNEXT_DEPLOY_ORDER, OPENNEXT_DESTROY_ORDER, PARALLEL_DEPLOY_GROUPS, PARALLEL_DESTROY_GROUPS, OPENNEXT_PARALLEL_GROUPS, isApplicationOperation, isOrganisationOperation, getParallelDeployGroups, getParallelDestroyGroups, getApplicationDeployOrder, getApplicationDestroyOrder, getApplicationStackName, getOrganisationStackName, isApplicationStack, getApplicationStepName, getApplicationStepId, toPascalCase } from "./operations.js";
|
|
13
|
+
export type { ParallelDeploymentResult, ParallelDeployGroup, ParallelOperation, ParallelOperationType, ParallelOperationState } from "./deployment/index.js";
|
|
14
|
+
export { PARALLEL_OPERATION_TYPES } from "./deployment/index.js";
|
|
15
|
+
export type { OpenNextPattern, AppResourceFlags } from "./patternDetection.js";
|
|
16
|
+
export { isOpenNextPattern, OPENNEXT_PATTERNS, detectPattern, detectPayloadPattern, detectDatabase, deriveResourcesFromManifestStacks } from "./patternDetection.js";
|
|
17
|
+
export { STACK_NOT_FOUND_PATTERN, CDK_NO_STACKS_MATCH, INFRASTRUCTURE_FILENAME } from "./constants.js";
|
|
18
|
+
export { ApplicationError, wrapApplicationError, type ApplicationErrorType, type StackDeploymentData, type StackDeploymentOptions, type ApplicationDeploymentData, type ApplicationDestructionData } from "./application/index.js";
|
|
19
|
+
export type { FjallStateFile, TemplateHashEntry } from "./FjallState.js";
|
|
20
|
+
export { FjallStateFileSchema, readStateFile, writeStateFile, createEmptyState, deleteStateFile, updateTemplateHash, getStateFilePath } from "./FjallState.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ProgressReporter } from "./ProgressEvent.js";
|
|
2
|
+
export { APPLICATION_STACKS, ORGANISATION_TYPES, APPLICATION_DEPLOY_ORDER, APPLICATION_DESTROY_ORDER, OPENNEXT_DEPLOY_ORDER, OPENNEXT_DESTROY_ORDER, PARALLEL_DEPLOY_GROUPS, PARALLEL_DESTROY_GROUPS, OPENNEXT_PARALLEL_GROUPS, isApplicationOperation, isOrganisationOperation, getParallelDeployGroups, getParallelDestroyGroups, getApplicationDeployOrder, getApplicationDestroyOrder, getApplicationStackName, getOrganisationStackName, isApplicationStack, getApplicationStepName, getApplicationStepId, toPascalCase } from "./operations.js";
|
|
3
|
+
export { PARALLEL_OPERATION_TYPES } from "./deployment/index.js";
|
|
4
|
+
export { isOpenNextPattern, OPENNEXT_PATTERNS, detectPattern, detectPayloadPattern, detectDatabase, deriveResourcesFromManifestStacks } from "./patternDetection.js";
|
|
5
|
+
// Constants
|
|
6
|
+
export { STACK_NOT_FOUND_PATTERN, CDK_NO_STACKS_MATCH, INFRASTRUCTURE_FILENAME } from "./constants.js";
|
|
7
|
+
// Application types
|
|
8
|
+
export { ApplicationError, wrapApplicationError } from "./application/index.js";
|
|
9
|
+
export { FjallStateFileSchema, readStateFile, writeStateFile, createEmptyState, deleteStateFile, updateTemplateHash, getStateFilePath } from "./FjallState.js";
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { type AppResourceFlags } from "./patternDetection.js";
|
|
2
|
+
import { toPascalCase } from "@fjall/util";
|
|
3
|
+
/**
|
|
4
|
+
* Application infrastructure stacks
|
|
5
|
+
*/
|
|
6
|
+
export declare const APPLICATION_STACKS: {
|
|
7
|
+
readonly NETWORK: "Network";
|
|
8
|
+
readonly DATABASE: "Database";
|
|
9
|
+
readonly STORAGE: "Storage";
|
|
10
|
+
readonly COMPUTE: "Compute";
|
|
11
|
+
readonly CDN: "Cdn";
|
|
12
|
+
readonly MESSAGING: "Messaging";
|
|
13
|
+
};
|
|
14
|
+
export type ApplicationStack = (typeof APPLICATION_STACKS)[keyof typeof APPLICATION_STACKS];
|
|
15
|
+
/**
|
|
16
|
+
* Organisation infrastructure types
|
|
17
|
+
* Note: These are deployment types, not stacks - each maps to a single CDK stack
|
|
18
|
+
*/
|
|
19
|
+
export declare const ORGANISATION_TYPES: {
|
|
20
|
+
readonly ORGANISATION: "organisation";
|
|
21
|
+
readonly PLATFORM: "platform";
|
|
22
|
+
readonly ACCOUNT: "account";
|
|
23
|
+
};
|
|
24
|
+
export type OrganisationType = (typeof ORGANISATION_TYPES)[keyof typeof ORGANISATION_TYPES];
|
|
25
|
+
/**
|
|
26
|
+
* Discriminated union for all deployment operations
|
|
27
|
+
* Using 'kind' as discriminator for clear type narrowing
|
|
28
|
+
*/
|
|
29
|
+
export type DeploymentOperation = ApplicationOperation | OrganisationOperation;
|
|
30
|
+
export interface ApplicationOperation {
|
|
31
|
+
kind: "application";
|
|
32
|
+
appName: string;
|
|
33
|
+
path: string;
|
|
34
|
+
hasDockerfile?: boolean;
|
|
35
|
+
isManagedAccount?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface OrganisationOperation {
|
|
38
|
+
kind: "organisation";
|
|
39
|
+
type: OrganisationType;
|
|
40
|
+
target: string;
|
|
41
|
+
path: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Type guards for safe type narrowing
|
|
45
|
+
*/
|
|
46
|
+
export declare function isApplicationOperation(op: DeploymentOperation): op is ApplicationOperation;
|
|
47
|
+
export declare function isOrganisationOperation(op: DeploymentOperation): op is OrganisationOperation;
|
|
48
|
+
/**
|
|
49
|
+
* Stack ordering for application deployments
|
|
50
|
+
*/
|
|
51
|
+
export declare const APPLICATION_DEPLOY_ORDER: readonly ApplicationStack[];
|
|
52
|
+
export declare const APPLICATION_DESTROY_ORDER: readonly ApplicationStack[];
|
|
53
|
+
/**
|
|
54
|
+
* Stack ordering for OpenNext (Next.js/Payload) deployments
|
|
55
|
+
* These patterns require additional infrastructure: S3, DynamoDB, SQS, CloudFront
|
|
56
|
+
*/
|
|
57
|
+
export declare const OPENNEXT_DEPLOY_ORDER: readonly ApplicationStack[];
|
|
58
|
+
/**
|
|
59
|
+
* Stack ordering for OpenNext destroy operations (reverse of deploy order)
|
|
60
|
+
* CDN must be destroyed first as it depends on Compute, then work backwards
|
|
61
|
+
*/
|
|
62
|
+
export declare const OPENNEXT_DESTROY_ORDER: readonly ApplicationStack[];
|
|
63
|
+
/**
|
|
64
|
+
* Parallel deployment groups for concurrent stack deployment
|
|
65
|
+
* Stacks within each phase can be deployed in parallel.
|
|
66
|
+
*
|
|
67
|
+
* Dependency structure:
|
|
68
|
+
* - Phase 1: Network (required by all other stacks)
|
|
69
|
+
* - Phase 2: Storage, Messaging, Database (independent of each other, only need Network)
|
|
70
|
+
* - Phase 3: Compute (needs Database outputs)
|
|
71
|
+
* - Phase 4: CDN (needs Compute outputs)
|
|
72
|
+
*/
|
|
73
|
+
export declare const PARALLEL_DEPLOY_GROUPS: {
|
|
74
|
+
readonly PHASE_1: {
|
|
75
|
+
readonly phase: 1;
|
|
76
|
+
readonly stacks: readonly ["Network"];
|
|
77
|
+
readonly description: "Network infrastructure";
|
|
78
|
+
};
|
|
79
|
+
readonly PHASE_2: {
|
|
80
|
+
readonly phase: 2;
|
|
81
|
+
readonly stacks: readonly ["Storage", "Messaging", "Database"];
|
|
82
|
+
readonly description: "Storage and database resources (parallel)";
|
|
83
|
+
};
|
|
84
|
+
readonly PHASE_3: {
|
|
85
|
+
readonly phase: 3;
|
|
86
|
+
readonly stacks: readonly ["Compute"];
|
|
87
|
+
readonly description: "Compute resources";
|
|
88
|
+
};
|
|
89
|
+
readonly PHASE_4: {
|
|
90
|
+
readonly phase: 4;
|
|
91
|
+
readonly stacks: readonly ["Cdn"];
|
|
92
|
+
readonly description: "CDN distribution";
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Parallel deployment groups for OpenNext (Next.js/Payload) deployments
|
|
97
|
+
* Optimised to run BUILD in parallel with infrastructure stacks.
|
|
98
|
+
*/
|
|
99
|
+
export declare const OPENNEXT_PARALLEL_GROUPS: {
|
|
100
|
+
/** Regular Next.js: BUILD + all Phase 2 stacks in parallel */
|
|
101
|
+
readonly NEXTJS_PARALLEL: {
|
|
102
|
+
readonly stacks: readonly ["Storage", "Messaging", "Database"];
|
|
103
|
+
readonly includeBuild: true;
|
|
104
|
+
readonly description: "Build + Storage/Messaging/Database (parallel)";
|
|
105
|
+
};
|
|
106
|
+
/** Payload: BUILD + remaining stacks (after Database + migrations) */
|
|
107
|
+
readonly PAYLOAD_PARALLEL: {
|
|
108
|
+
readonly stacks: readonly ["Storage", "Messaging"];
|
|
109
|
+
readonly includeBuild: true;
|
|
110
|
+
readonly description: "Build + Storage/Messaging (parallel)";
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Type for parallel deploy group keys
|
|
115
|
+
*/
|
|
116
|
+
export type ParallelDeployGroupKey = keyof typeof PARALLEL_DEPLOY_GROUPS;
|
|
117
|
+
/**
|
|
118
|
+
* Get all parallel deploy groups as an ordered array
|
|
119
|
+
*/
|
|
120
|
+
export declare function getParallelDeployGroups(): ReadonlyArray<(typeof PARALLEL_DEPLOY_GROUPS)[ParallelDeployGroupKey]>;
|
|
121
|
+
/**
|
|
122
|
+
* Parallel destroy groups for OpenNext destroy operations.
|
|
123
|
+
* Reverse of deploy order to respect dependencies.
|
|
124
|
+
*/
|
|
125
|
+
export declare const PARALLEL_DESTROY_GROUPS: {
|
|
126
|
+
readonly PHASE_1: {
|
|
127
|
+
readonly phase: 1;
|
|
128
|
+
readonly stacks: readonly ["Cdn"];
|
|
129
|
+
readonly description: "CDN distribution";
|
|
130
|
+
};
|
|
131
|
+
readonly PHASE_2: {
|
|
132
|
+
readonly phase: 2;
|
|
133
|
+
readonly stacks: readonly ["Compute"];
|
|
134
|
+
readonly description: "Compute resources";
|
|
135
|
+
};
|
|
136
|
+
readonly PHASE_3: {
|
|
137
|
+
readonly phase: 3;
|
|
138
|
+
readonly stacks: readonly ["Database", "Messaging", "Storage"];
|
|
139
|
+
readonly description: "Database, messaging, and storage (parallel)";
|
|
140
|
+
};
|
|
141
|
+
readonly PHASE_4: {
|
|
142
|
+
readonly phase: 4;
|
|
143
|
+
readonly stacks: readonly ["Network"];
|
|
144
|
+
readonly description: "Network infrastructure";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Type for parallel destroy group keys
|
|
149
|
+
*/
|
|
150
|
+
export type ParallelDestroyGroupKey = keyof typeof PARALLEL_DESTROY_GROUPS;
|
|
151
|
+
/**
|
|
152
|
+
* Get all parallel destroy groups as an ordered array
|
|
153
|
+
*/
|
|
154
|
+
export declare function getParallelDestroyGroups(): ReadonlyArray<(typeof PARALLEL_DESTROY_GROUPS)[ParallelDestroyGroupKey]>;
|
|
155
|
+
/**
|
|
156
|
+
* Options for determining deployment order
|
|
157
|
+
*/
|
|
158
|
+
export interface DeployOrderOptions {
|
|
159
|
+
pattern?: "payload" | "nextjs" | null;
|
|
160
|
+
resources?: AppResourceFlags;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get deployment order based on application configuration.
|
|
164
|
+
*
|
|
165
|
+
* Strategies:
|
|
166
|
+
* 1. OpenNext (pattern = "payload" or "nextjs"): Predefined order (build orchestration)
|
|
167
|
+
* 2. Dynamic: Include only detected stacks, ordered by tier
|
|
168
|
+
* 3. Fallback: Standard order (no manifest available)
|
|
169
|
+
*/
|
|
170
|
+
export declare function getApplicationDeployOrder(options?: DeployOrderOptions): readonly ApplicationStack[];
|
|
171
|
+
/**
|
|
172
|
+
* Get destroy order based on application configuration.
|
|
173
|
+
* Destroy order respects dependencies (reverse of deploy order).
|
|
174
|
+
*/
|
|
175
|
+
export declare function getApplicationDestroyOrder(options?: DeployOrderOptions): readonly ApplicationStack[];
|
|
176
|
+
/**
|
|
177
|
+
* Helper functions for stack operations
|
|
178
|
+
*/
|
|
179
|
+
export { toPascalCase };
|
|
180
|
+
export declare function getApplicationStackName(appName: string, stack: ApplicationStack): string;
|
|
181
|
+
export declare function getOrganisationStackName(type: OrganisationType): string;
|
|
182
|
+
/**
|
|
183
|
+
* Type guard for ApplicationStack
|
|
184
|
+
*/
|
|
185
|
+
export declare function isApplicationStack(value: string): value is ApplicationStack;
|
|
186
|
+
/**
|
|
187
|
+
* Step name generators for UI display
|
|
188
|
+
*/
|
|
189
|
+
export declare function getApplicationStepName(stack: ApplicationStack, action: "deploy" | "destroy"): string;
|
|
190
|
+
/**
|
|
191
|
+
* Step ID generators for tracking
|
|
192
|
+
*/
|
|
193
|
+
export declare function getApplicationStepId(stack: ApplicationStack, action: "deploy" | "destroy"): string;
|