Skip to content

Commit bf4335e

Browse files
committed
chore: draft documentation
1 parent b493761 commit bf4335e

File tree

71 files changed

+2728
-2850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2728
-2850
lines changed

.github/dependabot.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,43 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "weekly"
8-
open-pull-requests-limit: 5
8+
day: "sunday"
9+
time: "05:00"
10+
timezone: "UTC"
11+
open-pull-requests-limit: 1
912
commit-message:
1013
prefix: "chore(deps)"
1114
include: "scope"
12-
labels:
13-
- "dependencies"
14-
reviewers:
15-
- "pierrevensy"
16-
assignees:
17-
- "pierrevensy"
15+
labels: ["dependencies"]
16+
reviewers: ["pierrevensy"]
17+
assignees: ["pierrevensy"]
18+
groups:
19+
minor-updates:
20+
patterns:
21+
- "*"
22+
update-types:
23+
- "minor"
24+
- "patch"
1825

1926
# Check for updates to GitHub Actions
2027
- package-ecosystem: "github-actions"
2128
directory: "/"
2229
schedule:
2330
interval: "weekly"
24-
open-pull-requests-limit: 5
31+
day: "sunday"
32+
time: "06:00"
33+
timezone: "UTC"
34+
open-pull-requests-limit: 1
2535
commit-message:
2636
prefix: "chore(actions)"
2737
include: "scope"
28-
labels:
29-
- "github-actions"
30-
reviewers:
31-
- "pierrevensy"
32-
assignees:
33-
- "pierrevensy"
38+
labels: ["github-actions"]
39+
reviewers: ["pierrevensy"]
40+
assignees: ["pierrevensy"]
41+
groups:
42+
minor-updates:
43+
patterns:
44+
- "*"
45+
update-types:
46+
- "minor"
47+
- "patch"

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1820
- name: Setup Node.js
1921
uses: actions/setup-node@v4
2022
with:
@@ -27,6 +29,10 @@ jobs:
2729
run: npm run test:cvg
2830
- name: Build library
2931
run: npm run build
32+
- name: SonarQube Scan
33+
uses: SonarSource/sonarqube-scan-action@v5
34+
env:
35+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3036

3137
release-please:
3238
runs-on: ubuntu-latest

.github/workflows/pr.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ on:
44
pull_request:
55
branches:
66
- main
7+
types: [opened, synchronize, reopened]
8+
9+
permissions:
10+
contents: read
711

812
jobs:
913
build:
1014
runs-on: ubuntu-latest
1115
steps:
1216
- name: Checkout code
1317
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1420
- name: Setup Node.js
1521
uses: actions/setup-node@v4
1622
with:
@@ -22,4 +28,9 @@ jobs:
2228
- name: Run tests
2329
run: npm run test:cvg
2430
- name: Build library
25-
run: npm run build
31+
run: npm run build
32+
- name: SonarQube Scan
33+
if: github.actor != 'dependabot[bot]'
34+
uses: SonarSource/sonarqube-scan-action@v5
35+
env:
36+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
types:
66
- published
77

8+
permissions:
9+
contents: read
10+
packages: write
11+
812
jobs:
913
publish:
1014
runs-on: ubuntu-latest
@@ -27,4 +31,4 @@ jobs:
2731
- name: Publish to NPM
2832
run: npm publish --access public
2933
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ All notable changes to the "Stone.js AWS Lambda Adapter" extension will be docum
1010

1111
### Features
1212

