@tsed/platform-serverless-testing 8.0.0-alpha.4 → 8.0.0-alpha.6

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.
@@ -1,6 +1,6 @@
1
1
  import { DITest } from "@tsed/di";
2
2
  import { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEventBase, APIGatewayProxyHandler } from "aws-lambda";
3
- import { APIGatewayProxyResult } from "aws-lambda/trigger/api-gateway-proxy";
3
+ import { APIGatewayProxyResult } from "aws-lambda/trigger/api-gateway-proxy.js";
4
4
  import { Type } from "@tsed/core";
5
5
  import { PlatformBuilder, PlatformBuilderSettings } from "@tsed/common";
6
6
  export interface LambdaPromiseResult extends Promise<APIGatewayProxyResult> {
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@tsed/platform-serverless-testing",
3
3
  "description": "Module to test Serverless function with Ts.ED",
4
- "type": "commonjs",
5
- "version": "8.0.0-alpha.4",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.6",
6
6
  "source": "./src/index.ts",
7
- "main": "./lib/cjs/index.js",
7
+ "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./lib/types/index.d.ts",
13
13
  "import": "./lib/esm/index.js",
14
- "require": "./lib/cjs/index.js",
15
14
  "default": "./lib/cjs/index.js"
16
15
  }
17
16
  },
@@ -52,12 +51,12 @@
52
51
  "homepage": "https://github.com/tsedio/tsed/tree/production/packages/platform/platform-serverless-testing",
53
52
  "repository": "https://github.com/tsedio/tsed",
54
53
  "devDependencies": {
55
- "@tsed/barrels": "8.0.0-alpha.4",
56
- "@tsed/common": "8.0.0-alpha.4",
57
- "@tsed/core": "8.0.0-alpha.4",
58
- "@tsed/di": "8.0.0-alpha.4",
59
- "@tsed/schema": "8.0.0-alpha.4",
60
- "@tsed/typescript": "8.0.0-alpha.4",
54
+ "@tsed/barrels": "8.0.0-alpha.6",
55
+ "@tsed/common": "8.0.0-alpha.6",
56
+ "@tsed/core": "8.0.0-alpha.6",
57
+ "@tsed/di": "8.0.0-alpha.6",
58
+ "@tsed/schema": "8.0.0-alpha.6",
59
+ "@tsed/typescript": "8.0.0-alpha.6",
61
60
  "@types/aws-lambda": "^8.10.136",
62
61
  "eslint": "^8.57.0",
63
62
  "typescript": "4.9.5"
@@ -66,13 +65,13 @@
66
65
  "tslib": "2.6.1"
67
66
  },
68
67
  "peerDependencies": {
69
- "@tsed/common": "8.0.0-alpha.4",
70
- "@tsed/core": "8.0.0-alpha.4",
71
- "@tsed/di": "8.0.0-alpha.4",
72
- "@tsed/json-mapper": "8.0.0-alpha.4",
68
+ "@tsed/common": "8.0.0-alpha.6",
69
+ "@tsed/core": "8.0.0-alpha.6",
70
+ "@tsed/di": "8.0.0-alpha.6",
71
+ "@tsed/json-mapper": "8.0.0-alpha.6",
73
72
  "@tsed/logger": ">=6.7.5",
74
- "@tsed/openspec": "8.0.0-alpha.4",
75
- "@tsed/schema": "8.0.0-alpha.4"
73
+ "@tsed/openspec": "8.0.0-alpha.6",
74
+ "@tsed/schema": "8.0.0-alpha.6"
76
75
  },
