@mstuercke/api-utils 0.0.13 → 0.0.15
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/dist/rest/RestApi.d.ts +1 -1
- package/dist/rest/types/RestApiRequest.d.ts +1 -1
- package/dist/rest/types/RestApiRequestHandler.d.ts +1 -1
- package/dist/rest/types/RestApiRoute.d.ts +2 -2
- package/dist/rest/types/RestApiRouteHandler.d.ts +1 -1
- package/dist/rest/types/RestApiRouteWithAuthentication.d.ts +7 -0
- package/dist/rest/types/RestApiRouteWithAuthentication.js +2 -0
- package/dist/rest/types/RestApiRouteWithAuthentication.js.map +1 -0
- package/dist/rest/types/RestRequireAuthentication.d.ts +1 -1
- package/dist/rest/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/rest/RestApi.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { RestApiRequestHandler, RestApiRoute, RestPathParams, RestQueryParams, R
|
|
|
2
2
|
import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
|
|
3
3
|
export declare class RestApi {
|
|
4
4
|
private routes;
|
|
5
|
-
addRouteHandler<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication =
|
|
5
|
+
addRouteHandler<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication = false>(route: RestApiRoute<PathParams, QueryParams, RequestHeaders, RequestBody, ResponseBody, RequireAuthentication>, requestHandler: RestApiRequestHandler<PathParams, QueryParams, RequestHeaders, RequestBody, ResponseBody, RequireAuthentication>): this;
|
|
6
6
|
handleRequest(proxyEvent: APIGatewayProxyEvent): Promise<APIGatewayProxyResult>;
|
|
7
7
|
private getMatchingRouteHandlers;
|
|
8
8
|
private getMatchingRouteHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RestPathParams, RestQueryParams, RestRequestBody } from './index';
|
|
2
2
|
import { RestRequestHeaders } from './RestRequestHeaders';
|
|
3
3
|
import { RestRequireAuthentication } from './RestRequireAuthentication';
|
|
4
|
-
export type RestApiRequest<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, RequireAuthentication extends RestRequireAuthentication =
|
|
4
|
+
export type RestApiRequest<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, RequireAuthentication extends RestRequireAuthentication = false> = {
|
|
5
5
|
pathParams: PathParams;
|
|
6
6
|
queryParams: QueryParams;
|
|
7
7
|
headers: RequestHeaders;
|
|
@@ -6,5 +6,5 @@ import { RestRequestHeaders } from './RestRequestHeaders';
|
|
|
6
6
|
import { RestApiRequest } from './RestApiRequest';
|
|
7
7
|
import { RestApiResponse } from './RestApiResponse';
|
|
8
8
|
import { RestRequireAuthentication } from './RestRequireAuthentication';
|
|
9
|
-
export type RestApiRequestHandler<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication =
|
|
9
|
+
export type RestApiRequestHandler<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication = false> = (request: RestApiRequest<PathParams, QueryParams, RequestHeaders, RequestBody, RequireAuthentication>) => Promise<RestApiResponse<ResponseBody>>;
|
|
10
10
|
export type RestApiRequestHandlerBase = RestApiRequestHandler<RestPathParams, RestQueryParams, RestRequestHeaders, RestRequestBody, RestResponseBody, RestRequireAuthentication>;
|
|
@@ -6,7 +6,7 @@ import { RestRequestHeaders } from './RestRequestHeaders';
|
|
|
6
6
|
import { RestRequireAuthentication } from './RestRequireAuthentication';
|
|
7
7
|
export type RestHttpMethod = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT' | 'OPTIONS';
|
|
8
8
|
export type RestRoutePath = `/${string}`;
|
|
9
|
-
export
|
|
9
|
+
export type RestApiRoute<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication = false> = {
|
|
10
10
|
method: RestHttpMethod;
|
|
11
11
|
path: RestRoutePath;
|
|
12
12
|
buildUrl: (pathParams: PathParams, queryParams: QueryParams) => RestRoutePath;
|
|
@@ -16,5 +16,5 @@ export interface RestApiRoute<PathParams extends RestPathParams = never, QueryPa
|
|
|
16
16
|
RequestBody: RequestBody;
|
|
17
17
|
ResponseBody: ResponseBody;
|
|
18
18
|
};
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
export type RestApiRouteBase = RestApiRoute<RestPathParams, RestQueryParams, RestRequestHeaders, RestRequestBody, RestResponseBody, RestRequireAuthentication>;
|
|
@@ -6,7 +6,7 @@ import { RestRequestBody } from './RestRequestBody';
|
|
|
6
6
|
import { RestResponseBody } from './RestResponseBody';
|
|
7
7
|
import { RestRequestHeaders } from './RestRequestHeaders';
|
|
8
8
|
import { RestRequireAuthentication } from './RestRequireAuthentication';
|
|
9
|
-
export interface RestApiRouteHandler<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication =
|
|
9
|
+
export interface RestApiRouteHandler<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never, RequireAuthentication extends RestRequireAuthentication = false> {
|
|
10
10
|
route: RestApiRoute<PathParams, QueryParams, RequestHeaders, RequestBody, ResponseBody, RequireAuthentication>;
|
|
11
11
|
requestHandler: RestApiRequestHandler<PathParams, QueryParams, RequestHeaders, RequestBody, ResponseBody, RequireAuthentication>;
|
|
12
12
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RestPathParams } from './RestPathParams';
|
|
2
|
+
import { RestRequestBody } from './RestRequestBody';
|
|
3
|
+
import { RestResponseBody } from './RestResponseBody';
|
|
4
|
+
import { RestQueryParams } from './RestQueryParams';
|
|
5
|
+
import { RestRequestHeaders } from './RestRequestHeaders';
|
|
6
|
+
import { RestApiRoute } from './RestApiRoute';
|
|
7
|
+
export type RestApiRouteWithAuthentication<PathParams extends RestPathParams = never, QueryParams extends RestQueryParams = never, RequestHeaders extends RestRequestHeaders = never, RequestBody extends RestRequestBody = never, ResponseBody extends RestResponseBody = never> = RestApiRoute<PathParams, QueryParams, RequestHeaders, RequestBody, ResponseBody, true>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestApiRouteWithAuthentication.js","sourceRoot":"","sources":["../../../src/rest/types/RestApiRouteWithAuthentication.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type RestRequireAuthentication =
|
|
1
|
+
export type RestRequireAuthentication = boolean;
|
|
@@ -3,6 +3,7 @@ export { RestApiRequestHandler } from './RestApiRequestHandler';
|
|
|
3
3
|
export { RestApiResponse } from './RestApiResponse';
|
|
4
4
|
export { RestApiRoute, RestRoutePath, RestHttpMethod } from './RestApiRoute';
|
|
5
5
|
export { RestApiRouteHandler } from './RestApiRouteHandler';
|
|
6
|
+
export { RestApiRouteWithAuthentication } from './RestApiRouteWithAuthentication';
|
|
6
7
|
export { RestPathParams } from './RestPathParams';
|
|
7
8
|
export { RestQueryParams } from './RestQueryParams';
|
|
8
9
|
export { RestRequestBody } from './RestRequestBody';
|