@venturekit/infra 0.0.0-dev.20260312012510 → 0.0.0-dev.20260329102450

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/cdk/index.js CHANGED
@@ -1,11 +1,7 @@
1
- "use strict";
2
1
  /**
3
2
  * CDK constructs for VentureKit infrastructure.
4
3
  *
5
4
  * Exported for use by the generated CDK app in .vk/cdk/.
6
5
  */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.VentureStack = void 0;
9
- var stack_js_1 = require("./stack.js");
10
- Object.defineProperty(exports, "VentureStack", { enumerable: true, get: function () { return stack_js_1.VentureStack; } });
6
+ export { VentureStack } from './stack.js';
11
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cdk/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uCAA0C;AAAjC,wGAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cdk/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -8,22 +8,154 @@
8
8
  */
9
9
  import * as cdk from 'aws-cdk-lib';
10
10
  import { Construct } from 'constructs';
11
- import type { VentureIntent } from '@venturekit/core';
11
+ import type { VentureIntent, EnvConfig } from '@venturekit/core';
12
12
  export interface VentureStackProps extends cdk.StackProps {
13
13
  projectName: string;
14
14
  stage: string;
15
15
  routesDir: string;
16
+ /** Directory containing standalone Lambda functions */
17
+ functionsDir?: string;
18
+ /** Directory containing queue consumer handlers */
19
+ queuesDir?: string;
20
+ /** Directory containing cron/scheduled task handlers */
21
+ cronsDir?: string;
16
22
  infrastructure?: VentureIntent;
17
23
  projectDir: string;
24
+ /** Preset name — when 'free', uses only free-tier AWS resources */
25
+ preset?: string;
26
+ /**
27
+ * Fully resolved environment configuration from presets + user overrides.
28
+ * When provided, all resource sizing is driven by this config.
29
+ * When absent, falls back to legacy behavior using `preset` string.
30
+ */
31
+ envConfig?: EnvConfig;
18
32
  }
