@spytecgps/lambda-utils 1.0.18 → 1.0.20

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
@@ -20,6 +20,8 @@ export interface SpytecAuthContext {
20
20
  resources: SpytecAuthorizedResources;
21
21
  principalId: string;
22
22
  scope?: string;
23
+ enterprise?: boolean;
24
+ maintenanceModule?: boolean;
23
25
  }
24
26
  export declare type BaseAPIGatewayEvent = Omit<APIGatewayProxyEventBase<SpytecAuthContext>, 'pathParameters' | 'queryStringParameters' | 'body'>;
25
27
  export interface WrapperArgs<E, R> {
@@ -12,6 +12,7 @@ interface SpytecJoi extends Joi.Root {
12
12
  delimitedArray(): ArraySchema;
13
13
  dateString(): StringSchema;
14
14
  jsonArray<TSchema = any, T = TSchema>(schema?: Joi.SchemaMap<T>): ArraySchema<TSchema>;
15
+ base64ThenUriEncodedObject<TSchema = any, T = TSchema>(schema?: SchemaMap<T>): ObjectSchema<TSchema>;
15
16
  }
16
17
  export declare const SpytecJoi: SpytecJoi;
17
18
  export {};
@@ -140,4 +140,22 @@ exports.SpytecJoi = Joi.extend(function (joi) { return ({
140
140
  }
141
141
  return { value: value };
142
142
  },
143
+ }); }, function (joi) { return ({
144
+ type: 'base64ThenUriEncodedObject',
145
+ base: joi.object(),
146
+ coerce: function (value) {
147
+ try {
148
+ var decodedValue = decodeURIComponent(Buffer.from(value, 'base64').toString());
149
+ return { value: JSON.parse(decodedValue) };
150
+ }
151
+ catch (err) {
152
+ return null;
153
+ }
154
+ },
155
+ validate: function (value, helpers) {
156
+ if (!value) {
157
+ return { value: value, errors: helpers.error('json.valid') };
158
+ }
159
+ return { value: value };
160
+ },
143
161
  }); });
@@ -38,6 +38,8 @@ exports.getAuthorizerValidator = function (_a) {
38
38
  .valid(type)
39
39
  .error(function () { return new errors_1.UnauthorizedError("missing user type " + type); })
40
40
  : Joi.optional(),
41
+ enterprise: Joi.boolean().default(false),
42
+ maintenanceModule: Joi.boolean().default(false),
41
43
  });
42
44
  };
43
45
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/lambda-utils",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Lambda Utils",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",