@ashishpandeyone/cdk-lambda-web-function 0.1.0 → 0.1.2

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/.jsii CHANGED
@@ -9745,7 +9745,7 @@
9745
9745
  },
9746
9746
  "name": "@ashishpandeyone/cdk-lambda-web-function",
9747
9747
  "readme": {
9748
- "markdown": "# CDK constructs for AWS Lambda Web Functions\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n[AWS Lambda Web Functions](https://aws.amazon.com/lambda/) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.\n\n```ts fixture=bare\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n\nconst fn = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-web.global.on.aws\n```\n\nThe stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.\n\n## Writing the server\n\n1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.\n2. Start listening within **about 9 seconds**, or initialisation fails with `Application.TimeoutListenError`.\n3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.\n4. The runtime has **no AWS SDK**: bundle the clients you import.\n5. Code runs on **arm64**.\n\n```js\nconst express = require('express');\n\nconst app = express();\napp.get('/', (req, res) => res.json({ hello: 'world', region: process.env.AWS_REGION }));\n\nconst [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');\napp.listen(Number(port), host);\n```\n\nRequests carry `lambda-web-request-id` and `lambda-web-endpoint-name` headers.\n\n## Regions and endpoints\n\nEach `WebFunction` has one endpoint, `fn.endpoint`:\n\n| `endpointType` | URL | Routing |\n|---|---|---|\n| `HOME_REGION` (default) | `https://<id>.<cell>.lambda-web.<home>.on.aws` | home region only |\n| `MULTI_REGION` | one global `https://<id>.lambda-web.global.on.aws` | nearest region |\n| `PER_REGION` | one URL per region, from `fn.endpoint.regionalUrl(region)` | the region in the hostname |\n\n```ts\nconst perRegion = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.PER_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'UsEast1Url', { value: perRegion.endpoint.regionalUrl('us-east-1') });\n// perRegion.endpoint.regions is ['<home region>', 'eu-west-1', 'us-east-1']\n```\n\n- `MULTI_REGION` and `PER_REGION` need at least one region besides the home region; `HOME_REGION` takes none.\n- A MultiRegion endpoint takes about a minute to create.\n\n### Changing regions or the endpoint type\n\nAn endpoint's type and regions can't change in place: a change creates a **new endpoint with a new URL**, and the old one is deleted once the new one is live. Two endpoints of one function can't share a name, so:\n\n| `endpointName` | Physical name | Changing `regions` or `endpointType` |\n|---|---|---|\n| omitted (recommended) | `default-<hash of type and regions>` | works: new endpoint, new URL |\n| set, e.g. `'live'` | `live` | also change the name in the same deployment, or it fails with *The endpoint live already exists* (the stack rolls back and the old endpoint keeps serving) |\n\nThe construct warns at synth time when `endpointName` is set.\n\n## Authentication and invoking\n\n| `authType` | Meaning |\n|---|---|\n| `AWS_IAM` | Callers sign requests (SigV4 or SigV4a, signing name `lambda`) and need `lambda:InvokeWebFunctionEndpoint` |\n| `NONE` | **Public**: Lambda does no authentication; your application does (JWT, sessions). The `Authorization` header reaches your application untouched. The construct warns at synth time |\n\n```ts\nfn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function\n```\n\nThe grant is on the endpoint's home-region ARN, which IAM evaluates in every region the endpoint serves from, including the global URL.\n\n| Endpoint | How to sign |\n|---|---|\n| `HOME_REGION` | SigV4 for the home region |\n| `PER_REGION` | SigV4 for the hostname's region, or SigV4a |\n| `MULTI_REGION` | **SigV4a with region set `*`**: you can't know which region will serve the request |\n\n```js\nimport { SignatureV4a } from '@smithy/signature-v4a';\nimport { Sha256 } from '@aws-crypto/sha256-js';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\n\nconst signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });\nconst signed = await signer.sign(\n { method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },\n { signingRegion: '*' },\n);\nconst response = await fetch(`https://${host}/`, { headers: signed.headers });\n```\n\n## Configuration\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('build'),\n authType: WebFunctionAuthType.AWS_IAM,\n entrypoint: 'server.js', // default index.js\n webFunctionName: 'orders-api', // default: generated from the construct path\n description: 'Orders HTTP API',\n environment: { TABLE_NAME: table.tableName },\n timeout: Duration.seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n maxConcurrencyPerEnvironment: 32, // requests per environment at once: 1-128, default 64\n});\n\napi.addEnvironment('FEATURE_FLAG', 'on');\ntable.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com\n```\n\n- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.\n- Environment variable names starting with `AWS_` are reserved.\n- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.\n\n### Code\n\n`code` takes any `lambda.Code` that produces a zip in S3: `fromAsset`, `fromBucket`/`fromBucketV2`, `fromCustomCommand`, `fromDockerBuild`. Inline code and container images fail at synth time.\n\nLambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy.\n\n### Updates\n\nAny change to code or configuration creates a new **revision**. The endpoint switches to it once it's ready, and the old revision is deleted after the deployment succeeds; a failed deployment rolls back to it. If nothing changed, nothing is deployed.\n\n## Logs in every region\n\nWeb Functions log in two tiers:\n\n```text\n every serving region home region\n ┌──────────────────┐ ┌──────────────────────────────────────────┐\n │ <group>.local │── copied ───►│ <group> every region's logs │\n │ (that region's │ (seconds) │ streams …[rev]<instance>-<acct>-<region> │\n │ environments) │ │ <group>.local (home-region traffic) │\n └──────────────────┘ └──────────────────────────────────────────┘\n```\n\n**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region of the endpoint.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n logRetention: logs.RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n logRemovalPolicy: RemovalPolicy.DESTROY, // default RETAIN\n applicationLogLevelV2: lambda.ApplicationLogLevel.WARN,\n systemLogLevelV2: lambda.SystemLogLevel.INFO, // DEBUG, INFO or WARN\n});\n```\n\n- The default group is `/aws/lambda/web/<function name>`. Log lines are JSON; application lines carry `requestId`, `endpointName` and `region`.\n- Every event is stored twice (`.local` plus the home-region copy), so expect about double log ingestion, plus cross-region transfer.\n- With `DESTROY`, deletion waits about a minute after the function is gone, because environments flush their last lines late.\n- Subscribe only to `fn.logGroup`: subscribing to the `.local` groups as well delivers every event twice.\n\n## Limitations\n\n- One endpoint per function; no traffic splitting between revisions.\n- Not yet supported: importing existing functions, VPC access (network connectors), resource-policy permissions, KMS encryption, metrics helpers, tracing, and a CloudFront origin.\n- `cdk deploy --hotswap` and `cdk watch` don't support Web Functions.\n- Quotas per account and region: 50 revisions and 10 endpoints per function, 200 Arm vCPUs, 10,000 requests per second.\n- The stack's custom resource provider Lambda keeps its own log group after the stack is deleted, as with other CDK custom resources.\n\n## Development\n\nTooling is pinned in `mise.toml` (Node 24, AWS CDK CLI). Personal settings, such as the AWS profile for the live end-to-end tests, go in a git-ignored `mise.local.toml`.\n\n```bash\nmise install\nnpx projen build # compile, unit tests, lint, API docs\nnpx projen e2e # deploy, verify and destroy real stacks in three regions (needs AWS credentials)\n```\n"
9748
+ "markdown": "# CDK constructs for AWS Lambda Web Functions\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n[AWS Lambda Web Functions](https://aws.amazon.com/lambda/) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.\n\n```ts fixture=bare\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n\nconst fn = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-web.global.on.aws\n```\n\nThe stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.\n\n## Writing the server\n\n1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.\n2. Start listening within **about 9 seconds**, or initialisation fails with `Application.TimeoutListenError`.\n3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.\n4. The runtime has **no AWS SDK**: bundle the clients you import.\n5. Code runs on **arm64**.\n\n```js\nconst express = require('express');\n\nconst app = express();\napp.get('/', (req, res) => res.json({ hello: 'world', region: process.env.AWS_REGION }));\n\nconst [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');\napp.listen(Number(port), host);\n```\n\nRequests carry `lambda-web-request-id` and `lambda-web-endpoint-name` headers.\n\n## Regions and endpoints\n\nEach `WebFunction` has a default endpoint, `fn.endpoint`, configured with the `endpoint` property. [Add more](#more-endpoints) with `fn.addEndpoint()`.\n\n| `endpointType` | URL | Routing |\n|---|---|---|\n| `HOME_REGION` (default) | `https://<id>.<cell>.lambda-web.<home>.on.aws` | home region only |\n| `MULTI_REGION` | one global `https://<id>.lambda-web.global.on.aws` | nearest region |\n| `PER_REGION` | one URL per region, from `fn.endpoint.regionalUrl(region)` | the region in the hostname |\n\n```ts\nconst perRegion = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.PER_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'UsEast1Url', { value: perRegion.endpoint.regionalUrl('us-east-1') });\n// perRegion.endpoint.regions is ['<home region>', 'eu-west-1', 'us-east-1']\n```\n\n- `MULTI_REGION` and `PER_REGION` need at least one region besides the home region; `HOME_REGION` takes none.\n- A MultiRegion endpoint takes about a minute to create.\n- Lambda routes a `MULTI_REGION` endpoint by latency, not by health: it doesn't fail over when a region has problems.\n\n### More endpoints\n\nA function can have up to 10 endpoints, each with its own URL, authentication, regions and limits. For example, a public endpoint next to an IAM-only global one:\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.NONE, // the default endpoint is public\n endpoint: { rateLimit: 1000 }, // requests per second\n});\n\nconst internal = api.addEndpoint('Internal', {\n authType: WebFunctionAuthType.AWS_IAM,\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n description: 'Service-to-service traffic',\n maxEnvironments: 50,\n});\ninternal.grantInvoke(consumerRole);\nnew CfnOutput(this, 'InternalUrl', { value: internal.url });\n```\n\n- `rateLimit` takes 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000; excess requests get HTTP 429. `maxEnvironments` takes 2–10,000.\n- **Both limits apply separately in each region** an endpoint serves from: a 3-region endpoint with `rateLimit: 1000` accepts up to 1,000 requests per second in each region.\n- Endpoints can serve the same regions. The construct owns one `.local` log group per region, whichever endpoints serve it.\n\n### Changing regions or the endpoint type\n\nAn endpoint's type and regions can't change in place: a change creates a **new endpoint with a new URL**, and the old one is deleted once the new one is live. Two endpoints of one function can't share a name, so:\n\n| `endpointName` | Physical name | Changing `regions` or `endpointType` |\n|---|---|---|\n| omitted (recommended) | `default-<hash>` for `fn.endpoint`, `<id>-<hash>` for added endpoints; the hash covers the type and regions | works: new endpoint, new URL |\n| set, e.g. `'live'` | `live` | also change the name in the same deployment, or it fails with *The endpoint live already exists* (the stack rolls back and the old endpoint keeps serving) |\n\nThe construct warns at synth time when `endpointName` is set.\n\n## Authentication and invoking\n\n| `authType` | Meaning |\n|---|---|\n| `AWS_IAM` | Callers sign requests (SigV4 or SigV4a, signing name `lambda`) and need `lambda:InvokeWebFunctionEndpoint` |\n| `NONE` | **Public**: Lambda does no authentication; your application does (JWT, sessions). The `Authorization` header reaches your application untouched. The construct warns at synth time |\n\n```ts\nfn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function\n```\n\nThe grant is on the endpoint's home-region ARN, which IAM evaluates in every region the endpoint serves from, including the global URL. `fn.grants` covers the default endpoint only; grant other endpoints with their own `grantInvoke()` or `grants.invoke()`.\n\n| Endpoint | How to sign |\n|---|---|\n| `HOME_REGION` | SigV4 for the home region |\n| `PER_REGION` | SigV4 for the hostname's region, or SigV4a |\n| `MULTI_REGION` | **SigV4a with region set `*`**: you can't know which region will serve the request |\n\n```js\nimport { SignatureV4a } from '@smithy/signature-v4a';\nimport { Sha256 } from '@aws-crypto/sha256-js';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\n\nconst signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });\nconst signed = await signer.sign(\n { method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },\n { signingRegion: '*' },\n);\nconst response = await fetch(`https://${host}/`, { headers: signed.headers });\n```\n\n## Configuration\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('build'),\n authType: WebFunctionAuthType.AWS_IAM,\n entrypoint: 'server.js', // default index.js\n webFunctionName: 'orders-api', // default: generated from the construct path\n description: 'Orders HTTP API',\n environment: { TABLE_NAME: table.tableName },\n timeout: Duration.seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n maxConcurrencyPerEnvironment: 32, // requests per environment at once: 1-128, default 64\n});\n\napi.addEnvironment('FEATURE_FLAG', 'on');\ntable.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com\n```\n\n- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.\n- Environment variable names starting with `AWS_` are reserved.\n- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.\n\n### Bundling TypeScript with `NodejsWebFunction`\n\n`NodejsWebFunction` is a `WebFunction` that bundles your server from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` does for Lambda functions:\n\n```ts\nnew NodejsWebFunction(this, 'Api', {\n entry: 'src/server.ts',\n authType: WebFunctionAuthType.AWS_IAM,\n bundling: {\n minify: true, // default true\n sourceMap: true, // default true\n format: lambdaNodejs.OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n externalModules: [], // default: bundle everything you import\n },\n});\n```\n\n- **Defaults:** `runtime` is `NODEJS_24_X`, and the esbuild target follows the runtime (`node24`). The project root is the directory of the nearest lock file above `entry` (override it with `depsLockFilePath` or `projectRoot`).\n- **It also sets what a `lambda.Code` can't:** the entry point that matches the bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on, appended to any `NODE_OPTIONS` you set, so stack traces point at your `.ts` files (e.g. `/var/task/src/server.ts:22:12`). Source map paths are relative to the project root, so no build-machine paths are deployed.\n- **ESM bundles include a `require` shim**, so CommonJS dependencies that load Node.js built-ins (Express, for example) work.\n- **The AWS SDK is bundled like any other dependency**, since the runtime has none. Only the clients you import are included.\n- **Bundling runs locally** when esbuild is installed in your project, and otherwise in Docker (an arm64 AWS SAM build image; set `forceDockerBundling` to always use Docker).\n- **Not yet supported:** installing native modules next to the bundle (`nodeModules`) and command hooks. For native dependencies, use `WebFunction` with `Code.fromAsset(..., { bundling: { image, command } })`.\n\n### Code\n\n`code` takes any `lambda.Code` that produces a zip in S3: `fromAsset`, `fromBucket`/`fromBucketV2`, `fromCustomCommand`, `fromDockerBuild`. Inline code and container images fail at synth time.\n\nLambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy.\n\n## Revisions\n\nAny change to code or configuration creates a new **revision** (`fn.currentRevision`), and endpoints switch to it once it's ready. A failed deployment rolls back to the previous revision. If nothing changed, nothing is deployed.\n\nEarlier revisions are kept, so you can roll back or route traffic to them. After each deployment, the construct deletes the oldest beyond `revisionRetention` (default 20, up to 50). It never deletes a revision an endpoint routes to, or one the previous deployment used, which a rollback returns to.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n revisionRetention: 5,\n});\n```\n\n### Routing to earlier revisions\n\nReference an earlier revision by its ID (for example from a `CfnOutput` of `fn.currentRevision.revisionId`, or `aws lambda-web list-web-function-revisions`). Then pin an endpoint to it, or split traffic between two revisions:\n\n```ts\nconst previous = WebFunctionRevision.fromRevisionAttributes(this, 'Previous', {\n webFunction: fn,\n revisionId: 'rev-a1b2c',\n});\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }]);\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint('Stable', { authType: WebFunctionAuthType.AWS_IAM, revision: previous });\n```\n\n- An endpoint routes to at most two revisions. The additional revision's `weight` is a whole percentage, from 0.01 to 0.99.\n- To promote, remove `routeTraffic` (or `revision`) and deploy: the endpoint serves the current revision again.\n- Lambda Web Function metrics have no revision dimension. To compare a split's revisions, log a version you control (for example an environment variable) from your application.\n\n### Canary and linear deployments\n\nBy default an endpoint moves all its traffic to a new revision at once. With `deployment`, it moves in steps instead, watching CloudWatch alarms: if one goes into ALARM, the endpoint goes back to the revision it served before and the deployment fails, so CloudFormation rolls the stack back.\n\n```ts\n// errorRate: a cloudwatch.IAlarm, for example on the share of 5xx responses\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n // 10% of the traffic for 10 minutes, then all of it.\n deployment: WebFunctionDeployment.canary({ percent: 10, bake: Duration.minutes(10), alarms: [errorRate] }),\n },\n});\n\n// 25% more every 5 minutes. Each endpoint has its own deployment.\napi.addEndpoint('Public', {\n authType: WebFunctionAuthType.NONE,\n deployment: WebFunctionDeployment.linear({ percent: 25, interval: Duration.minutes(5), alarms: [errorRate] }),\n});\n```\n\n| | Steps | Limits |\n|---|---|---|\n| `allAtOnce()` (default) | 100% | |\n| `canary({ percent, bake })` | `percent`, then 100% after `bake` | `percent` 1–99, `bake` 1–45 minutes |\n| `linear({ percent, interval })` | `percent` more every `interval` | `percent` 5–50, `interval` from 1 minute, at most 45 minutes in all |\n\nHow it works:\n\n- Each deployment that creates a revision (code or configuration) moves the traffic from the revision the endpoint serves at that moment, which is also what it goes back to. If someone switched the endpoint outside CloudFormation, the deployment starts from there.\n- Each step waits until every region of a `MULTI_REGION` or `PER_REGION` endpoint has applied it (usually about 15 seconds), and if a region fails to update, the endpoint goes back as for an alarm. The bake or interval counts from the start of the step.\n- Alarms are checked before the first step (an alarm already in ALARM stops the deployment before any traffic moves), throughout every step, and once the new revision has all the traffic. They can be in any region, and composite alarms work. `INSUFFICIENT_DATA` doesn't stop a deployment.\n- A rollback of the stack, for any reason, moves the traffic back at once, without waiting or checking alarms.\n- A stack's first deployment, and a new endpoint (including one renamed by a region change), serve the revision at once: there's nothing to move from.\n- A deployment can take up to an hour: CloudFormation waits for it before it updates the endpoint. Deployments of different endpoints run in parallel.\n- A canary or linear endpoint always moves to the current revision, so it can't also use `revision`, `additionalRevisions` or `routeTraffic()`. Use `allAtOnce()` to deploy a fix immediately, for example while an alarm is in ALARM.\n\nLambda Web Function metrics have no revision dimension, so an alarm sees the whole endpoint: at 10%, a new revision's errors are a tenth of the endpoint's. Alarm on a rate, with a threshold low enough to notice that, or publish metrics from your application that carry its version. A bake should be longer than an alarm needs to fire (its period times its evaluation periods).\n\nThe deployment runs in a few resources per stack, created on first use: two Lambda functions, a Step Functions state machine that calls them every 15 seconds, and a log group.\n\n## Logs in every region\n\nWeb Functions log in two tiers:\n\n```text\n every serving region home region\n ┌──────────────────┐ ┌──────────────────────────────────────────┐\n │ <group>.local │── copied ───►│ <group> every region's logs │\n │ (that region's │ (seconds) │ streams …[rev]<instance>-<acct>-<region> │\n │ environments) │ │ <group>.local (home-region traffic) │\n └──────────────────┘ └──────────────────────────────────────────┘\n```\n\n**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region of the endpoint.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n logRetention: logs.RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n logRemovalPolicy: RemovalPolicy.DESTROY, // default RETAIN\n applicationLogLevelV2: lambda.ApplicationLogLevel.WARN,\n systemLogLevelV2: lambda.SystemLogLevel.INFO, // DEBUG, INFO or WARN\n});\n```\n\n- The default group is `/aws/lambda/web/<function name>`. Log lines are JSON; application lines carry `requestId`, `endpointName` and `region`.\n- Every event is stored twice (`.local` plus the home-region copy), so expect about double log ingestion, plus cross-region transfer.\n- With `DESTROY`, deletion waits about a minute after the function is gone, because environments flush their last lines late.\n- Subscribe only to `fn.logGroup`: subscribing to the `.local` groups as well delivers every event twice.\n\n## Limitations\n\n- Not yet supported: importing existing functions, VPC access (network connectors), resource-policy permissions, KMS encryption, metrics helpers, tracing, and a CloudFront origin.\n- `cdk deploy --hotswap` and `cdk watch` don't support Web Functions.\n- Quotas: 10 endpoints and about 50 revisions per function (Lambda cleans up older revisions automatically), and 10,000 requests per second per endpoint. Per account and region: 100,000 requests per second and 2,000 Arm64 vCPUs (each execution environment uses 2). The account quotas are adjustable, and new accounts start lower. See [Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).\n- The stack's custom resource provider Lambda keeps its own log group after the stack is deleted, as with other CDK custom resources.\n\n## Development\n\nTooling is pinned in `mise.toml` (Node 24, AWS CDK CLI). Personal settings, such as the AWS profile for the live end-to-end tests, go in a git-ignored `mise.local.toml`.\n\n```bash\nmise install\nnpx projen build # compile, unit tests, lint, API docs\nnpx projen e2e # deploy, verify and destroy real stacks in three regions (needs AWS credentials)\n```\n"
9749
9749
  },
