ag-common 0.0.93 → 0.0.94
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.
|
@@ -8,10 +8,14 @@ export declare type NextType<T> = ({ event, body, params, userProfile, lang, }:
|
|
|
8
8
|
userProfile?: User;
|
|
9
9
|
lang: TLang;
|
|
10
10
|
}) => Promise<APIGatewayProxyResult>;
|
|
11
|
-
export declare function validateOpenApi<T>({ event, next, authorized, schema, COGNITO_USER_POOL_ID, }: {
|
|
11
|
+
export declare function validateOpenApi<T>({ event, next, authorized, schema, COGNITO_USER_POOL_ID, jwksRegion, }: {
|
|
12
12
|
COGNITO_USER_POOL_ID: string;
|
|
13
13
|
schema: any;
|
|
14
14
|
event: APIGatewayEvent;
|
|
15
15
|
next: NextType<T>;
|
|
16
16
|
authorized?: true | false | 'optional';
|
|
17
|
+
/**
|
|
18
|
+
* default ap-southeast-2
|
|
19
|
+
*/
|
|
20
|
+
jwksRegion?: string;
|
|
17
21
|
}): Promise<APIGatewayProxyResult>;
|
|
@@ -43,7 +43,7 @@ const getOperation = ({ path, method, resource, schema, }) => {
|
|
|
43
43
|
const pathParams = (re === null || re === void 0 ? void 0 : re.groups) && JSON.parse(JSON.stringify(re === null || re === void 0 ? void 0 : re.groups));
|
|
44
44
|
return { operation, pathParams };
|
|
45
45
|
};
|
|
46
|
-
function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID, }) {
|
|
46
|
+
function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID, jwksRegion = 'ap-southeast-2', }) {
|
|
47
47
|
var _a, _b, _c, _d, _e;
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
if (!schema) {
|
|
@@ -107,6 +107,7 @@ function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID
|
|
|
107
107
|
({ error, userProfile } = yield (0, validations_1.getAndValidateToken)({
|
|
108
108
|
tokenRaw: authHeader,
|
|
109
109
|
COGNITO_USER_POOL_ID,
|
|
110
|
+
jwksRegion,
|
|
110
111
|
}));
|
|
111
112
|
if (error) {
|
|
112
113
|
return error;
|