@spytecgps/lambda-utils 2.3.25 → 2.3.27

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/index.js CHANGED
@@ -169,7 +169,7 @@ const SpytecJoi = Joi__namespace.extend((joi) => ({
169
169
  const getAuthorizerValidator = (params = {}) => {
170
170
  return Joi__namespace.object({
171
171
  clientId: Joi__namespace.number().greater(0).required(),
172
- userId: Joi__namespace.string().guid({ version: 'uuidv4' }).required(),
172
+ userId: Joi__namespace.string().guid( /*{ version: 'uuidv4' }*/).required(),
173
173
  resources: json.object({}),
174
174
  scope: Joi__namespace.string().optional(),
175
175
  // .error(() => new UnauthorizedError(`missing scope ${scope}`))
@@ -184,6 +184,15 @@ const getAuthorizerValidator = (params = {}) => {
184
184
  ...params,
185
185
  });
186
186
  };
187
+ const getAuthorizerValidatorV4 = (params = {}) => {
188
+ return Joi__namespace.object({
189
+ clientId: Joi__namespace.number().greater(0).required(),
190
+ userId: Joi__namespace.string().guid( /*{ version: 'uuidv4' }*/).required(),
191
+ scope: Joi__namespace.string().optional(),
192
+ type: Joi__namespace.string().optional(),
193
+ ...params,
194
+ });
195
+ };
187
196
  /**
188
197
  * @deprecated
189
198
  */
@@ -195,6 +204,11 @@ const getRequestContextValidator = (params = {}) => {
195
204
  authorizer: getAuthorizerValidator(params),
196
205
  });
197
206
  };
207
+ const getRequestContextValidatorV4 = (params = {}) => {
208
+ return Joi__namespace.object({
209
+ authorizer: getAuthorizerValidatorV4(params),
210
+ });
211
+ };
198
212
 
199
213
  class HttpError extends Error {
200
214
  }
@@ -715,8 +729,10 @@ exports.buildProxyResult = buildProxyResult;
715
729
  exports.buildResponseBody = buildResponseBody;
716
730
  exports.defaultApiSchema = defaultApiSchema;
717
731
  exports.getAuthorizerValidator = getAuthorizerValidator;
732
+ exports.getAuthorizerValidatorV4 = getAuthorizerValidatorV4;
718
733
  exports.getEnvKey = getEnvKey;
719
734
  exports.getRequestContextValidator = getRequestContextValidator;
735
+ exports.getRequestContextValidatorV4 = getRequestContextValidatorV4;
720
736
  exports.iccidSchema = iccidSchema;
721
737
  exports.imeiSchema = imeiSchema;
722
738
  exports.isDev = isDev;
package/dist/types.d.ts CHANGED
@@ -75,3 +75,10 @@ export type SQSWrapperArgsWithReturn<RecordType extends BaseRecord, T> = {
75
75
  singleHandler?: (record: RecordType) => T | Promise<T>;
76
76
  mode?: 'serial' | 'parallel';
77
77
  };
78
+ export interface SpytecAuthContextV4 {
79
+ type: AuthClass;
80
+ userId?: string;
81
+ clientId: number;
82
+ principalId: string;
83
+ scope?: string;
84
+ }
@@ -1,11 +1,14 @@
1
1
  import { APIGatewayEventRequestContextWithAuthorizer } from 'aws-lambda/common/api-gateway';
2
2
  import * as Joi from 'joi';
3
- import { SpytecAuthContext } from '../types';
3
+ import { SpytecAuthContext, SpytecAuthContextV4 } from '../types';
4
4
  type GetAuthorizerValidatorParams = Partial<Record<keyof SpytecAuthContext, Joi.AnySchema>>;
5
+ type GetAuthorizerValidatorParamsV4 = Partial<Record<keyof SpytecAuthContextV4, Joi.AnySchema>>;
5
6
  export declare const getAuthorizerValidator: (params?: GetAuthorizerValidatorParams) => Joi.ObjectSchema<SpytecAuthContext>;
7
+ export declare const getAuthorizerValidatorV4: (params?: GetAuthorizerValidatorParamsV4) => Joi.ObjectSchema<SpytecAuthContext>;
6
8
  /**
7
9
  * @deprecated
8
10
  */
9
11
  export declare const requestContextValidator: Joi.ObjectSchema<any>;
10
12
  export declare const getRequestContextValidator: (params?: GetAuthorizerValidatorParams) => Joi.ObjectSchema<APIGatewayEventRequestContextWithAuthorizer<SpytecAuthContext>>;
13
+ export declare const getRequestContextValidatorV4: (params?: GetAuthorizerValidatorParamsV4) => Joi.ObjectSchema<APIGatewayEventRequestContextWithAuthorizer<SpytecAuthContextV4>>;
11
14
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/lambda-utils",
3
- "version": "2.3.25",
3
+ "version": "2.3.27",
4
4
  "description": "Lambda Utils",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -74,4 +74,4 @@
74
74
  "files": [
75
75
  "dist/**/*"
76
76
  ]
77
- }
77
+ }
@@ -1,2 +0,0 @@
1
- import { logger, withRequest } from '@spytecgps/sdk-logger';
2
- export { logger, withRequest };