@spytecgps/lambda-utils 0.0.9 → 0.9.1
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
|
@@ -4,20 +4,22 @@ import { APIGatewayProxyEventBase } from 'aws-lambda/trigger/api-gateway-proxy';
|
|
|
4
4
|
export interface SpytecAuthorizedResources {
|
|
5
5
|
devices: string[];
|
|
6
6
|
}
|
|
7
|
+
export declare type AuthClass = 'user' | 'client' | 'system';
|
|
7
8
|
export interface SpytecAuthContext {
|
|
8
|
-
type:
|
|
9
|
+
type: AuthClass;
|
|
9
10
|
userId?: string;
|
|
10
11
|
clientId: number;
|
|
11
12
|
resources: SpytecAuthorizedResources;
|
|
12
13
|
principalId: string;
|
|
13
14
|
scope?: string;
|
|
14
15
|
}
|
|
15
|
-
export declare type
|
|
16
|
+
export declare type BaseAPIGatewayEvent = Omit<APIGatewayProxyEventBase<SpytecAuthContext>, 'pathParameters' | 'queryStringParameters' | 'body'>;
|
|
16
17
|
export interface WrapperArgs<E, R> {
|
|
17
18
|
event: APIGatewayProxyWithLambdaAuthorizerEvent<SpytecAuthContext>;
|
|
18
19
|
schema?: ObjectSchema<E>;
|
|
19
|
-
handler:
|
|
20
|
+
handler: Handler<E, R>;
|
|
20
21
|
}
|
|
22
|
+
export declare type Handler<E, R> = (event: E) => Promise<HandlerResponse<R>>;
|
|
21
23
|
export interface HandlerResponse<R> {
|
|
22
24
|
statusCode?: number;
|
|
23
25
|
headers?: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as Joi from 'joi';
|
|
2
|
-
import { SpytecAuthContext } from '../types';
|
|
2
|
+
import { AuthClass, SpytecAuthContext } from '../types';
|
|
3
3
|
import { APIGatewayEventRequestContextWithAuthorizer } from 'aws-lambda/common/api-gateway';
|
|
4
4
|
interface GetAuthorizerValidatorParams {
|
|
5
5
|
scope?: string;
|
|
6
|
+
type?: AuthClass;
|
|
6
7
|
}
|
|
7
|
-
export declare const getAuthorizerValidator: ({ scope }?: GetAuthorizerValidatorParams) => Joi.ObjectSchema<SpytecAuthContext>;
|
|
8
|
+
export declare const getAuthorizerValidator: ({ scope, type }?: GetAuthorizerValidatorParams) => Joi.ObjectSchema<SpytecAuthContext>;
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated
|
|
10
11
|
*/
|
package/dist/wrappers/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
1
|
+
import apiGatewayEventWrapper from './apiGatewayEventWrapper';
|
|
2
|
+
export { apiGatewayEventWrapper };
|
|
3
3
|
export * from './response';
|