@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/cdk/index.js CHANGED
@@ -1,10 +1,6 @@
1
- import {
2
- lambdaHandlerId
3
- } from "../chunk-K64F77DP.js";
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
- httpFunction;
24
- httpApi;
25
- queue;
26
- deadLetterQueue;
27
- queueFunction;
28
- scheduleFunction;
29
- consoleFunction;
30
- assetsBucket;
31
- distribution;
32
- constructor(scope, id, props) {
33
- super(scope, id);
34
- const code = lambda.Code.fromAsset(props.functionDir);
35
- const runtime = props.runtime ?? lambda.Runtime.NODEJS_22_X;
36
- const memorySize = props.memorySize ?? 512;
37
- const environment = {
38
- NODE_ENV: "production",
39
- ...dataApiEnvironment(props.dataApi),
40
- // `guren lambda:build` writes the environment the bundle expects (asset
41
- // and SSR locations) next to the function directory; explicit props win.
42
- ...readBuildEnvironment(props.functionDir),
43
- ...props.environment
44
- };
45
- const functionDefaults = { code, runtime, memorySize, environment };
46
- this.httpFunction = new lambda.Function(this, "Http", {
47
- ...functionDefaults,
48
- handler: lambdaHandlerId("http"),
49
- timeout: props.timeout ?? Duration.seconds(30)
50
- });
51
- this.httpApi = new apigwv2.HttpApi(this, "Api", {
52
- defaultIntegration: new HttpLambdaIntegration("HttpIntegration", this.httpFunction)
53
- });
54
- if (props.queue) {
55
- const workerTimeout = props.queue.timeout ?? Duration.seconds(60);
56
- this.deadLetterQueue = new sqs.Queue(this, "JobDeadLetterQueue");
57
- this.queue = new sqs.Queue(this, "JobQueue", {
58
- // AWS guidance for Lambda event sources: at least 6x the function
59
- // timeout, so a message never becomes visible again mid-processing
60
- // (batching windows and retries extend the in-flight period).
61
- visibilityTimeout: Duration.seconds(workerTimeout.toSeconds() * 6),
62
- deadLetterQueue: {
63
- queue: this.deadLetterQueue,
64
- maxReceiveCount: props.queue.maxReceiveCount ?? 3
65
- }
66
- });
67
- this.queueFunction = new lambda.Function(this, "QueueWorker", {
68
- ...functionDefaults,
69
- handler: lambdaHandlerId("queue"),
70
- timeout: workerTimeout
71
- });
72
- this.queueFunction.addEventSource(
73
- new SqsEventSource(this.queue, {
74
- batchSize: props.queue.batchSize ?? 10,
75
- // createSqsHandler() returns per-message failures; without this the
76
- // whole batch would be retried when one job fails.
77
- reportBatchItemFailures: true
78
- })
79
- );
80
- }
81
- if (props.schedule) {
82
- this.scheduleFunction = new lambda.Function(this, "Scheduler", {
83
- ...functionDefaults,
84
- handler: lambdaHandlerId("schedule"),
85
- timeout: Duration.seconds(60)
86
- });
87
- new events.Rule(this, "ScheduleRule", {
88
- schedule: events.Schedule.rate(props.schedule.rate ?? Duration.minutes(1)),
89
- targets: [new targets.LambdaFunction(this.scheduleFunction)]
90
- });
91
- }
92
- if (props.console) {
93
- this.consoleFunction = new lambda.Function(this, "Console", {
94
- ...functionDefaults,
95
- handler: lambdaHandlerId("console"),
96
- timeout: Duration.minutes(5)
97
- });
98
- }
99
- const functions = [this.httpFunction, this.queueFunction, this.scheduleFunction, this.consoleFunction].filter((fn) => fn !== void 0);
100
- if (this.queue) {
101
- for (const fn of functions) {
102
- fn.addEnvironment("SQS_QUEUE_URL", this.queue.queueUrl);
103
- this.queue.grantSendMessages(fn);
104
- }
105
- }
106
- if (props.dataApi) {
107
- for (const fn of functions) {
108
- fn.addToRolePolicy(new iam.PolicyStatement({
109
- actions: [
110
- "rds-data:ExecuteStatement",
111
- "rds-data:BatchExecuteStatement",
112
- "rds-data:BeginTransaction",
113
- "rds-data:CommitTransaction",
114
- "rds-data:RollbackTransaction"
115
- ],
116
- resources: [props.dataApi.resourceArn]
117
- }));
118
- fn.addToRolePolicy(new iam.PolicyStatement({
119
- actions: ["secretsmanager:GetSecretValue"],
120
- resources: [props.dataApi.secretArn]
121
- }));
122
- }
123
- }
124
- if (props.assets) {
125
- this.assetsBucket = new s3.Bucket(this, "Assets", {
126
- blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
127
- enforceSSL: true
128
- });
129
- const apiDomain = `${this.httpApi.apiId}.execute-api.${this.httpApi.stack.region}.${this.httpApi.stack.urlSuffix}`;
130
- const assetOrigin = origins.S3BucketOrigin.withOriginAccessControl(this.assetsBucket);
131
- const assetBehavior = {
132
- origin: assetOrigin,
133
- viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
134
- cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED
135
- };
136
- const additionalBehaviors = {
137
- "/assets/*": assetBehavior,
138
- "/public/*": assetBehavior
139
- };
140
- if (existsSync(props.assets.dir)) {
141
- for (const entry of readdirSync(props.assets.dir, { withFileTypes: true })) {
142
- if (entry.name === "assets" || entry.name === "public") {
143
- continue;
144
- }
145
- additionalBehaviors[entry.isDirectory() ? `/${entry.name}/*` : `/${entry.name}`] = assetBehavior;
146
- }
147
- }
148
- this.distribution = new cloudfront.Distribution(this, "Distribution", {
149
- defaultBehavior: {
150
- origin: new origins.HttpOrigin(apiDomain),
151
- viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
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
- if (!dataApi) {
177
- return {};
178
- }
179
- return {
180
- DATABASE_RESOURCE_ARN: dataApi.resourceArn,
181
- DATABASE_SECRET_ARN: dataApi.secretArn,
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
- const envPath = resolve(functionDir, "../env.json");
187
- if (!existsSync(envPath)) {
188
- return {};
189
- }
190
- try {
191
- return JSON.parse(readFileSync(envPath, "utf8"));
192
- } catch {
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
- export {
197
- GurenLambdaApp
198
- };
183
+ //#endregion
184
+ export { GurenLambdaApp };
@@ -1,24 +1,23 @@
1
- import * as citty from 'citty';
2
-
1
+ //#region src/commands.d.ts
3
2
  declare const _default: {
4
- 'lambda:build': citty.CommandDef<{
5
- root: {
6
- type: "string";
7
- description: string;
8
- };
9
- 'skip-app-build': {
10
- type: "boolean";
11
- description: string;
12
- };
13
- zip: {
14
- type: "boolean";
15
- description: string;
16
- };
17
- database: {
18
- type: "string";
19
- description: string;
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
- var lambdaBuild = defineCommand({
10
- meta: {
11
- name: "lambda:build",
12
- description: "Assemble an AWS Lambda deployment (.lambda/) from the app build"
13
- },
14
- args: {
15
- root: {
16
- type: "string",
17
- description: "App root directory (defaults to the current working directory)"
18
- },
19
- "skip-app-build": {
20
- type: "boolean",
21
- description: "Skip running the app's build script before assembling output"
22
- },
23
- zip: {
24
- type: "boolean",
25
- description: "Also produce .lambda/function.zip (requires the zip binary)"
26
- },
27
- database: {
28
- type: "string",
29
- 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.`
30
- }
31
- },
32
- async run({ args }) {
33
- await buildLambdaOutput({
34
- rootDir: args.root || process.cwd(),
35
- skipAppBuild: Boolean(args["skip-app-build"]),
36
- zip: Boolean(args.zip),
37
- databaseDialects: args.database ? parseDatabaseDialects(args.database, "Lambda build") : void 0
38
- });
39
- }
40
- });
41
- var commands_default = {
42
- "lambda:build": lambdaBuild
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 '@guren/core';
2
- import { PathLike, DatabaseDialect } from '@guren/core/internal/deploy-build';
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
- /** 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[];
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 ["http", "queue", "schedule", "console"];
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, type LambdaPluginConfig, buildLambdaOutput, lambdaHandlerId, lambdaPlugin };
68
+ //#endregion
69
+ export { type BuildLambdaOutputOptions, LAMBDA_HANDLER_EXPORTS, LAMBDA_HANDLER_MODULE, type LambdaHandlerExport, LambdaPluginConfig, buildLambdaOutput, lambdaHandlerId, lambdaPlugin };