9750
9750
  "repository": {
9751
9751
  "type": "git",
@@ -9758,39 +9758,613 @@
9758
9758
  }
9759
9759
  },
9760
9760
  "types": {
9761
+ "@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions": {
9762
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
9763
+ "datatype": true,
9764
+ "docs": {
9765
+ "stability": "experimental",
9766
+ "summary": "Options for `WebFunction.addEndpoint`."
9767
+ },
9768
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions",
9769
+ "interfaces": [
9770
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"
9771
+ ],
9772
+ "kind": "interface",
9773
+ "locationInModule": {
9774
+ "filename": "src/web-function-endpoint.ts",
9775
+ "line": 105
9776
+ },
9777
+ "name": "AddWebFunctionEndpointOptions",
9778
+ "properties": [
9779
+ {
9780
+ "abstract": true,
9781
+ "docs": {
9782
+ "stability": "experimental",
9783
+ "summary": "How callers of this endpoint are authenticated."
9784
+ },
9785
+ "immutable": true,
9786
+ "locationInModule": {
9787
+ "filename": "src/web-function-endpoint.ts",
9788
+ "line": 109
9789
+ },
9790
+ "name": "authType",
9791
+ "type": {
9792
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType"
9793
+ }
9794
+ },
9795
+ {
9796
+ "abstract": true,
9797
+ "docs": {
9798
+ "default": "- all traffic goes to `revision`",
9799
+ "remarks": "`revision` gets the rest.\nAn endpoint routes to at most two revisions.",
9800
+ "stability": "experimental",
9801
+ "summary": "A second revision and its share of the endpoint's traffic;"
9802
+ },
9803
+ "immutable": true,
9804
+ "locationInModule": {
9805
+ "filename": "src/web-function-endpoint.ts",
9806
+ "line": 125
9807
+ },
9808
+ "name": "additionalRevisions",
9809
+ "optional": true,
9810
+ "type": {
9811
+ "collection": {
9812
+ "elementtype": {
9813
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight"
9814
+ },
9815
+ "kind": "array"
9816
+ }
9817
+ }
9818
+ },
9819
+ {
9820
+ "abstract": true,
9821
+ "docs": {
9822
+ "default": "- the function's current revision (`currentRevision`)",
9823
+ "stability": "experimental",
9824
+ "summary": "The revision the endpoint serves, e.g. an earlier one from `WebFunctionRevision.fromRevisionAttributes` to keep this endpoint on it while others move on. Same as calling `routeTraffic`."
9825
+ },
9826
+ "immutable": true,
9827
+ "locationInModule": {
9828
+ "filename": "src/web-function-endpoint.ts",
9829
+ "line": 117
9830
+ },
9831
+ "name": "revision",
9832
+ "optional": true,
9833
+ "type": {
9834
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
9835
+ }
9836
+ }
9837
+ ],
9838
+ "symbolId": "src/web-function-endpoint:AddWebFunctionEndpointOptions"
9839
+ },
9761
9840
  "@ashishpandeyone/cdk-lambda-web-function.IWebFunction": {
9762
9841
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
9763
9842
  "docs": {
9764
9843
  "stability": "experimental",
9765
- "summary": "A Lambda Web Function."
9844
+ "summary": "A Lambda Web Function."
9845
+ },
9846
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
9847
+ "interfaces": [
9848
+ "aws-cdk-lib.IResource",
9849
+ "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef"
9850
+ ],
9851
+ "kind": "interface",
9852
+ "locationInModule": {
9853
+ "filename": "src/web-function.ts",
9854
+ "line": 153
9855
+ },
9856
+ "name": "IWebFunction",
9857
+ "properties": [
9858
+ {
9859
+ "abstract": true,
9860
+ "docs": {
9861
+ "custom": {
9862
+ "attribute": "true"
9863
+ },
9864
+ "stability": "experimental",
9865
+ "summary": "The function's ARN."
9866
+ },
9867
+ "immutable": true,
9868
+ "locationInModule": {
9869
+ "filename": "src/web-function.ts",
9870
+ "line": 166
9871
+ },
9872
+ "name": "webFunctionArn",
9873
+ "type": {
9874
+ "primitive": "string"
9875
+ }
9876
+ },
9877
+ {
9878
+ "abstract": true,
9879
+ "docs": {
9880
+ "custom": {
9881
+ "attribute": "true"
9882
+ },
9883
+ "stability": "experimental",
9884
+ "summary": "The function's name."
9885
+ },
9886
+ "immutable": true,
9887
+ "locationInModule": {
9888
+ "filename": "src/web-function.ts",
9889
+ "line": 159
9890
+ },
9891
+ "name": "webFunctionName",
9892
+ "type": {
9893
+ "primitive": "string"
9894
+ }
9895
+ }
9896
+ ],
9897
+ "symbolId": "src/web-function:IWebFunction"
9898
+ },
9899
+ "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision": {
9900
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
9901
+ "docs": {
9902
+ "stability": "experimental",
9903
+ "summary": "A revision of a Web Function: an immutable snapshot of its code and configuration."
9904
+ },
9905
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision",
9906
+ "interfaces": [
9907
+ "constructs.IConstruct"
9908
+ ],
9909
+ "kind": "interface",
9910
+ "locationInModule": {
9911
+ "filename": "src/web-function-revision.ts",
9912
+ "line": 7
9913
+ },
9914
+ "name": "IWebFunctionRevision",
9915
+ "properties": [
9916
+ {
9917
+ "abstract": true,
9918
+ "docs": {
9919
+ "stability": "experimental",
9920
+ "summary": "The revision's ARN."
9921
+ },
9922
+ "immutable": true,
9923
+ "locationInModule": {
9924
+ "filename": "src/web-function-revision.ts",
9925
+ "line": 12
9926
+ },
9927
+ "name": "revisionArn",
9928
+ "type": {
9929
+ "primitive": "string"
9930
+ }
9931
+ },
9932
+ {
9933
+ "abstract": true,
9934
+ "docs": {
9935
+ "stability": "experimental",
9936
+ "summary": "The revision's ID, e.g. `rev-a1b2c`."
9937
+ },
9938
+ "immutable": true,
9939
+ "locationInModule": {
9940
+ "filename": "src/web-function-revision.ts",
9941
+ "line": 9
9942
+ },
9943
+ "name": "revisionId",
9944
+ "type": {
9945
+ "primitive": "string"
9946
+ }
9947
+ },
9948
+ {
9949
+ "abstract": true,
9950
+ "docs": {
9951
+ "stability": "experimental",
9952
+ "summary": "The function the revision belongs to."
9953
+ },
9954
+ "immutable": true,
9955
+ "locationInModule": {
9956
+ "filename": "src/web-function-revision.ts",
9957
+ "line": 15
9958
+ },
9959
+ "name": "webFunction",
9960
+ "type": {
9961
+ "fqn": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef"
9962
+ }
9963
+ }
9964
+ ],
9965
+ "symbolId": "src/web-function-revision:IWebFunctionRevision"
9966
+ },
9967
+ "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction": {
9968
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
9969
+ "base": "@ashishpandeyone/cdk-lambda-web-function.WebFunction",
9970
+ "docs": {
9971
+ "remarks": "Besides bundling, it sets what a `lambda.Code` alone can't: the entry point that matches the\nbundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on.",
9972
+ "stability": "experimental",
9973
+ "summary": "A `WebFunction` whose code is bundled from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` for Lambda functions."
9974
+ },
9975
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction",
9976
+ "initializer": {
9977
+ "docs": {
9978
+ "stability": "experimental"
9979
+ },
9980
+ "locationInModule": {
9981
+ "filename": "src/nodejs-web-function.ts",
9982
+ "line": 167
9983
+ },
9984
+ "parameters": [
9985
+ {
9986
+ "name": "scope",
9987
+ "type": {
9988
+ "fqn": "constructs.Construct"
9989
+ }
9990
+ },
9991
+ {
9992
+ "name": "id",
9993
+ "type": {
9994
+ "primitive": "string"
9995
+ }
9996
+ },
9997
+ {
9998
+ "name": "props",
9999
+ "type": {
10000
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps"
10001
+ }
10002
+ }
10003
+ ]
10004
+ },
10005
+ "kind": "class",
10006
+ "locationInModule": {
10007
+ "filename": "src/nodejs-web-function.ts",
10008
+ "line": 166
10009
+ },
10010
+ "name": "NodejsWebFunction",
10011
+ "symbolId": "src/nodejs-web-function:NodejsWebFunction"
10012
+ },
10013
+ "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions": {
10014
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10015
+ "datatype": true,
10016
+ "docs": {
10017
+ "stability": "experimental",
10018
+ "summary": "How `NodejsWebFunction` bundles the server with esbuild."
10019
+ },
10020
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions",
10021
+ "kind": "interface",
10022
+ "locationInModule": {
10023
+ "filename": "src/nodejs-web-function.ts",
10024
+ "line": 12
10025
+ },
10026
+ "name": "NodejsWebFunctionBundlingOptions",
10027
+ "properties": [
10028
+ {
10029
+ "abstract": true,
10030
+ "docs": {
10031
+ "default": "- none",
10032
+ "stability": "experimental",
10033
+ "summary": "Text to prepend to the bundle."
10034
+ },
10035
+ "immutable": true,
10036
+ "locationInModule": {
10037
+ "filename": "src/nodejs-web-function.ts",
10038
+ "line": 69
10039
+ },
10040
+ "name": "banner",
10041
+ "optional": true,
10042
+ "type": {
10043
+ "primitive": "string"
10044
+ }
10045
+ },
10046
+ {
10047
+ "abstract": true,
10048
+ "docs": {
10049
+ "default": "- none",
10050
+ "stability": "experimental",
10051
+ "summary": "Replace global identifiers with constant expressions (esbuild `--define`)."
10052
+ },
10053
+ "immutable": true,
10054
+ "locationInModule": {
10055
+ "filename": "src/nodejs-web-function.ts",
10056
+ "line": 55
10057
+ },
10058
+ "name": "define",
10059
+ "optional": true,
10060
+ "type": {
10061
+ "collection": {
10062
+ "elementtype": {
10063
+ "primitive": "string"
10064
+ },
10065
+ "kind": "map"
10066
+ }
10067
+ }
10068
+ },
10069
+ {
10070
+ "abstract": true,
10071
+ "docs": {
10072
+ "default": "- the arm64 AWS SAM build image for the runtime, e.g. `public.ecr.aws/sam/build-nodejs24.x:latest-arm64`",
10073
+ "stability": "experimental",
10074
+ "summary": "Docker image for bundling when esbuild isn't installed locally."
10075
+ },
10076
+ "immutable": true,
10077
+ "locationInModule": {
10078
+ "filename": "src/nodejs-web-function.ts",
10079
+ "line": 118
10080
+ },
10081
+ "name": "dockerImage",
10082
+ "optional": true,
10083
+ "type": {
10084
+ "fqn": "aws-cdk-lib.DockerImage"
10085
+ }
10086
+ },
10087
+ {
10088
+ "abstract": true,
10089
+ "docs": {
10090
+ "default": "- none",
10091
+ "stability": "experimental",
10092
+ "summary": "Environment variables while bundling (not at runtime)."
10093
+ },
10094
+ "immutable": true,
10095
+ "locationInModule": {
10096
+ "filename": "src/nodejs-web-function.ts",
10097
+ "line": 104
10098
+ },
10099
+ "name": "environment",
10100
+ "optional": true,
10101
+ "type": {
10102
+ "collection": {
10103
+ "elementtype": {
10104
+ "primitive": "string"
10105
+ },
10106
+ "kind": "map"
10107
+ }
10108
+ }
10109
+ },
10110
+ {
10111
+ "abstract": true,
10112
+ "docs": {
10113
+ "default": "- none",
10114
+ "stability": "experimental",
10115
+ "summary": "Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`."
10116
+ },
10117
+ "immutable": true,
10118
+ "locationInModule": {
10119
+ "filename": "src/nodejs-web-function.ts",
10120
+ "line": 97
10121
+ },
10122
+ "name": "esbuildArgs",
10123
+ "optional": true,
10124
+ "type": {
10125
+ "collection": {
10126
+ "elementtype": {
10127
+ "union": {
10128
+ "types": [
10129
+ {
10130
+ "primitive": "string"
10131
+ },
10132
+ {
10133
+ "primitive": "boolean"
10134
+ }
10135
+ ]
10136
+ }
10137
+ },
10138
+ "kind": "map"
10139
+ }
10140
+ }
10141
+ },
10142
+ {
10143
+ "abstract": true,
10144
+ "docs": {
10145
+ "default": "- none",
10146
+ "remarks": "The runtime has no AWS SDK, so `@aws-sdk/*` is bundled like\nany other dependency; only exclude modules you provide another way.",
10147
+ "stability": "experimental",
10148
+ "summary": "Modules to leave out of the bundle."
10149
+ },
10150
+ "immutable": true,
10151
+ "locationInModule": {
10152
+ "filename": "src/nodejs-web-function.ts",
10153
+ "line": 48
10154
+ },
10155
+ "name": "externalModules",
10156
+ "optional": true,
10157
+ "type": {
10158
+ "collection": {
10159
+ "elementtype": {
10160
+ "primitive": "string"
10161
+ },
10162
+ "kind": "array"
10163
+ }
10164
+ }
10165
+ },
10166
+ {
10167
+ "abstract": true,
10168
+ "docs": {
10169
+ "default": "- none",
10170
+ "stability": "experimental",
10171
+ "summary": "Text to append to the bundle."
10172
+ },
10173
+ "immutable": true,
10174
+ "locationInModule": {
10175
+ "filename": "src/nodejs-web-function.ts",
10176
+ "line": 76
10177
+ },
10178
+ "name": "footer",
10179
+ "optional": true,
10180
+ "type": {
10181
+ "primitive": "string"
10182
+ }
10183
+ },
10184
+ {
10185
+ "abstract": true,
10186
+ "docs": {
10187
+ "default": "false",
10188
+ "stability": "experimental",
10189
+ "summary": "Always bundle in Docker, even if esbuild is installed locally."
10190
+ },
10191
+ "immutable": true,
10192
+ "locationInModule": {
10193
+ "filename": "src/nodejs-web-function.ts",
10194
+ "line": 111
10195
+ },
10196
+ "name": "forceDockerBundling",
10197
+ "optional": true,
10198
+ "type": {
10199
+ "primitive": "boolean"
10200
+ }
10201
+ },
10202
+ {
10203
+ "abstract": true,
10204
+ "docs": {
10205
+ "default": "OutputFormat.ESM",
10206
+ "remarks": "ESM is written to `index.mjs` (with a `require` shim, so CommonJS dependencies\nsuch as Express work); CommonJS to `index.js`.",
10207
+ "stability": "experimental",
10208
+ "summary": "Output format."
10209
+ },
10210
+ "immutable": true,
10211
+ "locationInModule": {
10212
+ "filename": "src/nodejs-web-function.ts",
10213
+ "line": 33
10214
+ },
10215
+ "name": "format",
10216
+ "optional": true,
10217
+ "type": {
10218
+ "fqn": "aws-cdk-lib.aws_lambda_nodejs.OutputFormat"
10219
+ }
10220
+ },
10221
+ {
10222
+ "abstract": true,
10223
+ "docs": {
10224
+ "default": "false",
10225
+ "stability": "experimental",
10226
+ "summary": "Keep function and class names (`--keep-names`)."
10227
+ },
10228
+ "immutable": true,
10229
+ "locationInModule": {
10230
+ "filename": "src/nodejs-web-function.ts",
10231
+ "line": 90
10232
+ },
10233
+ "name": "keepNames",
10234
+ "optional": true,
10235
+ "type": {
10236
+ "primitive": "boolean"
10237
+ }
10238
+ },
10239
+ {
10240
+ "abstract": true,
10241
+ "docs": {
10242
+ "default": "- esbuild's defaults",
10243
+ "stability": "experimental",
10244
+ "summary": "esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`."
10245
+ },
10246
+ "immutable": true,
10247
+ "locationInModule": {
10248
+ "filename": "src/nodejs-web-function.ts",
10249
+ "line": 62
10250
+ },
10251
+ "name": "loader",
10252
+ "optional": true,
10253
+ "type": {
10254
+ "collection": {
10255
+ "elementtype": {
10256
+ "primitive": "string"
10257
+ },
10258
+ "kind": "map"
10259
+ }
10260
+ }
10261
+ },
10262
+ {
10263
+ "abstract": true,
10264
+ "docs": {
10265
+ "default": "true",
10266
+ "stability": "experimental",
10267
+ "summary": "Minify the bundle."
10268
+ },
10269
+ "immutable": true,
10270
+ "locationInModule": {
10271
+ "filename": "src/nodejs-web-function.ts",
10272
+ "line": 18
10273
+ },
10274
+ "name": "minify",
10275
+ "optional": true,
10276
+ "type": {
10277
+ "primitive": "boolean"
10278
+ }
10279
+ },
10280
+ {
10281
+ "abstract": true,
10282
+ "docs": {
10283
+ "default": "true",
10284
+ "stability": "experimental",
10285
+ "summary": "Generate a source map, and set `NODE_OPTIONS=--enable-source-maps` so stack traces point at your sources."
10286
+ },
10287
+ "immutable": true,
10288
+ "locationInModule": {
10289
+ "filename": "src/nodejs-web-function.ts",
10290
+ "line": 25
10291
+ },
10292
+ "name": "sourceMap",
10293
+ "optional": true,
10294
+ "type": {
10295
+ "primitive": "boolean"
10296
+ }
10297
+ },
10298
+ {
10299
+ "abstract": true,
10300
+ "docs": {
10301
+ "default": "- the runtime's Node.js version, e.g. `node24`",
10302
+ "stability": "experimental",
10303
+ "summary": "esbuild target."
10304
+ },
10305
+ "immutable": true,
10306
+ "locationInModule": {
10307
+ "filename": "src/nodejs-web-function.ts",
10308
+ "line": 40
10309
+ },
10310
+ "name": "target",
10311
+ "optional": true,
10312
+ "type": {
10313
+ "primitive": "string"
10314
+ }
10315
+ },
10316
+ {
10317
+ "abstract": true,
10318
+ "docs": {
10319
+ "default": "- esbuild's lookup from the entry file",
10320
+ "stability": "experimental",
10321
+ "summary": "Path of the tsconfig.json to use, relative to the project root or absolute (inside the project root)."
10322
+ },
10323
+ "immutable": true,
10324
+ "locationInModule": {
10325
+ "filename": "src/nodejs-web-function.ts",
10326
+ "line": 83
10327
+ },
10328
+ "name": "tsconfig",
10329
+ "optional": true,
10330
+ "type": {
10331
+ "primitive": "string"
10332
+ }
10333
+ }
10334
+ ],
10335
+ "symbolId": "src/nodejs-web-function:NodejsWebFunctionBundlingOptions"
10336
+ },
10337
+ "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps": {
10338
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10339
+ "datatype": true,
10340
+ "docs": {
10341
+ "stability": "experimental",
10342
+ "summary": "Properties for a `NodejsWebFunction`."
9766
10343
  },
9767
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10344
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps",
9768
10345
  "interfaces": [
9769
- "aws-cdk-lib.IResource",
9770
- "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef"
10346
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions"
9771
10347
  ],
9772
10348
  "kind": "interface",
9773
10349
  "locationInModule": {
9774
- "filename": "src/web-function.ts",
9775
- "line": 128
10350
+ "filename": "src/nodejs-web-function.ts",
10351
+ "line": 124
9776
10352
  },
9777
- "name": "IWebFunction",
10353
+ "name": "NodejsWebFunctionProps",
9778
10354
  "properties": [
9779
10355
  {
9780
10356
  "abstract": true,
9781
10357
  "docs": {
9782
- "custom": {
9783
- "attribute": "true"
9784
- },
10358
+ "remarks": "It's bundled with its dependencies.",
9785
10359
  "stability": "experimental",
9786
- "summary": "The function's ARN."
10360
+ "summary": "The file that starts your server (TypeScript or JavaScript)."
9787
10361
  },
9788
10362
  "immutable": true,
9789
10363
  "locationInModule": {
9790
- "filename": "src/web-function.ts",
9791
- "line": 141
10364
+ "filename": "src/nodejs-web-function.ts",
10365
+ "line": 128
9792
10366
  },
9793
- "name": "webFunctionArn",
10367
+ "name": "entry",
9794
10368
  "type": {
9795
10369
  "primitive": "string"
9796
10370
  }
@@ -9798,24 +10372,78 @@
9798
10372
  {
9799
10373
  "abstract": true,
9800
10374
  "docs": {
9801
- "custom": {
9802
- "attribute": "true"
9803
- },
10375
+ "default": "- minified ESM with a source map, targeting the runtime's Node.js version",
9804
10376
  "stability": "experimental",
9805
- "summary": "The function's name."
10377
+ "summary": "How the server is bundled."
9806
10378
  },
9807
10379
  "immutable": true,
9808
10380
  "locationInModule": {
9809
- "filename": "src/web-function.ts",
9810
- "line": 134
10381
+ "filename": "src/nodejs-web-function.ts",
10382
+ "line": 156
9811
10383
  },
9812
- "name": "webFunctionName",
10384
+ "name": "bundling",
10385
+ "optional": true,
10386
+ "type": {
10387
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions"
10388
+ }
10389
+ },
10390
+ {
10391
+ "abstract": true,
10392
+ "docs": {
10393
+ "default": "- the nearest `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` or `bun.lock(b)` above the entry",
10394
+ "stability": "experimental",
10395
+ "summary": "The lock file that marks the project root (where esbuild resolves `node_modules`)."
10396
+ },
10397
+ "immutable": true,
10398
+ "locationInModule": {
10399
+ "filename": "src/nodejs-web-function.ts",
10400
+ "line": 142
10401
+ },
10402
+ "name": "depsLockFilePath",
10403
+ "optional": true,
10404
+ "type": {
10405
+ "primitive": "string"
10406
+ }
10407
+ },
10408
+ {
10409
+ "abstract": true,
10410
+ "docs": {
10411
+ "default": "- the directory of the lock file",
10412
+ "remarks": "Must contain the entry file.",
10413
+ "stability": "experimental",
10414
+ "summary": "The project root."
10415
+ },
10416
+ "immutable": true,
10417
+ "locationInModule": {
10418
+ "filename": "src/nodejs-web-function.ts",
10419
+ "line": 149
10420
+ },
10421
+ "name": "projectRoot",
10422
+ "optional": true,
9813
10423
  "type": {
9814
10424
  "primitive": "string"
9815
10425
  }
10426
+ },
10427
+ {
10428
+ "abstract": true,
10429
+ "docs": {
10430
+ "default": "lambda.Runtime.NODEJS_24_X",
10431
+ "stability": "experimental",
10432
+ "summary": "The Node.js runtime."
10433
+ },
10434
+ "immutable": true,
10435
+ "locationInModule": {
10436
+ "filename": "src/nodejs-web-function.ts",
10437
+ "line": 135
10438
+ },
10439
+ "name": "runtime",
10440
+ "optional": true,
10441
+ "type": {
10442
+ "fqn": "aws-cdk-lib.aws_lambda.Runtime"
10443
+ }
9816
10444
  }
9817
10445
  ],
9818
- "symbolId": "src/web-function:IWebFunction"
10446
+ "symbolId": "src/nodejs-web-function:NodejsWebFunctionProps"
9819
10447
  },
9820
10448
  "@ashishpandeyone/cdk-lambda-web-function.WebFunction": {
9821
10449
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
@@ -9824,7 +10452,7 @@
9824
10452
  "custom": {
9825
10453
  "resource": "AWS::Lambda::WebFunction"
9826
10454
  },
9827
- "remarks": "Creates the function, its current revision (code and configuration; any change replaces it),\nan HTTPS endpoint, an execution role, and owns the function's log groups in every region.\n\nImporting existing functions (`fromXxx` methods) is planned after 0.1.",
10455
+ "remarks": "Creates the function, its current revision (code and configuration; any change creates a new one,\nand the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns\nthe function's log groups in every region its endpoints serve from.\n\nImporting existing functions (`fromXxx` methods) is planned after 0.1.",
9828
10456
  "stability": "experimental",
9829
10457
  "summary": "A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions."
9830
10458
  },
@@ -9835,7 +10463,7 @@
9835
10463
  },
9836
10464
  "locationInModule": {
9837
10465
  "filename": "src/web-function.ts",
9838
- "line": 186
10466
+ "line": 221
9839
10467
  },
9840
10468
  "parameters": [
9841
10469
  {
@@ -9865,9 +10493,42 @@
9865
10493
  "kind": "class",
9866
10494
  "locationInModule": {
9867
10495
  "filename": "src/web-function.ts",
9868
- "line": 154
10496
+ "line": 180
9869
10497
  },
9870
10498
  "methods": [
10499
+ {
10500
+ "docs": {
10501
+ "stability": "experimental",
10502
+ "summary": "Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits."
10503
+ },
10504
+ "locationInModule": {
10505
+ "filename": "src/web-function.ts",
10506
+ "line": 323
10507
+ },
10508
+ "name": "addEndpoint",
10509
+ "parameters": [
10510
+ {
10511
+ "docs": {
10512
+ "summary": "the endpoint's construct ID, also used in its generated name (`<id>-<hash>`)."
10513
+ },
10514
+ "name": "id",
10515
+ "type": {
10516
+ "primitive": "string"
10517
+ }
10518
+ },
10519
+ {
10520
+ "name": "options",
10521
+ "type": {
10522
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions"
10523
+ }
10524
+ }
10525
+ ],
10526
+ "returns": {
10527
+ "type": {
10528
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"
10529
+ }
10530
+ }
10531
+ },
9871
10532
  {
9872
10533
  "docs": {
9873
10534
  "remarks": "Names starting with `AWS_` are reserved.",
@@ -9876,7 +10537,7 @@
9876
10537
  },
9877
10538
  "locationInModule": {
9878
10539
  "filename": "src/web-function.ts",
9879
- "line": 278
10540
+ "line": 331
9880
10541
  },
9881
10542
  "name": "addEnvironment",
9882
10543
  "parameters": [
@@ -9906,7 +10567,7 @@
9906
10567
  },
9907
10568
  "locationInModule": {
9908
10569
  "filename": "src/web-function.ts",
9909
- "line": 289
10570
+ "line": 342
9910
10571
  },
9911
10572
  "name": "addToRolePolicy",
9912
10573
  "parameters": [
@@ -9926,7 +10587,7 @@
9926
10587
  },
9927
10588
  "locationInModule": {
9928
10589
  "filename": "src/web-function.ts",
9929
- "line": 297
10590
+ "line": 350
9930
10591
  },
9931
10592
  "name": "grantInvoke",
9932
10593
  "parameters": [
@@ -9949,12 +10610,28 @@
9949
10610
  {
9950
10611
  "docs": {
9951
10612
  "stability": "experimental",
9952
- "summary": "The function's endpoint."
10613
+ "summary": "The revision built from the current code and configuration."
10614
+ },
10615
+ "immutable": true,
10616
+ "locationInModule": {
10617
+ "filename": "src/web-function.ts",
10618
+ "line": 188
10619
+ },
10620
+ "name": "currentRevision",
10621
+ "type": {
10622
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
10623
+ }
10624
+ },
10625
+ {
10626
+ "docs": {
10627
+ "remarks": "Add more with `addEndpoint`.",
10628
+ "stability": "experimental",
10629
+ "summary": "The default endpoint."
9953
10630
  },
9954
10631
  "immutable": true,
9955
10632
  "locationInModule": {
9956
10633
  "filename": "src/web-function.ts",
9957
- "line": 162
10634
+ "line": 191
9958
10635
  },
9959
10636
  "name": "endpoint",
9960
10637
  "type": {
@@ -9969,7 +10646,7 @@
9969
10646
  "immutable": true,
9970
10647
  "locationInModule": {
9971
10648
  "filename": "src/web-function.ts",
9972
- "line": 171
10649
+ "line": 200
9973
10650
  },
9974
10651
  "name": "grantPrincipal",
9975
10652
  "overrides": "aws-cdk-lib.aws_iam.IGrantable",
@@ -9980,12 +10657,12 @@
9980
10657
  {
9981
10658
  "docs": {
9982
10659
  "stability": "experimental",
9983
- "summary": "Grants on the function (e.g. `grants.invoke(principal)`)."
10660
+ "summary": "Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`."
9984
10661
  },
9985
10662
  "immutable": true,
9986
10663
  "locationInModule": {
9987
10664
  "filename": "src/web-function.ts",
9988
- "line": 165
10665
+ "line": 194
9989
10666
  },
9990
10667
  "name": "grants",
9991
10668
  "type": {
@@ -10001,7 +10678,7 @@
10001
10678
  "immutable": true,
10002
10679
  "locationInModule": {
10003
10680
  "filename": "src/web-function.ts",
10004
- "line": 177
10681
+ "line": 206
10005
10682
  },
10006
10683
  "name": "logGroup",
10007
10684
  "type": {
@@ -10010,13 +10687,14 @@
10010
10687
  },
10011
10688
  {
10012
10689
  "docs": {
10690
+ "remarks": "Same as `currentRevision.revisionId`.",
10013
10691
  "stability": "experimental",
10014
10692
  "summary": "The ID of the current revision."
10015
10693
  },
10016
10694
  "immutable": true,
10017
10695
  "locationInModule": {
10018
10696
  "filename": "src/web-function.ts",
10019
- "line": 159
10697
+ "line": 185
10020
10698
  },
10021
10699
  "name": "revisionId",
10022
10700
  "type": {
@@ -10031,7 +10709,7 @@
10031
10709
  "immutable": true,
10032
10710
  "locationInModule": {
10033
10711
  "filename": "src/web-function.ts",
10034
- "line": 168
10712
+ "line": 197
10035
10713
  },
10036
10714
  "name": "role",
10037
10715
  "type": {
@@ -10046,7 +10724,7 @@
10046
10724
  "immutable": true,
10047
10725
  "locationInModule": {
10048
10726
  "filename": "src/web-function.ts",
10049
- "line": 156
10727
+ "line": 182
10050
10728
  },
10051
10729
  "name": "webFunctionArn",
10052
10730
  "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
@@ -10062,80 +10740,264 @@
10062
10740
  "immutable": true,
10063
10741
  "locationInModule": {
10064
10742
  "filename": "src/web-function.ts",
10065
- "line": 155
10743
+ "line": 181
10066
10744
  },
10067
10745
  "name": "webFunctionName",
10068
10746
  "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10069
10747
  "type": {
10070
- "primitive": "string"
10748
+ "primitive": "string"
10749
+ }
10750
+ },
10751
+ {
10752
+ "docs": {
10753
+ "stability": "experimental",
10754
+ "summary": "A reference to this function, for APIs that accept `lambda.IWebFunctionRef`."
10755
+ },
10756
+ "immutable": true,
10757
+ "locationInModule": {
10758
+ "filename": "src/web-function.ts",
10759
+ "line": 217
10760
+ },
10761
+ "name": "webFunctionRef",
10762
+ "overrides": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
10763
+ "type": {
10764
+ "fqn": "aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference"
10765
+ }
10766
+ }
10767
+ ],
10768
+ "symbolId": "src/web-function:WebFunction"
10769
+ },
10770
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType": {
10771
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10772
+ "docs": {
10773
+ "stability": "experimental",
10774
+ "summary": "How callers of a Web Function endpoint are authenticated."
10775
+ },
10776
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType",
10777
+ "kind": "enum",
10778
+ "locationInModule": {
10779
+ "filename": "src/enums.ts",
10780
+ "line": 4
10781
+ },
10782
+ "members": [
10783
+ {
10784
+ "docs": {
10785
+ "stability": "experimental",
10786
+ "summary": "Requests must be signed with SigV4 or SigV4a (signing name `lambda`) by a principal allowed `lambda:InvokeWebFunctionEndpoint` on the endpoint."
10787
+ },
10788
+ "name": "AWS_IAM"
10789
+ },
10790
+ {
10791
+ "docs": {
10792
+ "remarks": "The `Authorization` header reaches your application untouched.",
10793
+ "stability": "experimental",
10794
+ "summary": "No authentication by Lambda: the endpoint is public and your application authenticates requests itself."
10795
+ },
10796
+ "name": "NONE"
10797
+ }
10798
+ ],
10799
+ "name": "WebFunctionAuthType",
10800
+ "symbolId": "src/enums:WebFunctionAuthType"
10801
+ },
10802
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions": {
10803
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10804
+ "datatype": true,
10805
+ "docs": {
10806
+ "stability": "experimental",
10807
+ "summary": "Options for a canary deployment."
10808
+ },
10809
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions",
10810
+ "kind": "interface",
10811
+ "locationInModule": {
10812
+ "filename": "src/web-function-deployment.ts",
10813
+ "line": 12
10814
+ },
10815
+ "name": "WebFunctionCanaryDeploymentOptions",
10816
+ "properties": [
10817
+ {
10818
+ "abstract": true,
10819
+ "docs": {
10820
+ "remarks": "Make it longer than the time your alarms need to fire (period × evaluation periods).",
10821
+ "stability": "experimental",
10822
+ "summary": "How long the new revision serves `percent` before it gets all traffic (1-45 minutes)."
10823
+ },
10824
+ "immutable": true,
10825
+ "locationInModule": {
10826
+ "filename": "src/web-function-deployment.ts",
10827
+ "line": 22
10828
+ },
10829
+ "name": "bake",
10830
+ "type": {
10831
+ "fqn": "aws-cdk-lib.Duration"
10832
+ }
10833
+ },
10834
+ {
10835
+ "abstract": true,
10836
+ "docs": {
10837
+ "stability": "experimental",
10838
+ "summary": "The share of traffic, in whole percent (1-99), that the new revision gets first."
10839
+ },
10840
+ "immutable": true,
10841
+ "locationInModule": {
10842
+ "filename": "src/web-function-deployment.ts",
10843
+ "line": 16
10844
+ },
10845
+ "name": "percent",
10846
+ "type": {
10847
+ "primitive": "number"
10071
10848
  }
10072
10849
  },
10073
10850
  {
10851
+ "abstract": true,
10074
10852
  "docs": {
10853
+ "default": "- no alarms: traffic moves on a timer",
10854
+ "remarks": "They're checked before traffic moves, during the bake, and once the new revision has all traffic.\nUse alarms in any region (by ARN), including composite alarms.",
10075
10855
  "stability": "experimental",
10076
- "summary": "A reference to this function, for APIs that accept `lambda.IWebFunctionRef`."
10856
+ "summary": "Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back."
10077
10857
  },
10078
10858
  "immutable": true,
10079
10859
  "locationInModule": {
10080
- "filename": "src/web-function.ts",
10081
- "line": 182
10860
+ "filename": "src/web-function-deployment.ts",
10861
+ "line": 33
10082
10862
  },
10083
- "name": "webFunctionRef",
10084
- "overrides": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
10863
+ "name": "alarms",
10864
+ "optional": true,
10085
10865
  "type": {
10086
- "fqn": "aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference"
10866
+ "collection": {
10867
+ "elementtype": {
10868
+ "fqn": "aws-cdk-lib.aws_cloudwatch.IAlarm"
10869
+ },
10870
+ "kind": "array"
10871
+ }
10087
10872
  }
10088
10873
  }
10089
10874
  ],
10090
- "symbolId": "src/web-function:WebFunction"
10875
+ "symbolId": "src/web-function-deployment:WebFunctionCanaryDeploymentOptions"
10091
10876
  },
10092
- "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType": {
10877
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment": {
10093
10878
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10094
10879
  "docs": {
10095
10880
  "stability": "experimental",
10096
- "summary": "How callers of a Web Function endpoint are authenticated."
10881
+ "summary": "How an endpoint moves its traffic to a new revision."
10097
10882
  },
10098
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType",
10099
- "kind": "enum",
10883
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment",
10884
+ "kind": "class",
10100
10885
  "locationInModule": {
10101
- "filename": "src/enums.ts",
10102
- "line": 4
10886
+ "filename": "src/web-function-deployment.ts",
10887
+ "line": 65
10103
10888
  },
10104
- "members": [
10889
+ "methods": [
10105
10890
  {
10106
10891
  "docs": {
10107
10892
  "stability": "experimental",
10108
- "summary": "Requests must be signed with SigV4 or SigV4a (signing name `lambda`) by a principal allowed `lambda:InvokeWebFunctionEndpoint` on the endpoint."
10893
+ "summary": "All traffic moves to the new revision at once, as soon as it's ready (the default)."
10109
10894
  },
10110
- "name": "AWS_IAM"
10895
+ "locationInModule": {
10896
+ "filename": "src/web-function-deployment.ts",
10897
+ "line": 69
10898
+ },
10899
+ "name": "allAtOnce",
10900
+ "returns": {
10901
+ "type": {
10902
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
10903
+ }
10904
+ },
10905
+ "static": true
10111
10906
  },
10112
10907
  {
10113
10908
  "docs": {
10114
- "remarks": "The `Authorization` header reaches your application untouched.",
10115
10909
  "stability": "experimental",
10116
- "summary": "No authentication by Lambda: the endpoint is public and your application authenticates requests itself."
10910
+ "summary": "The new revision first gets `percent` of the traffic for `bake`, then all of it."
10117
10911
  },
10118
- "name": "NONE"
10912
+ "locationInModule": {
10913
+ "filename": "src/web-function-deployment.ts",
10914
+ "line": 76
10915
+ },
10916
+ "name": "canary",
10917
+ "parameters": [
10918
+ {
10919
+ "name": "options",
10920
+ "type": {
10921
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"
10922
+ }
10923
+ }
10924
+ ],
10925
+ "returns": {
10926
+ "type": {
10927
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
10928
+ }
10929
+ },
10930
+ "static": true
10931
+ },
10932
+ {
10933
+ "docs": {
10934
+ "stability": "experimental",
10935
+ "summary": "The new revision gets `percent` more of the traffic every `interval` until it has all of it."
10936
+ },
10937
+ "locationInModule": {
10938
+ "filename": "src/web-function-deployment.ts",
10939
+ "line": 85
10940
+ },
10941
+ "name": "linear",
10942
+ "parameters": [
10943
+ {
10944
+ "name": "options",
10945
+ "type": {
10946
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions"
10947
+ }
10948
+ }
10949
+ ],
10950
+ "returns": {
10951
+ "type": {
10952
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
10953
+ }
10954
+ },
10955
+ "static": true
10119
10956
  }
10120
10957
  ],
10121
- "name": "WebFunctionAuthType",
10122
- "symbolId": "src/enums:WebFunctionAuthType"
10958
+ "name": "WebFunctionDeployment",
10959
+ "symbolId": "src/web-function-deployment:WebFunctionDeployment"
10123
10960
  },
10124
10961
  "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint": {
10125
10962
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10126
10963
  "base": "constructs.Construct",
10127
10964
  "docs": {
10128
- "remarks": "Only `WebFunction` creates endpoints in this version (one per function), so the constructor is private.",
10965
+ "remarks": "Endpoints are created only through `WebFunction`, which owns their log groups in every region, so the constructor is private.",
10129
10966
  "stability": "experimental",
10130
- "summary": "The HTTPS endpoint of a Web Function. Created by `WebFunction`; access it as `fn.endpoint`."
10967
+ "summary": "An HTTPS endpoint of a Web Function: `fn.endpoint` (the default one) or the result of `fn.addEndpoint()`."
10131
10968
  },
10132
10969
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint",
10133
10970
  "kind": "class",
10134
10971
  "locationInModule": {
10135
10972
  "filename": "src/web-function-endpoint.ts",
10136
- "line": 65
10973
+ "line": 150
10137
10974
  },
10138
10975
  "methods": [
10976
+ {
10977
+ "docs": {
10978
+ "remarks": "Shortcut for `grants.invoke(grantee)`.\n[disable-awslint:no-grants]",
10979
+ "stability": "experimental",
10980
+ "summary": "Allows `grantee` to call this endpoint."
10981
+ },
10982
+ "locationInModule": {
10983
+ "filename": "src/web-function-endpoint.ts",
10984
+ "line": 328
10985
+ },
10986
+ "name": "grantInvoke",
10987
+ "parameters": [
10988
+ {
10989
+ "name": "grantee",
10990
+ "type": {
10991
+ "fqn": "aws-cdk-lib.aws_iam.IGrantable"
10992
+ }
10993
+ }
10994
+ ],
10995
+ "returns": {
10996
+ "type": {
10997
+ "fqn": "aws-cdk-lib.aws_iam.Grant"
10998
+ }
10999
+ }
11000
+ },
10139
11001
  {
10140
11002
  "docs": {
10141
11003
  "remarks": "Only for `PER_REGION` endpoints.",
@@ -10144,7 +11006,7 @@
10144
11006
  },
10145
11007
  "locationInModule": {
10146
11008
  "filename": "src/web-function-endpoint.ts",
10147
- "line": 146
11009
+ "line": 275
10148
11010
  },
10149
11011
  "name": "regionalUrl",
10150
11012
  "parameters": [
@@ -10163,10 +11025,57 @@
10163
11025
  "primitive": "string"
10164
11026
  }
10165
11027
  }
11028
+ },
11029
+ {
11030
+ "docs": {
11031
+ "remarks": "`revision` gets the rest).\n\nUse it to keep an endpoint on an earlier revision (`WebFunctionRevision.fromRevisionAttributes`),\nor to send part of the traffic to the current revision:\n`fn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }])`.\nCan be called once per endpoint, and not on one created with `revision` or `additionalRevisions`.",
11032
+ "stability": "experimental",
11033
+ "summary": "Routes the endpoint to `revision` instead of the function's current revision, optionally sharing traffic with one more revision (`additionalRevisions`, which gets its weight;"
11034
+ },
11035
+ "locationInModule": {
11036
+ "filename": "src/web-function-endpoint.ts",
11037
+ "line": 303
11038
+ },
11039
+ "name": "routeTraffic",
11040
+ "parameters": [
11041
+ {
11042
+ "name": "revision",
11043
+ "type": {
11044
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
11045
+ }
11046
+ },
11047
+ {
11048
+ "name": "additionalRevisions",
11049
+ "optional": true,
11050
+ "type": {
11051
+ "collection": {
11052
+ "elementtype": {
11053
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight"
11054
+ },
11055
+ "kind": "array"
11056
+ }
11057
+ }
11058
+ }
11059
+ ]
10166
11060
  }
10167
11061
  ],
10168
11062
  "name": "WebFunctionEndpoint",
10169
11063
  "properties": [
11064
+ {
11065
+ "docs": {
11066
+ "stability": "experimental",
11067
+ "summary": "How callers of the endpoint are authenticated."
11068
+ },
11069
+ "immutable": true,
11070
+ "locationInModule": {
11071
+ "filename": "src/web-function-endpoint.ts",
11072
+ "line": 170
11073
+ },
11074
+ "name": "authType",
11075
+ "type": {
11076
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType"
11077
+ }
11078
+ },
10170
11079
  {
10171
11080
  "docs": {
10172
11081
  "stability": "experimental",
@@ -10175,7 +11084,7 @@
10175
11084
  "immutable": true,
10176
11085
  "locationInModule": {
10177
11086
  "filename": "src/web-function-endpoint.ts",
10178
- "line": 90
11087
+ "line": 178
10179
11088
  },
10180
11089
  "name": "domainName",
10181
11090
  "type": {
@@ -10190,7 +11099,7 @@
10190
11099
  "immutable": true,
10191
11100
  "locationInModule": {
10192
11101
  "filename": "src/web-function-endpoint.ts",
10193
- "line": 79
11102
+ "line": 164
10194
11103
  },
10195
11104
  "name": "endpointArn",
10196
11105
  "type": {
@@ -10205,7 +11114,7 @@
10205
11114
  "immutable": true,
10206
11115
  "locationInModule": {
10207
11116
  "filename": "src/web-function-endpoint.ts",
10208
- "line": 76
11117
+ "line": 161
10209
11118
  },
10210
11119
  "name": "endpointName",
10211
11120
  "type": {
@@ -10220,13 +11129,28 @@
10220
11129
  "immutable": true,
10221
11130
  "locationInModule": {
10222
11131
  "filename": "src/web-function-endpoint.ts",
10223
- "line": 82
11132
+ "line": 167
10224
11133
  },
10225
11134
  "name": "endpointType",
10226
11135
  "type": {
10227
11136
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType"
10228
11137
  }
10229
11138
  },
11139
+ {
11140
+ "docs": {
11141
+ "stability": "experimental",
11142
+ "summary": "Grants on this endpoint (e.g. `grants.invoke(principal)`)."
11143
+ },
11144
+ "immutable": true,
11145
+ "locationInModule": {
11146
+ "filename": "src/web-function-endpoint.ts",
11147
+ "line": 186
11148
+ },
11149
+ "name": "grants",
11150
+ "type": {
11151
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants"
11152
+ }
11153
+ },
10230
11154
  {
10231
11155
  "docs": {
10232
11156
  "stability": "experimental",
@@ -10235,7 +11159,7 @@
10235
11159
  "immutable": true,
10236
11160
  "locationInModule": {
10237
11161
  "filename": "src/web-function-endpoint.ts",
10238
- "line": 85
11162
+ "line": 173
10239
11163
  },
10240
11164
  "name": "regions",
10241
11165
  "type": {
@@ -10255,7 +11179,7 @@
10255
11179
  "immutable": true,
10256
11180
  "locationInModule": {
10257
11181
  "filename": "src/web-function-endpoint.ts",
10258
- "line": 95
11182
+ "line": 183
10259
11183
  },
10260
11184
  "name": "url",
10261
11185
  "type": {
@@ -10276,22 +11200,59 @@
10276
11200
  "kind": "interface",
10277
11201
  "locationInModule": {
10278
11202
  "filename": "src/web-function-endpoint.ts",
10279
- "line": 12
11203
+ "line": 32
10280
11204
  },
10281
11205
  "name": "WebFunctionEndpointOptions",
10282
11206
  "properties": [
10283
11207
  {
10284
11208
  "abstract": true,
10285
11209
  "docs": {
10286
- "default": "- `default-<hash of type and regions>`",
10287
- "remarks": "When omitted, the name is `default-<hash>`, with the hash covering the endpoint type and regions,\nso changing either deploys a new endpoint cleanly. When set, changing the endpoint type or\nregions also requires a new name: two endpoints of one function can't share a name, and\nCloudFormation creates the replacement before deleting the old one.",
11210
+ "default": "WebFunctionDeployment.allAtOnce()",
11211
+ "remarks": "A deployment in steps can't be combined with `revision`, `additionalRevisions` or `routeTraffic()`.",
10288
11212
  "stability": "experimental",
10289
- "summary": "The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header."
11213
+ "summary": "How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM."
10290
11214
  },
10291
11215
  "immutable": true,
10292
11216
  "locationInModule": {
10293
11217
  "filename": "src/web-function-endpoint.ts",
10294
- "line": 40
11218
+ "line": 99
11219
+ },
11220
+ "name": "deployment",
11221
+ "optional": true,
11222
+ "type": {
11223
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11224
+ }
11225
+ },
11226
+ {
11227
+ "abstract": true,
11228
+ "docs": {
11229
+ "default": "- no description",
11230
+ "stability": "experimental",
11231
+ "summary": "A description of the endpoint."
11232
+ },
11233
+ "immutable": true,
11234
+ "locationInModule": {
11235
+ "filename": "src/web-function-endpoint.ts",
11236
+ "line": 68
11237
+ },
11238
+ "name": "description",
11239
+ "optional": true,
11240
+ "type": {
11241
+ "primitive": "string"
11242
+ }
11243
+ },
11244
+ {
11245
+ "abstract": true,
11246
+ "docs": {
11247
+ "default": "- `default-<hash>` for the function's default endpoint, `<id>-<hash>` for endpoints added with `addEndpoint`",
11248
+ "remarks": "When omitted, the name ends in a hash of the endpoint type and regions, so changing either deploys\na new endpoint cleanly. When set, changing the endpoint type or regions also requires a new name:\ntwo endpoints of one function can't share a name, and CloudFormation creates the replacement\nbefore deleting the old one.",
11249
+ "stability": "experimental",
11250
+ "summary": "The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function."
11251
+ },
11252
+ "immutable": true,
11253
+ "locationInModule": {
11254
+ "filename": "src/web-function-endpoint.ts",
11255
+ "line": 61
10295
11256
  },
10296
11257
  "name": "endpointName",
10297
11258
  "optional": true,
@@ -10309,7 +11270,7 @@
10309
11270
  "immutable": true,
10310
11271
  "locationInModule": {
10311
11272
  "filename": "src/web-function-endpoint.ts",
10312
- "line": 18
11273
+ "line": 38
10313
11274
  },
10314
11275
  "name": "endpointType",
10315
11276
  "optional": true,
@@ -10317,6 +11278,44 @@
10317
11278
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType"
10318
11279
  }
10319
11280
  },
11281
+ {
11282
+ "abstract": true,
11283
+ "docs": {
11284
+ "default": "- scales within the account's vCPU quota",
11285
+ "remarks": "Enforced separately in each region the endpoint serves from.",
11286
+ "stability": "experimental",
11287
+ "summary": "The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota."
11288
+ },
11289
+ "immutable": true,
11290
+ "locationInModule": {
11291
+ "filename": "src/web-function-endpoint.ts",
11292
+ "line": 88
11293
+ },
11294
+ "name": "maxEnvironments",
11295
+ "optional": true,
11296
+ "type": {
11297
+ "primitive": "number"
11298
+ }
11299
+ },
11300
+ {
11301
+ "abstract": true,
11302
+ "docs": {
11303
+ "default": "- no limit beyond the service quota of 10,000 requests per second per endpoint (per region)",
11304
+ "remarks": "excess requests get HTTP 429.\nAllowed: 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000.\n\nEnforced separately in each region the endpoint serves from, so a multi-region endpoint\ncan accept this many requests per second in every region.",
11305
+ "stability": "experimental",
11306
+ "summary": "The most requests per second the endpoint accepts;"
11307
+ },
11308
+ "immutable": true,
11309
+ "locationInModule": {
11310
+ "filename": "src/web-function-endpoint.ts",
11311
+ "line": 79
11312
+ },
11313
+ "name": "rateLimit",
11314
+ "optional": true,
11315
+ "type": {
11316
+ "primitive": "number"
11317
+ }
11318
+ },
10320
11319
  {
10321
11320
  "abstract": true,
10322
11321
  "docs": {
@@ -10328,7 +11327,7 @@
10328
11327
  "immutable": true,
10329
11328
  "locationInModule": {
10330
11329
  "filename": "src/web-function-endpoint.ts",
10331
- "line": 28
11330
+ "line": 48
10332
11331
  },
10333
11332
  "name": "regions",
10334
11333
  "optional": true,
@@ -10385,9 +11384,9 @@
10385
11384
  "@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants": {
10386
11385
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10387
11386
  "docs": {
10388
- "remarks": "Access it as `fn.grants`.",
11387
+ "remarks": "Access them as `fn.grants` (the default endpoint) or `endpoint.grants`.",
10389
11388
  "stability": "experimental",
10390
- "summary": "Grants on a Web Function."
11389
+ "summary": "Grants on a Web Function endpoint."
10391
11390
  },
10392
11391
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants",
10393
11392
  "kind": "class",
@@ -10400,7 +11399,7 @@
10400
11399
  "docs": {
10401
11400
  "remarks": "The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the\nendpoint serves from, including a MULTI_REGION global URL.",
10402
11401
  "stability": "experimental",
10403
- "summary": "Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`)."
11402
+ "summary": "Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`)."
10404
11403
  },
10405
11404
  "locationInModule": {
10406
11405
  "filename": "src/web-function-grants.ts",
@@ -10425,68 +11424,109 @@
10425
11424
  "name": "WebFunctionGrants",
10426
11425
  "symbolId": "src/web-function-grants:WebFunctionGrants"
10427
11426
  },
10428
- "@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps": {
11427
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions": {
10429
11428
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10430
11429
  "datatype": true,
10431
11430
  "docs": {
10432
11431
  "stability": "experimental",
10433
- "summary": "Properties for a `WebFunction`."
11432
+ "summary": "Options for a linear deployment."
10434
11433
  },
10435
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps",
11434
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions",
10436
11435
  "kind": "interface",
10437
11436
  "locationInModule": {
10438
- "filename": "src/web-function.ts",
10439
- "line": 16
11437
+ "filename": "src/web-function-deployment.ts",
11438
+ "line": 39
10440
11439
  },
10441
- "name": "WebFunctionProps",
11440
+ "name": "WebFunctionLinearDeploymentOptions",
10442
11441
  "properties": [
10443
11442
  {
10444
11443
  "abstract": true,
10445
11444
  "docs": {
10446
11445
  "stability": "experimental",
10447
- "summary": "How callers of the endpoint are authenticated."
11446
+ "summary": "How long each step serves before the next one (at least 1 minute, and at most 45 minutes in total)."
10448
11447
  },
10449
11448
  "immutable": true,
10450
11449
  "locationInModule": {
10451
- "filename": "src/web-function.ts",
10452
- "line": 33
11450
+ "filename": "src/web-function-deployment.ts",
11451
+ "line": 48
10453
11452
  },
10454
- "name": "authType",
11453
+ "name": "interval",
10455
11454
  "type": {
10456
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType"
11455
+ "fqn": "aws-cdk-lib.Duration"
10457
11456
  }
10458
11457
  },
10459
11458
  {
10460
11459
  "abstract": true,
10461
11460
  "docs": {
10462
- "remarks": "The code is copied into the stack's code bucket, which Lambda Web Functions can read.",
10463
11461
  "stability": "experimental",
10464
- "summary": "The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported."
11462
+ "summary": "The share of traffic, in whole percent (5-50), that moves to the new revision at each step."
10465
11463
  },
10466
11464
  "immutable": true,
10467
11465
  "locationInModule": {
10468
- "filename": "src/web-function.ts",
10469
- "line": 28
11466
+ "filename": "src/web-function-deployment.ts",
11467
+ "line": 43
10470
11468
  },
10471
- "name": "code",
11469
+ "name": "percent",
10472
11470
  "type": {
10473
- "fqn": "aws-cdk-lib.aws_lambda.Code"
11471
+ "primitive": "number"
10474
11472
  }
10475
11473
  },
10476
11474
  {
10477
11475
  "abstract": true,
10478
11476
  "docs": {
11477
+ "default": "- no alarms: traffic moves on a timer",
11478
+ "remarks": "They're checked before traffic moves, during every step, and once the new revision has all traffic.\nUse alarms in any region (by ARN), including composite alarms.",
10479
11479
  "stability": "experimental",
10480
- "summary": "The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`."
11480
+ "summary": "Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back."
11481
+ },
11482
+ "immutable": true,
11483
+ "locationInModule": {
11484
+ "filename": "src/web-function-deployment.ts",
11485
+ "line": 59
11486
+ },
11487
+ "name": "alarms",
11488
+ "optional": true,
11489
+ "type": {
11490
+ "collection": {
11491
+ "elementtype": {
11492
+ "fqn": "aws-cdk-lib.aws_cloudwatch.IAlarm"
11493
+ },
11494
+ "kind": "array"
11495
+ }
11496
+ }
11497
+ }
11498
+ ],
11499
+ "symbolId": "src/web-function-deployment:WebFunctionLinearDeploymentOptions"
11500
+ },
11501
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions": {
11502
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11503
+ "datatype": true,
11504
+ "docs": {
11505
+ "stability": "experimental",
11506
+ "summary": "Options shared by `WebFunction` and `NodejsWebFunction`: everything except how the code is supplied."
11507
+ },
11508
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions",
11509
+ "kind": "interface",
11510
+ "locationInModule": {
11511
+ "filename": "src/web-function.ts",
11512
+ "line": 21
11513
+ },
11514
+ "name": "WebFunctionOptions",
11515
+ "properties": [
11516
+ {
11517
+ "abstract": true,
11518
+ "docs": {
11519
+ "stability": "experimental",
11520
+ "summary": "How callers of the endpoint are authenticated."
10481
11521
  },
10482
11522
  "immutable": true,
10483
11523
  "locationInModule": {
10484
11524
  "filename": "src/web-function.ts",
10485
- "line": 20
11525
+ "line": 25
10486
11526
  },
10487
- "name": "runtime",
11527
+ "name": "authType",
10488
11528
  "type": {
10489
- "fqn": "aws-cdk-lib.aws_lambda.Runtime"
11529
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType"
10490
11530
  }
10491
11531
  },
10492
11532
  {
@@ -10499,7 +11539,7 @@
10499
11539
  "immutable": true,
10500
11540
  "locationInModule": {
10501
11541
  "filename": "src/web-function.ts",
10502
- "line": 115
11542
+ "line": 114
10503
11543
  },
10504
11544
  "name": "applicationLogLevelV2",
10505
11545
  "optional": true,
@@ -10517,7 +11557,7 @@
10517
11557
  "immutable": true,
10518
11558
  "locationInModule": {
10519
11559
  "filename": "src/web-function.ts",
10520
- "line": 61
11560
+ "line": 60
10521
11561
  },
10522
11562
  "name": "description",
10523
11563
  "optional": true,
@@ -10528,14 +11568,14 @@
10528
11568
  {
10529
11569
  "abstract": true,
10530
11570
  "docs": {
10531
- "default": "- a HOME_REGION endpoint",
11571
+ "default": "- a HOME_REGION endpoint serving the current revision",
10532
11572
  "stability": "experimental",
10533
- "summary": "The endpoint: where it serves from, and its name."
11573
+ "summary": "The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`."
10534
11574
  },
10535
11575
  "immutable": true,
10536
11576
  "locationInModule": {
10537
11577
  "filename": "src/web-function.ts",
10538
- "line": 40
11578
+ "line": 34
10539
11579
  },
10540
11580
  "name": "endpoint",
10541
11581
  "optional": true,
@@ -10543,24 +11583,6 @@
10543
11583
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"
10544
11584
  }
10545
11585
  },
10546
- {
10547
- "abstract": true,
10548
- "docs": {
10549
- "default": "'index.js'",
10550
- "stability": "experimental",
10551
- "summary": "The file that starts your server, relative to the root of the code."
10552
- },
10553
- "immutable": true,
10554
- "locationInModule": {
10555
- "filename": "src/web-function.ts",
10556
- "line": 47
10557
- },
10558
- "name": "entrypoint",
10559
- "optional": true,
10560
- "type": {
10561
- "primitive": "string"
10562
- }
10563
- },
10564
11586
  {
10565
11587
  "abstract": true,
10566
11588
  "docs": {
@@ -10572,7 +11594,7 @@
10572
11594
  "immutable": true,
10573
11595
  "locationInModule": {
10574
11596
  "filename": "src/web-function.ts",
10575
- "line": 78
11597
+ "line": 77
10576
11598
  },
10577
11599
  "name": "environment",
10578
11600
  "optional": true,
@@ -10596,7 +11618,7 @@
10596
11618
  "immutable": true,
10597
11619
  "locationInModule": {
10598
11620
  "filename": "src/web-function.ts",
10599
- "line": 108
11621
+ "line": 107
10600
11622
  },
10601
11623
  "name": "logRemovalPolicy",
10602
11624
  "optional": true,
@@ -10614,7 +11636,7 @@
10614
11636
  "immutable": true,
10615
11637
  "locationInModule": {
10616
11638
  "filename": "src/web-function.ts",
10617
- "line": 100
11639
+ "line": 99
10618
11640
  },
10619
11641
  "name": "logRetention",
10620
11642
  "optional": true,
@@ -10633,7 +11655,7 @@
10633
11655
  "immutable": true,
10634
11656
  "locationInModule": {
10635
11657
  "filename": "src/web-function.ts",
10636
- "line": 93
11658
+ "line": 92
10637
11659
  },
10638
11660
  "name": "maxConcurrencyPerEnvironment",
10639
11661
  "optional": true,
@@ -10641,6 +11663,25 @@
10641
11663
  "primitive": "number"
10642
11664
  }
10643
11665
  },
11666
+ {
11667
+ "abstract": true,
11668
+ "docs": {
11669
+ "default": "20",
11670
+ "remarks": "Each deployment that changes the code or\nconfiguration creates a revision; older ones stay available to roll back to or route traffic to,\nand the oldest beyond this count are deleted after each deployment.\n\nRevisions that an endpoint routes to are never deleted, and neither are those the previous\ndeployment used (a rollback returns to them).",
11671
+ "stability": "experimental",
11672
+ "summary": "How many of the newest revisions to keep (1-50)."
11673
+ },
11674
+ "immutable": true,
11675
+ "locationInModule": {
11676
+ "filename": "src/web-function.ts",
11677
+ "line": 46
11678
+ },
11679
+ "name": "revisionRetention",
11680
+ "optional": true,
11681
+ "type": {
11682
+ "primitive": "number"
11683
+ }
11684
+ },
10644
11685
  {
10645
11686
  "abstract": true,
10646
11687
  "docs": {
@@ -10652,7 +11693,7 @@
10652
11693
  "immutable": true,
10653
11694
  "locationInModule": {
10654
11695
  "filename": "src/web-function.ts",
10655
- "line": 71
11696
+ "line": 70
10656
11697
  },
10657
11698
  "name": "role",
10658
11699
  "optional": true,
@@ -10670,7 +11711,7 @@
10670
11711
  "immutable": true,
10671
11712
  "locationInModule": {
10672
11713
  "filename": "src/web-function.ts",
10673
- "line": 122
11714
+ "line": 121
10674
11715
  },
10675
11716
  "name": "systemLogLevelV2",
10676
11717
  "optional": true,
@@ -10688,7 +11729,7 @@
10688
11729
  "immutable": true,
10689
11730
  "locationInModule": {
10690
11731
  "filename": "src/web-function.ts",
10691
- "line": 85
11732
+ "line": 84
10692
11733
  },
10693
11734
  "name": "timeout",
10694
11735
  "optional": true,
@@ -10707,7 +11748,7 @@
10707
11748
  "immutable": true,
10708
11749
  "locationInModule": {
10709
11750
  "filename": "src/web-function.ts",
10710
- "line": 54
11751
+ "line": 53
10711
11752
  },
10712
11753
  "name": "webFunctionName",
10713
11754
  "optional": true,
@@ -10716,9 +11757,290 @@
10716
11757
  }
10717
11758
  }
10718
11759
  ],
11760
+ "symbolId": "src/web-function:WebFunctionOptions"
11761
+ },
11762
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps": {
11763
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11764
+ "datatype": true,
11765
+ "docs": {
11766
+ "stability": "experimental",
11767
+ "summary": "Properties for a `WebFunction`."
11768
+ },
11769
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps",
11770
+ "interfaces": [
11771
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions"
11772
+ ],
11773
+ "kind": "interface",
11774
+ "locationInModule": {
11775
+ "filename": "src/web-function.ts",
11776
+ "line": 127
11777
+ },
11778
+ "name": "WebFunctionProps",
11779
+ "properties": [
11780
+ {
11781
+ "abstract": true,
11782
+ "docs": {
11783
+ "remarks": "The code is copied into the stack's code bucket, which Lambda Web Functions can read.",
11784
+ "stability": "experimental",
11785
+ "summary": "The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported."
11786
+ },
11787
+ "immutable": true,
11788
+ "locationInModule": {
11789
+ "filename": "src/web-function.ts",
11790
+ "line": 139
11791
+ },
11792
+ "name": "code",
11793
+ "type": {
11794
+ "fqn": "aws-cdk-lib.aws_lambda.Code"
11795
+ }
11796
+ },
11797
+ {
11798
+ "abstract": true,
11799
+ "docs": {
11800
+ "stability": "experimental",
11801
+ "summary": "The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`."
11802
+ },
11803
+ "immutable": true,
11804
+ "locationInModule": {
11805
+ "filename": "src/web-function.ts",
11806
+ "line": 131
11807
+ },
11808
+ "name": "runtime",
11809
+ "type": {
11810
+ "fqn": "aws-cdk-lib.aws_lambda.Runtime"
11811
+ }
11812
+ },
11813
+ {
11814
+ "abstract": true,
11815
+ "docs": {
11816
+ "default": "'index.js'",
11817
+ "stability": "experimental",
11818
+ "summary": "The file that starts your server, relative to the root of the code."
11819
+ },
11820
+ "immutable": true,
11821
+ "locationInModule": {
11822
+ "filename": "src/web-function.ts",
11823
+ "line": 146
11824
+ },
11825
+ "name": "entrypoint",
11826
+ "optional": true,
11827
+ "type": {
11828
+ "primitive": "string"
11829
+ }
11830
+ }
11831
+ ],
10719
11832
  "symbolId": "src/web-function:WebFunctionProps"
11833
+ },
11834
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision": {
11835
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11836
+ "base": "constructs.Construct",
11837
+ "docs": {
11838
+ "remarks": "`WebFunction` creates its current revision (`fn.currentRevision`) from its code and configuration.\nUse `fromRevisionAttributes` to route an endpoint to an earlier one, which must still exist:\nonly revisions within `revisionRetention`, or that an endpoint routes to, are kept.",
11839
+ "stability": "experimental",
11840
+ "summary": "A revision of a Web Function."
11841
+ },
11842
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision",
11843
+ "interfaces": [
11844
+ "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
11845
+ ],
11846
+ "kind": "class",
11847
+ "locationInModule": {
11848
+ "filename": "src/web-function-revision.ts",
11849
+ "line": 36
11850
+ },
11851
+ "methods": [
11852
+ {
11853
+ "docs": {
11854
+ "stability": "experimental",
11855
+ "summary": "References an existing revision of `webFunction`, e.g. to pin an endpoint to it or split traffic with it."
11856
+ },
11857
+ "locationInModule": {
11858
+ "filename": "src/web-function-revision.ts",
11859
+ "line": 40
11860
+ },
11861
+ "name": "fromRevisionAttributes",
11862
+ "parameters": [
11863
+ {
11864
+ "name": "scope",
11865
+ "type": {
11866
+ "fqn": "constructs.Construct"
11867
+ }
11868
+ },
11869
+ {
11870
+ "name": "id",
11871
+ "type": {
11872
+ "primitive": "string"
11873
+ }
11874
+ },
11875
+ {
11876
+ "name": "attrs",
11877
+ "type": {
11878
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes"
11879
+ }
11880
+ }
11881
+ ],
11882
+ "returns": {
11883
+ "type": {
11884
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
11885
+ }
11886
+ },
11887
+ "static": true
11888
+ }
11889
+ ],
11890
+ "name": "WebFunctionRevision",
11891
+ "properties": [
11892
+ {
11893
+ "docs": {
11894
+ "stability": "experimental",
11895
+ "summary": "The revision's ARN."
11896
+ },
11897
+ "immutable": true,
11898
+ "locationInModule": {
11899
+ "filename": "src/web-function-revision.ts",
11900
+ "line": 57
11901
+ },
11902
+ "name": "revisionArn",
11903
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision",
11904
+ "type": {
11905
+ "primitive": "string"
11906
+ }
11907
+ },
11908
+ {
11909
+ "docs": {
11910
+ "stability": "experimental",
11911
+ "summary": "The revision's ID, e.g. `rev-a1b2c`."
11912
+ },
11913
+ "immutable": true,
11914
+ "locationInModule": {
11915
+ "filename": "src/web-function-revision.ts",
11916
+ "line": 56
11917
+ },
11918
+ "name": "revisionId",
11919
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision",
11920
+ "type": {
11921
+ "primitive": "string"
11922
+ }
11923
+ },
11924
+ {
11925
+ "docs": {
11926
+ "stability": "experimental",
11927
+ "summary": "The function the revision belongs to."
11928
+ },
11929
+ "immutable": true,
11930
+ "locationInModule": {
11931
+ "filename": "src/web-function-revision.ts",
11932
+ "line": 55
11933
+ },
11934
+ "name": "webFunction",
11935
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision",
11936
+ "type": {
11937
+ "fqn": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef"
11938
+ }
11939
+ }
11940
+ ],
11941
+ "symbolId": "src/web-function-revision:WebFunctionRevision"
11942
+ },
11943
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes": {
11944
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11945
+ "datatype": true,
11946
+ "docs": {
11947
+ "stability": "experimental",
11948
+ "summary": "Attributes of an existing revision."
11949
+ },
11950
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes",
11951
+ "kind": "interface",
11952
+ "locationInModule": {
11953
+ "filename": "src/web-function-revision.ts",
11954
+ "line": 21
11955
+ },
11956
+ "name": "WebFunctionRevisionAttributes",
11957
+ "properties": [
11958
+ {
11959
+ "abstract": true,
11960
+ "docs": {
11961
+ "stability": "experimental",
11962
+ "summary": "The revision's ID, e.g. `rev-a1b2c` (the `revisionId` of an earlier deployment)."
11963
+ },
11964
+ "immutable": true,
11965
+ "locationInModule": {
11966
+ "filename": "src/web-function-revision.ts",
11967
+ "line": 26
11968
+ },
11969
+ "name": "revisionId",
11970
+ "type": {
11971
+ "primitive": "string"
11972
+ }
11973
+ },
11974
+ {
11975
+ "abstract": true,
11976
+ "docs": {
11977
+ "stability": "experimental",
11978
+ "summary": "The function the revision belongs to."
11979
+ },
11980
+ "immutable": true,
11981
+ "locationInModule": {
11982
+ "filename": "src/web-function-revision.ts",
11983
+ "line": 23
11984
+ },
11985
+ "name": "webFunction",
11986
+ "type": {
11987
+ "fqn": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef"
11988
+ }
11989
+ }
11990
+ ],
11991
+ "symbolId": "src/web-function-revision:WebFunctionRevisionAttributes"
11992
+ },
11993
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight": {
11994
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11995
+ "datatype": true,
11996
+ "docs": {
11997
+ "stability": "experimental",
11998
+ "summary": "A revision and the share of an endpoint's traffic it receives."
11999
+ },
12000
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight",
12001
+ "kind": "interface",
12002
+ "locationInModule": {
12003
+ "filename": "src/web-function-endpoint.ts",
12004
+ "line": 18
12005
+ },
12006
+ "name": "WebFunctionRevisionWeight",
12007
+ "properties": [
12008
+ {
12009
+ "abstract": true,
12010
+ "docs": {
12011
+ "stability": "experimental",
12012
+ "summary": "The revision."
12013
+ },
12014
+ "immutable": true,
12015
+ "locationInModule": {
12016
+ "filename": "src/web-function-endpoint.ts",
12017
+ "line": 20
12018
+ },
12019
+ "name": "revision",
12020
+ "type": {
12021
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
12022
+ }
12023
+ },
12024
+ {
12025
+ "abstract": true,
12026
+ "docs": {
12027
+ "stability": "experimental",
12028
+ "summary": "The revision's share of the endpoint's traffic, as a fraction (like `lambda.Alias` `additionalVersions`). Must be a whole percentage from 0.01 to 0.99."
12029
+ },
12030
+ "immutable": true,
12031
+ "locationInModule": {
12032
+ "filename": "src/web-function-endpoint.ts",
12033
+ "line": 26
12034
+ },
12035
+ "name": "weight",
12036
+ "type": {
12037
+ "primitive": "number"
12038
+ }
12039
+ }
12040
+ ],
12041
+ "symbolId": "src/web-function-endpoint:WebFunctionRevisionWeight"
10720
12042
  }
10721
12043
  },
10722
- "version": "0.1.0",
10723
- "fingerprint": "u0Hmq0zAMAyCc6Dk05vjUCG6qd3zEXZ0NaQJhOSdkfA="
12044
+ "version": "0.1.2",
12045
+ "fingerprint": "klXX+MmGau/7IlYuQHB50VIISLQsvsWWTDfCXLEc9FQ="
10724
12046
  }