@fjall/deploy-core 0.89.5 → 0.94.0

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 (198) hide show
  1. package/LICENSE +50 -21
  2. package/README.md +25 -0
  3. package/dist/.minified +1 -0
  4. package/dist/src/__test-utils__/awsMockHelpers.d.ts +20 -0
  5. package/dist/src/__test-utils__/awsMockHelpers.js +1 -0
  6. package/dist/src/__test-utils__/index.d.ts +1 -0
  7. package/dist/src/__test-utils__/index.js +1 -0
  8. package/dist/src/aws/AwsProvider.js +0 -1
  9. package/dist/src/aws/SimpleAwsProvider.js +1 -70
  10. package/dist/src/aws/index.d.ts +4 -2
  11. package/dist/src/aws/index.js +1 -3
  12. package/dist/src/aws/organisations/accounts.js +10 -10
  13. package/dist/src/aws/organisations/backup.js +4 -2
  14. package/dist/src/aws/organisations/costAllocation.js +4 -2
  15. package/dist/src/aws/organisations/delegatedAdmin.d.ts +9 -0
  16. package/dist/src/aws/organisations/delegatedAdmin.js +43 -0
  17. package/dist/src/aws/organisations/identityCentre.d.ts +1 -1
  18. package/dist/src/aws/organisations/identityCentre.js +6 -2
  19. package/dist/src/aws/organisations/index.d.ts +4 -3
  20. package/dist/src/aws/organisations/index.js +1 -12
  21. package/dist/src/aws/organisations/ipam.js +4 -2
  22. package/dist/src/aws/organisations/organisation.js +27 -18
  23. package/dist/src/aws/organisations/organisationalUnits.d.ts +26 -6
  24. package/dist/src/aws/organisations/organisationalUnits.js +149 -35
  25. package/dist/src/aws/organisations/policies.js +4 -3
  26. package/dist/src/aws/organisations/ram.js +6 -2
  27. package/dist/src/aws/organisations/serviceAccess.js +12 -6
  28. package/dist/src/aws/organisations/trustedAccess.js +6 -2
  29. package/dist/src/aws/organisations/types.d.ts +23 -1
  30. package/dist/src/aws/organisations/types.js +1 -16
  31. package/dist/src/aws/utils/__tests__/cloudformationTestHelpers.d.ts +6 -0
  32. package/dist/src/aws/utils/__tests__/cloudformationTestHelpers.js +1 -0
  33. package/dist/src/aws/utils/cloudformationEventHelpers.d.ts +48 -0
  34. package/dist/src/aws/utils/cloudformationEventHelpers.js +1 -0
  35. package/dist/src/aws/utils/cloudformationEventTypes.d.ts +45 -0
  36. package/dist/src/aws/utils/cloudformationEventTypes.js +1 -0
  37. package/dist/src/aws/utils/cloudformationEvents.d.ts +8 -54
  38. package/dist/src/aws/utils/cloudformationEvents.js +1 -596
  39. package/dist/src/aws/utils/index.d.ts +5 -0
  40. package/dist/src/aws/utils/index.js +1 -0
  41. package/dist/src/aws/utils/stackStatus.js +1 -90
  42. package/dist/src/events/index.d.ts +13 -0
  43. package/dist/src/events/index.js +1 -0
  44. package/dist/src/index.d.ts +34 -17
  45. package/dist/src/index.js +41 -21
  46. package/dist/src/orchestration/__tests__/cascadeTestHelpers.d.ts +12 -0
  47. package/dist/src/orchestration/__tests__/cascadeTestHelpers.js +78 -0
  48. package/dist/src/orchestration/activeDeploymentGuard.d.ts +10 -0
  49. package/dist/src/orchestration/activeDeploymentGuard.js +39 -0
  50. package/dist/src/orchestration/applicationDeploy.js +46 -229
  51. package/dist/src/orchestration/applicationDeployHelpers.d.ts +39 -0
  52. package/dist/src/orchestration/applicationDeployHelpers.js +223 -0
  53. package/dist/src/orchestration/applicationDestroy.d.ts +14 -0
  54. package/dist/src/orchestration/applicationDestroy.js +131 -0
  55. package/dist/src/orchestration/builders/dockerBuilder.d.ts +17 -0
  56. package/dist/src/orchestration/builders/dockerBuilder.js +98 -0
  57. package/dist/src/orchestration/builders/frameworkRegistry.d.ts +23 -0
  58. package/dist/src/orchestration/builders/frameworkRegistry.js +1 -0
  59. package/dist/src/orchestration/builders/index.d.ts +4 -0
  60. package/dist/src/orchestration/builders/index.js +1 -0
  61. package/dist/src/orchestration/builders/openNextBuilder.d.ts +21 -0
  62. package/dist/src/orchestration/builders/openNextBuilder.js +144 -0
  63. package/dist/src/orchestration/cascadeDestroyHelpers.d.ts +30 -0
  64. package/dist/src/orchestration/cascadeDestroyHelpers.js +1 -0
  65. package/dist/src/orchestration/cascadeHelpers.d.ts +46 -0
  66. package/dist/src/orchestration/cascadeHelpers.js +160 -0
  67. package/dist/src/orchestration/contextHelpers.d.ts +46 -2
  68. package/dist/src/orchestration/contextHelpers.js +93 -1
  69. package/dist/src/orchestration/destroy.d.ts +13 -0
  70. package/dist/src/orchestration/destroy.js +67 -0
  71. package/dist/src/orchestration/detectionPipeline.d.ts +2 -11
  72. package/dist/src/orchestration/detectionPipeline.js +29 -10
  73. package/dist/src/orchestration/dockerBuildHelper.d.ts +10 -0
  74. package/dist/src/orchestration/dockerBuildHelper.js +49 -0
  75. package/dist/src/orchestration/dockerInterface.d.ts +4 -2
  76. package/dist/src/orchestration/index.d.ts +8 -1
  77. package/dist/src/orchestration/index.js +1 -3
  78. package/dist/src/orchestration/manifestSecretParser.d.ts +11 -0
  79. package/dist/src/orchestration/manifestSecretParser.js +1 -0
  80. package/dist/src/orchestration/openNextBuild.d.ts +28 -0
  81. package/dist/src/orchestration/openNextBuild.js +243 -0
  82. package/dist/src/orchestration/organisationDeploy.js +110 -233
  83. package/dist/src/orchestration/organisationDestroy.d.ts +24 -0
  84. package/dist/src/orchestration/organisationDestroy.js +189 -0
  85. package/dist/src/orchestration/organisationSetup.d.ts +6 -4
  86. package/dist/src/orchestration/organisationSetup.js +28 -8
  87. package/dist/src/orchestration/resolveOperation.js +68 -6
  88. package/dist/src/orchestration/serviceFactory.d.ts +4 -0
  89. package/dist/src/orchestration/serviceFactory.js +1 -16
  90. package/dist/src/orchestration/spawnHelpers.d.ts +47 -0
  91. package/dist/src/orchestration/spawnHelpers.js +1 -0
  92. package/dist/src/orchestration/stackCleanup.d.ts +39 -0
  93. package/dist/src/orchestration/stackCleanup.js +1 -0
  94. package/dist/src/orchestration/welcomeImageHelper.d.ts +15 -0
  95. package/dist/src/orchestration/welcomeImageHelper.js +64 -0
  96. package/dist/src/services/application/ApplicationStackService.d.ts +21 -30
  97. package/dist/src/services/application/ApplicationStackService.js +16 -234
  98. package/dist/src/services/application/applicationStackHelpers.d.ts +46 -0
  99. package/dist/src/services/application/applicationStackHelpers.js +248 -0
  100. package/dist/src/services/application/index.d.ts +1 -0
  101. package/dist/src/services/application/index.js +1 -1
  102. package/dist/src/services/index.d.ts +6 -0
  103. package/dist/src/services/index.js +1 -0
  104. package/dist/src/services/infrastructure/CdkArgumentBuilder.js +1 -67
  105. package/dist/src/services/infrastructure/CdkCommandRunner.d.ts +10 -2
  106. package/dist/src/services/infrastructure/CdkCommandRunner.js +18 -15
  107. package/dist/src/services/infrastructure/CdkErrorFormatter.js +16 -194
  108. package/dist/src/services/infrastructure/CdkEventMonitoring.js +1 -41
  109. package/dist/src/services/infrastructure/CdkOutputAnalyser.js +1 -1
  110. package/dist/src/services/infrastructure/CdkOutputParser.js +2 -33
  111. package/dist/src/services/infrastructure/CdkProcessManager.d.ts +5 -0
  112. package/dist/src/services/infrastructure/CdkProcessManager.js +81 -47
  113. package/dist/src/services/infrastructure/CdkService.d.ts +7 -53
  114. package/dist/src/services/infrastructure/CdkService.js +41 -83
  115. package/dist/src/services/infrastructure/CdkServiceTypes.d.ts +50 -0
  116. package/dist/src/services/infrastructure/CdkServiceTypes.js +0 -0
  117. package/dist/src/services/infrastructure/CloudFormationService.js +9 -10
  118. package/dist/src/services/infrastructure/ICdkProcessManager.d.ts +27 -0
  119. package/dist/src/services/infrastructure/ICdkProcessManager.js +1 -0
  120. package/dist/src/services/infrastructure/__tests__/cloudFormationTestHelpers.d.ts +9 -0
  121. package/dist/src/services/infrastructure/__tests__/cloudFormationTestHelpers.js +1 -0
  122. package/dist/src/services/infrastructure/cdkServiceHelpers.d.ts +9 -0
  123. package/dist/src/services/infrastructure/cdkServiceHelpers.js +1 -0
  124. package/dist/src/services/infrastructure/constructMapEnrichment.d.ts +7 -0
  125. package/dist/src/services/infrastructure/constructMapEnrichment.js +1 -0
  126. package/dist/src/services/infrastructure/index.d.ts +3 -1
  127. package/dist/src/services/infrastructure/index.js +1 -7
  128. package/dist/src/services/supporting/TemplateHashService.js +1 -1
  129. package/dist/src/services/supporting/helpers.js +1 -81
  130. package/dist/src/services/supporting/index.js +1 -3
  131. package/dist/src/steps/index.d.ts +1 -0
  132. package/dist/src/steps/index.js +1 -0
  133. package/dist/src/steps/stepRegistry.d.ts +71 -0
  134. package/dist/src/steps/stepRegistry.js +505 -0
  135. package/dist/src/types/FjallState.js +1 -118
  136. package/dist/src/types/ProgressEvent.js +1 -48
  137. package/dist/src/types/application/ApplicationServiceTypes.js +1 -30
  138. package/dist/src/types/application/index.js +1 -1
  139. package/dist/src/types/callbacks.d.ts +76 -4
  140. package/dist/src/types/callbacks.js +0 -1
  141. package/dist/src/types/constants.d.ts +2 -0
  142. package/dist/src/types/constants.js +1 -6
  143. package/dist/src/types/credentials.js +0 -1
  144. package/dist/src/types/deployment/DeploymentServiceTypes.d.ts +5 -2
  145. package/dist/src/types/deployment/DeploymentServiceTypes.js +1 -1
  146. package/dist/src/types/deployment/DeploymentTypes.js +0 -1
  147. package/dist/src/types/deployment/cloudformation.js +0 -1
  148. package/dist/src/types/deployment/index.d.ts +3 -1
  149. package/dist/src/types/deployment/index.js +1 -1
  150. package/dist/src/types/deployment/parallel.js +1 -10
  151. package/dist/src/types/deploymentEventSchema.d.ts +158 -0
  152. package/dist/src/types/deploymentEventSchema.js +1 -0
  153. package/dist/src/types/detection.d.ts +22 -0
  154. package/dist/src/types/detection.js +1 -0
  155. package/dist/src/types/entitlements.d.ts +31 -0
  156. package/dist/src/types/entitlements.js +0 -0
  157. package/dist/src/types/errors/CdkError.js +1 -20
  158. package/dist/src/types/errors/ServiceError.d.ts +2 -1
  159. package/dist/src/types/errors/ServiceError.js +1 -119
  160. package/dist/src/types/errors/index.d.ts +2 -0
  161. package/dist/src/types/errors/index.js +1 -0
  162. package/dist/src/types/events.d.ts +3 -9
  163. package/dist/src/types/events.js +0 -5
  164. package/dist/src/types/frameworkBuilder.d.ts +96 -0
  165. package/dist/src/types/frameworkBuilder.js +8 -0
  166. package/dist/src/types/index.d.ts +19 -4
  167. package/dist/src/types/index.js +1 -9
  168. package/dist/src/types/operations.d.ts +3 -2
  169. package/dist/src/types/operations.js +1 -285
  170. package/dist/src/types/orgConfig.d.ts +2 -10
  171. package/dist/src/types/orgConfig.js +0 -11
  172. package/dist/src/types/params.d.ts +60 -1
  173. package/dist/src/types/patternDetection.d.ts +14 -16
  174. package/dist/src/types/patternDetection.js +14 -18
  175. package/dist/src/types/patternTypes.d.ts +19 -0
  176. package/dist/src/types/patternTypes.js +1 -0
  177. package/dist/src/types/stepDefinitions.d.ts +163 -0
  178. package/dist/src/types/stepDefinitions.js +98 -0
  179. package/dist/src/types/validation.js +0 -1
  180. package/dist/src/util/dockerfileDetection.d.ts +5 -0
  181. package/dist/src/util/dockerfileDetection.js +1 -0
  182. package/dist/src/util/index.d.ts +4 -3
  183. package/dist/src/util/index.js +1 -3
  184. package/dist/src/util/sequencedCallbacks.d.ts +44 -0
  185. package/dist/src/util/sequencedCallbacks.js +1 -0
  186. package/package.json +49 -8
  187. package/dist/src/aws/utils/CloudFormationFailureAnalyser.d.ts +0 -32
  188. package/dist/src/aws/utils/CloudFormationFailureAnalyser.js +0 -228
  189. package/dist/src/aws/utils/errors.d.ts +0 -26
  190. package/dist/src/aws/utils/errors.js +0 -59
  191. package/dist/src/util/fsHelpers.d.ts +0 -4
  192. package/dist/src/util/fsHelpers.js +0 -16
  193. package/dist/src/util/securityHelpers.d.ts +0 -31
  194. package/dist/src/util/securityHelpers.js +0 -124
  195. package/dist/src/util/singleton.d.ts +0 -2
  196. package/dist/src/util/singleton.js +0 -9
  197. package/dist/src/util/sleep.d.ts +0 -4
  198. package/dist/src/util/sleep.js +0 -4
