@spytecgps/lambda-utils 1.0.19 → 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.
|
@@ -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
|
/**
|