@guren/plugin-lambda 0.2.0 → 0.2.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/dist/build-56qBHosh.js +221 -0
- package/dist/cdk/index.d.ts +56 -56
- package/dist/cdk/index.js +164 -178
- package/dist/commands.d.ts +21 -22
- package/dist/commands.js +36 -45
- package/dist/handlers-CkWGWQQX.js +19 -0
- package/dist/index.d.ts +38 -37
- package/dist/index.js +17 -22
- package/package.json +5 -5
- package/dist/chunk-K64F77DP.js +0 -12
- package/dist/chunk-OTE5NGTW.js +0 -262
package/dist/cdk/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
5
|
-
// src/cdk/index.ts
|
|
6
|
-
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
7
|
-
import { resolve } from "path";
|
|
1
|
+
import { r as lambdaHandlerId } from "../handlers-CkWGWQQX.js";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
8
4
|
import { CfnOutput, Duration } from "aws-cdk-lib";
|
|
9
5
|
import * as apigwv2 from "aws-cdk-lib/aws-apigatewayv2";
|
|
10
6
|
import { HttpLambdaIntegration } from "aws-cdk-lib/aws-apigatewayv2-integrations";
|
|
@@ -19,180 +15,170 @@ import * as s3 from "aws-cdk-lib/aws-s3";
|
|
|
19
15
|
import * as s3deploy from "aws-cdk-lib/aws-s3-deployment";
|
|
20
16
|
import * as sqs from "aws-cdk-lib/aws-sqs";
|
|
21
17
|
import { Construct } from "constructs";
|
|
18
|
+
//#region src/cdk/index.ts
|
|
19
|
+
/**
|
|
20
|
+
* The full serverless topology for a Guren app in one construct: an HTTP API
|
|
21
|
+
* in front of the `http` handler, and opt-in SQS/EventBridge/console wiring
|
|
22
|
+
* plus CloudFront + S3 for static assets. Handler names follow the module
|
|
23
|
+
* `guren lambda:build` emits (`handler.http`, `handler.queue`, ...).
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* new GurenLambdaApp(this, 'App', {
|
|
28
|
+
* functionDir: '../.lambda/function',
|
|
29
|
+
* assets: { dir: '../.lambda/assets' },
|
|
30
|
+
* queue: {},
|
|
31
|
+
* environment: { DATABASE_NAME: 'appdb', DATABASE_RESOURCE_ARN: '...', DATABASE_SECRET_ARN: '...' },
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
22
35
|
var GurenLambdaApp = class extends Construct {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
|
|
153
|
-
// Every page render is dynamic; assets carry the cacheable content.
|
|
154
|
-
cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,
|
|
155
|
-
// Forward cookies/query/headers, but not Host — API Gateway routes
|
|
156
|
-
// by its own hostname.
|
|
157
|
-
originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER
|
|
158
|
-
},
|
|
159
|
-
additionalBehaviors
|
|
160
|
-
});
|
|
161
|
-
new s3deploy.BucketDeployment(this, "AssetsDeployment", {
|
|
162
|
-
sources: [s3deploy.Source.asset(props.assets.dir)],
|
|
163
|
-
destinationBucket: this.assetsBucket,
|
|
164
|
-
// Invalidate on deploy: the /public/assets mirror and root-level
|
|
165
|
-
// files are not content-hashed, and CACHING_OPTIMIZED holds them
|
|
166
|
-
// for up to 24h otherwise.
|
|
167
|
-
distribution: this.distribution,
|
|
168
|
-
distributionPaths: ["/*"]
|
|
169
|
-
});
|
|
170
|
-
new CfnOutput(this, "DistributionUrl", { value: `https://${this.distribution.distributionDomainName}` });
|
|
171
|
-
}
|
|
172
|
-
new CfnOutput(this, "ApiUrl", { value: this.httpApi.apiEndpoint });
|
|
173
|
-
}
|
|
36
|
+
httpFunction;
|
|
37
|
+
httpApi;
|
|
38
|
+
queue;
|
|
39
|
+
deadLetterQueue;
|
|
40
|
+
queueFunction;
|
|
41
|
+
scheduleFunction;
|
|
42
|
+
consoleFunction;
|
|
43
|
+
assetsBucket;
|
|
44
|
+
distribution;
|
|
45
|
+
constructor(scope, id, props) {
|
|
46
|
+
super(scope, id);
|
|
47
|
+
const functionDefaults = {
|
|
48
|
+
code: lambda.Code.fromAsset(props.functionDir),
|
|
49
|
+
runtime: props.runtime ?? lambda.Runtime.NODEJS_22_X,
|
|
50
|
+
memorySize: props.memorySize ?? 512,
|
|
51
|
+
environment: {
|
|
52
|
+
NODE_ENV: "production",
|
|
53
|
+
...dataApiEnvironment(props.dataApi),
|
|
54
|
+
...readBuildEnvironment(props.functionDir),
|
|
55
|
+
...props.environment
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.httpFunction = new lambda.Function(this, "Http", {
|
|
59
|
+
...functionDefaults,
|
|
60
|
+
handler: lambdaHandlerId("http"),
|
|
61
|
+
timeout: props.timeout ?? Duration.seconds(30)
|
|
62
|
+
});
|
|
63
|
+
this.httpApi = new apigwv2.HttpApi(this, "Api", { defaultIntegration: new HttpLambdaIntegration("HttpIntegration", this.httpFunction) });
|
|
64
|
+
if (props.queue) {
|
|
65
|
+
const workerTimeout = props.queue.timeout ?? Duration.seconds(60);
|
|
66
|
+
this.deadLetterQueue = new sqs.Queue(this, "JobDeadLetterQueue");
|
|
67
|
+
this.queue = new sqs.Queue(this, "JobQueue", {
|
|
68
|
+
visibilityTimeout: Duration.seconds(workerTimeout.toSeconds() * 6),
|
|
69
|
+
deadLetterQueue: {
|
|
70
|
+
queue: this.deadLetterQueue,
|
|
71
|
+
maxReceiveCount: props.queue.maxReceiveCount ?? 3
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
this.queueFunction = new lambda.Function(this, "QueueWorker", {
|
|
75
|
+
...functionDefaults,
|
|
76
|
+
handler: lambdaHandlerId("queue"),
|
|
77
|
+
timeout: workerTimeout
|
|
78
|
+
});
|
|
79
|
+
this.queueFunction.addEventSource(new SqsEventSource(this.queue, {
|
|
80
|
+
batchSize: props.queue.batchSize ?? 10,
|
|
81
|
+
reportBatchItemFailures: true
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
if (props.schedule) {
|
|
85
|
+
this.scheduleFunction = new lambda.Function(this, "Scheduler", {
|
|
86
|
+
...functionDefaults,
|
|
87
|
+
handler: lambdaHandlerId("schedule"),
|
|
88
|
+
timeout: Duration.seconds(60)
|
|
89
|
+
});
|
|
90
|
+
new events.Rule(this, "ScheduleRule", {
|
|
91
|
+
schedule: events.Schedule.rate(props.schedule.rate ?? Duration.minutes(1)),
|
|
92
|
+
targets: [new targets.LambdaFunction(this.scheduleFunction)]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (props.console) this.consoleFunction = new lambda.Function(this, "Console", {
|
|
96
|
+
...functionDefaults,
|
|
97
|
+
handler: lambdaHandlerId("console"),
|
|
98
|
+
timeout: Duration.minutes(5)
|
|
99
|
+
});
|
|
100
|
+
const functions = [
|
|
101
|
+
this.httpFunction,
|
|
102
|
+
this.queueFunction,
|
|
103
|
+
this.scheduleFunction,
|
|
104
|
+
this.consoleFunction
|
|
105
|
+
].filter((fn) => fn !== void 0);
|
|
106
|
+
if (this.queue) for (const fn of functions) {
|
|
107
|
+
fn.addEnvironment("SQS_QUEUE_URL", this.queue.queueUrl);
|
|
108
|
+
this.queue.grantSendMessages(fn);
|
|
109
|
+
}
|
|
110
|
+
if (props.dataApi) for (const fn of functions) {
|
|
111
|
+
fn.addToRolePolicy(new iam.PolicyStatement({
|
|
112
|
+
actions: [
|
|
113
|
+
"rds-data:ExecuteStatement",
|
|
114
|
+
"rds-data:BatchExecuteStatement",
|
|
115
|
+
"rds-data:BeginTransaction",
|
|
116
|
+
"rds-data:CommitTransaction",
|
|
117
|
+
"rds-data:RollbackTransaction"
|
|
118
|
+
],
|
|
119
|
+
resources: [props.dataApi.resourceArn]
|
|
120
|
+
}));
|
|
121
|
+
fn.addToRolePolicy(new iam.PolicyStatement({
|
|
122
|
+
actions: ["secretsmanager:GetSecretValue"],
|
|
123
|
+
resources: [props.dataApi.secretArn]
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
if (props.assets) {
|
|
127
|
+
this.assetsBucket = new s3.Bucket(this, "Assets", {
|
|
128
|
+
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
|
|
129
|
+
enforceSSL: true
|
|
130
|
+
});
|
|
131
|
+
const apiDomain = `${this.httpApi.apiId}.execute-api.${this.httpApi.stack.region}.${this.httpApi.stack.urlSuffix}`;
|
|
132
|
+
const assetBehavior = {
|
|
133
|
+
origin: origins.S3BucketOrigin.withOriginAccessControl(this.assetsBucket),
|
|
134
|
+
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
135
|
+
cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED
|
|
136
|
+
};
|
|
137
|
+
const additionalBehaviors = {
|
|
138
|
+
"/assets/*": assetBehavior,
|
|
139
|
+
"/public/*": assetBehavior
|
|
140
|
+
};
|
|
141
|
+
if (existsSync(props.assets.dir)) for (const entry of readdirSync(props.assets.dir, { withFileTypes: true })) {
|
|
142
|
+
if (entry.name === "assets" || entry.name === "public") continue;
|
|
143
|
+
additionalBehaviors[entry.isDirectory() ? `/${entry.name}/*` : `/${entry.name}`] = assetBehavior;
|
|
144
|
+
}
|
|
145
|
+
this.distribution = new cloudfront.Distribution(this, "Distribution", {
|
|
146
|
+
defaultBehavior: {
|
|
147
|
+
origin: new origins.HttpOrigin(apiDomain),
|
|
148
|
+
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
149
|
+
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
|
|
150
|
+
cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,
|
|
151
|
+
originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER
|
|
152
|
+
},
|
|
153
|
+
additionalBehaviors
|
|
154
|
+
});
|
|
155
|
+
new s3deploy.BucketDeployment(this, "AssetsDeployment", {
|
|
156
|
+
sources: [s3deploy.Source.asset(props.assets.dir)],
|
|
157
|
+
destinationBucket: this.assetsBucket,
|
|
158
|
+
distribution: this.distribution,
|
|
159
|
+
distributionPaths: ["/*"]
|
|
160
|
+
});
|
|
161
|
+
new CfnOutput(this, "DistributionUrl", { value: `https://${this.distribution.distributionDomainName}` });
|
|
162
|
+
}
|
|
163
|
+
new CfnOutput(this, "ApiUrl", { value: this.httpApi.apiEndpoint });
|
|
164
|
+
}
|
|
174
165
|
};
|
|
175
166
|
function dataApiEnvironment(dataApi) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
...dataApi.database ? { DATABASE_NAME: dataApi.database } : {}
|
|
183
|
-
};
|
|
167
|
+
if (!dataApi) return {};
|
|
168
|
+
return {
|
|
169
|
+
DATABASE_RESOURCE_ARN: dataApi.resourceArn,
|
|
170
|
+
DATABASE_SECRET_ARN: dataApi.secretArn,
|
|
171
|
+
...dataApi.database ? { DATABASE_NAME: dataApi.database } : {}
|
|
172
|
+
};
|
|
184
173
|
}
|
|
185
174
|
function readBuildEnvironment(functionDir) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return {};
|
|
194
|
-
}
|
|
175
|
+
const envPath = resolve(functionDir, "../env.json");
|
|
176
|
+
if (!existsSync(envPath)) return {};
|
|
177
|
+
try {
|
|
178
|
+
return JSON.parse(readFileSync(envPath, "utf8"));
|
|
179
|
+
} catch {
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
195
182
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
};
|
|
183
|
+
//#endregion
|
|
184
|
+
export { GurenLambdaApp };
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/commands.d.ts
|
|
3
2
|
declare const _default: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
'lambda:build': import("citty").CommandDef<{
|
|
4
|
+
root: {
|
|
5
|
+
type: "string";
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
'skip-app-build': {
|
|
9
|
+
type: "boolean";
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
zip: {
|
|
13
|
+
type: "boolean";
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
database: {
|
|
17
|
+
type: "string";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
export { _default as default };
|
|
22
|
+
//#endregion
|
|
23
|
+
export { _default as default };
|
package/dist/commands.js
CHANGED
|
@@ -1,46 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildLambdaOutput
|
|
3
|
-
} from "./chunk-OTE5NGTW.js";
|
|
4
|
-
import "./chunk-K64F77DP.js";
|
|
5
|
-
|
|
6
|
-
// src/commands.ts
|
|
7
|
-
import { defineCommand } from "citty";
|
|
1
|
+
import { t as buildLambdaOutput } from "./build-56qBHosh.js";
|
|
8
2
|
import { DATABASE_DIALECTS, parseDatabaseDialects } from "@guren/core/internal/deploy-build";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
export {
|
|
45
|
-
commands_default as default
|
|
46
|
-
};
|
|
3
|
+
import { defineCommand } from "citty";
|
|
4
|
+
var commands_default = { "lambda:build": defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "lambda:build",
|
|
7
|
+
description: "Assemble an AWS Lambda deployment (.lambda/) from the app build"
|
|
8
|
+
},
|
|
9
|
+
args: {
|
|
10
|
+
root: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "App root directory (defaults to the current working directory)"
|
|
13
|
+
},
|
|
14
|
+
"skip-app-build": {
|
|
15
|
+
type: "boolean",
|
|
16
|
+
description: "Skip running the app's build script before assembling output"
|
|
17
|
+
},
|
|
18
|
+
zip: {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description: "Also produce .lambda/function.zip (requires the zip binary)"
|
|
21
|
+
},
|
|
22
|
+
database: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: `Databases this app connects to (comma-separated: ${DATABASE_DIALECTS.join(", ")}). Defaults to what config/database.ts declares; every other dialect's client is stubbed out of the bundle.`
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
async run({ args }) {
|
|
28
|
+
await buildLambdaOutput({
|
|
29
|
+
rootDir: args.root || process.cwd(),
|
|
30
|
+
skipAppBuild: Boolean(args["skip-app-build"]),
|
|
31
|
+
zip: Boolean(args.zip),
|
|
32
|
+
databaseDialects: args.database ? parseDatabaseDialects(args.database, "Lambda build") : void 0
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}) };
|
|
36
|
+
//#endregion
|
|
37
|
+
export { commands_default as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/handlers.ts
|
|
2
|
+
/**
|
|
3
|
+
* The single source of truth tying the generated bundle to the
|
|
4
|
+
* infrastructure: `lambda:build` emits a `handler` module re-exporting these
|
|
5
|
+
* names, and the CDK construct maps them to Lambda handler identifiers.
|
|
6
|
+
*/
|
|
7
|
+
const LAMBDA_HANDLER_MODULE = "handler";
|
|
8
|
+
const LAMBDA_HANDLER_EXPORTS = [
|
|
9
|
+
"http",
|
|
10
|
+
"queue",
|
|
11
|
+
"schedule",
|
|
12
|
+
"console"
|
|
13
|
+
];
|
|
14
|
+
/** Lambda handler identifier for an export, e.g. `handler.http`. */
|
|
15
|
+
function lambdaHandlerId(name) {
|
|
16
|
+
return `${LAMBDA_HANDLER_MODULE}.${name}`;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { LAMBDA_HANDLER_MODULE as n, lambdaHandlerId as r, LAMBDA_HANDLER_EXPORTS as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ServiceProviderConstructor } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { ServiceProviderConstructor } from "@guren/core";
|
|
2
|
+
import { DatabaseDialect, PathLike } from "@guren/core/internal/deploy-build";
|
|
3
|
+
//#region src/build.d.ts
|
|
4
4
|
interface BuildLambdaOutputOptions {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
/** App root directory. Defaults to the current working directory. */
|
|
6
|
+
rootDir?: PathLike;
|
|
7
|
+
/** Output directory for the assembled function. Defaults to `<root>/.lambda`. */
|
|
8
|
+
outputDir?: PathLike;
|
|
9
|
+
/** Module exporting the Lambda handlers (http/queue/schedule/console). Defaults to `<root>/src/lambda.ts`. */
|
|
10
|
+
entrypoint?: PathLike;
|
|
11
|
+
/** Static files directory staged for S3. Defaults to `<root>/public`. */
|
|
12
|
+
publicDir?: PathLike;
|
|
13
|
+
/** Vite SSR build output. Defaults to `<root>/.guren/ssr`. */
|
|
14
|
+
ssrDir?: PathLike;
|
|
15
|
+
/** Drizzle migrations copied into the function. Defaults to `<root>/db/migrations`. */
|
|
16
|
+
migrationsDir?: PathLike;
|
|
17
|
+
/** Client manifest key for the frontend entry. Defaults to `resources/js/app.tsx`. */
|
|
18
|
+
clientEntryKey?: string;
|
|
19
|
+
/** SSR manifest key for the server entry. Defaults to `resources/js/ssr.tsx`. */
|
|
20
|
+
ssrEntryKey?: string;
|
|
21
|
+
/** Skip running the app's `build` script before assembling output. */
|
|
22
|
+
skipAppBuild?: boolean;
|
|
23
|
+
/** Also produce `<outputDir>/function.zip` (requires the `zip` binary). */
|
|
24
|
+
zip?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Databases this app connects to, overriding what is read from
|
|
27
|
+
* `config/database.ts`. Every other dialect's client is stubbed out of the
|
|
28
|
+
* bundle. Pass this when the config reaches a factory without naming it and
|
|
29
|
+
* the build reports that it could not tell.
|
|
30
|
+
*/
|
|
31
|
+
databaseDialects?: readonly DatabaseDialect[];
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Assemble a deployable AWS Lambda directory (`.lambda/`) from a built Guren
|
|
@@ -37,24 +37,25 @@ interface BuildLambdaOutputOptions {
|
|
|
37
37
|
* `env.json` with the environment the function expects.
|
|
38
38
|
*/
|
|
39
39
|
declare function buildLambdaOutput(options?: BuildLambdaOutputOptions): Promise<void>;
|
|
40
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/handlers.d.ts
|
|
41
42
|
/**
|
|
42
43
|
* The single source of truth tying the generated bundle to the
|
|
43
44
|
* infrastructure: `lambda:build` emits a `handler` module re-exporting these
|
|
44
45
|
* names, and the CDK construct maps them to Lambda handler identifiers.
|
|
45
46
|
*/
|
|
46
47
|
declare const LAMBDA_HANDLER_MODULE = "handler";
|
|
47
|
-
declare const LAMBDA_HANDLER_EXPORTS: readonly [
|
|
48
|
+
declare const LAMBDA_HANDLER_EXPORTS: readonly ['http', 'queue', 'schedule', 'console'];
|
|
48
49
|
type LambdaHandlerExport = (typeof LAMBDA_HANDLER_EXPORTS)[number];
|
|
49
50
|
/** Lambda handler identifier for an export, e.g. `handler.http`. */
|
|
50
51
|
declare function lambdaHandlerId(name: LambdaHandlerExport): string;
|
|
51
|
-
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/index.d.ts
|
|
52
54
|
/**
|
|
53
55
|
* Configuration for the Lambda plugin. Currently empty — reserved so future
|
|
54
56
|
* fields never force another registration-shape change.
|
|
55
57
|
*/
|
|
56
|
-
interface LambdaPluginConfig {
|
|
57
|
-
}
|
|
58
|
+
interface LambdaPluginConfig {}
|
|
58
59
|
/**
|
|
59
60
|
* Register the Lambda plugin.
|
|
60
61
|
*
|
|
@@ -64,5 +65,5 @@ interface LambdaPluginConfig {
|
|
|
64
65
|
* ```
|
|
65
66
|
*/
|
|
66
67
|
declare function lambdaPlugin(config?: LambdaPluginConfig): ServiceProviderConstructor;
|
|
67
|
-
|
|
68
|
-
export { type BuildLambdaOutputOptions, LAMBDA_HANDLER_EXPORTS, LAMBDA_HANDLER_MODULE, type LambdaHandlerExport,
|
|
68
|
+
//#endregion
|
|
69
|
+
export { type BuildLambdaOutputOptions, LAMBDA_HANDLER_EXPORTS, LAMBDA_HANDLER_MODULE, type LambdaHandlerExport, LambdaPluginConfig, buildLambdaOutput, lambdaHandlerId, lambdaPlugin };
|