@aetherionfw/infra 1.1.0 → 1.1.1
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/README.md +45 -0
- package/dist/builder/FrameworkStack.d.ts +5 -0
- package/dist/builder/FrameworkStack.js +77 -1
- package/package.json +8 -2
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @aetherionfw/infra
|
|
2
|
+
|
|
3
|
+
> CDKTF (Cloud Development Kit for Terraform) builder for the Aetherion Serverless Framework.
|
|
4
|
+
|
|
5
|
+
Aetherion is a modern, TypeScript-first serverless framework designed to bring the developer experience of frameworks like NestJS to AWS serverless architectures.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This package is responsible for reading the metadata generated by your `@aetherionfw/core` decorators and automatically synthesizing the corresponding AWS infrastructure using Terraform (via CDKTF).
|
|
10
|
+
|
|
11
|
+
Features:
|
|
12
|
+
- Automatic **Lambda Function** provisioning (1:1 Architecture)
|
|
13
|
+
- Automatic **API Gateway** (HTTP/REST) wiring with resources, methods, and integrations
|
|
14
|
+
- **DynamoDB**, **RDS**, **S3**, **SQS**, **EventBridge**, and **KMS** integrations
|
|
15
|
+
- Automatic **IAM Permissions** resolution
|
|
16
|
+
- **VPC** configuration support
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @aetherionfw/infra cdktf constructs @cdktf/provider-aws
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
You rarely need to interact with this package manually. The Aetherion CLI handles the synthesis process for you. However, the entry point looks like this:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { App } from 'cdktf';
|
|
30
|
+
import { FrameworkStack } from '@aetherionfw/infra';
|
|
31
|
+
import '../src/app.module'; // Import your app module to register metadata
|
|
32
|
+
|
|
33
|
+
const app = new App();
|
|
34
|
+
// This automatically synthesizes all Lambdas, API Gateways, etc.
|
|
35
|
+
new FrameworkStack(app, 'aetherion-dev');
|
|
36
|
+
app.synth();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
For full documentation, visit [https://github.com/CrisD3v/Aetherion-framework](https://github.com/CrisD3v/Aetherion-framework).
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
2
|
import { TerraformStack } from 'cdktf';
|
|
3
3
|
export declare class FrameworkStack extends TerraformStack {
|
|
4
|
+
/**
|
|
5
|
+
* Resolves and loads `aetherion.config.ts` from the current working directory.
|
|
6
|
+
* Falls back to safe defaults if no config file is found.
|
|
7
|
+
*/
|
|
8
|
+
private static loadConfig;
|
|
4
9
|
/** All created Lambda functions indexed by their function name */
|
|
5
10
|
private lambdaFunctions;
|
|
6
11
|
/** All created Cognito User Pools indexed by their props.name */
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.FrameworkStack = void 0;
|
|
4
37
|
const cdktf_1 = require("cdktf");
|
|
@@ -31,15 +64,58 @@ const apigatewayv2_integration_1 = require("@cdktf/provider-aws/lib/apigatewayv2
|
|
|
31
64
|
const apigatewayv2_route_1 = require("@cdktf/provider-aws/lib/apigatewayv2-route");
|
|
32
65
|
const apigatewayv2_stage_1 = require("@cdktf/provider-aws/lib/apigatewayv2-stage");
|
|
33
66
|
const core_1 = require("@aetherionfw/core");
|
|
67
|
+
const path = __importStar(require("path"));
|
|
68
|
+
const fs = __importStar(require("fs"));
|
|
34
69
|
class FrameworkStack extends cdktf_1.TerraformStack {
|
|
70
|
+
/**
|
|
71
|
+
* Resolves and loads `aetherion.config.ts` from the current working directory.
|
|
72
|
+
* Falls back to safe defaults if no config file is found.
|
|
73
|
+
*/
|
|
74
|
+
static loadConfig() {
|
|
75
|
+
const configPath = path.resolve(process.cwd(), 'aetherion.config.ts');
|
|
76
|
+
const configJsPath = path.resolve(process.cwd(), 'aetherion.config.js');
|
|
77
|
+
let resolvedPath = null;
|
|
78
|
+
if (fs.existsSync(configPath))
|
|
79
|
+
resolvedPath = configPath;
|
|
80
|
+
else if (fs.existsSync(configJsPath))
|
|
81
|
+
resolvedPath = configJsPath;
|
|
82
|
+
if (!resolvedPath) {
|
|
83
|
+
console.warn('[Aetherion] No aetherion.config.ts found. Using default AWS provider settings.\n' +
|
|
84
|
+
' Run `aetherion init` to scaffold a config file, or create aetherion.config.ts manually.');
|
|
85
|
+
return {
|
|
86
|
+
accountId: process.env.AWS_ACCOUNT_ID ?? '',
|
|
87
|
+
region: process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? 'us-east-1',
|
|
88
|
+
profile: process.env.AWS_PROFILE,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
// Use require for .js, ts-node/register path for .ts
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
94
|
+
const mod = require(resolvedPath);
|
|
95
|
+
const config = mod.default ?? mod;
|
|
96
|
+
return {
|
|
97
|
+
accountId: process.env.AWS_ACCOUNT_ID ?? config.accountId,
|
|
98
|
+
region: process.env.AWS_REGION ?? config.region,
|
|
99
|
+
profile: process.env.AWS_PROFILE ?? config.profile,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.error(`[Aetherion] Failed to load aetherion.config.ts: ${err.message}`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
throw new Error('unreachable'); // satisfy TypeScript return type
|
|
106
|
+
}
|
|
107
|
+
}
|
|
35
108
|
/** All created Lambda functions indexed by their function name */
|
|
36
109
|
lambdaFunctions = new Map();
|
|
37
110
|
/** All created Cognito User Pools indexed by their props.name */
|
|
38
111
|
cognitoPools = new Map();
|
|
39
112
|
constructor(scope, id) {
|
|
40
113
|
super(scope, id);
|
|
114
|
+
const config = FrameworkStack.loadConfig();
|
|
41
115
|
new provider_1.AwsProvider(this, 'AWS', {
|
|
42
|
-
region:
|
|
116
|
+
region: config.region,
|
|
117
|
+
...(config.profile ? { profile: config.profile } : {}),
|
|
118
|
+
...(config.accountId ? { allowedAccountIds: [config.accountId] } : {}),
|
|
43
119
|
});
|
|
44
120
|
const registry = core_1.MetadataRegistry.getInstance();
|
|
45
121
|
// ────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aetherionfw/infra",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "CDKTF Builder for Aetherion Framework",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"cdktf": "^0.20.0",
|
|
8
8
|
"constructs": "^10.3.0",
|
|
9
9
|
"@cdktf/provider-aws": "^19.0.0",
|
|
10
|
-
"@aetherionfw/core": "1.1.
|
|
10
|
+
"@aetherionfw/core": "1.1.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@types/node": "^20.0.0",
|
|
13
14
|
"typescript": "^5.5.4"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
@@ -22,6 +23,11 @@
|
|
|
22
23
|
],
|
|
23
24
|
"author": "CrisD3v",
|
|
24
25
|
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/CrisD3v/Aetherion-framework.git",
|
|
29
|
+
"directory": "packages/infra"
|
|
30
|
+
},
|
|
25
31
|
"scripts": {
|
|
26
32
|
"build": "tsc",
|
|
27
33
|
"synth": "cdktf synth",
|