19
33
  export declare class VentureStack extends cdk.Stack {
20
34
  readonly outputs: Record<string, cdk.CfnOutput>;
35
+ /** Resolved environment configuration driving all resource sizing */
36
+ private readonly envConfig;
37
+ /** Data safety configuration for removal policies */
38
+ private readonly dataSafetyConfig;
39
+ /** Whether this is a free-tier deployment */
40
+ private readonly isFreeTier;
41
+ /** Standard tags applied to all taggable resources */
42
+ private readonly standardTags;
21
43
  constructor(scope: Construct, id: string, props: VentureStackProps);
44
+ /**
45
+ * Well-Architected: Reliability — RDS with stable logical ID so preset
46
+ * changes (e.g. nano→medium) perform an in-place instance class modify,
47
+ * not a replacement. Data is preserved because the CloudFormation resource
48
+ * identity stays the same.
49
+ *
50
+ * Well-Architected: Security — encrypted at rest, credentials in Secrets Manager
51
+ * Well-Architected: Reliability — automated backups, optional multi-AZ
52
+ * Well-Architected: Performance — instance type driven by intent.size
53
+ * Well-Architected: Operational Excellence — auto minor version upgrades
54
+ */
22
55
  private createDatabase;
56
+ /**
57
+ * Well-Architected: Security — block public access by default, SSE encryption
58
+ * Well-Architected: Reliability — versioning for backups, dataSafety removal policy
59
+ * Well-Architected: Cost — lifecycle rules for logs/backups to reduce storage cost
60
+ * Well-Architected: Sustainability — intelligent tiering for infrequent access
61
+ */
23
62
  private createStorage;
63
+ /**
64
+ * Well-Architected: Security — Cognito with advanced security features,
65
+ * stable logical ID for safe preset upgrades.
66
+ * Well-Architected: Reliability — dataSafety-driven removal policy
67
+ */
24
68
  private createAuth;
69
+ /**
70
+ * Well-Architected: Reliability — DLQ by default, stable logical ID
71
+ * Well-Architected: Security — encryption at rest with SQS managed keys
72
+ * Well-Architected: Performance — visibility timeout derived from handler timeout
73
+ */
25
74
  private createQueue;
75
+ /**
76
+ * Well-Architected: Security — VPC-only access, SG least-privilege
77
+ * Well-Architected: Performance — cache node type driven by intent.size
78
+ * Well-Architected: Reliability — encrypted in transit, snapshot retention for prod
79
+ */
26
80
  private createCache;
81
+ private createMonitoring;
82
+ private createSecret;
83
+ private createDomain;
84
+ /**
85
+ * Free-tier alternative to RDS: create a DynamoDB table.
86
+ * DynamoDB offers 25 GB + 25 RCU/WCU in the always-free tier.
87
+ *
88
+ * Well-Architected: Security — encryption at rest (default)
89
+ * Well-Architected: Reliability — PITR for strict dataSafety
90
+ * Well-Architected: Cost — PAY_PER_REQUEST for unpredictable workloads
91
+ */
92
+ private createDynamoDBTable;
93
+ /**
94
+ * Free-tier rate limit table using DynamoDB (always-free tier).
95
+ * Used by createDefaultRateLimiter() from @venturekit/runtime.
96
+ */
97
+ private createRateLimitTable;
98
+ /**
99
+ * Map ResourceSize to RDS instance type.
100
+ * Uses Graviton (T4G) instances for cost efficiency.
101
+ * Changing size triggers an in-place modify, NOT a replacement.
102
+ */
27
103
  private sizeToInstanceType;
104
+ /**
105
+ * Map ResourceSize to ElastiCache node type.
106
+ * Uses Graviton (T4G) instances for cost efficiency.
107
+ * Changing size triggers an in-place modify, NOT a replacement.
108
+ */
109
+ private sizeToCacheNodeType;
110
+ /**
111
+ * Convert dataSafety config to CDK RemovalPolicy.
112
+ * Well-Architected: Reliability — prevent accidental data loss.
113
+ */
114
+ private toRemovalPolicy;
115
+ /**
116
+ * Convert days to CDK logs.RetentionDays enum.
117
+ * Well-Architected: Cost — don't over-retain logs.
118
+ */
119
+ private toLogRetention;
120
+ /**
121
+ * Resolve Lambda runtime from preset config.
122
+ */
123
+ private toLambdaRuntime;
124
+ /**
125
+ * Resolve Lambda architecture from preset config.
126
+ */
127
+ private toLambdaArchitecture;
128
+ /**
129
+ * Recursively discover function files under the functions directory.
130
+ * Returns an array of { name, handlerFile } where name is the
131
+ * dash-delimited path (e.g. `order/create-order.ts` → `order-create-order`).
132
+ */
133
+ private discoverFunctionFiles;
134
+ /**
135
+ * Create a standalone Lambda function.
136
+ * Naming convention: {project}-{stage}-fn-{name}
137
+ *
138
+ * Well-Architected: Performance — memory/timeout from preset config
139
+ * Well-Architected: Sustainability — ARM64 Graviton by default
140
+ * Well-Architected: Operational Excellence — structured env vars, log retention from preset
141
+ * Well-Architected: Security — X-Ray tracing from preset config
142
+ */
143
+ private createStandaloneFunction;
144
+ /**
145
+ * Create a queue consumer Lambda function wired to an SQS queue.
146
+ * Naming convention: {project}-{stage}-queue-{name}
147
+ *
148
+ * Well-Architected: Reliability — DLQ on consumer queue, encrypted
149
+ * Well-Architected: Performance — batch size and visibility timeout
150
+ */
151
+ private createQueueConsumer;
152
+ /**
153
+ * Create a cron/scheduled task Lambda function wired to an EventBridge rule.
154
+ * Naming convention: {project}-{stage}-cron-{name}
155
+ *
156
+ * Well-Architected: Performance — memory/timeout from preset
157
+ * Well-Architected: Operational Excellence — log retention, tracing from preset
158
+ */
159
+ private createCronHandler;
28
160
  }
29
161
  //# sourceMappingURL=stack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/cdk/stack.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAanC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,iBAAkB,SAAQ,GAAG,CAAC,UAAU;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,YAAa,SAAQ,GAAG,CAAC,KAAK;IACzC,SAAgB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAM;gBAEhD,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;I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