@@ -1,5 +0,0 @@
1
- /**
2
- * Progress event types emitted by the deployment engine.
3
- * These flow to the caller via DeployCallbacks.
4
- */
5
- export {};
@@ -0,0 +1,96 @@
1
+ /**
2
+ * FrameworkBuilder interface and supporting types.
3
+ *
4
+ * Defines the detect/plan/build lifecycle for framework-specific builders
5
+ * (e.g., OpenNext, Docker). Builders are checked in priority order during
6
+ * detection and produce serialisable build plans.
7
+ */
8
+ import type { Result } from "@fjall/generator";
9
+ import type { PatternType } from "@fjall/generator";
10
+ import type { ApplicationStack } from "./operations.js";
11
+ import type { AppResourceFlags } from "./patternTypes.js";
12
+ /** Result of a builder's detect() phase */
13
+ export interface FrameworkDetection {
14
+ /** Whether this builder can handle the app */
15
+ readonly detected: boolean;
16
+ /** The pattern type for backwards compatibility with existing pipeline */
17
+ readonly pattern: PatternType | null;
18
+ /** Human-readable reason for the match/rejection */
19
+ readonly reason: string;
20
+ /** Infrastructure resources this framework requires */
21
+ readonly resources: AppResourceFlags;
22
+ /** Whether a database was detected */
23
+ readonly hasDatabase: boolean;
24
+ /** Whether a Dockerfile was found in the app directory */
25
+ readonly hasDockerfile: boolean;
26
+ }
27
+ /** Build plan produced by a builder's plan() phase — inspectable, serialisable */
28
+ export interface BuildPlan {
29
+ /** The builder that created this plan */
30
+ readonly builderName: string;
31
+ /** Stack deployment order */
32
+ readonly deployOrder: readonly ApplicationStack[];
33
+ /** Stack destroy order (reverse dependency) */
34
+ readonly destroyOrder: readonly ApplicationStack[];
35
+ /** Whether destroy should use parallel groups */
36
+ readonly parallelDestroy: boolean;
37
+ /** Pre-build commands (e.g., Payload import map generation) */
38
+ readonly preBuildCommands: readonly BuildCommand[];
39
+ /** Main build command (e.g., open-next build) */
40
+ readonly buildCommand: BuildCommand | null;
41
+ /** Whether this plan requires a Docker build (standard apps with Dockerfile) */
42
+ readonly requiresDockerBuild: boolean;
43
+ /** Infrastructure requirements */
44
+ readonly resources: AppResourceFlags;
45
+ }
46
+ /** A command to execute during the build phase */
47
+ export interface BuildCommand {
48
+ readonly name: string;
49
+ readonly binary: string;
50
+ readonly args: readonly string[];
51
+ /** Timeout in milliseconds */
52
+ readonly timeoutMs: number;
53
+ /** Working directory (relative to app path) */
54
+ readonly cwd?: string;
55
+ }
56
+ /** Callbacks for build progress reporting */
57
+ export interface BuildCallbacks {
58
+ readonly onBuildStart?: (builderName: string) => void;
59
+ readonly onBuildProgress?: (builderName: string, message: string) => void;
60
+ readonly onBuildComplete?: (builderName: string) => void;
61
+ readonly onBuildError?: (builderName: string, error: string) => void;
62
+ }
63
+ /** Context passed to detect() — lightweight filesystem info */
64
+ export interface DetectionContext {
65
+ /** Absolute path to the application source */
66
+ readonly appPath: string;
67
+ }
68
+ /** Options for build execution */
69
+ export interface BuildOptions {
70
+ /** Skip the build phase entirely */
71
+ readonly skipBuild?: boolean;
72
+ /** Only deploy infrastructure, skip application build */
73
+ readonly infraOnly?: boolean;
74
+ }
75
+ /** The FrameworkBuilder interface — detect/plan/build lifecycle */
76
+ export interface FrameworkBuilder {
77
+ /** Unique identifier (e.g., "opennext", "docker") */
78
+ readonly name: string;
79
+ /** Lower number = higher priority. Checked in ascending order. */
80
+ readonly priority: number;
81
+ /**
82
+ * Fast detection: can this builder handle the app?
83
+ * Examines filesystem markers. Must not perform heavy I/O.
84
+ */
85
+ detect(context: DetectionContext): FrameworkDetection;
86
+ /**
87
+ * Produce a build plan without executing anything.
88
+ * Inspectable and serialisable for testing/debugging.
89
+ */
90
+ plan(context: DetectionContext, detection: FrameworkDetection): BuildPlan;
91
+ /**
92
+ * Execute the build according to the plan.
93
+ * Reports progress via callbacks.
94
+ */
95
+ build(appPath: string, plan: BuildPlan, callbacks: BuildCallbacks, options?: BuildOptions): Promise<Result<void>>;
96
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * FrameworkBuilder interface and supporting types.
3
+ *
4
+ * Defines the detect/plan/build lifecycle for framework-specific builders
5
+ * (e.g., OpenNext, Docker). Builders are checked in priority order during
6
+ * detection and produce serialisable build plans.
7
+ */
8
+ export {};
@@ -1,10 +1,15 @@
1
+ export { DeploymentEventSchema, DEPLOYMENT_EVENT_TYPES, DEPLOYMENT_EVENT_RESOURCE_CATEGORIES, CASCADE_PHASES, CASCADE_ACCOUNT_STATUSES, toCascadePhase } from "./deploymentEventSchema.js";
2
+ export type { DeploymentEvent, DeploymentEventType, DeploymentEventResourceCategory, DeploymentEventCascadePhase, DeploymentEventCascadeAccountStatus } from "./deploymentEventSchema.js";
1
3
  export type { AwsCredentials, DeployIdentity } from "./credentials.js";
2
4
  export type { DeployCallbacks, StepCompleteStatus } from "./callbacks.js";
3
5
  export type { ProgressEvent, ProgressEventType, ResourceEvent, AwsAuthResult, CascadeDeploymentResult, CascadePhase } from "./events.js";
4
6
  export type { ApiClientInterface, EntitlementsData } from "./apiClient.js";
5
- export type { DeployParams, DeployOptions, DeploymentType, DeployResult } from "./params.js";
7
+ export type { DeployParams, DeployOptions, DeploymentType, DeployResult, DestroyParams, DestroyOptions, DestroyResult } from "./params.js";
6
8
  export type { OrgConfig, ProviderAccount, SSOSession } from "./orgConfig.js";
9
+ export type { Entitlements } from "./entitlements.js";
7
10
  export type { StackOutput, StackOutputsRecord, DeploymentContext, StepOutput, ApplicationDeploymentContext, CallerIdentity } from "./deployment/index.js";
11
+ export { stubCallerIdentity } from "./deployment/index.js";
12
+ export type { DetectionResult } from "./detection.js";
8
13
  export type { ValidationResult } from "./validation.js";
9
14
  export type { ProgressCallbacks } from "./ProgressEvent.js";
10
15
  export { ProgressReporter } from "./ProgressEvent.js";
@@ -12,9 +17,19 @@ export type { ApplicationStack, OrganisationType, DeploymentOperation, Applicati
12
17
  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
18
  export type { ParallelDeploymentResult, ParallelDeployGroup, ParallelOperation, ParallelOperationType, ParallelOperationState } from "./deployment/index.js";
14
19
  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";
20
+ export type { OpenNextPattern, AppResourceFlags } from "./patternTypes.js";
21
+ export { isOpenNextPattern, OPENNEXT_PATTERNS } from "./patternTypes.js";
22
+ export { deriveResourcesFromManifestStacks } from "./patternDetection.js";
23
+ /** @deprecated Use FrameworkRegistry.resolve() instead */
24
+ export { detectPattern } from "./patternDetection.js";
25
+ /** @deprecated Use FrameworkRegistry.resolve() instead */
26
+ export { detectPayloadPattern } from "./patternDetection.js";
27
+ /** @deprecated Use FrameworkRegistry.resolve() instead */
28
+ export { detectDatabase } from "./patternDetection.js";
29
+ export { STACK_NOT_FOUND_PATTERN, STACK_FAILED_STATE_PATTERN, CDK_NO_STACKS_MATCH, INFRASTRUCTURE_FILENAME } from "./constants.js";
18
30
  export { ApplicationError, wrapApplicationError, type ApplicationErrorType, type StackDeploymentData, type StackDeploymentOptions, type ApplicationDeploymentData, type ApplicationDestructionData } from "./application/index.js";
19
31
  export type { FjallStateFile, TemplateHashEntry } from "./FjallState.js";
20
32
  export { FjallStateFileSchema, readStateFile, writeStateFile, createEmptyState, deleteStateFile, updateTemplateHash, getStateFilePath } from "./FjallState.js";
33
+ export type { FrameworkBuilder, FrameworkDetection, BuildPlan, BuildCommand, BuildCallbacks, DetectionContext, BuildOptions } from "./frameworkBuilder.js";
34
+ export { STEP_IDS, STEP_NAMES, INFRASTRUCTURE_STEP_NAMES, INFRA_STEP_NAME } from "./stepDefinitions.js";
35
+ export type { StepId, InfrastructureStepName, StepDefinition, StepDeploymentType, Operation, StepContext } from "./stepDefinitions.js";
@@ -1,9 +1 @@
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";
1
+ import{DeploymentEventSchema as r,DEPLOYMENT_EVENT_TYPES as E,DEPLOYMENT_EVENT_RESOURCE_CATEGORIES as a,CASCADE_PHASES as o,CASCADE_ACCOUNT_STATUSES as A,toCascadePhase as S}from"./deploymentEventSchema.js";import{stubCallerIdentity as T}from"./deployment/index.js";import{ProgressReporter as _}from"./ProgressEvent.js";import{APPLICATION_STACKS as i,ORGANISATION_TYPES as N,APPLICATION_DEPLOY_ORDER as R,APPLICATION_DESTROY_ORDER as l,OPENNEXT_DEPLOY_ORDER as D,OPENNEXT_DESTROY_ORDER as m,PARALLEL_DEPLOY_GROUPS as n,PARALLEL_DESTROY_GROUPS as s,OPENNEXT_PARALLEL_GROUPS as c,isApplicationOperation as C,isOrganisationOperation as L,getParallelDeployGroups as I,getParallelDestroyGroups as f,getApplicationDeployOrder as x,getApplicationDestroyOrder as d,getApplicationStackName as F,getOrganisationStackName as g,isApplicationStack as U,getApplicationStepName as Y,getApplicationStepId as y,toPascalCase as M}from"./operations.js";import{PARALLEL_OPERATION_TYPES as h}from"./deployment/index.js";import{isOpenNextPattern as K,OPENNEXT_PATTERNS as k}from"./patternTypes.js";import{deriveResourcesFromManifestStacks as H}from"./patternDetection.js";import{detectPattern as v}from"./patternDetection.js";import{detectPayloadPattern as V}from"./patternDetection.js";import{detectDatabase as q}from"./patternDetection.js";import{STACK_NOT_FOUND_PATTERN as B,STACK_FAILED_STATE_PATTERN as J,CDK_NO_STACKS_MATCH as Q,INFRASTRUCTURE_FILENAME as W}from"./constants.js";import{ApplicationError as $,wrapApplicationError as ee}from"./application/index.js";import{FjallStateFileSchema as re,readStateFile as Ee,writeStateFile as ae,createEmptyState as oe,deleteStateFile as Ae,updateTemplateHash as Se,getStateFilePath as pe}from"./FjallState.js";import{STEP_IDS as Pe,STEP_NAMES as _e,INFRASTRUCTURE_STEP_NAMES as Oe,INFRA_STEP_NAME as ie}from"./stepDefinitions.js";export{R as APPLICATION_DEPLOY_ORDER,l as APPLICATION_DESTROY_ORDER,i as APPLICATION_STACKS,$ as ApplicationError,A as CASCADE_ACCOUNT_STATUSES,o as CASCADE_PHASES,Q as CDK_NO_STACKS_MATCH,a as DEPLOYMENT_EVENT_RESOURCE_CATEGORIES,E as DEPLOYMENT_EVENT_TYPES,r as DeploymentEventSchema,re as FjallStateFileSchema,W as INFRASTRUCTURE_FILENAME,Oe as INFRASTRUCTURE_STEP_NAMES,ie as INFRA_STEP_NAME,D as OPENNEXT_DEPLOY_ORDER,m as OPENNEXT_DESTROY_ORDER,c as OPENNEXT_PARALLEL_GROUPS,k as OPENNEXT_PATTERNS,N as ORGANISATION_TYPES,n as PARALLEL_DEPLOY_GROUPS,s as PARALLEL_DESTROY_GROUPS,h as PARALLEL_OPERATION_TYPES,_ as ProgressReporter,J as STACK_FAILED_STATE_PATTERN,B as STACK_NOT_FOUND_PATTERN,Pe as STEP_IDS,_e as STEP_NAMES,oe as createEmptyState,Ae as deleteStateFile,H as deriveResourcesFromManifestStacks,q as detectDatabase,v as detectPattern,V as detectPayloadPattern,x as getApplicationDeployOrder,d as getApplicationDestroyOrder,F as getApplicationStackName,y as getApplicationStepId,Y as getApplicationStepName,g as getOrganisationStackName,I as getParallelDeployGroups,f as getParallelDestroyGroups,pe as getStateFilePath,C as isApplicationOperation,U as isApplicationStack,K as isOpenNextPattern,L as isOrganisationOperation,Ee as readStateFile,T as stubCallerIdentity,S as toCascadePhase,M as toPascalCase,Se as updateTemplateHash,ee as wrapApplicationError,ae as writeStateFile};
@@ -1,4 +1,5 @@
1
- import { type AppResourceFlags } from "./patternDetection.js";
1
+ import { type AppResourceFlags } from "./patternTypes.js";
2
+ import { type StepId } from "./stepDefinitions.js";
2
3
  import { toPascalCase } from "@fjall/util";
3
4
  /**
4
5
  * Application infrastructure stacks
@@ -190,4 +191,4 @@ export declare function getApplicationStepName(stack: ApplicationStack, action:
190
191
  /**
191
192
  * Step ID generators for tracking
192
193
  */
193
- export declare function getApplicationStepId(stack: ApplicationStack, action: "deploy" | "destroy"): string;
194
+ export declare function getApplicationStepId(stack: ApplicationStack, action: "deploy" | "destroy"): StepId;
@@ -1,285 +1 @@
1
- import { isOpenNextPattern } from "./patternDetection.js";
2
- import { toPascalCase } from "@fjall/util";
3
- /**
4
- * Application infrastructure stacks
5
- */
6
- export const APPLICATION_STACKS = {
7
- NETWORK: "Network",
8
- DATABASE: "Database",
9
- STORAGE: "Storage",
10
- COMPUTE: "Compute",
11
- CDN: "Cdn",
12
- MESSAGING: "Messaging"
13
- };
14
- /**
15
- * Organisation infrastructure types
16
- * Note: These are deployment types, not stacks - each maps to a single CDK stack
17
- */
18
- export const ORGANISATION_TYPES = {
19
- ORGANISATION: "organisation",
20
- PLATFORM: "platform",
21
- ACCOUNT: "account"
22
- };
23
- /**
24
- * Type guards for safe type narrowing
25
- */
26
- export function isApplicationOperation(op) {
27
- return op.kind === "application";
28
- }
29
- export function isOrganisationOperation(op) {
30
- return op.kind === "organisation";
31
- }
32
- /**
33
- * Stack ordering for application deployments
34
- */
35
- export const APPLICATION_DEPLOY_ORDER = [
36
- APPLICATION_STACKS.NETWORK,
37
- APPLICATION_STACKS.DATABASE,
38
- APPLICATION_STACKS.COMPUTE
39
- ];
40
- export const APPLICATION_DESTROY_ORDER = [
41
- APPLICATION_STACKS.COMPUTE,
42
- APPLICATION_STACKS.DATABASE,
43
- APPLICATION_STACKS.NETWORK
44
- ];
45
- /**
46
- * Stack ordering for OpenNext (Next.js/Payload) deployments
47
- * These patterns require additional infrastructure: S3, DynamoDB, SQS, CloudFront
48
- */
49
- export const OPENNEXT_DEPLOY_ORDER = [
50
- APPLICATION_STACKS.NETWORK,
51
- APPLICATION_STACKS.STORAGE,
52
- APPLICATION_STACKS.MESSAGING,
53
- APPLICATION_STACKS.DATABASE,
54
- APPLICATION_STACKS.COMPUTE,
55
- APPLICATION_STACKS.CDN
56
- ];
57
- /**
58
- * Stack ordering for OpenNext destroy operations (reverse of deploy order)
59
- * CDN must be destroyed first as it depends on Compute, then work backwards
60
- */
61
- export const OPENNEXT_DESTROY_ORDER = [
62
- APPLICATION_STACKS.CDN,
63
- APPLICATION_STACKS.COMPUTE,
64
- APPLICATION_STACKS.DATABASE,
65
- APPLICATION_STACKS.MESSAGING,
66
- APPLICATION_STACKS.STORAGE,
67
- APPLICATION_STACKS.NETWORK
68
- ];
69
- /**
70
- * Parallel deployment groups for concurrent stack deployment
71
- * Stacks within each phase can be deployed in parallel.
72
- *
73
- * Dependency structure:
74
- * - Phase 1: Network (required by all other stacks)
75
- * - Phase 2: Storage, Messaging, Database (independent of each other, only need Network)
76
- * - Phase 3: Compute (needs Database outputs)
77
- * - Phase 4: CDN (needs Compute outputs)
78
- */
79
- export const PARALLEL_DEPLOY_GROUPS = {
80
- PHASE_1: {
81
- phase: 1,
82
- stacks: [APPLICATION_STACKS.NETWORK],
83
- description: "Network infrastructure"
84
- },
85
- PHASE_2: {
86
- phase: 2,
87
- stacks: [
88
- APPLICATION_STACKS.STORAGE,
89
- APPLICATION_STACKS.MESSAGING,
90
- APPLICATION_STACKS.DATABASE
91
- ],
92
- description: "Storage and database resources (parallel)"
93
- },
94
- PHASE_3: {
95
- phase: 3,
96
- stacks: [APPLICATION_STACKS.COMPUTE],
97
- description: "Compute resources"
98
- },
99
- PHASE_4: {
100
- phase: 4,
101
- stacks: [APPLICATION_STACKS.CDN],
102
- description: "CDN distribution"
103
- }
104
- };
105
- /**
106
- * Parallel deployment groups for OpenNext (Next.js/Payload) deployments
107
- * Optimised to run BUILD in parallel with infrastructure stacks.
108
- */
109
- export const OPENNEXT_PARALLEL_GROUPS = {
110
- /** Regular Next.js: BUILD + all Phase 2 stacks in parallel */
111
- NEXTJS_PARALLEL: {
112
- stacks: [
113
- APPLICATION_STACKS.STORAGE,
114
- APPLICATION_STACKS.MESSAGING,
115
- APPLICATION_STACKS.DATABASE
116
- ],
117
- includeBuild: true,
118
- description: "Build + Storage/Messaging/Database (parallel)"
119
- },
120
- /** Payload: BUILD + remaining stacks (after Database + migrations) */
121
- PAYLOAD_PARALLEL: {
122
- stacks: [APPLICATION_STACKS.STORAGE, APPLICATION_STACKS.MESSAGING],
123
- includeBuild: true,
124
- description: "Build + Storage/Messaging (parallel)"
125
- }
126
- };
127
- /**
128
- * Get all parallel deploy groups as an ordered array
129
- */
130
- export function getParallelDeployGroups() {
131
- return [
132
- PARALLEL_DEPLOY_GROUPS.PHASE_1,
133
- PARALLEL_DEPLOY_GROUPS.PHASE_2,
134
- PARALLEL_DEPLOY_GROUPS.PHASE_3,
135
- PARALLEL_DEPLOY_GROUPS.PHASE_4
136
- ];
137
- }
138
- /**
139
- * Parallel destroy groups for OpenNext destroy operations.
140
- * Reverse of deploy order to respect dependencies.
141
- */
142
- export const PARALLEL_DESTROY_GROUPS = {
143
- PHASE_1: {
144
- phase: 1,
145
- stacks: [APPLICATION_STACKS.CDN],
146
- description: "CDN distribution"
147
- },
148
- PHASE_2: {
149
- phase: 2,
150
- stacks: [APPLICATION_STACKS.COMPUTE],
151
- description: "Compute resources"
152
- },
153
- PHASE_3: {
154
- phase: 3,
155
- stacks: [
156
- APPLICATION_STACKS.DATABASE,
157
- APPLICATION_STACKS.MESSAGING,
158
- APPLICATION_STACKS.STORAGE
159
- ],
160
- description: "Database, messaging, and storage (parallel)"
161
- },
162
- PHASE_4: {
163
- phase: 4,
164
- stacks: [APPLICATION_STACKS.NETWORK],
165
- description: "Network infrastructure"
166
- }
167
- };
168
- /**
169
- * Get all parallel destroy groups as an ordered array
170
- */
171
- export function getParallelDestroyGroups() {
172
- return [
173
- PARALLEL_DESTROY_GROUPS.PHASE_1,
174
- PARALLEL_DESTROY_GROUPS.PHASE_2,
175
- PARALLEL_DESTROY_GROUPS.PHASE_3,
176
- PARALLEL_DESTROY_GROUPS.PHASE_4
177
- ];
178
- }
179
- /**
180
- * Deploy tier priority — lower number deploys first, higher destroys first.
181
- * Used for dynamic ordering based on manifest-detected resources.
182
- */
183
- const STACK_DEPLOY_TIER = {
184
- Network: 1,
185
- Storage: 2,
186
- Messaging: 2,
187
- Database: 2,
188
- Compute: 3,
189
- Cdn: 4
190
- };
191
- /**
192
- * Get deployment order based on application configuration.
193
- *
194
- * Strategies:
195
- * 1. OpenNext (pattern = "payload" or "nextjs"): Predefined order (build orchestration)
196
- * 2. Dynamic: Include only detected stacks, ordered by tier
197
- * 3. Fallback: Standard order (no manifest available)
198
- */
199
- export function getApplicationDeployOrder(options) {
200
- const { pattern, resources } = options ?? {};
201
- if (isOpenNextPattern(pattern)) {
202
- return OPENNEXT_DEPLOY_ORDER;
203
- }
204
- if (resources) {
205
- return buildOrderFromResources(resources, "asc");
206
- }
207
- return APPLICATION_DEPLOY_ORDER;
208
- }
209
- /**
210
- * Get destroy order based on application configuration.
211
- * Destroy order respects dependencies (reverse of deploy order).
212
- */
213
- export function getApplicationDestroyOrder(options) {
214
- const { pattern, resources } = options ?? {};
215
- if (isOpenNextPattern(pattern)) {
216
- return OPENNEXT_DESTROY_ORDER;
217
- }
218
- if (resources) {
219
- return buildOrderFromResources(resources, "desc");
220
- }
221
- return APPLICATION_DESTROY_ORDER;
222
- }
223
- /**
224
- * Build a stack order from resource flags, sorted by tier priority.
225
- */
226
- function buildOrderFromResources(resources, direction) {
227
- const stacks = [];
228
- if (resources.hasNetwork)
229
- stacks.push(APPLICATION_STACKS.NETWORK);
230
- if (resources.hasStorage)
231
- stacks.push(APPLICATION_STACKS.STORAGE);
232
- if (resources.hasMessaging)
233
- stacks.push(APPLICATION_STACKS.MESSAGING);
234
- if (resources.hasDatabase)
235
- stacks.push(APPLICATION_STACKS.DATABASE);
236
- if (resources.hasCompute)
237
- stacks.push(APPLICATION_STACKS.COMPUTE);
238
- if (resources.hasCdn)
239
- stacks.push(APPLICATION_STACKS.CDN);
240
- return stacks.sort((a, b) => {
241
- const diff = STACK_DEPLOY_TIER[a] - STACK_DEPLOY_TIER[b];
242
- return direction === "asc" ? diff : -diff;
243
- });
244
- }
245
- /**
246
- * Helper functions for stack operations
247
- */
248
- export { toPascalCase };
249
- export function getApplicationStackName(appName, stack) {
250
- return `${toPascalCase(appName)}${stack}`;
251
- }
252
- export function getOrganisationStackName(type) {
253
- switch (type) {
254
- case "organisation":
255
- return "Organisation";
256
- case "platform":
257
- return "Platform";
258
- case "account":
259
- return "Account";
260
- default: {
261
- const _exhaustive = type;
262
- throw new Error(`Unsupported organisation type: ${String(_exhaustive)}`);
263
- }
264
- }
265
- }
266
- /**
267
- * Type guard for ApplicationStack
268
- */
269
- export function isApplicationStack(value) {
270
- return Object.values(APPLICATION_STACKS).includes(value);
271
- }
272
- /**
273
- * Step name generators for UI display
274
- */
275
- export function getApplicationStepName(stack, action) {
276
- const verb = action === "deploy" ? "Deploying" : "Destroying";
277
- return `${verb} ${stack.toLowerCase()} infrastructure`;
278
- }
279
- /**
280
- * Step ID generators for tracking
281
- */
282
- export function getApplicationStepId(stack, action) {
283
- const suffix = action === "destroy" ? "-destroy" : "";
284
- return `${stack.toLowerCase()}${suffix}`;
285
- }
1
+ import{isOpenNextPattern as i}from"./patternTypes.js";import{STEP_IDS as s}from"./stepDefinitions.js";import{toPascalCase as E}from"@fjall/util";const t={NETWORK:"Network",DATABASE:"Database",STORAGE:"Storage",COMPUTE:"Compute",CDN:"Cdn",MESSAGING:"Messaging"},C={ORGANISATION:"organisation",PLATFORM:"platform",ACCOUNT:"account"};function G(e){return e.kind==="application"}function g(e){return e.kind==="organisation"}const T=[t.NETWORK,t.DATABASE,t.COMPUTE],u=[t.COMPUTE,t.DATABASE,t.NETWORK],P=[t.NETWORK,t.STORAGE,t.MESSAGING,t.DATABASE,t.COMPUTE,t.CDN],N=[t.CDN,t.COMPUTE,t.DATABASE,t.MESSAGING,t.STORAGE,t.NETWORK],n={PHASE_1:{phase:1,stacks:[t.NETWORK],description:"Network infrastructure"},PHASE_2:{phase:2,stacks:[t.STORAGE,t.MESSAGING,t.DATABASE],description:"Storage and database resources (parallel)"},PHASE_3:{phase:3,stacks:[t.COMPUTE],description:"Compute resources"},PHASE_4:{phase:4,stacks:[t.CDN],description:"CDN distribution"}},f={NEXTJS_PARALLEL:{stacks:[t.STORAGE,t.MESSAGING,t.DATABASE],includeBuild:!0,description:"Build + Storage/Messaging/Database (parallel)"},PAYLOAD_PARALLEL:{stacks:[t.STORAGE,t.MESSAGING],includeBuild:!0,description:"Build + Storage/Messaging (parallel)"}};function I(){return[n.PHASE_1,n.PHASE_2,n.PHASE_3,n.PHASE_4]}const a={PHASE_1:{phase:1,stacks:[t.CDN],description:"CDN distribution"},PHASE_2:{phase:2,stacks:[t.COMPUTE],description:"Compute resources"},PHASE_3:{phase:3,stacks:[t.DATABASE,t.MESSAGING,t.STORAGE],description:"Database, messaging, and storage (parallel)"},PHASE_4:{phase:4,stacks:[t.NETWORK],description:"Network infrastructure"}};function L(){return[a.PHASE_1,a.PHASE_2,a.PHASE_3,a.PHASE_4]}const S={Network:1,Storage:2,Messaging:2,Database:2,Compute:3,Cdn:4};function M(e){const{pattern:o,resources:r}=e??{};return i(o)?P:r?p(r,"asc"):T}function h(e){const{pattern:o,resources:r}=e??{};return i(o)?N:r?p(r,"desc"):u}function p(e,o){const r=[];return e.hasNetwork&&r.push(t.NETWORK),e.hasStorage&&r.push(t.STORAGE),e.hasMessaging&&r.push(t.MESSAGING),e.hasDatabase&&r.push(t.DATABASE),e.hasCompute&&r.push(t.COMPUTE),e.hasCdn&&r.push(t.CDN),r.sort((c,O)=>{const A=S[c]-S[O];return o==="asc"?A:-A})}function x(e,o){return`${E(e)}${o}`}function k(e){switch(e){case"organisation":return"Organisation";case"platform":return"Platform";case"account":return"Account";default:{const o=e;throw new Error(`Unsupported organisation type: ${String(o)}`)}}}const D=new Set(Object.values(t));function m(e){return D.has(e)}function y(e,o){return`${o==="deploy"?"Deploying":"Destroying"} ${e.toLowerCase()} infrastructure`}const R={[t.NETWORK]:{deploy:s.NETWORK,destroy:s.NETWORK_DESTROY},[t.DATABASE]:{deploy:s.DATABASE,destroy:s.DATABASE_DESTROY},[t.STORAGE]:{deploy:s.STORAGE,destroy:s.STORAGE_DESTROY},[t.COMPUTE]:{deploy:s.COMPUTE,destroy:s.COMPUTE_DESTROY},[t.CDN]:{deploy:s.CDN,destroy:s.CDN_DESTROY},[t.MESSAGING]:{deploy:s.MESSAGING,destroy:s.MESSAGING_DESTROY}};function U(e,o){return R[e][o]}export{T as APPLICATION_DEPLOY_ORDER,u as APPLICATION_DESTROY_ORDER,t as APPLICATION_STACKS,P as OPENNEXT_DEPLOY_ORDER,N as OPENNEXT_DESTROY_ORDER,f as OPENNEXT_PARALLEL_GROUPS,C as ORGANISATION_TYPES,n as PARALLEL_DEPLOY_GROUPS,a as PARALLEL_DESTROY_GROUPS,M as getApplicationDeployOrder,h as getApplicationDestroyOrder,x as getApplicationStackName,U as getApplicationStepId,y as getApplicationStepName,k as getOrganisationStackName,I as getParallelDeployGroups,L as getParallelDestroyGroups,G as isApplicationOperation,m as isApplicationStack,g as isOrganisationOperation,E as toPascalCase};
@@ -8,6 +8,8 @@
8
8
  * Passed to CDK via -c orgConfig=<json> context at synthesis time.
9
9
  * See: investigations/2026-03-16-config-split-investigation.md
10
10
  */
11
+ import type { ProviderAccount, SSOSession } from "@fjall/util/config";
12
+ export type { ProviderAccount, SSOSession };
11
13
  export interface OrgConfig {
12
14
  providerAccounts: ProviderAccount[];
13
15
  primaryRegion?: string;
@@ -16,13 +18,3 @@ export interface OrgConfig {
16
18
  rootOidcRoleArn?: string;
17
19
  ssoSessions?: Record<string, SSOSession>;
18
20
  }
19
- export interface ProviderAccount {
20
- id: string;
21
- name: string;
22
- environment: string;
23
- managed?: boolean;
24
- }
25
- export interface SSOSession {
26
- ssoRegion: string;
27
- ssoStartUrl: string;
28
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Organisation-level configuration.
3
- *
4
- * This config is injected by the caller, not read from disk:
5
- * - CLI: fetches from GET /api/organisation-config (cached locally with TTL)
6
- * - Worker: reads from DB (Organization + ConnectedAwsAccount models)
7
- *
8
- * Passed to CDK via -c orgConfig=<json> context at synthesis time.
9
- * See: investigations/2026-03-16-config-split-investigation.md
10
- */
11
- export {};
@@ -60,7 +60,7 @@ export interface DeployOptions {
60
60
  deployOnly?: boolean;
61
61
  passThroughCDK?: boolean;
62
62
  environment?: string;
63
- /** Skip OIDC provider creation — set when OIDC is already configured (webapp Quick Create). */
63
+ /** Skip OIDC connector deployment in the Account stack — set when the OIDC connector was already provisioned separately (e.g. via the webapp CloudFormation quick-create flow). */
64
64
  skipOidc?: boolean;
65
65
  }
66
66
  export type DeploymentType = "application" | "organisation";
@@ -69,8 +69,67 @@ export interface DeployResult {
69
69
  deploymentType: DeploymentType;
70
70
  /** Stack outputs (website URL, OIDC role ARN, etc.) */
71
71
  outputs?: Record<string, string>;
72
+ /** Per-account outputs from cascade deploys (accountId → stack outputs). */
73
+ cascadeOutputs?: Array<{
74
+ accountId: string;
75
+ outputs: Record<string, string>;
76
+ }>;
72
77
  /** Duration in milliseconds */
73
78
  durationMs?: number;
79
+ /** Non-fatal warnings (e.g. cascade account failures) */
80
+ warnings?: string[];
81
+ }
82
+ /**
83
+ * Parameters for the destroy entry point.
84
+ *
85
+ * Mirrors DeployParams but excludes deploy-only concerns (Docker,
86
+ * detection, deployOnly/infraOnly). Destroy needs credentials,
87
+ * working directory, and callbacks — nothing more.
88
+ */
89
+ export interface DestroyParams {
90
+ /** Target name (e.g., "my-app", "organisation", "platform", "account-prod") */
91
+ target: string;
92
+ /** Absolute path to the repository root containing fjall-config.json */
93
+ workingDirectory: string;
94
+ /** AWS credentials for the operation. deploy-core never resolves these itself. */
95
+ awsCredentials: AwsCredentials;
96
+ /** Typed callbacks for progress events. CLI and worker implement differently. */
97
+ callbacks: DeployCallbacks;
98
+ /** Destroy options */
99
+ options?: DestroyOptions;
100
+ /**
101
+ * Org-level config (accounts, regions, OIDC).
102
+ * Passed to CDK via -c orgConfig=<json> context.
103
+ */
104
+ orgConfig?: OrgConfig;
105
+ /**
106
+ * Pre-fetched identity for org deployments.
107
+ * CLI: omit this, provide apiClient instead.
108
+ * Worker: provide this from DB, omit apiClient.
109
+ */
110
+ identity?: DeployIdentity;
111
+ }
112
+ export interface DestroyOptions {
113
+ /** Skip interactive confirmation prompts */
114
+ skipConfirmation?: boolean;
115
+ /** Force destroy even when stacks are in unusual states */
116
+ force?: boolean;
117
+ /** Cascade destroy to child accounts (org type only) */
118
+ cascade?: boolean;
119
+ /** Verbose output */
120
+ verbose?: boolean;
121
+ }
122
+ export interface DestroyResult {
123
+ target: string;
124
+ deploymentType: DeploymentType;
125
+ /** Duration in milliseconds */
126
+ durationMs?: number;
127
+ /** Stacks that were successfully destroyed */
128
+ stacksDestroyed?: string[];
129
+ /** Stacks that were skipped (already deleted) */
130
+ skippedStacks?: string[];
131
+ /** Non-fatal warnings (e.g. cascade account failures) */
132
+ warnings?: string[];
74
133
  }
75
134
  /** Re-export Result from generator for consumers. */
76
135
  export type { Result };
@@ -1,24 +1,20 @@
1
1
  /**
2
- * Pattern detection types and functions.
2
+ * Filesystem-based pattern detection functions.
3
3
  *
4
- * Contains both pure predicates used by operations.ts and
5
- * filesystem-based detection functions used by orchestration services.
4
+ * Pure types and predicates live in patternTypes.ts (browser-safe).
5
+ * This file contains only functions that require Node fs access.
6
6
  */
7
7
  import type { PatternType } from "@fjall/generator";
8
- declare const OPENNEXT_PATTERNS_ARRAY: readonly ["payload", "nextjs"];
9
- export type OpenNextPattern = (typeof OPENNEXT_PATTERNS_ARRAY)[number];
10
- export declare const OPENNEXT_PATTERNS: Set<string>;
11
- export declare function isOpenNextPattern(pattern: string | undefined | null): pattern is OpenNextPattern;
12
- export interface AppResourceFlags {
13
- hasNetwork: boolean;
14
- hasCompute: boolean;
15
- hasDatabase: boolean;
16
- hasStorage: boolean;
17
- hasMessaging: boolean;
18
- hasCdn: boolean;
19
- }
8
+ export type { OpenNextPattern, AppResourceFlags } from "./patternTypes.js";
9
+ export { OPENNEXT_PATTERNS, isOpenNextPattern } from "./patternTypes.js";
10
+ import type { AppResourceFlags } from "./patternTypes.js";
20
11
  /** Derive resource flags from manifest stack names (authoritative, post-synth) */
21
12
  export declare function deriveResourcesFromManifestStacks(stackNames: string[]): AppResourceFlags;
13
+ /**
14
+ * Read infrastructure.ts content from an app path.
15
+ * Returns null if file doesn't exist or can't be read.
16
+ */
17
+ export declare function readInfrastructureContent(appPath: string): string | null;
22
18
  /**
23
19
  * Detect the application pattern (Payload, Next.js, or none) from infrastructure.ts.
24
20
  *
@@ -26,6 +22,9 @@ export declare function deriveResourcesFromManifestStacks(stackNames: string[]):
26
22
  * project files like package.json. This ensures accurate detection even
27
23
  * when multiple apps coexist in the same project directory.
28
24
  *
25
+ * @deprecated Use FrameworkRegistry.resolve() instead. This function is retained
26
+ * for backwards compatibility with consumers that have not yet migrated.
27
+ *
29
28
  * @param appPath - The fjall app path (e.g., "fjall/app8" or absolute path)
30
29
  */
31
30
  export declare function detectPattern(appPath: string): {
@@ -40,4 +39,3 @@ export declare function detectPayloadPattern(appPath: string): boolean;
40
39
  * Detect if infrastructure.ts contains a database resource.
41
40
  */
42
41
  export declare function detectDatabase(appPath: string): boolean;
43
- export {};