@worktif/runtime 0.3.0-edge.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/LICENSE +101 -0
- package/README.md +495 -0
- package/out/dist/bin/index.js +212 -0
- package/out/dist/bin/purenow.js +218 -0
- package/out/dist/bin/templates/runtime-web/cdk/.gitignore.template +25 -0
- package/out/dist/bin/templates/runtime-web/cdk/README.md.template +267 -0
- package/out/dist/bin/templates/runtime-web/cdk/bin/app.ts.template +173 -0
- package/out/dist/bin/templates/runtime-web/cdk/cdk.json.template +79 -0
- package/out/dist/bin/templates/runtime-web/cdk/package.json.template +28 -0
- package/out/dist/bin/templates/runtime-web/cdk/tsconfig.json.template +38 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/.env.example +15 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/README.md +118 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/gitignore.template +64 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/package.json +34 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/purenow.config.ts +105 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/app.tsx +35 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/handlers/users/index.ts +17 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/handlers/users/users.handlers.ts +222 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/index.tsx +71 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/pages/about-page.tsx +65 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/pages/home-page.tsx +55 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/pages/users-page.tsx +66 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/routes.tsx +61 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/services/index.ts +17 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/services/users.service.ts +133 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/ties/index.ts +17 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/src/ties/users.ties.ts +53 -0
- package/out/dist/bin/templates/runtime-web/purenow-basic/tsconfig.json +53 -0
- package/out/dist/lib/index.d.ts +4 -0
- package/out/dist/lib/index.js +4 -0
- package/out/dist/lib/lib/index.d.ts +3 -0
- package/out/dist/lib/lib/runtime-web/index.d.ts +17 -0
- package/out/dist/lib/lib/runtime-web/pipelines/browser-pipeline.d.ts +110 -0
- package/out/dist/lib/lib/runtime-web/pipelines/index.d.ts +2 -0
- package/out/dist/lib/lib/runtime-web/pureweb.d.ts +65 -0
- package/out/dist/lib/lib/runtime-web/types/config.types.d.ts +301 -0
- package/out/dist/lib/lib/runtime-web/types/http.types.d.ts +171 -0
- package/out/dist/lib/lib/runtime-web/types/index.d.ts +14 -0
- package/out/dist/lib/lib/runtime-web/types/infra.types.d.ts +225 -0
- package/out/dist/lib/lib/runtime-web/types/lambda.types.d.ts +175 -0
- package/out/dist/lib/lib/runtime-web/types/microservice.types.d.ts +70 -0
- package/out/dist/lib/lib/runtime-web/types/runtime.types.d.ts +55 -0
- package/out/dist/lib/utils/index.d.ts +2 -0
- package/out/dist/lib/utils/types/index.d.ts +3 -0
- package/out/dist/lib/utils/types/runtime.config.types.d.ts +71 -0
- package/out/dist/src/bin/index.d.ts +5 -0
- package/out/dist/src/bin/index.unix.d.ts +5 -0
- package/out/dist/src/bin/purenow-runtime-cli.d.ts +31 -0
- package/out/dist/src/bin/services/index.d.ts +8 -0
- package/out/dist/src/bin/services/purenow-runtime-deployment.strategy.d.ts +37 -0
- package/out/dist/src/bin/services/purenow-runtime-stacks-deploy.service.d.ts +58 -0
- package/out/dist/src/bin/services/purenow-runtime-stacks-deploy.service.types.d.ts +18 -0
- package/out/dist/src/bin/services/runtime-web-cli-extensions.d.ts +2 -0
- package/out/dist/src/bin/services/template.service.d.ts +53 -0
- package/out/dist/src/bin/services/utils/index.d.ts +2 -0
- package/out/dist/src/bin/utils/errors.d.ts +68 -0
- package/out/dist/src/lib/runtime-web/index.d.ts +17 -0
- package/out/dist/src/lib/runtime-web/pipelines/browser-pipeline.d.ts +110 -0
- package/out/dist/src/lib/runtime-web/pipelines/index.d.ts +2 -0
- package/out/dist/src/lib/runtime-web/pureweb.d.ts +65 -0
- package/out/dist/src/lib/runtime-web/types/config.types.d.ts +301 -0
- package/out/dist/src/lib/runtime-web/types/http.types.d.ts +171 -0
- package/out/dist/src/lib/runtime-web/types/index.d.ts +14 -0
- package/out/dist/src/lib/runtime-web/types/infra.types.d.ts +225 -0
- package/out/dist/src/lib/runtime-web/types/lambda.types.d.ts +175 -0
- package/out/dist/src/lib/runtime-web/types/microservice.types.d.ts +70 -0
- package/out/dist/src/lib/runtime-web/types/runtime.types.d.ts +55 -0
- package/package.json +133 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS environment configuration.
|
|
3
|
+
*/
|
|
4
|
+
export interface AwsEnvironment {
|
|
5
|
+
/** AWS account ID (12-digit string) */
|
|
6
|
+
account: string;
|
|
7
|
+
/** AWS region identifier (e.g., 'us-east-1', 'eu-west-1') */
|
|
8
|
+
region: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Custom domain configuration for API Gateway.
|
|
12
|
+
*/
|
|
13
|
+
export interface DomainConfig {
|
|
14
|
+
/** Root domain name (e.g., 'myapp.com') */
|
|
15
|
+
rootDomain: string;
|
|
16
|
+
/** Optional subdomain (e.g., 'api' for 'api.myapp.com') */
|
|
17
|
+
subdomain?: string;
|
|
18
|
+
/** ARN of the SSL certificate in AWS Certificate Manager */
|
|
19
|
+
certificateArn?: string;
|
|
20
|
+
/** Route 53 hosted zone ID for the domain */
|
|
21
|
+
hostedZoneId?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* VPC configuration for Lambda functions.
|
|
25
|
+
*/
|
|
26
|
+
export interface VpcConfig {
|
|
27
|
+
/** VPC ID where Lambda functions will be deployed */
|
|
28
|
+
vpcId: string;
|
|
29
|
+
/** Subnet IDs for Lambda function placement */
|
|
30
|
+
subnetIds: string[];
|
|
31
|
+
/** Security group IDs for Lambda functions */
|
|
32
|
+
securityGroupIds: string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Infrastructure configuration for CDK deployment.
|
|
36
|
+
*
|
|
37
|
+
* Contains only infrastructure-specific settings (AWS resources, networking, etc.).
|
|
38
|
+
* Does NOT contain runtime configuration like microservices - that belongs in PurenowConfig.register.
|
|
39
|
+
*
|
|
40
|
+
* This separation ensures:
|
|
41
|
+
* - Clean architecture boundaries (infra vs runtime)
|
|
42
|
+
* - Single source of truth (register is at runtime level)
|
|
43
|
+
* - Proper context isolation (infra only needed in CDK context)
|
|
44
|
+
*/
|
|
45
|
+
export interface InfraOptions {
|
|
46
|
+
/**
|
|
47
|
+
* AWS environment (account and region).
|
|
48
|
+
*
|
|
49
|
+
* **Required**: Must specify target AWS account and region for deployment.
|
|
50
|
+
* **Security**: Account ID prevents accidental cross-account deployments.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* env: {
|
|
55
|
+
* account: '123456789012',
|
|
56
|
+
* region: 'us-east-1'
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
env: AwsEnvironment;
|
|
61
|
+
/**
|
|
62
|
+
* Deployment stage for infrastructure resources.
|
|
63
|
+
*
|
|
64
|
+
* **Must match**: Should match the stage in PurenowConfig for consistency.
|
|
65
|
+
* **Resource naming**: Used in CloudFormation stack names and resource tags.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* stage: 'prod'
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
stage: 'dev' | 'staging' | 'prod';
|
|
73
|
+
/**
|
|
74
|
+
* Enable SEO metadata support.
|
|
75
|
+
*
|
|
76
|
+
* **Creates**: DynamoDB table for SEO metadata storage
|
|
77
|
+
* **Lambda**: Enables SEO Lambda function for metadata management
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
enableSeo?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Path to React application entry point.
|
|
84
|
+
*
|
|
85
|
+
* **Purpose**: Used to create the SSR Lambda that serves all React routes
|
|
86
|
+
* **Bundling**: Framework bundles this file with esbuild for Lambda deployment
|
|
87
|
+
* **Automatic**: SSR Lambda is created automatically, not in microservice register
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* reactEntry: './src/index.tsx'
|
|
92
|
+
* reactEntry: './app/main.tsx'
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
reactEntry: string;
|
|
96
|
+
/**
|
|
97
|
+
* API exposure mode.
|
|
98
|
+
*
|
|
99
|
+
* **apiGateway**: Use API Gateway with CloudFront integration (recommended)
|
|
100
|
+
* **lambdaUrl**: Use Lambda Function URLs (simpler, but less features)
|
|
101
|
+
*
|
|
102
|
+
* @default 'apiGateway'
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* apiMode: 'apiGateway' // Full API Gateway features
|
|
107
|
+
* apiMode: 'lambdaUrl' // Simple Lambda URLs
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
apiMode?: 'apiGateway' | 'lambdaUrl';
|
|
111
|
+
/**
|
|
112
|
+
* Custom domain configuration.
|
|
113
|
+
*
|
|
114
|
+
* **Optional**: If provided, sets up custom domain for API Gateway
|
|
115
|
+
* **Requirements**: SSL certificate must exist in ACM
|
|
116
|
+
* **DNS**: Route 53 hosted zone must be configured
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* domain: {
|
|
121
|
+
* rootDomain: 'myapp.com',
|
|
122
|
+
* subdomain: 'api', // Results in api.myapp.com
|
|
123
|
+
* certificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/...',
|
|
124
|
+
* hostedZoneId: 'Z1D633PJN98FT9'
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
domain?: DomainConfig;
|
|
129
|
+
/**
|
|
130
|
+
* Default memory allocation for Lambda functions (MB).
|
|
131
|
+
*
|
|
132
|
+
* **Range**: 128 - 10240 MB
|
|
133
|
+
* **Override**: Individual Lambdas can override via LambdaDefinition.config
|
|
134
|
+
* **Performance**: More memory = more CPU power and faster execution
|
|
135
|
+
*
|
|
136
|
+
* @default 512
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* lambdaMemorySize: 1024 // 1GB default memory
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
lambdaMemorySize?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Default timeout for Lambda functions (seconds).
|
|
146
|
+
*
|
|
147
|
+
* **Range**: 1 - 900 seconds (15 minutes)
|
|
148
|
+
* **Override**: Individual Lambdas can override via LambdaDefinition.config
|
|
149
|
+
* **API Gateway**: Limited to 29 seconds for HTTP endpoints
|
|
150
|
+
*
|
|
151
|
+
* @default 30
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* lambdaTimeout: 60 // 1 minute default timeout
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
lambdaTimeout?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Enable Lambda warmup to prevent cold starts.
|
|
161
|
+
*
|
|
162
|
+
* **Creates**: EventBridge rule that invokes Lambdas periodically
|
|
163
|
+
* **Cost**: Small additional cost for scheduled invocations
|
|
164
|
+
* **Performance**: Reduces cold start latency for critical functions
|
|
165
|
+
*
|
|
166
|
+
* @default false
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* enableWarmup: true // Enable for production workloads
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
enableWarmup?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Clear CloudFront cache on deployment.
|
|
176
|
+
*
|
|
177
|
+
* **Purpose**: Ensures users get updated static assets immediately
|
|
178
|
+
* **Cost**: Small charge per invalidation request
|
|
179
|
+
* **Recommended**: Enable for production deployments
|
|
180
|
+
*
|
|
181
|
+
* @default true
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* clearCacheOnDeploy: true // Invalidate cache after deploy
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
clearCacheOnDeploy?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Global environment variables for all Lambda functions.
|
|
191
|
+
*
|
|
192
|
+
* **Merged**: Combined with Lambda-specific environment variables
|
|
193
|
+
* **Precedence**: Lambda-specific variables override global ones
|
|
194
|
+
* **Security**: Avoid sensitive values, use AWS Secrets Manager instead
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* environment: {
|
|
199
|
+
* NODE_ENV: 'production',
|
|
200
|
+
* LOG_LEVEL: 'info',
|
|
201
|
+
* REGION: 'us-east-1'
|
|
202
|
+
* }
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
environment?: Record<string, string>;
|
|
206
|
+
/**
|
|
207
|
+
* VPC configuration for Lambda functions.
|
|
208
|
+
*
|
|
209
|
+
* **Optional**: If provided, deploys Lambdas inside VPC
|
|
210
|
+
* **Use cases**: Access to private RDS, ElastiCache, or internal services
|
|
211
|
+
* **Performance**: Adds cold start latency (~1-2 seconds)
|
|
212
|
+
* **NAT Gateway**: Required for internet access from private subnets
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* vpc: {
|
|
217
|
+
* vpcId: 'vpc-12345678',
|
|
218
|
+
* subnetIds: ['subnet-12345678', 'subnet-87654321'],
|
|
219
|
+
* securityGroupIds: ['sg-12345678']
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
vpc?: VpcConfig;
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=infra.types.d.ts.map
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { HttpIntegration } from './http.types';
|
|
2
|
+
/**
|
|
3
|
+
* Lambda handler factory function type.
|
|
4
|
+
*
|
|
5
|
+
* Receives injected dependencies and returns a Lambda handler function.
|
|
6
|
+
* Dependencies are automatically resolved from the microservice's PureContainer
|
|
7
|
+
* based on the class references in the ties array.
|
|
8
|
+
*
|
|
9
|
+
* @param deps - Object containing injected dependencies (camelCase keys)
|
|
10
|
+
* @returns Lambda handler function
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const chargeHandler: LambdaHandlerFactory = (deps) => {
|
|
15
|
+
* return async (event, context) => {
|
|
16
|
+
* // deps.paymentsService is automatically injected
|
|
17
|
+
* return await deps.paymentsService.processCharge(event.body);
|
|
18
|
+
* };
|
|
19
|
+
* };
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export type LambdaHandlerFactory = (deps: Record<string, unknown>) => (event: unknown, context: unknown) => Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Lambda-specific configuration overrides.
|
|
25
|
+
*
|
|
26
|
+
* Allows overriding global Lambda settings for specific functions.
|
|
27
|
+
* All properties are optional and will fall back to global defaults.
|
|
28
|
+
*/
|
|
29
|
+
export interface LambdaConfig {
|
|
30
|
+
/**
|
|
31
|
+
* Memory allocation for this Lambda function (MB).
|
|
32
|
+
*
|
|
33
|
+
* **Range**: 128 - 10240 MB
|
|
34
|
+
* **Default**: Uses global lambdaMemorySize from InfraOptions
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* memorySize: 1024 // 1GB memory
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
memorySize?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Timeout for this Lambda function (seconds).
|
|
44
|
+
*
|
|
45
|
+
* **Range**: 1 - 900 seconds (15 minutes)
|
|
46
|
+
* **Default**: Uses global lambdaTimeout from InfraOptions
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* timeout: 30 // 30 second timeout
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
timeout?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Additional environment variables for this Lambda function.
|
|
56
|
+
*
|
|
57
|
+
* Merged with global environment variables from InfraOptions.
|
|
58
|
+
* Lambda-specific variables take precedence over global ones.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* environment: {
|
|
63
|
+
* PAYMENT_PROVIDER: 'stripe',
|
|
64
|
+
* MAX_RETRY_ATTEMPTS: '3'
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
environment?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Lambda endpoint definition with dependency injection.
|
|
72
|
+
*
|
|
73
|
+
* Declaratively defines a Lambda function with its dependencies, business logic,
|
|
74
|
+
* and optional HTTP integration. The framework automatically creates the Lambda
|
|
75
|
+
* function, injects dependencies, and sets up API Gateway routes.
|
|
76
|
+
*/
|
|
77
|
+
export interface LambdaDefinition {
|
|
78
|
+
/**
|
|
79
|
+
* Lambda identifier within the microservice.
|
|
80
|
+
*
|
|
81
|
+
* **Optional**: If omitted, automatically generated from handler function name.
|
|
82
|
+
* **Final ID**: Combined with service name as `{serviceName}.{id}`
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* id: 'charge' // Results in 'payments.charge' if service is 'payments'
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
id?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Service name (auto-set by framework).
|
|
92
|
+
*
|
|
93
|
+
* **Internal**: Automatically populated by the framework during registration.
|
|
94
|
+
* **Do not set manually**.
|
|
95
|
+
*/
|
|
96
|
+
service?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Array of class constructors for dependency injection.
|
|
99
|
+
*
|
|
100
|
+
* Classes are automatically resolved from the microservice's PureContainer
|
|
101
|
+
* using their class names as keys. Dependencies are injected into the handler
|
|
102
|
+
* with camelCase property names.
|
|
103
|
+
*
|
|
104
|
+
* **Key Generation**: Automatic via Class.name (no magic strings)
|
|
105
|
+
* **Property Names**: ClassName → camelCase (PaymentsService → paymentsService)
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* ties: [PaymentsService, BillingService, ConfigService]
|
|
110
|
+
* // Results in: { paymentsService, billingService, configService }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
ties: Array<new (...args: unknown[]) => unknown>;
|
|
114
|
+
/**
|
|
115
|
+
* Lambda handler factory function.
|
|
116
|
+
*
|
|
117
|
+
* Receives injected dependencies and returns the actual Lambda handler.
|
|
118
|
+
* The framework calls this function with resolved dependencies from the
|
|
119
|
+
* microservice's PureContainer.
|
|
120
|
+
*
|
|
121
|
+
* @see {@link LambdaHandlerFactory}
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* handler: (deps) => async (event, context) => {
|
|
126
|
+
* const result = await deps.paymentsService.processPayment(event.body);
|
|
127
|
+
* return {
|
|
128
|
+
* statusCode: 200,
|
|
129
|
+
* body: JSON.stringify(result)
|
|
130
|
+
* };
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
handler: LambdaHandlerFactory;
|
|
135
|
+
/**
|
|
136
|
+
* HTTP integration configuration.
|
|
137
|
+
*
|
|
138
|
+
* **Optional**: If provided, creates an API Gateway route for this Lambda.
|
|
139
|
+
* If omitted, Lambda can only be invoked directly or via other AWS services.
|
|
140
|
+
*
|
|
141
|
+
* @see {@link HttpIntegration}
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* http: {
|
|
146
|
+
* method: 'POST',
|
|
147
|
+
* path: '/api/payments/charge',
|
|
148
|
+
* auth: 'jwt',
|
|
149
|
+
* cors: true
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
http?: HttpIntegration;
|
|
154
|
+
/**
|
|
155
|
+
* Lambda-specific configuration overrides.
|
|
156
|
+
*
|
|
157
|
+
* **Optional**: Overrides global Lambda settings for this specific function.
|
|
158
|
+
* Useful for functions with special requirements (more memory, longer timeout, etc.).
|
|
159
|
+
*
|
|
160
|
+
* @see {@link LambdaConfig}
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* config: {
|
|
165
|
+
* memorySize: 2048, // 2GB for heavy processing
|
|
166
|
+
* timeout: 300, // 5 minutes for long operations
|
|
167
|
+
* environment: {
|
|
168
|
+
* SPECIAL_CONFIG: 'value'
|
|
169
|
+
* }
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
config?: LambdaConfig;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=lambda.types.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { LambdaDefinition } from './lambda.types';
|
|
2
|
+
/**
|
|
3
|
+
* Type for Ties class constructors.
|
|
4
|
+
*
|
|
5
|
+
* Ties classes implement the register(container) pattern for dependency injection.
|
|
6
|
+
* They use PureContainer from @worktif/utils to register services.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of the Ties class instance
|
|
9
|
+
*/
|
|
10
|
+
export type TiesInstance<T = unknown> = new (...args: unknown[]) => T;
|
|
11
|
+
/**
|
|
12
|
+
* Microservice definition containing DI configuration and Lambda endpoints.
|
|
13
|
+
*
|
|
14
|
+
* A microservice is a logical grouping of related Lambda functions that share
|
|
15
|
+
* a common PureContainer instance for dependency injection.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const paymentsService: MicroserviceDefinition = {
|
|
20
|
+
* ties: [PaymentsTies, BillingTies],
|
|
21
|
+
* lambdas: [chargeHandler, refundHandler, webhookHandler]
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface MicroserviceDefinition {
|
|
26
|
+
/**
|
|
27
|
+
* Array of Ties class constructors for dependency injection.
|
|
28
|
+
*
|
|
29
|
+
* Each Ties class must implement a register(container: PureContainer<string>) method
|
|
30
|
+
* that registers services using container.tie(), container.tieConst(), or container.tieSingleton().
|
|
31
|
+
*
|
|
32
|
+
* The framework automatically creates a PureContainer instance for each microservice
|
|
33
|
+
* and calls register() on each Ties class to build the DI container.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* ties: [PaymentsTies, BillingTies, ConfigTies]
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
ties: TiesInstance[];
|
|
41
|
+
/**
|
|
42
|
+
* Array of Lambda endpoint definitions.
|
|
43
|
+
*
|
|
44
|
+
* Each Lambda definition describes a single Lambda function with its dependencies,
|
|
45
|
+
* handler logic, and optional HTTP integration.
|
|
46
|
+
*
|
|
47
|
+
* The framework automatically creates Lambda functions from these definitions
|
|
48
|
+
* and injects dependencies from the microservice's PureContainer.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* lambdas: [
|
|
53
|
+
* {
|
|
54
|
+
* id: 'charge',
|
|
55
|
+
* ties: [PaymentsService, BillingService],
|
|
56
|
+
* handler: (deps) => async (event, context) => {
|
|
57
|
+
* return await deps.paymentsService.processCharge(event.body);
|
|
58
|
+
* },
|
|
59
|
+
* http: {
|
|
60
|
+
* method: 'POST',
|
|
61
|
+
* path: '/api/payments/charge',
|
|
62
|
+
* auth: 'jwt'
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* ]
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
lambdas: LambdaDefinition[];
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=microservice.types.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser environment metadata.
|
|
3
|
+
*/
|
|
4
|
+
export interface BrowserMetadata {
|
|
5
|
+
/** User agent string */
|
|
6
|
+
userAgent: string;
|
|
7
|
+
/** Current URL */
|
|
8
|
+
url: string;
|
|
9
|
+
/** Viewport dimensions */
|
|
10
|
+
viewport: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Lambda environment metadata.
|
|
17
|
+
*/
|
|
18
|
+
export interface LambdaMetadata {
|
|
19
|
+
/** Lambda function name */
|
|
20
|
+
functionName: string;
|
|
21
|
+
/** Function version */
|
|
22
|
+
version: string;
|
|
23
|
+
/** AWS region */
|
|
24
|
+
region: string;
|
|
25
|
+
/** Memory limit (MB) */
|
|
26
|
+
memoryLimit: number;
|
|
27
|
+
/** Request ID */
|
|
28
|
+
requestId?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* CDK environment metadata.
|
|
32
|
+
*/
|
|
33
|
+
export interface CDKMetadata {
|
|
34
|
+
/** AWS account ID */
|
|
35
|
+
account: string;
|
|
36
|
+
/** AWS region */
|
|
37
|
+
region: string;
|
|
38
|
+
/** CDK version */
|
|
39
|
+
cdkVersion?: string;
|
|
40
|
+
/** Node.js version */
|
|
41
|
+
nodeVersion: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Runtime environment context.
|
|
45
|
+
*
|
|
46
|
+
* Contains the detected environment type and relevant metadata.
|
|
47
|
+
* Used by the framework to route execution to the appropriate pipeline.
|
|
48
|
+
*/
|
|
49
|
+
export interface EnvironmentContext {
|
|
50
|
+
/** Detected environment type */
|
|
51
|
+
type: 'browser' | 'lambda' | 'cdk';
|
|
52
|
+
/** Environment-specific metadata */
|
|
53
|
+
metadata: BrowserMetadata | LambdaMetadata | CDKMetadata;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=runtime.types.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { PurenowConfig } from '@worktif/purenow';
|
|
2
|
+
/**
|
|
3
|
+
* Runtime-specific configuration that extends PurenowConfig.
|
|
4
|
+
*
|
|
5
|
+
* This interface adds runtime workspace functionality while preserving
|
|
6
|
+
* all existing purenow configuration options. The runtime configuration
|
|
7
|
+
* is merged with purenow configuration rather than replacing it.
|
|
8
|
+
*/
|
|
9
|
+
export interface RuntimeConfig extends PurenowConfig {
|
|
10
|
+
/**
|
|
11
|
+
* Runtime-specific configuration options.
|
|
12
|
+
* These settings extend purenow functionality without replacing it.
|
|
13
|
+
*/
|
|
14
|
+
runtime?: {
|
|
15
|
+
/** Enable Runtime Core stack deployment (extends purenow's two-stack architecture) */
|
|
16
|
+
enableThirdStack?: boolean;
|
|
17
|
+
/** Runtime web mode configuration */
|
|
18
|
+
runtimeWebMode?: 'development' | 'production';
|
|
19
|
+
/** Additional runtime features to enable */
|
|
20
|
+
additionalFeatures?: string[];
|
|
21
|
+
/** Development server enhancements */
|
|
22
|
+
devServerEnhancements?: {
|
|
23
|
+
/** Enable hot module replacement */
|
|
24
|
+
hotReload?: boolean;
|
|
25
|
+
/** Enable debug mode with additional logging */
|
|
26
|
+
debugMode?: boolean;
|
|
27
|
+
/** Enable performance monitoring */
|
|
28
|
+
performanceMonitoring?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Build optimizations */
|
|
31
|
+
buildOptimizations?: {
|
|
32
|
+
/** Enable bundle analysis */
|
|
33
|
+
bundleAnalysis?: boolean;
|
|
34
|
+
/** Enable tree shaking */
|
|
35
|
+
treeshaking?: boolean;
|
|
36
|
+
/** Enable code minification */
|
|
37
|
+
codeMinification?: boolean;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Configuration merging utility that preserves all purenow settings
|
|
43
|
+
* while adding runtime-specific extensions.
|
|
44
|
+
*
|
|
45
|
+
* @param purenowConfig - Base purenow configuration
|
|
46
|
+
* @param runtimeConfig - Runtime-specific configuration to merge
|
|
47
|
+
* @returns Merged configuration with all purenow settings preserved
|
|
48
|
+
*/
|
|
49
|
+
export declare function mergeRuntimeConfig(purenowConfig: PurenowConfig, runtimeConfig?: Partial<RuntimeConfig['runtime']>): RuntimeConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Type guard to check if a configuration is a RuntimeConfig.
|
|
52
|
+
*
|
|
53
|
+
* @param config - Configuration to check
|
|
54
|
+
* @returns True if the configuration has runtime-specific properties
|
|
55
|
+
*/
|
|
56
|
+
export declare function isRuntimeConfig(config: any): config is RuntimeConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Extract runtime-specific configuration from a RuntimeConfig.
|
|
59
|
+
*
|
|
60
|
+
* @param config - RuntimeConfig to extract from
|
|
61
|
+
* @returns Runtime-specific configuration or undefined
|
|
62
|
+
*/
|
|
63
|
+
export declare function extractRuntimeConfig(config: RuntimeConfig): RuntimeConfig['runtime'];
|
|
64
|
+
/**
|
|
65
|
+
* Create a RuntimeConfig from a base PurenowConfig with default runtime settings.
|
|
66
|
+
*
|
|
67
|
+
* @param purenowConfig - Base purenow configuration
|
|
68
|
+
* @returns RuntimeConfig with default runtime settings
|
|
69
|
+
*/
|
|
70
|
+
export declare function createRuntimeConfig(purenowConfig: PurenowConfig): RuntimeConfig;
|
|
71
|
+
//# sourceMappingURL=runtime.config.types.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export { PurenowRuntimeCli } from './purenow-runtime-cli';
|
|
3
|
+
export { TemplateService as RuntimeTemplateService, ScaffoldOptions as RuntimeScaffoldOptions, TemplateContext as RuntimeTemplateContext, PurenowRuntimeStacksDeployService, RuntimeDeploymentStrategy, buildStaticHtml, PurenowRuntimeCliContext, PurenowRuntimeDeploymentOutputs, PurenowRuntimeStacksDeployResult, } from './services';
|
|
4
|
+
export * from './purenow-runtime-cli';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import { GlobalOptions, PurenowCli, PurenowCliContext } from '@worktif/purenow/bin';
|
|
4
|
+
import { PurenowRuntimeCliContext } from './services';
|
|
5
|
+
/**
|
|
6
|
+
* Runtime CLI that properly extends PurenowCli using the extensible architecture
|
|
7
|
+
*
|
|
8
|
+
* This implementation uses purenow's ExtensibleCliCore.addCommands() and addActions()
|
|
9
|
+
* to add runtime-specific functionality while preserving all existing purenow commands.
|
|
10
|
+
*/
|
|
11
|
+
export declare class PurenowRuntimeCli extends PurenowCli {
|
|
12
|
+
static defaultToolName: string;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Create Purenow-specific context with all required services
|
|
16
|
+
*/
|
|
17
|
+
protected createContext<T extends PurenowCliContext = PurenowRuntimeCliContext>(globalOpts: GlobalOptions, cwd?: string): Promise<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Run the CLI with provided arguments
|
|
20
|
+
*/
|
|
21
|
+
run(args?: string[]): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Handle errors with structured logging (no emoji)
|
|
24
|
+
*/
|
|
25
|
+
static handleError(error: unknown): never;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create CLI instance that properly extends purenow
|
|
29
|
+
*/
|
|
30
|
+
export declare function createRuntimeCli(): PurenowRuntimeCli;
|
|
31
|
+
//# sourceMappingURL=purenow-runtime-cli.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './template.service';
|
|
2
|
+
export * from './purenow-runtime-stacks-deploy.service';
|
|
3
|
+
export * from './purenow-runtime-deployment.strategy';
|
|
4
|
+
export * from './purenow-runtime-stacks-deploy.service';
|
|
5
|
+
export * from './purenow-runtime-stacks-deploy.service.types';
|
|
6
|
+
export * from './runtime-web-cli-extensions';
|
|
7
|
+
export * from './utils';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|