@jaypie/express 1.2.4-rc8 → 1.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/express",
3
- "version": "1.2.4-rc8",
3
+ "version": "1.2.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/finlaysonstudio/jaypie.git"
@@ -24,26 +24,22 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "rollup --config",
27
+ "clean": "rimraf dist docker/dist docker/.aws-sam",
28
+ "docker:build": "npm run build && docker build -f docker/Dockerfile -t jaypie-express-lambda .",
29
+ "docker:invoke": "curl -s -X POST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d @docker/events/api-gateway-v1-get.json",
30
+ "docker:invoke:404": "curl -s -X POST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d @docker/events/api-gateway-v1-404.json",
31
+ "docker:invoke:echo": "curl -s -X POST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d @docker/events/api-gateway-v1-post.json",
32
+ "docker:invoke:stream": "curl -s -X POST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d @docker/events/api-gateway-v1-stream.json",
33
+ "docker:invoke:v2": "curl -s -X POST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d @docker/events/function-url-v2.json",
34
+ "docker:run": "docker stop lambda-test 2>/dev/null; docker run --rm --name lambda-test -p 9000:8080 jaypie-express-lambda",
27
35
  "format": "npm run format:package && npm run format:lint",
28
36
  "format:lint": "eslint --fix .",
29
37
  "format:package": "sort-package-json ./package.json",
30
38
  "lint": "eslint .",
39
+ "sam:build": "npm run build && cp -r dist docker/ && cd docker && sam build",
40
+ "sam:invoke": "cd docker && sam local invoke ExpressFunction -e events/api-gateway-v1-get.json",
41
+ "sam:start": "cd docker && sam local start-api --warm-containers EAGER",
31
42
  "test": "vitest run .",
32
- "test:spec:constants": "vitest run ./src/__tests__/constants.spec.ts",
33
- "test:spec:cors.helper": "vitest run ./src/__tests__/cors.helper.spec.ts",
34
- "test:spec:createServer": "vitest run ./src/__tests__/createServer.spec.ts",
35
- "test:spec:decorateResponse.helper": "vitest run ./src/__tests__/decorateResponse.helper.spec.ts",
36
- "test:spec:echo.handler": "vitest run ./src/__tests__/echo.handler.spec.ts",
37
- "test:spec:expressHandler": "vitest run ./src/__tests__/expressHandler.spec.ts",
38
- "test:spec:expressStreamHandler": "vitest run ./src/__tests__/expressStreamHandler.spec.ts",
39
- "test:spec:getCurrentInvokeUuid.adapter": "vitest run ./src/__tests__/getCurrentInvokeUuid.adapter.spec.ts",
40
- "test:spec:getCurrentInvokeUuid.webadapter": "vitest run ./src/__tests__/getCurrentInvokeUuid.webadapter.spec.ts",
41
- "test:spec:http.handler": "vitest run ./src/__tests__/http.handler.spec.ts",
42
- "test:spec:index": "vitest run ./src/__tests__/index.spec.ts",
43
- "test:spec:routes": "vitest run ./src/__tests__/routes.spec.ts",
44
- "test:spec:summarizeRequest.helper": "vitest run ./src/__tests__/summarizeRequest.helper.spec.ts",
45
- "test:spec:summarizeResponse.helper": "vitest run ./src/__tests__/summarizeResponse.helper.spec.ts",
46
- "test:spec:supertest": "vitest run ./src/__tests__/supertest.spec.ts",
47
43
  "typecheck": "tsc --noEmit"
48
44
  },
