Skip to content

Commit

Permalink
remove v3 folder and add general requirements into main components ov…
Browse files Browse the repository at this point in the history
…erview page
  • Loading branch information
sommeeeer committed Jun 9, 2024
1 parent 22e80d7 commit a98bbbd
Show file tree
Hide file tree
Showing 8 changed files with 9,288 additions and 7,963 deletions.
58 changes: 34 additions & 24 deletions docs/pages/inner_workings/components/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import { Callout } from 'nextra/components'
import { Callout } from 'nextra/components';

<Callout>
This documentation is still a work in progress. Some parts might be missing or incomplete.

This is also mostly for advanced use cases (Overriding some default, provide support for another Cloud provider, creating your own IAC component ...), most people won't need to use this.
This is also mostly for advanced use cases (Overriding some default, provide support for another Cloud provider, creating your own IAC component ...), most people won't need to use this.

</Callout>

## General Requirements

- For the node runtime, you need at least Node 18.
- For the edge runtime, you can use both Node 18+ or cloudflare workers with `node_compat` flag enabled (Cloudflare workers support is experimental)
- Open-next doesn't work well on Windows. We recommend using WSL2 or a Linux VM.

## Backends

Every backend is a separate module. The following backends are available:
- Servers (Node or Edge runtime)
- Middleware (If manually set to external)
- Image Optimization
- Revalidation
- Warmer
- Initializer

- Servers (Node or Edge runtime)
- Middleware (If manually set to external)
- Image Optimization
- Revalidation
- Warmer
- Initializer

All these backends can be overrided to fit your needs. They share some common ground for the configuration and the way they are used.

Expand All @@ -38,15 +46,15 @@ The wrapper is the main entrypoint for the backend. This is the type of the wrap
```typescript
type WrapperHandler<
E extends BaseEventOrResult = InternalEvent,
R extends BaseEventOrResult = InternalResult,
R extends BaseEventOrResult = InternalResult
> = (
handler: OpenNextHandler<E, R>,
converter: Converter<E, R>,
converter: Converter<E, R>
) => Promise<(...args: any[]) => any>;

export type Wrapper<
E extends BaseEventOrResult = InternalEvent,
R extends BaseEventOrResult = InternalResult,
R extends BaseEventOrResult = InternalResult
> = BaseOverride & {
wrapper: WrapperHandler<E, R>;
supportStreaming: boolean;
Expand All @@ -56,10 +64,11 @@ export type Wrapper<
The `handler` is the original handler that is being wrapped. The `converter` is the converter that is being used to convert the event and the result.

Here is a list of the provided wrappers:
- `aws-lambda` - The default AWS Lambda wrapper - It is the default wrapper
- `aws-lambda-streaming` - The AWS Lambda wrapper with streaming support
- `node` - The Node wrapper - Create a node server, not suitable for serverless
- `cloudflare` - The Cloudflare wrapper - For Cloudflare Worker

- `aws-lambda` - The default AWS Lambda wrapper - It is the default wrapper
- `aws-lambda-streaming` - The AWS Lambda wrapper with streaming support
- `node` - The Node wrapper - Create a node server, not suitable for serverless
- `cloudflare` - The Cloudflare wrapper - For Cloudflare Worker

##### Aws Lambda streaming

Expand All @@ -74,7 +83,7 @@ The converter is used to convert the event and the result. This is the type of t
```typescript
export type Converter<
E extends BaseEventOrResult = InternalEvent,
R extends BaseEventOrResult = InternalResult,
R extends BaseEventOrResult = InternalResult
> = BaseOverride & {
convertFrom: (event: any) => Promise<E>;
convertTo: (result: R, originalRequest?: any) => any;
Expand All @@ -84,11 +93,12 @@ export type Converter<
The `convertFrom` method is used to convert the event to the internal event used by the backend internal handler. The `convertTo` method is used to convert the result to the expected result.
`convertTo` can usually be ignored when using streaming as the result is being streamed directly.

Here is a list of the provided converters:
- `aws-apigw-v2` - The default AWS API Gateway v2 converter - It is the default converter
- `aws-apigw-v1` - The AWS API Gateway v1 converter
- `aws-cloudfront` - The AWS CloudFront converter - Used for lambda@edge
- `edge` - The Edge converter - Converts from `Request` and to `Response`
- `node` - The Node converter - Converts from `IncomingMessage` and to `ServerResponse`
- `sqs-revalidate` - The SQS Revalidate converter - Used by default for the revalidation backend
- `dummy` - The Dummy converter - Does nothing
Here is a list of the provided converters:

- `aws-apigw-v2` - The default AWS API Gateway v2 converter - It is the default converter
- `aws-apigw-v1` - The AWS API Gateway v1 converter
- `aws-cloudfront` - The AWS CloudFront converter - Used for lambda@edge
- `edge` - The Edge converter - Converts from `Request` and to `Response`
- `node` - The Node converter - Converts from `IncomingMessage` and to `ServerResponse`
- `sqs-revalidate` - The SQS Revalidate converter - Used by default for the revalidation backend
- `dummy` - The Dummy converter - Does nothing
7 changes: 0 additions & 7 deletions docs/pages/v3/_meta.json

This file was deleted.

69 changes: 0 additions & 69 deletions docs/pages/v3/config.mdx

This file was deleted.

67 changes: 0 additions & 67 deletions docs/pages/v3/index.mdx

This file was deleted.

74 changes: 0 additions & 74 deletions docs/pages/v3/override.mdx

This file was deleted.

Loading

0 comments on commit a98bbbd

Please sign in to comment.