@fjall/deploy-core 0.94.0 → 0.95.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.
- package/dist/.minified +1 -1
- package/dist/src/aws/organisations/accounts.js +1 -99
- package/dist/src/aws/organisations/backup.js +1 -30
- package/dist/src/aws/organisations/costAllocation.js +1 -28
- package/dist/src/aws/organisations/delegatedAdmin.js +3 -43
- package/dist/src/aws/organisations/identityCentre.js +1 -23
- package/dist/src/aws/organisations/ipam.js +1 -20
- package/dist/src/aws/organisations/organisation.js +1 -103
- package/dist/src/aws/organisations/organisationalUnits.js +1 -239
- package/dist/src/aws/organisations/policies.js +1 -37
- package/dist/src/aws/organisations/ram.js +1 -19
- package/dist/src/aws/organisations/serviceAccess.js +1 -44
- package/dist/src/aws/organisations/trustedAccess.js +1 -19
- package/dist/src/aws/utils/regions.js +1 -1
- package/dist/src/index.js +1 -65
- package/dist/src/orchestration/__tests__/cascadeTestHelpers.js +1 -78
- package/dist/src/orchestration/activeDeploymentGuard.js +5 -39
- package/dist/src/orchestration/applicationDeploy.js +1 -149
- package/dist/src/orchestration/applicationDeployHelpers.js +4 -223
- package/dist/src/orchestration/applicationDestroy.js +1 -131
- package/dist/src/orchestration/builders/dockerBuilder.js +1 -98
- package/dist/src/orchestration/builders/openNextBuilder.js +1 -144
- package/dist/src/orchestration/cascadeHelpers.js +1 -160
- package/dist/src/orchestration/contextHelpers.js +1 -107
- package/dist/src/orchestration/deploy.js +1 -42
- package/dist/src/orchestration/destroy.js +1 -67
- package/dist/src/orchestration/detectionPipeline.js +1 -84
- package/dist/src/orchestration/dockerBuildHelper.js +1 -49
- package/dist/src/orchestration/dockerInterface.js +0 -1
- package/dist/src/orchestration/domainInterface.js +0 -1
- package/dist/src/orchestration/openNextBuild.js +3 -243
- package/dist/src/orchestration/organisationDeploy.js +3 -284
- package/dist/src/orchestration/organisationDestroy.js +3 -189
- package/dist/src/orchestration/organisationSetup.js +1 -247
- package/dist/src/orchestration/resolveOperation.js +1 -123
- package/dist/src/orchestration/welcomeImageHelper.js +1 -64
- package/dist/src/services/application/ApplicationStackService.js +1 -218
- package/dist/src/services/application/applicationStackHelpers.js +4 -248
- package/dist/src/services/infrastructure/CdkCommandRunner.js +2 -244
- package/dist/src/services/infrastructure/CdkOutputAnalyser.js +1 -125
- package/dist/src/services/infrastructure/CdkProcessManager.js +3 -278
- package/dist/src/services/infrastructure/CdkService.js +3 -213
- package/dist/src/services/infrastructure/CloudFormationService.js +1 -248
- package/dist/src/services/infrastructure/ICdkProcessManager.js +0 -1
- package/dist/src/services/supporting/CdkContextBuilder.js +1 -44
- package/dist/src/services/supporting/TemplateHashService.js +1 -152
- package/dist/src/steps/stepRegistry.js +1 -505
- package/dist/src/types/apiClient.js +0 -1
- package/dist/src/types/detection.js +0 -1
- package/dist/src/types/frameworkBuilder.js +0 -8
- package/dist/src/types/params.js +0 -1
- package/dist/src/types/patternDetection.js +1 -88
- package/dist/src/types/stepDefinitions.js +1 -98
- package/package.json +4 -4
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
package/dist/src/types/params.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,88 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Filesystem-based pattern detection functions.
|
|
3
|
-
*
|
|
4
|
-
* Pure types and predicates live in patternTypes.ts (browser-safe).
|
|
5
|
-
* This file contains only functions that require Node fs access.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, readFileSync } from "fs";
|
|
8
|
-
import { join } from "path";
|
|
9
|
-
import { logger } from "@fjall/util/logger";
|
|
10
|
-
import { getErrorMessage } from "@fjall/util";
|
|
11
|
-
import { APPLICATION_STACKS } from "./operations.js";
|
|
12
|
-
import { INFRASTRUCTURE_FILENAME } from "./constants.js";
|
|
13
|
-
export { OPENNEXT_PATTERNS, isOpenNextPattern } from "./patternTypes.js";
|
|
14
|
-
/** Derive resource flags from manifest stack names (authoritative, post-synth) */
|
|
15
|
-
export function deriveResourcesFromManifestStacks(stackNames) {
|
|
16
|
-
const has = (suffix) => stackNames.some((s) => s.endsWith(suffix));
|
|
17
|
-
return {
|
|
18
|
-
hasNetwork: has(APPLICATION_STACKS.NETWORK),
|
|
19
|
-
hasCompute: has(APPLICATION_STACKS.COMPUTE),
|
|
20
|
-
hasDatabase: has(APPLICATION_STACKS.DATABASE),
|
|
21
|
-
hasStorage: has(APPLICATION_STACKS.STORAGE),
|
|
22
|
-
hasMessaging: has(APPLICATION_STACKS.MESSAGING),
|
|
23
|
-
hasCdn: has(APPLICATION_STACKS.CDN)
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Read infrastructure.ts content from an app path.
|
|
28
|
-
* Returns null if file doesn't exist or can't be read.
|
|
29
|
-
*/
|
|
30
|
-
export function readInfrastructureContent(appPath) {
|
|
31
|
-
try {
|
|
32
|
-
const filePath = join(appPath, INFRASTRUCTURE_FILENAME);
|
|
33
|
-
if (!existsSync(filePath))
|
|
34
|
-
return null;
|
|
35
|
-
return readFileSync(filePath, "utf-8");
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
logger.debug("patternDetection", "Failed to read infrastructure file", {
|
|
39
|
-
appPath,
|
|
40
|
-
error: getErrorMessage(error)
|
|
41
|
-
});
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Detect the application pattern (Payload, Next.js, or none) from infrastructure.ts.
|
|
47
|
-
*
|
|
48
|
-
* Pattern detection is based on the IaC file (infrastructure.ts), NOT on
|
|
49
|
-
* project files like package.json. This ensures accurate detection even
|
|
50
|
-
* when multiple apps coexist in the same project directory.
|
|
51
|
-
*
|
|
52
|
-
* @deprecated Use FrameworkRegistry.resolve() instead. This function is retained
|
|
53
|
-
* for backwards compatibility with consumers that have not yet migrated.
|
|
54
|
-
*
|
|
55
|
-
* @param appPath - The fjall app path (e.g., "fjall/app8" or absolute path)
|
|
56
|
-
*/
|
|
57
|
-
export function detectPattern(appPath) {
|
|
58
|
-
const content = readInfrastructureContent(appPath);
|
|
59
|
-
if (!content) {
|
|
60
|
-
return { pattern: null, hasDatabase: false };
|
|
61
|
-
}
|
|
62
|
-
if (content.includes("PatternFactory")) {
|
|
63
|
-
if (content.includes('type: "payload"')) {
|
|
64
|
-
return { pattern: "payload", hasDatabase: true };
|
|
65
|
-
}
|
|
66
|
-
if (content.includes('type: "nextjs"')) {
|
|
67
|
-
const hasDatabase = content.includes("DatabaseFactory.build(") ||
|
|
68
|
-
content.includes("database:");
|
|
69
|
-
return { pattern: "nextjs", hasDatabase };
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const hasDatabase = content.includes("DatabaseFactory.build(");
|
|
73
|
-
return { pattern: null, hasDatabase };
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Detect if infrastructure.ts contains a Payload CMS pattern.
|
|
77
|
-
*/
|
|
78
|
-
export function detectPayloadPattern(appPath) {
|
|
79
|
-
const { pattern } = detectPattern(appPath);
|
|
80
|
-
return pattern === "payload";
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Detect if infrastructure.ts contains a database resource.
|
|
84
|
-
*/
|
|
85
|
-
export function detectDatabase(appPath) {
|
|
86
|
-
const { hasDatabase } = detectPattern(appPath);
|
|
87
|
-
return hasDatabase;
|
|
88
|
-
}
|
|
1
|
+
import{existsSync as o,readFileSync as i}from"fs";import{join as u}from"path";import{logger as c}from"@fjall/util/logger";import{getErrorMessage as l}from"@fjall/util";import{APPLICATION_STACKS as a}from"./operations.js";import{INFRASTRUCTURE_FILENAME as d}from"./constants.js";import{OPENNEXT_PATTERNS as x,isOpenNextPattern as P}from"./patternTypes.js";function E(e){const t=r=>e.some(n=>n.endsWith(r));return{hasNetwork:t(a.NETWORK),hasCompute:t(a.COMPUTE),hasDatabase:t(a.DATABASE),hasStorage:t(a.STORAGE),hasMessaging:t(a.MESSAGING),hasCdn:t(a.CDN)}}function f(e){try{const t=u(e,d);return o(t)?i(t,"utf-8"):null}catch(t){return c.debug("patternDetection","Failed to read infrastructure file",{appPath:e,error:l(t)}),null}}function s(e){const t=f(e);if(!t)return{pattern:null,hasDatabase:!1};if(t.includes("PatternFactory")){if(t.includes('type: "payload"'))return{pattern:"payload",hasDatabase:!0};if(t.includes('type: "nextjs"'))return{pattern:"nextjs",hasDatabase:t.includes("DatabaseFactory.build(")||t.includes("database:")}}return{pattern:null,hasDatabase:t.includes("DatabaseFactory.build(")}}function S(e){const{pattern:t}=s(e);return t==="payload"}function A(e){const{hasDatabase:t}=s(e);return t}export{x as OPENNEXT_PATTERNS,E as deriveResourcesFromManifestStacks,A as detectDatabase,s as detectPattern,S as detectPayloadPattern,P as isOpenNextPattern,f as readInfrastructureContent};
|
|
@@ -1,98 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Step IDs used throughout the deployment process.
|
|
3
|
-
* Centralised here to avoid magic strings and enable type safety.
|
|
4
|
-
*/
|
|
5
|
-
export const STEP_IDS = {
|
|
6
|
-
// Common steps
|
|
7
|
-
AUTH: "auth",
|
|
8
|
-
DETECT_CONFIG: "detect-config",
|
|
9
|
-
BOOTSTRAP: "bootstrap",
|
|
10
|
-
CFN_CHECK: "cfn-check",
|
|
11
|
-
DIFF: "diff",
|
|
12
|
-
DEPLOY: "deploy",
|
|
13
|
-
DESTROY: "destroy",
|
|
14
|
-
VERIFY: "verify",
|
|
15
|
-
// OpenNext steps
|
|
16
|
-
OPENNEXT_BUILD: "opennext-build",
|
|
17
|
-
CDK_SYNTH: "cdk-synth",
|
|
18
|
-
// Docker/ECS steps
|
|
19
|
-
DOCKER_OPERATIONS: "docker-operations",
|
|
20
|
-
ECR_INIT: "ecr-init",
|
|
21
|
-
DOCKER_DEPLOY: "docker-deploy",
|
|
22
|
-
TAG_ECR_IMAGES: "tag-ecr-images",
|
|
23
|
-
ECS_UPDATE: "ecs-update",
|
|
24
|
-
ECS_MONITOR: "ecs-monitor",
|
|
25
|
-
// Organisation-specific steps
|
|
26
|
-
ORG_SETUP: "org-setup",
|
|
27
|
-
ORG_ENSURE: "org-ensure",
|
|
28
|
-
ORG_POLICY_TYPES: "policy-types",
|
|
29
|
-
ORG_SERVICE_ACCESS: "service-access",
|
|
30
|
-
ORG_CREATE_ACCOUNTS: "create-accounts",
|
|
31
|
-
ORG_ENSURE_OUS: "ensure-ous",
|
|
32
|
-
ORG_PLACE_ACCOUNTS: "place-accounts",
|
|
33
|
-
IDENTITY_CENTRE: "identity-centre",
|
|
34
|
-
ORG_ACCOUNTS: "accounts",
|
|
35
|
-
ORG_COST_TAGS: "cost-tags",
|
|
36
|
-
ORG_PROFILES: "profiles",
|
|
37
|
-
/** Organisation-level prepare (synth + hash-compare). For infra, use PREPARE_ENVIRONMENT. */
|
|
38
|
-
PREPARE: "prepare",
|
|
39
|
-
// Infrastructure-level prepare (platform/account deploy)
|
|
40
|
-
PREPARE_ENVIRONMENT: "prepare-environment",
|
|
41
|
-
// Platform-specific steps
|
|
42
|
-
PLATFORM_ACCOUNT: "platform-account",
|
|
43
|
-
// Account-specific steps
|
|
44
|
-
ACCOUNT_CONTEXT: "account-context",
|
|
45
|
-
// Infrastructure lifecycle steps (platform/account deploy)
|
|
46
|
-
CONNECT: "connect",
|
|
47
|
-
MONITORING: "monitoring",
|
|
48
|
-
// Organisation deploy/destroy steps
|
|
49
|
-
ORG_DEPLOY: "organisation-deploy",
|
|
50
|
-
ORG_DESTROY: "organisation-destroy",
|
|
51
|
-
// Cascade steps
|
|
52
|
-
CASCADE_PLATFORM: "cascade-platform",
|
|
53
|
-
CASCADE_DOMAINS: "cascade-domains",
|
|
54
|
-
CASCADE_ACCOUNTS: "cascade-accounts",
|
|
55
|
-
// Infrastructure stack steps (deploy)
|
|
56
|
-
NETWORK: "network",
|
|
57
|
-
STORAGE: "storage",
|
|
58
|
-
MESSAGING: "messaging",
|
|
59
|
-
DATABASE: "database",
|
|
60
|
-
COMPUTE: "compute",
|
|
61
|
-
CDN: "cdn",
|
|
62
|
-
// Infrastructure stack steps (destroy)
|
|
63
|
-
NETWORK_DESTROY: "network-destroy",
|
|
64
|
-
STORAGE_DESTROY: "storage-destroy",
|
|
65
|
-
MESSAGING_DESTROY: "messaging-destroy",
|
|
66
|
-
DATABASE_DESTROY: "database-destroy",
|
|
67
|
-
COMPUTE_DESTROY: "compute-destroy",
|
|
68
|
-
CDN_DESTROY: "cdn-destroy"
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Human-readable step names paired with STEP_IDS.
|
|
72
|
-
* Extracted because these strings are used at 3+ call sites.
|
|
73
|
-
*/
|
|
74
|
-
export const STEP_NAMES = {
|
|
75
|
-
AUTH: "Authenticating with AWS",
|
|
76
|
-
PREPARE_DEPLOY: "Preparing deployment",
|
|
77
|
-
PREPARE_DESTROY: "Preparing destruction",
|
|
78
|
-
BOOTSTRAP: "Bootstrapping AWS environment",
|
|
79
|
-
CHECK_INFRA_STATE: "Checking infrastructure state"
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Canonical step names emitted by infrastructure deployments (platform/account).
|
|
83
|
-
* The webapp's onboarding timeline and deployment detail page import these
|
|
84
|
-
* directly, replacing the previous fragile string duplication.
|
|
85
|
-
*/
|
|
86
|
-
export const INFRASTRUCTURE_STEP_NAMES = [
|
|
87
|
-
"Connect securely",
|
|
88
|
-
"Prepare environment",
|
|
89
|
-
"Deploy infrastructure",
|
|
90
|
-
"Enable monitoring"
|
|
91
|
-
];
|
|
92
|
-
/** Named access for specific step names (avoids fragile positional indices) */
|
|
93
|
-
export const INFRA_STEP_NAME = {
|
|
94
|
-
CONNECT: INFRASTRUCTURE_STEP_NAMES[0],
|
|
95
|
-
PREPARE: INFRASTRUCTURE_STEP_NAMES[1],
|
|
96
|
-
DEPLOY: INFRASTRUCTURE_STEP_NAMES[2],
|
|
97
|
-
MONITORING: INFRASTRUCTURE_STEP_NAMES[3]
|
|
98
|
-
};
|
|
1
|
+
const E={AUTH:"auth",DETECT_CONFIG:"detect-config",BOOTSTRAP:"bootstrap",CFN_CHECK:"cfn-check",DIFF:"diff",DEPLOY:"deploy",DESTROY:"destroy",VERIFY:"verify",OPENNEXT_BUILD:"opennext-build",CDK_SYNTH:"cdk-synth",DOCKER_OPERATIONS:"docker-operations",ECR_INIT:"ecr-init",DOCKER_DEPLOY:"docker-deploy",TAG_ECR_IMAGES:"tag-ecr-images",ECS_UPDATE:"ecs-update",ECS_MONITOR:"ecs-monitor",ORG_SETUP:"org-setup",ORG_ENSURE:"org-ensure",ORG_POLICY_TYPES:"policy-types",ORG_SERVICE_ACCESS:"service-access",ORG_CREATE_ACCOUNTS:"create-accounts",ORG_ENSURE_OUS:"ensure-ous",ORG_PLACE_ACCOUNTS:"place-accounts",IDENTITY_CENTRE:"identity-centre",ORG_ACCOUNTS:"accounts",ORG_COST_TAGS:"cost-tags",ORG_PROFILES:"profiles",PREPARE:"prepare",PREPARE_ENVIRONMENT:"prepare-environment",PLATFORM_ACCOUNT:"platform-account",ACCOUNT_CONTEXT:"account-context",CONNECT:"connect",MONITORING:"monitoring",ORG_DEPLOY:"organisation-deploy",ORG_DESTROY:"organisation-destroy",CASCADE_PLATFORM:"cascade-platform",CASCADE_DOMAINS:"cascade-domains",CASCADE_ACCOUNTS:"cascade-accounts",NETWORK:"network",STORAGE:"storage",MESSAGING:"messaging",DATABASE:"database",COMPUTE:"compute",CDN:"cdn",NETWORK_DESTROY:"network-destroy",STORAGE_DESTROY:"storage-destroy",MESSAGING_DESTROY:"messaging-destroy",DATABASE_DESTROY:"database-destroy",COMPUTE_DESTROY:"compute-destroy",CDN_DESTROY:"cdn-destroy"},t={AUTH:"Authenticating with AWS",PREPARE_DEPLOY:"Preparing deployment",PREPARE_DESTROY:"Preparing destruction",BOOTSTRAP:"Bootstrapping AWS environment",CHECK_INFRA_STATE:"Checking infrastructure state"},e=["Connect securely","Prepare environment","Deploy infrastructure","Enable monitoring"],o={CONNECT:e[0],PREPARE:e[1],DEPLOY:e[2],MONITORING:e[3]};export{e as INFRASTRUCTURE_STEP_NAMES,o as INFRA_STEP_NAME,E as STEP_IDS,t as STEP_NAMES};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/deploy-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"description": "Shared deployment engine for Fjall — used by CLI and webapp worker",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"@aws-sdk/client-s3": "^3.1009.0",
|
|
73
73
|
"@aws-sdk/client-sso-admin": "^3.1009.0",
|
|
74
74
|
"@aws-sdk/client-sts": "^3.1009.0",
|
|
75
|
-
"@fjall/generator": "^0.
|
|
76
|
-
"@fjall/util": "^0.
|
|
75
|
+
"@fjall/generator": "^0.95.0",
|
|
76
|
+
"@fjall/util": "^0.95.0",
|
|
77
77
|
"@smithy/node-http-handler": "^4.5.0",
|
|
78
78
|
"zod": "^4.3.6"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"vitest": "^3.2.3"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "7fdbf0c5dd58088642c67d877e5e224831dfc149"
|
|
84
84
|
}
|