@aesop-fables/triginta 0.2.3 → 0.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.
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { APIGatewayProxyEventPathParameters, APIGatewayProxyEventV2 } from 'aws-lambda';
|
|
2
|
+
import { IServiceContainer } from '@aesop-fables/containr';
|
|
2
3
|
import { IConfiguredRoute } from './IConfiguredRoute';
|
|
3
4
|
export interface InvocationContext {
|
|
4
5
|
configuredRoute: IConfiguredRoute;
|
|
6
|
+
container: IServiceContainer;
|
|
5
7
|
body?: any;
|
|
6
8
|
path: string;
|
|
7
9
|
}
|
|
8
10
|
export declare function parseRouteParams(route: string, path: string): APIGatewayProxyEventPathParameters;
|
|
9
|
-
export declare function parsePathParameters(context:
|
|
10
|
-
export declare
|
|
11
|
+
export declare function parsePathParameters(context: EventGenerationContext): Partial<APIGatewayProxyEventV2>;
|
|
12
|
+
export declare type EventGenerationContext = Omit<InvocationContext, 'container'>;
|
|
13
|
+
export declare function createApiGatewayEvent(context: EventGenerationContext): Partial<APIGatewayProxyEventV2>;
|
|
11
14
|
export declare function invokeHttpHandler<Output>(context: InvocationContext): Promise<Output>;
|
package/lib/invokeHttpHandler.js
CHANGED
|
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.invokeHttpHandler = exports.createApiGatewayEvent = exports.parsePathParameters = exports.parseRouteParams = void 0;
|
|
16
|
-
const HttpLambda_1 = require("./HttpLambda");
|
|
17
16
|
const node_querystring_1 = __importDefault(require("node:querystring"));
|
|
18
17
|
const HttpLambdaServices_1 = require("./HttpLambdaServices");
|
|
19
18
|
function normalizeAndParse(input) {
|
|
@@ -112,7 +111,7 @@ exports.createApiGatewayEvent = createApiGatewayEvent;
|
|
|
112
111
|
// TODO -- We need to rename this to make it clear that it's for testing ONLY
|
|
113
112
|
function invokeHttpHandler(context) {
|
|
114
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const container =
|
|
114
|
+
const { container } = context;
|
|
116
115
|
const factory = container.get(HttpLambdaServices_1.HttpLambdaServices.HttpLambdaFactory);
|
|
117
116
|
const configuredHandler = factory.createHandler(context.configuredRoute.constructor);
|
|
118
117
|
return configuredHandler(createApiGatewayEvent(context), {
|
package/package.json
CHANGED