diff --git a/www/blog/2023-04-28-aws-lambda-response-streaming.mdx b/www/blog/2023-04-28-aws-lambda-response-streaming.mdx index fd7aa080..810030f8 100644 --- a/www/blog/2023-04-28-aws-lambda-response-streaming.mdx +++ b/www/blog/2023-04-28-aws-lambda-response-streaming.mdx @@ -42,9 +42,9 @@ If you already use this library, just change [DefaultHandler](/docs/main/handler ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { AwsStreamHandler } from '@h4ad/serverless-adapter/lib/handlers/aws'; -import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy'; -import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; +import { AwsStreamHandler } from '@h4ad/serverless-adapter/handlers/aws'; +import { DummyResolver } from '@h4ad/serverless-adapter/resolvers/dummy'; +import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/adapters/aws'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/alb.mdx b/www/docs/main/adapters/aws/alb.mdx index cf8f6359..873c7da7 100644 --- a/www/docs/main/adapters/aws/alb.mdx +++ b/www/docs/main/adapters/aws/alb.mdx @@ -73,8 +73,8 @@ To add support to AWS ALB you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { AlbAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { AlbAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/api-gateway-v1.mdx b/www/docs/main/adapters/aws/api-gateway-v1.mdx index c2273a28..1f18f98f 100644 --- a/www/docs/main/adapters/aws/api-gateway-v1.mdx +++ b/www/docs/main/adapters/aws/api-gateway-v1.mdx @@ -125,8 +125,8 @@ To add support to AWS API Gateway V1 you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ApiGatewayV1Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { ApiGatewayV1Adapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/api-gateway-v2.mdx b/www/docs/main/adapters/aws/api-gateway-v2.mdx index f451cec4..0276f10b 100644 --- a/www/docs/main/adapters/aws/api-gateway-v2.mdx +++ b/www/docs/main/adapters/aws/api-gateway-v2.mdx @@ -115,8 +115,8 @@ To add support to AWS API Gateway V2 you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/dynamodb.mdx b/www/docs/main/adapters/aws/dynamodb.mdx index ff8ee8d0..ceba0649 100644 --- a/www/docs/main/adapters/aws/dynamodb.mdx +++ b/www/docs/main/adapters/aws/dynamodb.mdx @@ -76,8 +76,8 @@ To add support to AWS DynamoDB you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { DynamoDBAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { DynamoDBAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/event-bridge.mdx b/www/docs/main/adapters/aws/event-bridge.mdx index 11926333..bdd21dab 100644 --- a/www/docs/main/adapters/aws/event-bridge.mdx +++ b/www/docs/main/adapters/aws/event-bridge.mdx @@ -161,8 +161,8 @@ To add support to AWS EventBridge you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { EventBridgeAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { EventBridgeAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/function-url.mdx b/www/docs/main/adapters/aws/function-url.mdx index 3d60f38f..27f4e29a 100644 --- a/www/docs/main/adapters/aws/function-url.mdx +++ b/www/docs/main/adapters/aws/function-url.mdx @@ -8,8 +8,8 @@ so you can use the [ApiGatewayV2Adapter](./api-gateway-v2#usage) to support it. ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/lambda-edge.mdx b/www/docs/main/adapters/aws/lambda-edge.mdx index 64ea9284..2a837075 100644 --- a/www/docs/main/adapters/aws/lambda-edge.mdx +++ b/www/docs/main/adapters/aws/lambda-edge.mdx @@ -30,8 +30,8 @@ To add support to AWS Lambda@Edge you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { RequestLambdaEdgeAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { RequestLambdaEdgeAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/s3.mdx b/www/docs/main/adapters/aws/s3.mdx index 2d7a7ef1..87593f26 100644 --- a/www/docs/main/adapters/aws/s3.mdx +++ b/www/docs/main/adapters/aws/s3.mdx @@ -84,8 +84,8 @@ To add support to AWS S3 you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { S3Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { S3Adapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/sns.mdx b/www/docs/main/adapters/aws/sns.mdx index 8d8eab7b..1ed05811 100644 --- a/www/docs/main/adapters/aws/sns.mdx +++ b/www/docs/main/adapters/aws/sns.mdx @@ -77,8 +77,8 @@ To add support to AWS SNS you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { SNSAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { SNSAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/aws/sqs.mdx b/www/docs/main/adapters/aws/sqs.mdx index e751cb31..7499a1e4 100644 --- a/www/docs/main/adapters/aws/sqs.mdx +++ b/www/docs/main/adapters/aws/sqs.mdx @@ -66,8 +66,8 @@ To add support to AWS SQS you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { SQSAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { SQSAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/azure/http-trigger-v4.mdx b/www/docs/main/adapters/azure/http-trigger-v4.mdx index 7e940516..ecc7578a 100644 --- a/www/docs/main/adapters/azure/http-trigger-v4.mdx +++ b/www/docs/main/adapters/azure/http-trigger-v4.mdx @@ -86,9 +86,9 @@ To add support to Azure Http Trigger you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { AzureHandler } from '@h4ad/serverless-adapter/lib/handlers/azure'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; -import { HttpTriggerV4Adapter } from '@h4ad/serverless-adapter/lib/adapters/azure'; +import { AzureHandler } from '@h4ad/serverless-adapter/handlers/azure'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; +import { HttpTriggerV4Adapter } from '@h4ad/serverless-adapter/adapters/azure'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/digital-ocean/http-function.mdx b/www/docs/main/adapters/digital-ocean/http-function.mdx index 1102a7a6..72d11022 100644 --- a/www/docs/main/adapters/digital-ocean/http-function.mdx +++ b/www/docs/main/adapters/digital-ocean/http-function.mdx @@ -85,9 +85,9 @@ To add support to DigitalOcean Functions you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { DigitalOceanHandler } from '@h4ad/serverless-adapter/lib/handlers/digital-ocean'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; -import { HttpFunctionAdapter } from '@h4ad/serverless-adapter/lib/adapters/digital-ocean'; +import { DigitalOceanHandler } from '@h4ad/serverless-adapter/handlers/digital-ocean'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; +import { HttpFunctionAdapter } from '@h4ad/serverless-adapter/adapters/digital-ocean'; import app from './app'; export const main = ServerlessAdapter.new(app) diff --git a/www/docs/main/adapters/huawei/huawei-api-gateway.mdx b/www/docs/main/adapters/huawei/huawei-api-gateway.mdx index 930cbac5..bc00b2f3 100644 --- a/www/docs/main/adapters/huawei/huawei-api-gateway.mdx +++ b/www/docs/main/adapters/huawei/huawei-api-gateway.mdx @@ -18,10 +18,10 @@ To add support to Api Gateway you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { HuaweiApiGatewayAdapter } from '@h4ad/serverless-adapter/lib/adapters/huawei'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; -import { CallbackResolver } from '@h4ad/serverless-adapter/lib/resolvers/callback'; +import { HuaweiApiGatewayAdapter } from '@h4ad/serverless-adapter/adapters/huawei'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; +import { CallbackResolver } from '@h4ad/serverless-adapter/resolvers/callback'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/advanced/adapters/creating-an-adapter.mdx b/www/docs/main/advanced/adapters/creating-an-adapter.mdx index d1646b96..8705eafc 100644 --- a/www/docs/main/advanced/adapters/creating-an-adapter.mdx +++ b/www/docs/main/advanced/adapters/creating-an-adapter.mdx @@ -100,7 +100,7 @@ First, we need to create our new adapter class, let's define it as: ```typescript title="api-gateway-v2.adapter.ts" import type { APIGatewayProxyEventV2, Context } from 'aws-lambda'; import type { APIGatewayProxyStructuredResultV2 } from 'aws-lambda/trigger/api-gateway-proxy'; -import { AdapterContract } from '@h4ad/serverless-adapter/lib/contracts'; +import { AdapterContract } from '@h4ad/serverless-adapter/contracts'; export class ApiGatewayV2Adapter implements AdapterContract {} ``` diff --git a/www/docs/main/frameworks/apollo-server.mdx b/www/docs/main/frameworks/apollo-server.mdx index 674a2a7e..f05a4ef9 100644 --- a/www/docs/main/frameworks/apollo-server.mdx +++ b/www/docs/main/frameworks/apollo-server.mdx @@ -34,9 +34,9 @@ Then, you just need to use the [ApolloServerFramework](/docs/api/Frameworks/Apol ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors'; -import { ApolloServerFramework } from '@h4ad/serverless-adapter/lib/frameworks/apollo-server'; -import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/lib/frameworks/body-parser'; +import { CorsFramework } from '@h4ad/serverless-adapter/frameworks/cors'; +import { ApolloServerFramework } from '@h4ad/serverless-adapter/frameworks/apollo-server'; +import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/frameworks/body-parser'; import { ApolloServer } from '@apollo/server'; export const app = new ApolloServer({ @@ -117,7 +117,7 @@ Ok, after define the schema, let's create the apollo server instance. ```ts import { ApolloServer } from '@apollo/server'; import { GraphQLError } from 'graphql/error/GraphQLError'; -import { DefaultServerlessApolloServerContext } from '@h4ad/serverless-adapter/lib/frameworks/apollo-server'; +import { DefaultServerlessApolloServerContext } from '@h4ad/serverless-adapter/frameworks/apollo-server'; import type { SNSEvent, SQSEvent } from 'aws-lambda'; export const app = new ApolloServer({ @@ -170,13 +170,13 @@ Well, now we only need to expose the Apollo Server Instance using Serverless Ada ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ApolloServerMutationAdapter } from '@h4ad/serverless-adapter/lib/adapters/apollo-server'; -import { ApiGatewayV2Adapter, SNSAdapter, SQSAdapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; -import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors'; -import { ApolloServerFramework, DefaultServerlessApolloServerContext } from '@h4ad/serverless-adapter/lib/frameworks/apollo-server'; -import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/lib/frameworks/body-parser'; +import { ApolloServerMutationAdapter } from '@h4ad/serverless-adapter/adapters/apollo-server'; +import { ApiGatewayV2Adapter, SNSAdapter, SQSAdapter } from '@h4ad/serverless-adapter/adapters/aws'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; +import { CorsFramework } from '@h4ad/serverless-adapter/frameworks/cors'; +import { ApolloServerFramework, DefaultServerlessApolloServerContext } from '@h4ad/serverless-adapter/frameworks/apollo-server'; +import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/frameworks/body-parser'; const framework = new ApolloServerFramework(); const jsonBodyFramework = new JsonBodyParserFramework(framework); @@ -239,7 +239,7 @@ By default, the context will be [DefaultServerlessApolloServerContext](/docs/api the creation of the context by passing `context` variable inside `ApolloServerFramework`, like: ```ts -import { ApolloServerFramework, DefaultServerlessApolloServerContext } from '@h4ad/serverless-adapter/lib/frameworks/apollo-server'; +import { ApolloServerFramework, DefaultServerlessApolloServerContext } from '@h4ad/serverless-adapter/frameworks/apollo-server'; // I want the date when it's started, and also, i always recommend including the default context type MyCustomContext = { startedAt: Date } & DefaultServerlessApolloServerContext; diff --git a/www/docs/main/frameworks/deepkit.mdx b/www/docs/main/frameworks/deepkit.mdx index b88ef0fb..d376314a 100644 --- a/www/docs/main/frameworks/deepkit.mdx +++ b/www/docs/main/frameworks/deepkit.mdx @@ -22,7 +22,7 @@ import { App } from '@deepkit/app'; import { FrameworkModule } from '@deepkit/framework'; import { HtmlResponse, HttpKernel, HttpModule, HttpRouterRegistry } from '@deepkit/http'; import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { HttpDeepkitFramework } from '@h4ad/serverless-adapter/lib/frameworks/deepkit'; +import { HttpDeepkitFramework } from '@h4ad/serverless-adapter/frameworks/deepkit'; const app = new App({ controllers: [], diff --git a/www/docs/main/frameworks/express.mdx b/www/docs/main/frameworks/express.mdx index 198b5e27..26926e25 100644 --- a/www/docs/main/frameworks/express.mdx +++ b/www/docs/main/frameworks/express.mdx @@ -14,7 +14,7 @@ Then, you need you just need to use the [ExpressFramework](../../api/Frameworks/ ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; const express = require('express'); diff --git a/www/docs/main/frameworks/fastify.mdx b/www/docs/main/frameworks/fastify.mdx index 449c2b7b..6af482fd 100644 --- a/www/docs/main/frameworks/fastify.mdx +++ b/www/docs/main/frameworks/fastify.mdx @@ -13,7 +13,7 @@ Then, you need you just need to use the [FastifyFramework](../../api/Frameworks/ ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { FastifyFramework } from '@h4ad/serverless-adapter/lib/frameworks/fastify'; +import { FastifyFramework } from '@h4ad/serverless-adapter/frameworks/fastify'; const Fastify = require('fastify'); diff --git a/www/docs/main/frameworks/hapi.mdx b/www/docs/main/frameworks/hapi.mdx index 8568cd13..057b965e 100644 --- a/www/docs/main/frameworks/hapi.mdx +++ b/www/docs/main/frameworks/hapi.mdx @@ -14,7 +14,7 @@ Then, you need you just need to use the [HapiFramework](../../api/Frameworks/Hap ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { HapiFramework } from '@h4ad/serverless-adapter/lib/frameworks/hapi'; +import { HapiFramework } from '@h4ad/serverless-adapter/frameworks/hapi'; const Hapi = require('@hapi/hapi'); diff --git a/www/docs/main/frameworks/helpers/body-parser.mdx b/www/docs/main/frameworks/helpers/body-parser.mdx index ca555f7d..0cb92210 100644 --- a/www/docs/main/frameworks/helpers/body-parser.mdx +++ b/www/docs/main/frameworks/helpers/body-parser.mdx @@ -41,8 +41,8 @@ The first parameter is the instance of another framework, so if you want to use ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { JsonBodyParserFramework, JsonBodyParserFrameworkOptions } from '@h4ad/serverless-adapter/lib/frameworks/cors'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; +import { JsonBodyParserFramework, JsonBodyParserFrameworkOptions } from '@h4ad/serverless-adapter/frameworks/cors'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; const express = require('express'); @@ -68,9 +68,9 @@ If you want to combine with more frameworks, just add others like: ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { JsonBodyParserFramework, UrlencodedBodyParserFramework, RawBodyParserFramework } from '@h4ad/serverless-adapter/lib/frameworks/body-parser'; -import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; import { } from './cors.framework'; +import { JsonBodyParserFramework, UrlencodedBodyParserFramework, RawBodyParserFramework } from '@h4ad/serverless-adapter/frameworks/body-parser'; +import { CorsFramework } from '@h4ad/serverless-adapter/frameworks/cors'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; import { } from './cors.framework'; const expressFramework = new ExpressFramework(); @@ -103,7 +103,7 @@ If you want to customize the error messages, like when the size limit is exceede ```ts import type { IncomingMessage, ServerResponse } from 'http'; import type { HttpError } from 'http-errors'; -import { JsonBodyParserFramework, JsonBodyParserFrameworkOptions } from '@h4ad/serverless-adapter/lib/frameworks/body-parser'; +import { JsonBodyParserFramework, JsonBodyParserFrameworkOptions } from '@h4ad/serverless-adapter/frameworks/body-parser'; const options: JsonBodyParserFrameworkOptions = { customErrorHandler: (req: IncomingMessage, response: ServerResponse, error: HttpError) => { diff --git a/www/docs/main/frameworks/helpers/cors.mdx b/www/docs/main/frameworks/helpers/cors.mdx index 6fe905b1..a24f8722 100644 --- a/www/docs/main/frameworks/helpers/cors.mdx +++ b/www/docs/main/frameworks/helpers/cors.mdx @@ -41,8 +41,8 @@ The first parameter is the instance of another framework, so if you want to use ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { CorsFramework, CorsFrameworkOptions } from '@h4ad/serverless-adapter/lib/frameworks/cors'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; +import { CorsFramework, CorsFrameworkOptions } from '@h4ad/serverless-adapter/frameworks/cors'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; const express = require('express'); diff --git a/www/docs/main/frameworks/helpers/lazy.mdx b/www/docs/main/frameworks/helpers/lazy.mdx index 5e7d155e..da26dea5 100644 --- a/www/docs/main/frameworks/helpers/lazy.mdx +++ b/www/docs/main/frameworks/helpers/lazy.mdx @@ -19,8 +19,8 @@ The first parameter is the instance of another framework, so if you want to use ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { LazyFramework } from '@h4ad/serverless-adapter/lib/frameworks/lazy'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; +import { LazyFramework } from '@h4ad/serverless-adapter/frameworks/lazy'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; const express = require('express'); diff --git a/www/docs/main/frameworks/koa.mdx b/www/docs/main/frameworks/koa.mdx index 2c9f9df7..9d7884c2 100644 --- a/www/docs/main/frameworks/koa.mdx +++ b/www/docs/main/frameworks/koa.mdx @@ -14,7 +14,7 @@ Then, you need you just need to use the [KoaFramework](../../api/Frameworks/KoaF ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { KoaFramework } from '@h4ad/serverless-adapter/lib/frameworks/koa'; +import { KoaFramework } from '@h4ad/serverless-adapter/frameworks/koa'; const Koa = require('koa'); diff --git a/www/docs/main/frameworks/nestjs.mdx b/www/docs/main/frameworks/nestjs.mdx index 2b30c0a0..b8149718 100644 --- a/www/docs/main/frameworks/nestjs.mdx +++ b/www/docs/main/frameworks/nestjs.mdx @@ -32,8 +32,8 @@ So, to add support to NestJS, we have two ways: ```typescript title="index.ts" import { NestFactory } from '@nestjs/core'; import { ExpressAdapter } from '@nestjs/platform-express'; -import { LazyFramework } from '@h4ad/serverless-adapter/lib/frameworks/lazy'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; +import { LazyFramework } from '@h4ad/serverless-adapter/frameworks/lazy'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; import { AppModule } from './app.module'; async function bootstrap() { @@ -71,8 +71,8 @@ export const handler = ServerlessAdapter.new(null) ```typescript title="index.ts" import { NestFactory } from '@nestjs/core'; import { FastifyAdapter } from '@nestjs/platform-fastify'; -import { LazyFramework } from '@h4ad/serverless-adapter/lib/frameworks/lazy'; -import { FastifyFramework } from '@h4ad/serverless-adapter/lib/frameworks/fastify'; +import { LazyFramework } from '@h4ad/serverless-adapter/frameworks/lazy'; +import { FastifyFramework } from '@h4ad/serverless-adapter/frameworks/fastify'; import { AppModule } from './app.module'; async function bootstrap() { diff --git a/www/docs/main/frameworks/trpc.mdx b/www/docs/main/frameworks/trpc.mdx index 9d38b318..c9d9f71c 100644 --- a/www/docs/main/frameworks/trpc.mdx +++ b/www/docs/main/frameworks/trpc.mdx @@ -22,9 +22,9 @@ Then, you just need to use the [TrpcFramework](../../api/Frameworks/TrpcFramewor ```ts title="index.ts" import * as trpc from '@trpc/server'; import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { TrpcFramework, TrpcAdapterContext, TrpcFrameworkOptions } from '@h4ad/serverless-adapter/lib/frameworks/trpc'; -import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/lib/frameworks/body-parser'; -import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors'; +import { TrpcFramework, TrpcAdapterContext, TrpcFrameworkOptions } from '@h4ad/serverless-adapter/frameworks/trpc'; +import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/frameworks/body-parser'; +import { CorsFramework } from '@h4ad/serverless-adapter/frameworks/cors'; import { z } from 'zod'; type CustomContext = { currentDate: Date }; @@ -85,7 +85,7 @@ With this behavior, to integrate with [SQSAdapter](/docs/main/adapters/aws/sqs), ```typescript title="index.ts" import type { SQSEvent } from 'aws-lambda'; import * as trpc from '@trpc/server'; -import { TrpcAdapterContext } from '@h4ad/serverless-adapter/lib/frameworks/trpc'; +import { TrpcAdapterContext } from '@h4ad/serverless-adapter/frameworks/trpc'; import { z } from 'zod'; type TrpcContext = TrpcAdapterContext; @@ -133,9 +133,9 @@ like the code below: ```typescript title="index.ts" import * as trpc from '@trpc/server'; import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { TrpcFramework, TrpcAdapterContext, TrpcFrameworkOptions } from '@h4ad/serverless-adapter/lib/frameworks/trpc'; -import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/lib/frameworks/body-parser'; -import { CorsFramework } from '@h4ad/serverless-adapter/lib/frameworks/cors'; +import { TrpcFramework, TrpcAdapterContext, TrpcFrameworkOptions } from '@h4ad/serverless-adapter/frameworks/trpc'; +import { JsonBodyParserFramework } from '@h4ad/serverless-adapter/frameworks/body-parser'; +import { CorsFramework } from '@h4ad/serverless-adapter/frameworks/cors'; type CustomContext = { potato: boolean }; type TrpcContext = TrpcAdapterContext; diff --git a/www/docs/main/getting-started/usage.mdx b/www/docs/main/getting-started/usage.mdx index 3871dd56..aa45cd12 100644 --- a/www/docs/main/getting-started/usage.mdx +++ b/www/docs/main/getting-started/usage.mdx @@ -17,12 +17,20 @@ We need to pass to [Serverless Adapter](/docs/api/ServerlessAdapter) the instanc - Handler: [Default Handler](../handlers/aws). - Resolver: [Promise Resolver](../resolvers/promise). +:::warning +If you are using `Typescript`, imports will only work exactly as in the example +if you set your `moduleResolution` to `nodenext` or `bundler` in your `tsconfig.json`. + +If you don't want to change this, you should append `/lib` after the package name, +like `@h4ad/serverless-adapter/lib/frameworks/express/index`. +::: + ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; -import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; +import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/adapters/aws'; const express = require('express'); diff --git a/www/docs/main/handlers/aws.mdx b/www/docs/main/handlers/aws.mdx index d240f506..e34aefa5 100644 --- a/www/docs/main/handlers/aws.mdx +++ b/www/docs/main/handlers/aws.mdx @@ -25,7 +25,7 @@ To use, you can import and call the method [setHandler](../../api/ServerlessAdap ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; import app from './app'; export const handler = ServerlessAdapter.new(app) @@ -63,9 +63,9 @@ To support this behavior, we need to change three things: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { AwsStreamHandler } from '@h4ad/serverless-adapter/lib/handlers/aws'; -import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy'; -import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws'; +import { AwsStreamHandler } from '@h4ad/serverless-adapter/handlers/aws'; +import { DummyResolver } from '@h4ad/serverless-adapter/resolvers/dummy'; +import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/adapters/aws'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/handlers/azure.mdx b/www/docs/main/handlers/azure.mdx index 8088e2aa..55f7228e 100644 --- a/www/docs/main/handlers/azure.mdx +++ b/www/docs/main/handlers/azure.mdx @@ -34,7 +34,7 @@ If you want to log using the original instance [createDefaultLogger](../../api/C you can set the `useContextLogWhenInternalLogger` option to `false` for [AzureHandlerOptions](../../api/Handlers/AzureHandler/AzureHandlerOptions). ```typescript -import { AzureHandler } from '@h4ad/serverless-adapter/lib/handlers/azure'; +import { AzureHandler } from '@h4ad/serverless-adapter/handlers/azure'; const handler = new AzureHandler({ useContextLogWhenInternalLogger: false, @@ -68,9 +68,9 @@ Then, you can import and call the method [setHandler](../../api/ServerlessAdapte ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { AzureHandler } from '@h4ad/serverless-adapter/lib/handlers/azure'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; -import { HttpTriggerV4Adapter } from '@h4ad/serverless-adapter/lib/adapters/azure'; +import { AzureHandler } from '@h4ad/serverless-adapter/handlers/azure'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; +import { HttpTriggerV4Adapter } from '@h4ad/serverless-adapter/adapters/azure'; import app from './app'; export default ServerlessAdapter.new(app) diff --git a/www/docs/main/handlers/digital-ocean.mdx b/www/docs/main/handlers/digital-ocean.mdx index 37eda0c7..e9ffbdd0 100644 --- a/www/docs/main/handlers/digital-ocean.mdx +++ b/www/docs/main/handlers/digital-ocean.mdx @@ -35,9 +35,9 @@ Import and call the method [setHandler](../../api/ServerlessAdapter#method-setha ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { DigitalOceanHandler } from '@h4ad/serverless-adapter/lib/handlers/digital-ocean'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; -import { HttpFunctionAdapter } from '@h4ad/serverless-adapter/lib/adapters/digital-ocean'; +import { DigitalOceanHandler } from '@h4ad/serverless-adapter/handlers/digital-ocean'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; +import { HttpFunctionAdapter } from '@h4ad/serverless-adapter/adapters/digital-ocean'; import app from './app'; export const main = ServerlessAdapter.new(app) diff --git a/www/docs/main/handlers/firebase.mdx b/www/docs/main/handlers/firebase.mdx index b3fff61d..eb369a40 100644 --- a/www/docs/main/handlers/firebase.mdx +++ b/www/docs/main/handlers/firebase.mdx @@ -29,9 +29,9 @@ To use, you can import [HttpFirebaseV2Handler](../../api/Handlers/HttpFirebaseHa ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { DummyAdapter } from '@h4ad/serverless-adapter/lib/adapters/dummy'; -import { HttpFirebaseV2Handler } from '@h4ad/serverless-adapter/lib/handlers/firebase'; -import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy'; +import { DummyAdapter } from '@h4ad/serverless-adapter/adapters/dummy'; +import { HttpFirebaseV2Handler } from '@h4ad/serverless-adapter/handlers/firebase'; +import { DummyResolver } from '@h4ad/serverless-adapter/resolvers/dummy'; import app from './app'; export const helloWorld = ServerlessAdapter.new(app) diff --git a/www/docs/main/handlers/gcp.mdx b/www/docs/main/handlers/gcp.mdx index 5ff3001f..3aa5b377 100644 --- a/www/docs/main/handlers/gcp.mdx +++ b/www/docs/main/handlers/gcp.mdx @@ -23,9 +23,9 @@ To use, you can import [GCPHandler](../../api/Handlers/GCPHandler) and call the ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { DummyAdapter } from '@h4ad/serverless-adapter/lib/adapters/dummy'; -import { GCPHandler } from '@h4ad/serverless-adapter/lib/handlers/gcp'; -import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy'; +import { DummyAdapter } from '@h4ad/serverless-adapter/adapters/dummy'; +import { GCPHandler } from '@h4ad/serverless-adapter/handlers/gcp'; +import { DummyResolver } from '@h4ad/serverless-adapter/resolvers/dummy'; import app from './app'; const functionName = 'helloWorld'; diff --git a/www/docs/main/handlers/huawei.mdx b/www/docs/main/handlers/huawei.mdx index dc293e66..9d318f50 100644 --- a/www/docs/main/handlers/huawei.mdx +++ b/www/docs/main/handlers/huawei.mdx @@ -16,10 +16,10 @@ To integrate your app with Huawei FunctionGrapth with the Http Function type, yo ```ts import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; -import { HttpHuaweiHandler } from '@h4ad/serverless-adapter/lib/handlers/huawei'; -import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy'; -import { DummyAdapter } from '@h4ad/serverless-adapter/lib/adapters/dummy'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; +import { HttpHuaweiHandler } from '@h4ad/serverless-adapter/handlers/huawei'; +import { DummyResolver } from '@h4ad/serverless-adapter/resolvers/dummy'; +import { DummyAdapter } from '@h4ad/serverless-adapter/adapters/dummy'; import app from './app'; // instead exposing handler, you have the dispose function @@ -67,10 +67,10 @@ So, to add support to Api Gateway you do the following: ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { HuaweiApiGatewayAdapter } from '@h4ad/serverless-adapter/lib/adapters/huawei'; -import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express'; -import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default'; -import { CallbackResolver } from '@h4ad/serverless-adapter/lib/resolvers/callback'; +import { HuaweiApiGatewayAdapter } from '@h4ad/serverless-adapter/adapters/huawei'; +import { ExpressFramework } from '@h4ad/serverless-adapter/frameworks/express'; +import { DefaultHandler } from '@h4ad/serverless-adapter/handlers/default'; +import { CallbackResolver } from '@h4ad/serverless-adapter/resolvers/callback'; import app from './app'; export const handler = ServerlessAdapter.new(app) diff --git a/www/docs/main/resolvers/aws-context.mdx b/www/docs/main/resolvers/aws-context.mdx index 980ec839..855ba18a 100644 --- a/www/docs/main/resolvers/aws-context.mdx +++ b/www/docs/main/resolvers/aws-context.mdx @@ -37,7 +37,7 @@ To use, you can import and call the method [setResolver](../../api/ServerlessAda ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { AwsContextResolver } from '@h4ad/serverless-adapter/lib/resolvers/aws-context'; +import { AwsContextResolver } from '@h4ad/serverless-adapter/resolvers/aws-context'; const express = require('express'); diff --git a/www/docs/main/resolvers/callback.mdx b/www/docs/main/resolvers/callback.mdx index 576025cc..ea4fafb7 100644 --- a/www/docs/main/resolvers/callback.mdx +++ b/www/docs/main/resolvers/callback.mdx @@ -31,7 +31,7 @@ To use, you can import and call the method [setResolver](../../api/ServerlessAda ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { CallbackResolver } from '@h4ad/serverless-adapter/lib/resolvers/callback'; +import { CallbackResolver } from '@h4ad/serverless-adapter/resolvers/callback'; const express = require('express'); diff --git a/www/docs/main/resolvers/promise.mdx b/www/docs/main/resolvers/promise.mdx index aef3f55b..a13b6f7a 100644 --- a/www/docs/main/resolvers/promise.mdx +++ b/www/docs/main/resolvers/promise.mdx @@ -29,7 +29,7 @@ To use, you can import and call the method [setResolver](../../api/ServerlessAda ```ts title="index.ts" import { ServerlessAdapter } from '@h4ad/serverless-adapter'; -import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise'; +import { PromiseResolver } from '@h4ad/serverless-adapter/resolvers/promise'; const express = require('express');