49
45
  "dependencies": {
@@ -1,60 +0,0 @@
1
- import type { Application, RequestHandler } from "express";
2
- import type { Server } from "http";
3
- import type { CorsConfig } from "./cors.helper.js";
4
- export interface CreateServerOptions {
5
- /**
6
- * CORS configuration. Pass false to disable CORS middleware.
7
- */
8
- cors?: CorsConfig | false;
9
- /**
10
- * JSON body parser limit. Defaults to "1mb".
11
- */
12
- jsonLimit?: string;
13
- /**
14
- * Additional middleware to apply before routes.
15
- */
16
- middleware?: RequestHandler[];
17
- /**
18
- * Port to listen on. Defaults to PORT env var or 8080.
19
- */
20
- port?: number | string;
21
- }
22
- export interface ServerResult {
23
- /**
24
- * The HTTP server instance.
25
- */
26
- server: Server;
27
- /**
28
- * The port the server is listening on.
29
- */
30
- port: number;
31
- }
32
- /**
33
- * Creates and starts an Express server with standard Jaypie middleware.
34
- *
35
- * Features:
36
- * - CORS handling (configurable)
37
- * - JSON body parsing
38
- * - Listens on PORT env var (default 8080)
39
- *
40
- * Usage:
41
- * ```ts
42
- * import express from "express";
43
- * import { createServer, expressHandler } from "@jaypie/express";
44
- *
45
- * const app = express();
46
- *
47
- * app.get("/", expressHandler(async (req, res) => {
48
- * return { message: "Hello World" };
49
- * }));
50
- *
51
- * const { server, port } = await createServer(app);
52
- * console.log(`Server running on port ${port}`);
53
- * ```
54
- *
55
- * @param app - Express application instance
56
- * @param options - Server configuration options
57
- * @returns Promise resolving to server instance and port
58
- */
59
- declare function createServer(app: Application, options?: CreateServerOptions): Promise<ServerResult>;
60
- export default createServer;
@@ -1,12 +0,0 @@
1
- import type { Request } from "express";
2
- /**
3
- * Get the current invoke UUID from Lambda Web Adapter context.
4
- * This function extracts the request ID from either:
5
- * 1. The x-amzn-request-id header (set by Lambda Web Adapter)
6
- * 2. The _X_AMZN_TRACE_ID environment variable (set by Lambda runtime)
7
- *
8
- * @param req - Optional Express request object to extract headers from
9
- * @returns The AWS request ID or undefined if not in Lambda context
10
- */
11
- declare function getWebAdapterUuid(req?: Request): string | undefined;
12
- export default getWebAdapterUuid;
@@ -1,60 +0,0 @@
1
- import type { Application, RequestHandler } from "express";
2
- import type { Server } from "http";
3
- import type { CorsConfig } from "./cors.helper.js";
4
- export interface CreateServerOptions {
5
- /**
6
- * CORS configuration. Pass false to disable CORS middleware.
7
- */
8
- cors?: CorsConfig | false;
9
- /**
10
- * JSON body parser limit. Defaults to "1mb".
11
- */
12
- jsonLimit?: string;
13
- /**
14
- * Additional middleware to apply before routes.
15
- */
16
- middleware?: RequestHandler[];
17
- /**
18
- * Port to listen on. Defaults to PORT env var or 8080.
19
- */
20
- port?: number | string;
21
- }
22
- export interface ServerResult {
23
- /**
24
- * The HTTP server instance.
25
- */
26
- server: Server;
27
- /**
28
- * The port the server is listening on.
29
- */
30
- port: number;
31
- }
32
- /**
33
- * Creates and starts an Express server with standard Jaypie middleware.
34
- *
35
- * Features:
36
- * - CORS handling (configurable)
37
- * - JSON body parsing
38
- * - Listens on PORT env var (default 8080)
39
- *
40
- * Usage:
41
- * ```ts
42
- * import express from "express";
43
- * import { createServer, expressHandler } from "@jaypie/express";
44
- *
45
- * const app = express();
46
- *
47
- * app.get("/", expressHandler(async (req, res) => {
48
- * return { message: "Hello World" };
49
- * }));
50
- *
51
- * const { server, port } = await createServer(app);
52
- * console.log(`Server running on port ${port}`);
53
- * ```
54
- *
55
- * @param app - Express application instance
56
- * @param options - Server configuration options
57
- * @returns Promise resolving to server instance and port
58
- */
59
- declare function createServer(app: Application, options?: CreateServerOptions): Promise<ServerResult>;
60
- export default createServer;
@@ -1,12 +0,0 @@
1
- import type { Request } from "express";
2
- /**
3
- * Get the current invoke UUID from Lambda Web Adapter context.
4
- * This function extracts the request ID from either:
5
- * 1. The x-amzn-request-id header (set by Lambda Web Adapter)
6
- * 2. The _X_AMZN_TRACE_ID environment variable (set by Lambda runtime)
7
- *
8
- * @param req - Optional Express request object to extract headers from
9
- * @returns The AWS request ID or undefined if not in Lambda context
10
- */
11
- declare function getWebAdapterUuid(req?: Request): string | undefined;
12
- export default getWebAdapterUuid;