@tsed/platform-serverless-http 8.11.1 → 8.12.0-rc.1

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.
@@ -22,4 +22,3 @@ export class PlatformServerlessHttp {
22
22
  return platform;
23
23
  }
24
24
  }
25
- //# sourceMappingURL=PlatformServerlessHttp.js.map
@@ -6,4 +6,3 @@ import { Req } from "@tsed/platform-http";
6
6
  export function ServerlessContext() {
7
7
  return Req("serverless.context");
8
8
  }
9
- //# sourceMappingURL=serverlessContext.js.map
@@ -6,4 +6,3 @@ import { Req } from "@tsed/platform-http";
6
6
  export function ServerlessEvent() {
7
7
  return Req("serverless.event");
8
8
  }
9
- //# sourceMappingURL=serverlessEvent.js.map
package/lib/esm/index.js CHANGED
@@ -4,4 +4,3 @@
4
4
  export * from "./builder/PlatformServerlessHttp.js";
5
5
  export * from "./decorators/serverlessContext.js";
6
6
  export * from "./decorators/serverlessEvent.js";
7
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsed/platform-serverless-http",
3
3
  "description": "Module to support Serverless HTTP function with Ts.ED",
4
4
  "type": "module",
5
- "version": "8.11.1",
5
+ "version": "8.12.0-rc.1",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
@@ -58,12 +58,12 @@
58
58
  "tslib": "2.7.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@tsed/barrels": "8.11.1",
62
- "@tsed/di": "8.11.1",
63
- "@tsed/hooks": "8.11.1",
64
- "@tsed/platform-http": "8.11.1",
65
- "@tsed/platform-serverless-testing": "8.11.1",
66
- "@tsed/typescript": "8.11.1",
61
+ "@tsed/barrels": "8.12.0-rc.1",
62
+ "@tsed/di": "8.12.0-rc.1",
63
+ "@tsed/hooks": "8.12.0-rc.1",
64
+ "@tsed/platform-http": "8.12.0-rc.1",
65
+ "@tsed/platform-serverless-testing": "8.12.0-rc.1",
66
+ "@tsed/typescript": "8.12.0-rc.1",
67
67
  "@types/aws-lambda": "^8.10.145",
68
68
  "eslint": "9.12.0",
69
69
  "serverless-http": "^3.2.0",
@@ -102,5 +102,8 @@
102
102
  "@tsed/schema": {
103
103
  "optional": false
104
104
  }
105
+ },
106
+ "publishConfig": {
107
+ "tag": "rc"
105
108
  }
106
109
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformServerlessHttp.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAA0B,MAAM,qBAAqB,CAAC;AAE7E,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAAC,SAAS,CAAC,MAAiB,EAAE,QAAsC;QACxE,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEjC,QAAgB,CAAC,OAAO,GAAG,GAAY,EAAE;YACxC,IAAI,OAAY,CAAC;YAEjB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC9B,uBAAuB;gBACvB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,OAAO,CAAC;oBACd,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;wBACxC,OAAO,CAAC,OAAY;4BAClB,OAAO,CAAC,UAAU,GAAG,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;wBACxC,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC;gBAED,OAAO,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO,QAAe,CAAC;IACzB,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverlessContext.js","sourceRoot":"","sources":["../../../src/decorators/serverlessContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAGxC;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACnC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverlessEvent.js","sourceRoot":"","sources":["../../../src/decorators/serverlessEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACjC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC"}
@@ -1,40 +0,0 @@
1
- import {PlatformExpress} from "@tsed/platform-express";
2
- import {PlatformBuilder} from "@tsed/platform-http";
3
- import serverless from "serverless-http";
4
-
5
- import {PlatformServerlessHttp} from "./PlatformServerlessHttp.js";
6
-
7
- vi.mock("serverless-http");
8
-
9
- class Server {}
10
-
11
- describe("PlatformServerlessHttp", () => {
12
- beforeEach(() => {});
13
- it("should create a new serverless http app", async () => {
14
- const event = {};
15
- const context = {};
16
- const callback = vi.fn();
17
- const platform = {
18
- callback: vi.fn().mockReturnValue(callback),
19
- listen: vi.fn().mockResolvedValue(undefined)
20
- };
21
- vi.spyOn(PlatformBuilder, "create").mockReturnValue(platform as any);
22
-
23
- const handler = vi.fn();
24
-
25
- (serverless as any).mockReturnValue(handler);
26
-
27
- const instance = PlatformServerlessHttp.bootstrap(Server, {
28
- adapter: PlatformExpress as any
29
- });
30
-
31
- const h: any = instance.handler();
32
-
33
- await h(event, context);
34
-
35
- expect(serverless).toHaveBeenCalledWith(callback, {
36
- request: expect.any(Function)
37
- });
38
- expect(handler).toHaveBeenCalledWith(event, context);
39
- });
40
- });
@@ -1,31 +0,0 @@
1
- import {Type} from "@tsed/core";
2
- import {PlatformBuilder, PlatformBuilderSettings} from "@tsed/platform-http";
3
- import type {Handler} from "aws-lambda";
4
- import serverless from "serverless-http";
5
-
6
- export class PlatformServerlessHttp {
7
- static bootstrap(module: Type<any>, settings: PlatformBuilderSettings<any>): PlatformBuilder & {handler(): Handler} {
8
- const platform = PlatformBuilder.create(module, settings);
9
- const promise = platform.listen();
10
-
11
- (platform as any).handler = (): Handler => {
12
- let handler: any;
13
-
14
- return async (event, context) => {
15
- // istanbul ignore else
16
- if (!handler) {
17
- await promise;
18
- handler = serverless(platform.callback(), {
19
- request(request: any) {
20
- request.serverless = {event, context};
21
- }
22
- });
23
- }
24
-
25
- return handler(event, context);
26
- };
27
- };
28
-
29
- return platform as any;
30
- }
31
- }
@@ -1,12 +0,0 @@
1
- import {Req} from "@tsed/platform-http";
2
- import type {Context} from "aws-lambda";
3
-
4
- /**
5
- * Return the Serverless context
6
- * @decorator
7
- */
8
- export function ServerlessContext(): ParameterDecorator {
9
- return Req("serverless.context");
10
- }
11
-
12
- export type ServerlessContext = Context;
@@ -1,9 +0,0 @@
1
- import {Req} from "@tsed/platform-http";
2
-
3
- /**
4
- * Return the serverless.event
5
- * @decorator
6
- */
7
- export function ServerlessEvent(): ParameterDecorator {
8
- return Req("serverless.event");
9
- }
package/src/index.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./builder/PlatformServerlessHttp.js";
5
- export * from "./decorators/serverlessContext.js";
6
- export * from "./decorators/serverlessEvent.js";
package/vitest.config.mts DELETED
@@ -1,21 +0,0 @@
1
- // @ts-ignore
2
- import {presets} from "@tsed/vitest/presets";
3
- import {defineConfig} from "vitest/config";
4
-
5
- export default defineConfig(
6
- {
7
- ...presets,
8
- test: {
9
- ...presets.test,
10
- coverage: {
11
- ...presets.test.coverage,
12
- thresholds: {
13
- statements: 0,
14
- branches: 0,
15
- functions: 0,
16
- lines: 0
17
- }
18
- }
19
- }
20
- }
21
- );