77
76
  "publishConfig": {
78
77
  "tag": "alpha"
@@ -1,147 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformServerlessTest = exports.LambdaClientRequest = void 0;
4
- const di_1 = require("@tsed/di");
5
- const createFakeEvent_js_1 = require("./createFakeEvent.js");
6
- const createFakeContext_js_1 = require("./createFakeContext.js");
7
- const core_1 = require("@tsed/core");
8
- class LambdaClientRequest extends Promise {
9
- constructor() {
10
- super(...arguments);
11
- this.event = (0, createFakeEvent_js_1.createFakeEvent)();
12
- this.context = (0, createFakeContext_js_1.createFakeContext)();
13
- }
14
- static call(lambdaName) {
15
- const resolvers = {};
16
- const promise = new LambdaClientRequest((resolve, reject) => {
17
- resolvers.resolve = resolve;
18
- resolvers.reject = reject;
19
- });
20
- promise.init(lambdaName, resolvers.resolve, resolvers.reject);
21
- return promise;
22
- }
23
- static get(path, options = {}) {
24
- return this.call("handler").get(path, options);
25
- }
26
- static post(path, body, options = {}) {
27
- return this.call("handler").post(path, body, options);
28
- }
29
- static put(path, body, options = {}) {
30
- return this.call("handler").put(path, body, options);
31
- }
32
- static patch(path, body, options = {}) {
33
- return this.call("handler").patch(path, body, options);
34
- }
35
- static delete(path, body, options = {}) {
36
- return this.call("handler").delete(path, body, options);
37
- }
38
- get(path, options = {}) {
39
- Object.assign(this.event, options);
40
- this.event.path = path;
41
- this.event.httpMethod = "GET";
42
- return this;
43
- }
44
- post(path, body = {}, options = {}) {
45
- Object.assign(this.event, options);
46
- this.event.path = path;
47
- this.event.httpMethod = "POST";
48
- this.body(body);
49
- return this;
50
- }
51
- patch(path, body = {}, options = {}) {
52
- Object.assign(this.event, options);
53
- this.event.path = path;
54
- this.event.httpMethod = "PATCH";
55
- this.body(body);
56
- return this;
57
- }
58
- put(path, body = {}, options = {}) {
59
- Object.assign(this.event, options);
60
- this.event.path = path;
61
- this.event.httpMethod = "PUT";
62
- this.body(body);
63
- return this;
64
- }
65
- delete(path, body = {}, options = {}) {
66
- Object.assign(this.event, options);
67
- this.event.path = path;
68
- this.event.httpMethod = "DELETE";
69
- this.body(body);
70
- return this;
71
- }
72
- query(query) {
73
- this.event.queryStringParameters = {
74
- ...this.event.queryStringParameters,
75
- ...JSON.parse(JSON.stringify(query))
76
- };
77
- return this;
78
- }
79
- params(pathParameters) {
80
- this.event.pathParameters = {
81
- ...this.event.pathParameters,
82
- ...JSON.parse(JSON.stringify(pathParameters))
83
- };
84
- return this;
85
- }
86
- headers(headers) {
87
- this.event.headers = {
88
- ...this.event.headers,
89
- ...JSON.parse(JSON.stringify(headers))
90
- };
91
- return this;
92
- }
93
- body(body) {
94
- if (body !== undefined) {
95
- this.event.headers["content-type"] = "application/json";
96
- this.event.body = JSON.stringify(body);
97
- }
98
- return this;
99
- }
100
- init(lambda, resolve, reject) {
101
- setTimeout(async () => {
102
- try {
103
- const result = await PlatformServerlessTest.callbacks[lambda](this.event, this.context, resolve);
104
- resolve(result);
105
- }
106
- catch (er) {
107
- reject(er);
108
- }
109
- });
110
- }
111
- }
112
- exports.LambdaClientRequest = LambdaClientRequest;
113
- class PlatformServerlessTest extends di_1.DITest {
114
- static { this.callbacks = {}; }
115
- static { this.request = LambdaClientRequest; }
116
- static bootstrap(serverless, { server, ...settings }) {
117
- return function before() {
118
- settings = di_1.DITest.configure(settings);
119
- const isServerlessHttp = (0, core_1.nameOf)(serverless).includes("Http");
120
- // @ts-ignore
121
- const instance = isServerlessHttp ? serverless.bootstrap(server, settings) : serverless.bootstrap(settings);
122
- PlatformServerlessTest.instance = instance;
123
- PlatformServerlessTest.callbacks = {};
124
- if (!isServerlessHttp) {
125
- PlatformServerlessTest.callbacks = instance.callbacks();
126
- }
127
- PlatformServerlessTest.callbacks.handler = instance.handler();
128
- // used by inject method
129
- di_1.DITest.injector = instance.injector;
130
- return instance.promise;
131
- };
132
- }
133
- /**
134
- * Resets the test injector of the test context, so it won't pollute your next test. Call this in your `tearDown` logic.
135
- */
136
- static async reset() {
137
- if (PlatformServerlessTest.instance) {
138
- await PlatformServerlessTest.instance.stop();
139
- }
140
- if (di_1.DITest.hasInjector()) {
141
- await di_1.DITest.injector.destroy();
142
- di_1.DITest._injector = null;
143
- }
144
- }
145
- }
146
- exports.PlatformServerlessTest = PlatformServerlessTest;
147
- //# sourceMappingURL=PlatformServerlessTest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformServerlessTest.js","sourceRoot":"","sources":["../../src/PlatformServerlessTest.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAGhC,6DAAqD;AACrD,iEAAyD;AACzD,qCAAwC;AAKxC,MAAa,mBAAoB,SAAQ,OAA8B;IAAvE;;QACE,UAAK,GAAG,IAAA,oCAAe,GAAE,CAAC;QAC1B,YAAO,GAAG,IA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C,IAAI,CAAC,gBAAgB,EAAE;gBACrB,sBAAsB,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;aACzD;YAED,sBAAsB,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;YAC9D,wBAAwB;YACxB,WAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;YAEpC,OAAO,QAAQ,CAAC,OAAO,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK;QAChB,IAAI,sBAAsB,CAAC,QAAQ,EAAE;YACnC,MAAM,sBAAsB,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SAC9C;QACD,IAAI,WAAM,CAAC,WAAW,EAAE,EAAE;YACxB,MAAM,WAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChC,WAAM,CAAC,SAAS,GAAG,IAAI,CAAC;SACzB;IACH,CAAC;;AAhDH,wDAiDC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFakeContext = void 0;
4
- function createFakeContext(context) {
5
- return {
6
- awsRequestId: "awsRequestId",
7
- callbackWaitsForEmptyEventLoop: false,
8
- functionName: "",
9
- functionVersion: "",
10
- invokedFunctionArn: "",
11
- logGroupName: "",
12
- logStreamName: "",
13
- memoryLimitInMB: "",
14
- ...(context || {})
15
- };
16
- }
17
- exports.createFakeContext = createFakeContext;
18
- //# sourceMappingURL=createFakeContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createFakeContext.js","sourceRoot":"","sources":["../../src/createFakeContext.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAAC,OAAiB;IACjD,OAAO;QACL,YAAY,EAAE,cAAc;QAC5B,8BAA8B,EAAE,KAAK;QACrC,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE;QACnB,kBAAkB,EAAE,EAAE;QACtB,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,EAAE;QACjB,eAAe,EAAE,EAAE;QACnB,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KACR,CAAC;AACf,CAAC;AAZD,8CAYC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFakeEvent = void 0;
4
- function createFakeEvent(event = {}) {
5
- return {
6
- body: "",
7
- headers: {},
8
- httpMethod: "",
9
- isBase64Encoded: false,
10
- multiValueHeaders: {},
11
- multiValueQueryStringParameters: {},
12
- path: event.path || "/",
13
- pathParameters: {},
14
- queryStringParameters: {},
15
- resource: "",
16
- stageVariables: {},
17
- ...event,
18
- requestContext: {
19
- ...event?.requestContext,
20
- accountId: "",
21
- apiId: "",
22
- protocol: "https",
23
- httpMethod: "",
24
- identity: {},
25
- path: event.path || "/",
26
- stage: "",
27
- requestId: "requestId",
28
- requestTimeEpoch: 0,
29
- resourceId: 1,
30
- resourcePath: event.path || "/"
31
- }
32
- };
33
- }
34
- exports.createFakeEvent = createFakeEvent;
35
- //# sourceMappingURL=createFakeEvent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createFakeEvent.js","sourceRoot":"","sources":["../../src/createFakeEvent.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,QAAoF,EAAE;IACpH,OAAO;QACL,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,EAAE;QACrB,+BAA+B,EAAE,EAAE;QACnC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,GAAG;QACvB,cAAc,EAAE,EAAE;QAClB,qBAAqB,EAAE,EAAE;QACzB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;QAClB,GAAG,KAAK;QACR,cAAc,EAAE;YACd,GAAG,KAAK,EAAE,cAAc;YACxB,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,OAAO;YACjB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAS;YACnB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,GAAG;YACvB,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,WAAW;YACtB,gBAAgB,EAAE,CAAC;YACnB,UAAU,EAAE,CAAC;YACb,YAAY,EAAE,KAAK,CAAC,IAAI,IAAI,GAAG;SACzB;KAC4D,CAAC;AACzE,CAAC;AA7BD,0CA6BC"}
package/lib/cjs/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./createFakeEvent.js"), exports);
5
- tslib_1.__exportStar(require("./createFakeContext.js"), exports);
6
- tslib_1.__exportStar(require("./PlatformServerlessTest.js"), exports);
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,iEAAuC;AACvC,sEAA4C"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,46 +0,0 @@
1
- import { DITest } from "@tsed/di";
2
- import { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEventBase, APIGatewayProxyHandler } from "aws-lambda";
3
- import { APIGatewayProxyResult } from "aws-lambda/trigger/api-gateway-proxy";
4
- import { Type } from "@tsed/core";
5
- import { PlatformBuilder, PlatformBuilderSettings } from "@tsed/common";
6
- export interface LambdaPromiseResult extends Promise<APIGatewayProxyResult> {
7
- }
8
- export declare class LambdaClientRequest extends Promise<APIGatewayProxyResult> {
9
- event: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
10
- context: import("aws-lambda").Context;
11
- static call(lambdaName: string): LambdaClientRequest;
12
- static get(path: string, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): LambdaClientRequest;
13
- static post(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): LambdaClientRequest;
14
- static put(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): LambdaClientRequest;
15
- static patch(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): LambdaClientRequest;
16
- static delete(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): LambdaClientRequest;
17
- get(path: string, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): this;
18
- post(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): this;
19
- patch(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): this;
20
- put(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): this;
21
- delete(path: string, body?: any, options?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): this;
22
- query(query: any): this;
23
- params(pathParameters: any): this;
24
- headers(headers: Record<string, any>): this;
25
- body(body: any): this;
26
- protected init(lambda: string, resolve: Function, reject: Function): void;
27
- }
28
- export declare class PlatformServerlessTest extends DITest {
29
- static callbacks: Record<string, APIGatewayProxyHandler>;
30
- static instance: any;
31
- static request: typeof LambdaClientRequest;
32
- static bootstrap(serverless: {
33
- bootstrap: (server: Type<any>, settings: PlatformBuilderSettings<any>) => PlatformBuilder;
34
- }, { server, ...settings }: PlatformBuilderSettings<any> & {
35
- server: Type<any>;
36
- }): () => Promise<any>;
37
- static bootstrap(serverless: {
38
- bootstrap: (settings: Partial<TsED.Configuration> & {
39
- lambda?: Type[];
40
- }) => any;
41
- }, { server, ...settings }: PlatformBuilderSettings<any>): () => Promise<any>;
42
- /**
43
- * Resets the test injector of the test context, so it won't pollute your next test. Call this in your `tearDown` logic.
44
- */
45
- static reset(): Promise<void>;
46
- }
@@ -1,2 +0,0 @@
1
- import { Context } from "aws-lambda";
2
- export declare function createFakeContext(context?: Context): Context;
@@ -1,2 +0,0 @@
1
- import { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEventBase } from "aws-lambda";
2
- export declare function createFakeEvent(event?: Partial<APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>>): APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
@@ -1,3 +0,0 @@
1
- export * from "./createFakeEvent.js";
2
- export * from "./createFakeContext.js";
3
- export * from "./PlatformServerlessTest.js";