@spytecgps/lambda-utils 0.0.8 → 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/types.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface SpytecAuthContext {
10
10
  clientId: number;
11
11
  resources: SpytecAuthorizedResources;
12
12
  principalId: string;
13
+ scope?: string;
13
14
  }
14
15
  export declare type BaseEvent = Omit<APIGatewayProxyEventBase<SpytecAuthContext>, 'pathParameters' | 'queryStringParameters'>;
15
16
  export interface WrapperArgs<E, R> {
@@ -1,4 +1,2 @@
1
- import * as Joi from 'joi';
2
1
  export declare const json: any;
3
2
  export declare const urlEncoded: any;
4
- export declare const requestContextValidator: Joi.ObjectSchema<any>;
@@ -1,3 +1,4 @@
1
1
  import validateEvent from './validateEvent';
2
2
  export { validateEvent };
3
3
  export * from './custom';
4
+ export * from './requestContext';
@@ -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>) => 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/lambda-utils",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Lambda Utils",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",