13-
* implement aws adapters ([8695eb2](https://github.com/stonemjs/aws-lambda-http-adapter/commit/8695eb2c7960769d56015943ac0839e787f176d2))
13+
* implement aws adapters ([8695eb2](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/commit/8695eb2c7960769d56015943ac0839e787f176d2))

README.md

Lines changed: 174 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,187 @@
1-
# Stone.js: AWS Lambda Adapters
1+
# Stone.js - AWS Lambda HTTP Adapter
22

3-
[![npm](https://img.shields.io/npm/l/@stone-js/browser-core)](https://opensource.org/licenses/MIT)
3+
[![npm](https://img.shields.io/npm/l/@stone-js/aws-lambda-http-adapter)](https://opensource.org/licenses/MIT)
44
[![npm](https://img.shields.io/npm/v/@stone-js/aws-lambda-http-adapter)](https://www.npmjs.com/package/@stone-js/aws-lambda-http-adapter)
55
[![npm](https://img.shields.io/npm/dm/@stone-js/aws-lambda-http-adapter)](https://www.npmjs.com/package/@stone-js/aws-lambda-http-adapter)
66
![Maintenance](https://img.shields.io/maintenance/yes/2025)
7-
[![Publish Package to npmjs](https://github.com/stonemjs/aws-lambda-http-adapter/actions/workflows/release.yml/badge.svg)](https://github.com/stonemjs/aws-lambda-http-adapter/actions/workflows/release.yml)
8-
[![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?logo=dependabot)](https://github.com/stonemjs/aws-lambda-http-adapter/network/updates)
7+
[![Build Status](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/actions/workflows/main.yml/badge.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/actions/workflows/main.yml)
8+
[![Publish Package to npmjs](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/actions/workflows/release.yml/badge.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/actions/workflows/release.yml)
9+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-aws-lambda-http-adapter&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-aws-lambda-http-adapter)
10+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-aws-lambda-http-adapter&metric=coverage)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-aws-lambda-http-adapter)
11+
[![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](./SECURITY.md)
12+
[![CodeQL](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/security/code-scanning)
13+
[![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg)](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/network/updates)
914
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
1015

11-
Stone.js AWS Lambda HTTP Adapters with typings.
16+
The **AWS Lambda HTTP Adapter** allows your Stone.js application to run as a fully event-driven Lambda function behind API Gateway or any Lambda-compatible HTTP environment. It seamlessly transforms API Gateway events into `IncomingEvent` and returns `OutgoingResponse`, adhering to the Continuum Architecture.
1217

1318
---
1419

15-
Get started with the [documentation](https://stonejs.com/docs/architecture/adapter.html).
20+
## Introduction
1621

22+
In Stone.js, **adapters** serve as bridges between raw platform input and structured internal events. The AWS Lambda HTTP Adapter processes API Gateway-style HTTP events and turns them into normalized `IncomingEvent` objects. It also formats your system’s `OutgoingResponse` into a valid Lambda HTTP response payload.
23+
24+
This adapter empowers you to write cloud-native functions that stay decoupled from AWS specifics while preserving the full Stone.js lifecycle, type safety, and cross-platform consistency.
25+
26+
## Installation
27+
28+
```bash
29+
npm install @stone-js/aws-lambda-http-adapter
30+
````
31+
32+
> This package is **pure ESM**. Make sure your project uses ESM (`"type": "module"` in `package.json`) or configure your tooling accordingly.
33+
34+
## Usage
35+
36+
You can integrate the adapter either declaratively with a decorator or imperatively using the `awsLambdaHttpAdapterBlueprint`.
37+
38+
### Declarative API
39+
40+
```ts
41+
import { AwsLambdaHttp } from '@stone-js/aws-lambda-http-adapter'
42+
import { StoneApp, IncomingEvent, IEventHandler } from '@stone-js/core'
43+
44+
@StoneApp()
45+
@AwsLambdaHttp({ default: true })
46+
export class Application implements IEventHandler<IncomingEvent> {
47+
handle(event: IncomingEvent) {
48+
const name = event.get<string>('name', 'Lambda')
49+
return { message: `Hello ${name}` }
50+
}
51+
}
52+
```
53+
54+
### Imperative API
55+
56+
```ts
57+
import { defineStoneApp, IncomingEvent, defineConfig, IBlueprint } from '@stone-js/core'
58+
import { awsLambdaHttpAdapterBlueprint, AWS_LAMBDA_HTTP_PLATFORM } from '@stone-js/aws-lambda-http-adapter'
59+
60+
const handler = (event: IncomingEvent) => {
61+
const name = event.get<string>('name', 'Lambda')
62+
return { message: `Hi ${name}` }
63+
}
64+
65+
export const App = defineStoneApp(handler, {}, [awsLambdaHttpAdapterBlueprint])
66+
67+
export const AppConfig = defineConfig({
68+
afterConfigure(blueprint: IBlueprint) {
69+
if (blueprint.is('stone.adapter.platform', AWS_LAMBDA_HTTP_PLATFORM)) {
70+
blueprint.set('stone.adapter.default', true)
71+
}
72+
}
73+
})
74+
```
75+
76+
## What It Enables
77+
78+
* **Serverless by Design**
79+
Build modern HTTP APIs or websites running entirely on AWS Lambda behind API Gateway or ALB.
80+
81+
* **Clean Separation of Concerns**
82+
Your app never sees AWS-specific payloads. All requests and responses are fully normalized by the adapter.
83+
84+
* **Full Continuum Integration**
85+
Request becomes `IncomingEvent`, response becomes `OutgoingResponse`. Lambda is just another execution environment.
86+
87+
* **Small, Fast, Efficient**
88+
No cold start bloat. No Express or frameworks. Just your logic and the lightweight Stone.js runtime.
89+
90+
* **Lifecycle Support**
91+
Includes support for `onStart`, `onStop`, error hooks, and adapter middleware.
92+
93+
* **Typed Event Context**
94+
Access query, body, headers, cookies, IPs and more with full TypeScript support.
95+
96+
* **Zero Glue Code**
97+
No need to write `handler(event, context)` boilerplate. Stone.js manages that for you.
98+
99+
* **Multi-platform Ready**
100+
The same app can run locally with Node, in the browser, or in the cloud, just change the adapter.
101+
102+
## Configuration Options
103+
104+
Unlike Node, this adapter inherits all standard options from the core `AdapterConfig`:
105+
106+
| Option | Type | Description |
107+
| --------------- | ----------------------------------------- | ------------------------------------------------ |
108+
| `default` | `boolean` | Set as the default adapter for your app |
109+
| `alias` | `string` | Optional name to reference this adapter |
110+
| `current` | `boolean` | Marks this adapter as active at runtime |
111+
| `middleware[]` | `AdapterMixedPipeType[]` | Middleware executed during the adapter lifecycle |
112+
| `errorHandlers` | `Record<string, MetaAdapterErrorHandler>` | Customize error response formatting or behavior |
113+
114+
> Note: AWS Lambda automatically injects its execution context and raw event. This adapter handles both without manual plumbing.
115+
116+
## Adapter Context Shape
117+
118+
When middleware or hooks execute, the AWS Lambda adapter provides this normalized context:
119+
120+
```ts
121+
interface AwsLambdaHttpAdapterContext {
122+
rawEvent: AwsLambdaHttpEvent;
123+
rawResponse?: RawHttpResponseOptions;
124+
executionContext: Record<string, unknown>;
125+
incomingEvent?: IncomingHttpEvent;
126+
outgoingResponse?: OutgoingHttpResponse;
127+
incomingEventBuilder: IAdapterEventBuilder<IncomingHttpEventOptions, IncomingHttpEvent>;
128+
rawResponseBuilder: IAdapterEventBuilder<RawHttpResponseOptions, IRawResponseWrapper<RawHttpResponseOptions>>;
129+
}
130+
```
131+
132+
### AWS Lambda Event
133+
134+
```ts
135+
export interface AwsLambdaHttpEvent extends Record<string, unknown> {
136+
path?: string
137+
body?: unknown
138+
rawPath?: string
139+
encoding?: string
140+
httpMethod?: string
141+
isBase64Encoded?: boolean
142+
headers: Record<string, string>
143+
queryStringParameters?: Record<string, string>
144+
requestContext?: {
145+
identity?: {
146+
sourceIp?: string
147+
}
148+
httpMethod?: string
149+
http?: {
150+
method?: string
151+
sourceIp?: string
152+
}
153+
}
154+
}
155+
```
156+
157+
### AWS Lambda Response
158+
159+
```ts
160+
export interface RawHttpResponseOptions {
161+
body?: unknown
162+
statusCode: number
163+
statusMessage?: string
164+
headers?: Record<string, string>
165+
isBase64Encoded?: boolean
166+
}
167+
```
168+
169+
This context ensures complete control over request handling and response shaping, even in a FaaS environment.
170+
171+
## Summary
172+
173+
The `@stone-js/aws-lambda-http-adapter` makes your Stone.js app cloud-native, cost-efficient, and Lambda-ready. Embrace the event-driven cloud with minimal effort and maximum architectural clarity.
174+
175+
## Learn More
176+
177+
This package is part of the Stone.js ecosystem, a modern JavaScript framework built around the Continuum Architecture.
178+
179+
Explore the full documentation: [https://stonejs.dev](https://stonejs.dev)
180+
181+
## API documentation
182+
183+
* [API](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/blob/main/docs)
17184
18185
## Contributing
19186
20-
See [Contributing Guide](https://github.com/stonemjs/aws-lambda-http-adapter/blob/main/CONTRIBUTING.md).
187+
See [Contributing Guide](https://github.com/stone-foundation/stone-js-aws-lambda-http-adapter/blob/main/CONTRIBUTING.md)

SECURITY.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Security Policy
2+
3+
Thank you for your interest in the security of Stone.js. We take the security of our framework and its users seriously.
4+
This document outlines the process for reporting vulnerabilities and our commitment to secure development.
5+
6+
## Supported Versions
7+
8+
We actively maintain and patch the latest stable release of Stone.js and its core packages.
9+
10+
| Version | Status |
11+
| --------- | ---------------------------------- |
12+
| `1.x` | ✅ Actively maintained |
13+
| `< 1.0.0` | ⚠️ Legacy, no guaranteed patches |
14+
15+
If you're using an older version and encounter a security issue, we encourage you to upgrade to the latest release.
16+
17+
## Reporting a Vulnerability
18+
19+
If you discover a security vulnerability in Stone.js or any of its official packages, **please report it responsibly and privately**.
20+
21+
### How to report
22+
23+
- Email: **security@stonejs.dev**
24+
- Subject: `Security Issue: [Your short description]`
25+
- Include:
26+
- A detailed description of the vulnerability
27+
- Steps to reproduce (if applicable)
28+
- A suggested fix or patch (optional but appreciated)
29+
- Affected versions and environments
30+
31+
We will respond within **5 working days** and aim to provide a fix or mitigation within **30 days**, depending on severity.
32+
33+
## Our Commitment
34+
35+
We commit to:
36+
37+
- Promptly investigate and validate reports
38+
- Keep reporters informed of the resolution progress
39+
- Publicly disclose confirmed vulnerabilities **after a fix is available**, with appropriate credit (unless anonymity is requested)
40+
- Maintain secure coding standards and regular dependency audits using:
41+
- [GitHub CodeQL](https://codeql.github.com/)
42+
- [Dependabot](https://github.com/dependabot)
43+
44+
## Disclosure Policy
45+
46+
We follow a **coordinated disclosure** policy:
47+
48+
- Vulnerabilities are not published until a fix is available.
49+
- CVE identifiers will be requested when applicable.
50+
- Security-related changes are clearly documented in release notes and changelogs.
51+
52+
## Acknowledgements
53+
54+
We deeply appreciate the responsible security researchers and users who help keep Stone.js secure.
55+
56+
If you’d like to contribute to security audits, penetration testing, or analysis of Stone.js internals, feel free to reach out via [security@stonejs.dev](mailto:security@stonejs.dev).
57+
58+
## Thank You
59+
60+
Security is a shared responsibility, thank you for helping make Stone.js safer for everyone.
61+
62+
— The Stone.js Team

0 commit comments

Comments
 (0)