@spytecgps/lambda-utils 0.0.7 → 0.0.9
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/errors/UnauthorizedError.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/validation/custom.d.ts +0 -2
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/requestContext.d.ts +13 -0
- package/dist/validation/validateEvent.d.ts +2 -2
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIGatewayProxyWithLambdaAuthorizerEvent } from 'aws-lambda';
|
|
2
2
|
import { ObjectSchema } from 'joi';
|
|
3
|
+
import { APIGatewayProxyEventBase } from 'aws-lambda/trigger/api-gateway-proxy';
|
|
3
4
|
export interface SpytecAuthorizedResources {
|
|
4
5
|
devices: string[];
|
|
5
6
|
}
|
|
@@ -8,8 +9,10 @@ export interface SpytecAuthContext {
|
|
|
8
9
|
userId?: string;
|
|
9
10
|
clientId: number;
|
|
10
11
|
resources: SpytecAuthorizedResources;
|
|
12
|
+
principalId: string;
|
|
13
|
+
scope?: string;
|
|
11
14
|
}
|
|
12
|
-
export declare type BaseEvent = Omit<
|
|
15
|
+
export declare type BaseEvent = Omit<APIGatewayProxyEventBase<SpytecAuthContext>, 'pathParameters' | 'queryStringParameters'>;
|
|
13
16
|
export interface WrapperArgs<E, R> {
|
|
14
17
|
event: APIGatewayProxyWithLambdaAuthorizerEvent<SpytecAuthContext>;
|
|
15
18
|
schema?: ObjectSchema<E>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Joi from 'joi';
|
|
2
|
+
import { SpytecAuthContext } from '../types';
|
|
3
|
+
import { APIGatewayEventRequestContextWithAuthorizer } from 'aws-lambda/common/api-gateway';
|
|
4
|
+
interface GetAuthorizerValidatorParams {
|
|
5
|
+
scope?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getAuthorizerValidator: ({ scope }?: GetAuthorizerValidatorParams) => Joi.ObjectSchema<SpytecAuthContext>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
11
|
+
export declare const requestContextValidator: Joi.ObjectSchema<any>;
|
|
12
|
+
export declare const getRequestContextValidator: (params?: GetAuthorizerValidatorParams) => Joi.ObjectSchema<APIGatewayEventRequestContextWithAuthorizer<SpytecAuthContext>>;
|
|
13
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ObjectSchema } from 'joi';
|
|
2
|
-
declare const validateEvent: <T>(event: any, schema?: ObjectSchema<T
|
|
1
|
+
import { ObjectSchema, ValidationOptions } from 'joi';
|
|
2
|
+
declare const validateEvent: <T>(event: any, schema?: ObjectSchema<T>, validateOptions?: ValidationOptions) => T;
|
|
3
3
|
export default validateEvent;
|