@hyper.software/common-helpers 1.0.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/README.md +0 -0
- package/lib/errors/CriticalError.d.ts +11 -0
- package/lib/errors/CriticalError.js +38 -0
- package/lib/errors/CriticalError.js.map +1 -0
- package/lib/errors/ValidationError.d.ts +11 -0
- package/lib/errors/ValidationError.js +38 -0
- package/lib/errors/ValidationError.js.map +1 -0
- package/lib/errors/ValidationErrorSilent.d.ts +4 -0
- package/lib/errors/ValidationErrorSilent.js +29 -0
- package/lib/errors/ValidationErrorSilent.js.map +1 -0
- package/lib/errors/ValidationErrorWithStatus.d.ts +11 -0
- package/lib/errors/ValidationErrorWithStatus.js +39 -0
- package/lib/errors/ValidationErrorWithStatus.js.map +1 -0
- package/lib/errors/ValidationErrorWithStatusSilent.d.ts +4 -0
- package/lib/errors/ValidationErrorWithStatusSilent.js +29 -0
- package/lib/errors/ValidationErrorWithStatusSilent.js.map +1 -0
- package/lib/errors/__mocks__/errors.mock.d.ts +75 -0
- package/lib/errors/__mocks__/errors.mock.js +92 -0
- package/lib/errors/__mocks__/errors.mock.js.map +1 -0
- package/lib/errors/__tests__/errorMappers.test.d.ts +1 -0
- package/lib/errors/__tests__/errorMappers.test.js +30 -0
- package/lib/errors/__tests__/errorMappers.test.js.map +1 -0
- package/lib/errors/__tests__/errors.test.d.ts +1 -0
- package/lib/errors/__tests__/errors.test.js +82 -0
- package/lib/errors/__tests__/errors.test.js.map +1 -0
- package/lib/errors/errorMappers.d.ts +18 -0
- package/lib/errors/errorMappers.js +153 -0
- package/lib/errors/errorMappers.js.map +1 -0
- package/lib/errors/errors.types.d.ts +15 -0
- package/lib/errors/errors.types.js +9 -0
- package/lib/errors/errors.types.js.map +1 -0
- package/lib/errors/index.d.ts +5 -0
- package/lib/errors/index.js +13 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/express/__tests__/swaggerHelpers.test.d.ts +1 -0
- package/lib/express/__tests__/swaggerHelpers.test.js +57 -0
- package/lib/express/__tests__/swaggerHelpers.test.js.map +1 -0
- package/lib/express/middleware/aliveMiddleware/index.d.ts +10 -0
- package/lib/express/middleware/aliveMiddleware/index.js +22 -0
- package/lib/express/middleware/aliveMiddleware/index.js.map +1 -0
- package/lib/express/middleware/companyMiddleware/company.d.ts +10 -0
- package/lib/express/middleware/companyMiddleware/company.js +24 -0
- package/lib/express/middleware/companyMiddleware/company.js.map +1 -0
- package/lib/express/middleware/companyMiddleware/companyApiRequest.d.ts +7 -0
- package/lib/express/middleware/companyMiddleware/companyApiRequest.js +18 -0
- package/lib/express/middleware/companyMiddleware/companyApiRequest.js.map +1 -0
- package/lib/express/middleware/companyMiddleware/index.d.ts +17 -0
- package/lib/express/middleware/companyMiddleware/index.js +28 -0
- package/lib/express/middleware/companyMiddleware/index.js.map +1 -0
- package/lib/express/middleware/companyMiddleware/index.types.d.ts +2 -0
- package/lib/express/middleware/companyMiddleware/index.types.js +3 -0
- package/lib/express/middleware/companyMiddleware/index.types.js.map +1 -0
- package/lib/express/middleware/expressErrorHandlerMiddleware/__tests__/expressErrorHandlerMiddleware.test.d.ts +1 -0
- package/lib/express/middleware/expressErrorHandlerMiddleware/__tests__/expressErrorHandlerMiddleware.test.js +97 -0
- package/lib/express/middleware/expressErrorHandlerMiddleware/__tests__/expressErrorHandlerMiddleware.test.js.map +1 -0
- package/lib/express/middleware/expressErrorHandlerMiddleware/index.d.ts +15 -0
- package/lib/express/middleware/expressErrorHandlerMiddleware/index.js +82 -0
- package/lib/express/middleware/expressErrorHandlerMiddleware/index.js.map +1 -0
- package/lib/express/middleware/index.d.ts +7 -0
- package/lib/express/middleware/index.js +18 -0
- package/lib/express/middleware/index.js.map +1 -0
- package/lib/express/middleware/languageMiddleware/index.d.ts +5 -0
- package/lib/express/middleware/languageMiddleware/index.js +53 -0
- package/lib/express/middleware/languageMiddleware/index.js.map +1 -0
- package/lib/express/middleware/partnerMiddleware/index.d.ts +17 -0
- package/lib/express/middleware/partnerMiddleware/index.js +28 -0
- package/lib/express/middleware/partnerMiddleware/index.js.map +1 -0
- package/lib/express/middleware/partnerMiddleware/index.types.d.ts +2 -0
- package/lib/express/middleware/partnerMiddleware/index.types.js +3 -0
- package/lib/express/middleware/partnerMiddleware/index.types.js.map +1 -0
- package/lib/express/middleware/partnerMiddleware/partner.d.ts +10 -0
- package/lib/express/middleware/partnerMiddleware/partner.js +24 -0
- package/lib/express/middleware/partnerMiddleware/partner.js.map +1 -0
- package/lib/express/middleware/partnerMiddleware/partnerServiceRequest.d.ts +7 -0
- package/lib/express/middleware/partnerMiddleware/partnerServiceRequest.js +18 -0
- package/lib/express/middleware/partnerMiddleware/partnerServiceRequest.js.map +1 -0
- package/lib/express/middleware/responseHelpersMiddleware/index.d.ts +2 -0
- package/lib/express/middleware/responseHelpersMiddleware/index.js +67 -0
- package/lib/express/middleware/responseHelpersMiddleware/index.js.map +1 -0
- package/lib/express/middleware/responseHelpersMiddleware/types.d.ts +18 -0
- package/lib/express/middleware/responseHelpersMiddleware/types.js +3 -0
- package/lib/express/middleware/responseHelpersMiddleware/types.js.map +1 -0
- package/lib/express/middleware/translationsMiddleware/index.d.ts +4 -0
- package/lib/express/middleware/translationsMiddleware/index.js +20 -0
- package/lib/express/middleware/translationsMiddleware/index.js.map +1 -0
- package/lib/express/swaggerControllersConfig.d.ts +13 -0
- package/lib/express/swaggerControllersConfig.js +112 -0
- package/lib/express/swaggerControllersConfig.js.map +1 -0
- package/lib/express/swaggerHelpers.d.ts +4 -0
- package/lib/express/swaggerHelpers.js +27 -0
- package/lib/express/swaggerHelpers.js.map +1 -0
- package/lib/express/swaggerUiController.d.ts +6 -0
- package/lib/express/swaggerUiController.js +17 -0
- package/lib/express/swaggerUiController.js.map +1 -0
- package/lib/express/swaggerUiTemplate.d.ts +5 -0
- package/lib/express/swaggerUiTemplate.js +9 -0
- package/lib/express/swaggerUiTemplate.js.map +1 -0
- package/lib/helpers/ExecuteOnce.d.ts +6 -0
- package/lib/helpers/ExecuteOnce.js +31 -0
- package/lib/helpers/ExecuteOnce.js.map +1 -0
- package/lib/helpers/UniversalConfig.d.ts +8 -0
- package/lib/helpers/UniversalConfig.js +31 -0
- package/lib/helpers/UniversalConfig.js.map +1 -0
- package/lib/helpers/__tests__/arrays.test.d.ts +1 -0
- package/lib/helpers/__tests__/arrays.test.js +17 -0
- package/lib/helpers/__tests__/arrays.test.js.map +1 -0
- package/lib/helpers/__tests__/emptyValues.test.d.ts +1 -0
- package/lib/helpers/__tests__/emptyValues.test.js +31 -0
- package/lib/helpers/__tests__/emptyValues.test.js.map +1 -0
- package/lib/helpers/__tests__/formatters.formatCurrency.test.d.ts +1 -0
- package/lib/helpers/__tests__/formatters.formatCurrency.test.js +18 -0
- package/lib/helpers/__tests__/formatters.formatCurrency.test.js.map +1 -0
- package/lib/helpers/__tests__/formatters.formatDate.test.d.ts +1 -0
- package/lib/helpers/__tests__/formatters.formatDate.test.js +163 -0
- package/lib/helpers/__tests__/formatters.formatDate.test.js.map +1 -0
- package/lib/helpers/__tests__/formatters.formatDouble.test.d.ts +1 -0
- package/lib/helpers/__tests__/formatters.formatDouble.test.js +26 -0
- package/lib/helpers/__tests__/formatters.formatDouble.test.js.map +1 -0
- package/lib/helpers/__tests__/navigation.test.d.ts +1 -0
- package/lib/helpers/__tests__/navigation.test.js +64 -0
- package/lib/helpers/__tests__/navigation.test.js.map +1 -0
- package/lib/helpers/__tests__/strings.test.d.ts +1 -0
- package/lib/helpers/__tests__/strings.test.js +46 -0
- package/lib/helpers/__tests__/strings.test.js.map +1 -0
- package/lib/helpers/__tests__/validation.test.d.ts +1 -0
- package/lib/helpers/__tests__/validation.test.js +193 -0
- package/lib/helpers/__tests__/validation.test.js.map +1 -0
- package/lib/helpers/arrays.d.ts +1 -0
- package/lib/helpers/arrays.js +10 -0
- package/lib/helpers/arrays.js.map +1 -0
- package/lib/helpers/clientLogger.d.ts +8 -0
- package/lib/helpers/clientLogger.js +73 -0
- package/lib/helpers/clientLogger.js.map +1 -0
- package/lib/helpers/constants/applicationForm.d.ts +59 -0
- package/lib/helpers/constants/applicationForm.js +68 -0
- package/lib/helpers/constants/applicationForm.js.map +1 -0
- package/lib/helpers/constants/candidates.d.ts +64 -0
- package/lib/helpers/constants/candidates.js +74 -0
- package/lib/helpers/constants/candidates.js.map +1 -0
- package/lib/helpers/constants/common.d.ts +93 -0
- package/lib/helpers/constants/common.js +111 -0
- package/lib/helpers/constants/common.js.map +1 -0
- package/lib/helpers/constants/contract.d.ts +37 -0
- package/lib/helpers/constants/contract.js +42 -0
- package/lib/helpers/constants/contract.js.map +1 -0
- package/lib/helpers/constants/documents.d.ts +11 -0
- package/lib/helpers/constants/documents.js +16 -0
- package/lib/helpers/constants/documents.js.map +1 -0
- package/lib/helpers/constants/features.d.ts +7 -0
- package/lib/helpers/constants/features.js +11 -0
- package/lib/helpers/constants/features.js.map +1 -0
- package/lib/helpers/constants/fileUploads.d.ts +5 -0
- package/lib/helpers/constants/fileUploads.js +8 -0
- package/lib/helpers/constants/fileUploads.js.map +1 -0
- package/lib/helpers/constants/index.d.ts +37 -0
- package/lib/helpers/constants/index.js +43 -0
- package/lib/helpers/constants/index.js.map +1 -0
- package/lib/helpers/constants/integrations.d.ts +39 -0
- package/lib/helpers/constants/integrations.js +47 -0
- package/lib/helpers/constants/integrations.js.map +1 -0
- package/lib/helpers/constants/language.d.ts +6 -0
- package/lib/helpers/constants/language.js +10 -0
- package/lib/helpers/constants/language.js.map +1 -0
- package/lib/helpers/constants/listing.d.ts +327 -0
- package/lib/helpers/constants/listing.js +364 -0
- package/lib/helpers/constants/listing.js.map +1 -0
- package/lib/helpers/constants/listingTemplate.d.ts +7 -0
- package/lib/helpers/constants/listingTemplate.js +12 -0
- package/lib/helpers/constants/listingTemplate.js.map +1 -0
- package/lib/helpers/constants/mediaTypes.d.ts +34 -0
- package/lib/helpers/constants/mediaTypes.js +39 -0
- package/lib/helpers/constants/mediaTypes.js.map +1 -0
- package/lib/helpers/constants/messages.d.ts +5 -0
- package/lib/helpers/constants/messages.js +10 -0
- package/lib/helpers/constants/messages.js.map +1 -0
- package/lib/helpers/constants/moveIn.d.ts +59 -0
- package/lib/helpers/constants/moveIn.js +66 -0
- package/lib/helpers/constants/moveIn.js.map +1 -0
- package/lib/helpers/constants/partner.d.ts +7 -0
- package/lib/helpers/constants/partner.js +12 -0
- package/lib/helpers/constants/partner.js.map +1 -0
- package/lib/helpers/constants/pictures.d.ts +2 -0
- package/lib/helpers/constants/pictures.js +5 -0
- package/lib/helpers/constants/pictures.js.map +1 -0
- package/lib/helpers/constants/properties.d.ts +17 -0
- package/lib/helpers/constants/properties.js +24 -0
- package/lib/helpers/constants/properties.js.map +1 -0
- package/lib/helpers/constants/schedule.d.ts +11 -0
- package/lib/helpers/constants/schedule.js +15 -0
- package/lib/helpers/constants/schedule.js.map +1 -0
- package/lib/helpers/constants/scoring.d.ts +8 -0
- package/lib/helpers/constants/scoring.js +13 -0
- package/lib/helpers/constants/scoring.js.map +1 -0
- package/lib/helpers/constants/screenSizes.d.ts +8 -0
- package/lib/helpers/constants/screenSizes.js +11 -0
- package/lib/helpers/constants/screenSizes.js.map +1 -0
- package/lib/helpers/constants/searchProfile.d.ts +5 -0
- package/lib/helpers/constants/searchProfile.js +9 -0
- package/lib/helpers/constants/searchProfile.js.map +1 -0
- package/lib/helpers/constants/swagger.d.ts +5 -0
- package/lib/helpers/constants/swagger.js +10 -0
- package/lib/helpers/constants/swagger.js.map +1 -0
- package/lib/helpers/constants/tenants.d.ts +5 -0
- package/lib/helpers/constants/tenants.js +10 -0
- package/lib/helpers/constants/tenants.js.map +1 -0
- package/lib/helpers/constants/units.d.ts +156 -0
- package/lib/helpers/constants/units.js +173 -0
- package/lib/helpers/constants/units.js.map +1 -0
- package/lib/helpers/constants/urls.d.ts +4 -0
- package/lib/helpers/constants/urls.js +7 -0
- package/lib/helpers/constants/urls.js.map +1 -0
- package/lib/helpers/constants/user.d.ts +5 -0
- package/lib/helpers/constants/user.js +10 -0
- package/lib/helpers/constants/user.js.map +1 -0
- package/lib/helpers/constants/validators.d.ts +5 -0
- package/lib/helpers/constants/validators.js +9 -0
- package/lib/helpers/constants/validators.js.map +1 -0
- package/lib/helpers/emptyValues.d.ts +2 -0
- package/lib/helpers/emptyValues.js +16 -0
- package/lib/helpers/emptyValues.js.map +1 -0
- package/lib/helpers/formatters.d.ts +13 -0
- package/lib/helpers/formatters.js +107 -0
- package/lib/helpers/formatters.js.map +1 -0
- package/lib/helpers/guards.d.ts +1 -0
- package/lib/helpers/guards.js +10 -0
- package/lib/helpers/guards.js.map +1 -0
- package/lib/helpers/index.d.ts +6 -0
- package/lib/helpers/index.js +13 -0
- package/lib/helpers/index.js.map +1 -0
- package/lib/helpers/isBrowser.d.ts +1 -0
- package/lib/helpers/isBrowser.js +4 -0
- package/lib/helpers/isBrowser.js.map +1 -0
- package/lib/helpers/math.d.ts +3 -0
- package/lib/helpers/math.js +41 -0
- package/lib/helpers/math.js.map +1 -0
- package/lib/helpers/moment.d.ts +40 -0
- package/lib/helpers/moment.js +83 -0
- package/lib/helpers/moment.js.map +1 -0
- package/lib/helpers/navigation.d.ts +19 -0
- package/lib/helpers/navigation.js +142 -0
- package/lib/helpers/navigation.js.map +1 -0
- package/lib/helpers/stringifySafe.d.ts +1 -0
- package/lib/helpers/stringifySafe.js +16 -0
- package/lib/helpers/stringifySafe.js.map +1 -0
- package/lib/helpers/strings.d.ts +4 -0
- package/lib/helpers/strings.js +64 -0
- package/lib/helpers/strings.js.map +1 -0
- package/lib/helpers/validation.d.ts +110 -0
- package/lib/helpers/validation.js +278 -0
- package/lib/helpers/validation.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces.d.ts +16 -0
- package/lib/interfaces.js +22 -0
- package/lib/interfaces.js.map +1 -0
- package/lib/redux/analyticsMiddleware.d.ts +4 -0
- package/lib/redux/analyticsMiddleware.js +53 -0
- package/lib/redux/analyticsMiddleware.js.map +1 -0
- package/lib/redux/clientMiddleware.d.ts +1 -0
- package/lib/redux/clientMiddleware.js +79 -0
- package/lib/redux/clientMiddleware.js.map +1 -0
- package/lib/redux/emptyMiddleware.d.ts +1 -0
- package/lib/redux/emptyMiddleware.js +6 -0
- package/lib/redux/emptyMiddleware.js.map +1 -0
- package/lib/redux/index.d.ts +3 -0
- package/lib/redux/index.js +9 -0
- package/lib/redux/index.js.map +1 -0
- package/lib/services/applicantService.d.ts +1 -0
- package/lib/services/applicantService.js +8 -0
- package/lib/services/applicantService.js.map +1 -0
- package/lib/services/cookieService/cookieService.d.ts +29 -0
- package/lib/services/cookieService/cookieService.js +61 -0
- package/lib/services/cookieService/cookieService.js.map +1 -0
- package/lib/services/googleAnalyticsService/googleAnalyticsService.d.ts +17 -0
- package/lib/services/googleAnalyticsService/googleAnalyticsService.js +79 -0
- package/lib/services/googleAnalyticsService/googleAnalyticsService.js.map +1 -0
- package/lib/services/imageService/imageService.d.ts +7 -0
- package/lib/services/imageService/imageService.js +27 -0
- package/lib/services/imageService/imageService.js.map +1 -0
- package/lib/services/index.d.ts +10 -0
- package/lib/services/index.js +13 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/languageService/languageService.d.ts +16 -0
- package/lib/services/languageService/languageService.js +46 -0
- package/lib/services/languageService/languageService.js.map +1 -0
- package/lib/services/localstorageService/localstorageService.d.ts +2 -0
- package/lib/services/localstorageService/localstorageService.js +19 -0
- package/lib/services/localstorageService/localstorageService.js.map +1 -0
- package/lib/services/sessionStorageService/index.d.ts +2 -0
- package/lib/services/sessionStorageService/index.js +19 -0
- package/lib/services/sessionStorageService/index.js.map +1 -0
- package/lib/translations/getAllTranslations.d.ts +5 -0
- package/lib/translations/getAllTranslations.js +26 -0
- package/lib/translations/getAllTranslations.js.map +1 -0
- package/package.json +110 -0
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IError, LogLevel } from './errors.types';
|
|
2
|
+
export declare class CriticalError extends Error implements IError {
|
|
3
|
+
isCriticalError: boolean;
|
|
4
|
+
type: string;
|
|
5
|
+
errorMessage: string;
|
|
6
|
+
errorLocale: string;
|
|
7
|
+
payload: string;
|
|
8
|
+
logLevel: LogLevel;
|
|
9
|
+
statusCode: number;
|
|
10
|
+
constructor(message: string, errorLocale: string, payload?: any);
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var errors_types_1 = require("./errors.types");
|
|
17
|
+
var CriticalError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(CriticalError, _super);
|
|
19
|
+
function CriticalError(message, errorLocale, payload) {
|
|
20
|
+
var _this = _super.call(this, message) || this;
|
|
21
|
+
_this.isCriticalError = true;
|
|
22
|
+
_this.type = 'CriticalError';
|
|
23
|
+
_this.errorMessage = '';
|
|
24
|
+
_this.errorLocale = '';
|
|
25
|
+
_this.payload = '';
|
|
26
|
+
_this.logLevel = errors_types_1.LogLevel.error;
|
|
27
|
+
_this.statusCode = 400;
|
|
28
|
+
_this.name = _this.constructor.name;
|
|
29
|
+
_this.message = 'critical error';
|
|
30
|
+
_this.errorMessage = message;
|
|
31
|
+
_this.errorLocale = errorLocale;
|
|
32
|
+
_this.payload = payload && JSON.stringify(payload);
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
return CriticalError;
|
|
36
|
+
}(Error));
|
|
37
|
+
exports.CriticalError = CriticalError;
|
|
38
|
+
//# sourceMappingURL=CriticalError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CriticalError.js","sourceRoot":"","sources":["../../src/errors/CriticalError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAkD;AAElD;IAAmC,iCAAK;IAStC,uBAAY,OAAe,EAAE,WAAmB,EAAE,OAAa;QAA/D,YACE,kBAAM,OAAO,CAAC,SAMf;QAfM,qBAAe,GAAG,IAAI,CAAC;QACvB,UAAI,GAAG,eAAe,CAAC;QACvB,kBAAY,GAAG,EAAE,CAAC;QAClB,iBAAW,GAAG,EAAE,CAAC;QACjB,aAAO,GAAG,EAAE,CAAC;QACb,cAAQ,GAAG,uBAAQ,CAAC,KAAK,CAAC;QAC1B,gBAAU,GAAG,GAAG,CAAC;QAItB,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;QAChC,KAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,KAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;;IACpD,CAAC;IACH,oBAAC;AAAD,CAAC,AAjBD,CAAmC,KAAK,GAiBvC;AAjBY,sCAAa"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IError, LogLevel } from './errors.types';
|
|
2
|
+
export declare class ValidationError extends Error implements IError {
|
|
3
|
+
isValidationError: boolean;
|
|
4
|
+
type: string;
|
|
5
|
+
errorMessage: string;
|
|
6
|
+
errorLocale: string;
|
|
7
|
+
payload: string;
|
|
8
|
+
logLevel: LogLevel;
|
|
9
|
+
statusCode: number;
|
|
10
|
+
constructor(message: string, errorLocale: string, payload?: any);
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var errors_types_1 = require("./errors.types");
|
|
17
|
+
var ValidationError = /** @class */ (function (_super) {
|
|
18
|
+
__extends(ValidationError, _super);
|
|
19
|
+
function ValidationError(message, errorLocale, payload) {
|
|
20
|
+
var _this = _super.call(this, message) || this;
|
|
21
|
+
_this.isValidationError = true;
|
|
22
|
+
_this.type = 'ValidationError';
|
|
23
|
+
_this.errorMessage = '';
|
|
24
|
+
_this.errorLocale = '';
|
|
25
|
+
_this.payload = '';
|
|
26
|
+
_this.logLevel = errors_types_1.LogLevel.warn;
|
|
27
|
+
_this.statusCode = 400;
|
|
28
|
+
_this.name = _this.constructor.name;
|
|
29
|
+
_this.message = 'validation error';
|
|
30
|
+
_this.errorMessage = message;
|
|
31
|
+
_this.errorLocale = errorLocale;
|
|
32
|
+
_this.payload = payload && JSON.stringify(payload);
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
return ValidationError;
|
|
36
|
+
}(Error));
|
|
37
|
+
exports.ValidationError = ValidationError;
|
|
38
|
+
//# sourceMappingURL=ValidationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationError.js","sourceRoot":"","sources":["../../src/errors/ValidationError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAkD;AAElD;IAAqC,mCAAK;IASxC,yBAAY,OAAe,EAAE,WAAmB,EAAE,OAAa;QAA/D,YACE,kBAAM,OAAO,CAAC,SAMf;QAfM,uBAAiB,GAAG,IAAI,CAAC;QACzB,UAAI,GAAG,iBAAiB,CAAC;QACzB,kBAAY,GAAG,EAAE,CAAC;QAClB,iBAAW,GAAG,EAAE,CAAC;QACjB,aAAO,GAAG,EAAE,CAAC;QACb,cAAQ,GAAG,uBAAQ,CAAC,IAAI,CAAC;QACzB,gBAAU,GAAG,GAAG,CAAC;QAItB,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC;QAClC,KAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,KAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;;IACpD,CAAC;IACH,sBAAC;AAAD,CAAC,AAjBD,CAAqC,KAAK,GAiBzC;AAjBY,0CAAe"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var errors_types_1 = require("./errors.types");
|
|
17
|
+
var _1 = require("./");
|
|
18
|
+
var ValidationErrorSilent = /** @class */ (function (_super) {
|
|
19
|
+
__extends(ValidationErrorSilent, _super);
|
|
20
|
+
function ValidationErrorSilent(message, errorLocale, payload) {
|
|
21
|
+
var _this = _super.call(this, message, errorLocale, payload) || this;
|
|
22
|
+
_this.type = 'ValidationErrorSilent';
|
|
23
|
+
_this.logLevel = errors_types_1.LogLevel.info;
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return ValidationErrorSilent;
|
|
27
|
+
}(_1.ValidationError));
|
|
28
|
+
exports.ValidationErrorSilent = ValidationErrorSilent;
|
|
29
|
+
//# sourceMappingURL=ValidationErrorSilent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationErrorSilent.js","sourceRoot":"","sources":["../../src/errors/ValidationErrorSilent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,uBAAqC;AAErC;IAA2C,yCAAe;IACxD,+BAAY,OAAe,EAAE,WAAmB,EAAE,OAAa;QAA/D,YACE,kBAAM,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,SAGrC;QAFC,KAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,KAAI,CAAC,QAAQ,GAAG,uBAAQ,CAAC,IAAI,CAAC;;IAChC,CAAC;IACH,4BAAC;AAAD,CAAC,AAND,CAA2C,kBAAe,GAMzD;AANY,sDAAqB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LogLevel, IError } from './errors.types';
|
|
2
|
+
export declare class ValidationErrorWithStatus extends Error implements IError {
|
|
3
|
+
isValidationError: boolean;
|
|
4
|
+
type: string;
|
|
5
|
+
errorMessage: string;
|
|
6
|
+
errorLocale: string;
|
|
7
|
+
payload: string;
|
|
8
|
+
logLevel: LogLevel;
|
|
9
|
+
statusCode: number;
|
|
10
|
+
constructor(status: number, message: string, errorLocale: string, payload?: any);
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var errors_types_1 = require("./errors.types");
|
|
17
|
+
var ValidationErrorWithStatus = /** @class */ (function (_super) {
|
|
18
|
+
__extends(ValidationErrorWithStatus, _super);
|
|
19
|
+
function ValidationErrorWithStatus(status, message, errorLocale, payload) {
|
|
20
|
+
var _this = _super.call(this, message) || this;
|
|
21
|
+
_this.isValidationError = true;
|
|
22
|
+
_this.type = 'ValidationErrorWithStatus';
|
|
23
|
+
_this.errorMessage = '';
|
|
24
|
+
_this.errorLocale = '';
|
|
25
|
+
_this.payload = '';
|
|
26
|
+
_this.logLevel = errors_types_1.LogLevel.warn;
|
|
27
|
+
_this.statusCode = 400;
|
|
28
|
+
_this.name = _this.constructor.name;
|
|
29
|
+
_this.statusCode = status;
|
|
30
|
+
_this.message = 'validation error with status';
|
|
31
|
+
_this.errorMessage = message;
|
|
32
|
+
_this.errorLocale = errorLocale;
|
|
33
|
+
_this.payload = payload && JSON.stringify(payload);
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
return ValidationErrorWithStatus;
|
|
37
|
+
}(Error));
|
|
38
|
+
exports.ValidationErrorWithStatus = ValidationErrorWithStatus;
|
|
39
|
+
//# sourceMappingURL=ValidationErrorWithStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationErrorWithStatus.js","sourceRoot":"","sources":["../../src/errors/ValidationErrorWithStatus.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAkD;AAElD;IAA+C,6CAAK;IASlD,mCAAY,MAAc,EAAE,OAAe,EAAE,WAAmB,EAAE,OAAa;QAA/E,YACE,kBAAM,OAAO,CAAC,SAOf;QAhBM,uBAAiB,GAAG,IAAI,CAAC;QACzB,UAAI,GAAG,2BAA2B,CAAC;QACnC,kBAAY,GAAG,EAAE,CAAC;QAClB,iBAAW,GAAG,EAAE,CAAC;QACjB,aAAO,GAAG,EAAE,CAAC;QACb,cAAQ,GAAG,uBAAQ,CAAC,IAAI,CAAC;QACzB,gBAAU,GAAG,GAAG,CAAC;QAItB,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,KAAI,CAAC,OAAO,GAAG,8BAA8B,CAAC;QAC9C,KAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,KAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;;IACpD,CAAC;IACH,gCAAC;AAAD,CAAC,AAlBD,CAA+C,KAAK,GAkBnD;AAlBY,8DAAyB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var errors_types_1 = require("./errors.types");
|
|
17
|
+
var _1 = require("./");
|
|
18
|
+
var ValidationErrorWithStatusSilent = /** @class */ (function (_super) {
|
|
19
|
+
__extends(ValidationErrorWithStatusSilent, _super);
|
|
20
|
+
function ValidationErrorWithStatusSilent(status, message, errorLocale, payload) {
|
|
21
|
+
var _this = _super.call(this, status, message, errorLocale, payload) || this;
|
|
22
|
+
_this.type = 'ValidationErrorWithStatusSilent';
|
|
23
|
+
_this.logLevel = errors_types_1.LogLevel.info;
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return ValidationErrorWithStatusSilent;
|
|
27
|
+
}(_1.ValidationErrorWithStatus));
|
|
28
|
+
exports.ValidationErrorWithStatusSilent = ValidationErrorWithStatusSilent;
|
|
29
|
+
//# sourceMappingURL=ValidationErrorWithStatusSilent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationErrorWithStatusSilent.js","sourceRoot":"","sources":["../../src/errors/ValidationErrorWithStatusSilent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,uBAA+C;AAE/C;IAAqD,mDAAyB;IAC5E,yCAAY,MAAc,EAAE,OAAe,EAAE,WAAmB,EAAE,OAAa;QAA/E,YACE,kBAAM,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,SAG7C;QAFC,KAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;QAC9C,KAAI,CAAC,QAAQ,GAAG,uBAAQ,CAAC,IAAI,CAAC;;IAChC,CAAC;IACH,sCAAC;AAAD,CAAC,AAND,CAAqD,4BAAyB,GAM7E;AANY,0EAA+B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const swaggerSchemaValidationFailedError: {
|
|
2
|
+
code: string;
|
|
3
|
+
failedValidation: boolean;
|
|
4
|
+
results: {
|
|
5
|
+
errors: {
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
path: string[];
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
warnings: any[];
|
|
12
|
+
};
|
|
13
|
+
path: string[];
|
|
14
|
+
paramName: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const swaggerRequiredError: {
|
|
17
|
+
code: string;
|
|
18
|
+
failedValidation: boolean;
|
|
19
|
+
path: string[];
|
|
20
|
+
paramName: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const swaggerMissingRequiredPropertyError: {
|
|
23
|
+
code: string;
|
|
24
|
+
failedValidation: boolean;
|
|
25
|
+
results: {
|
|
26
|
+
errors: {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
path: string[];
|
|
30
|
+
}[];
|
|
31
|
+
warnings: any[];
|
|
32
|
+
};
|
|
33
|
+
path: string[];
|
|
34
|
+
paramName: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const sequelizeError: {
|
|
37
|
+
name: string;
|
|
38
|
+
message: string;
|
|
39
|
+
errors: {
|
|
40
|
+
message: string;
|
|
41
|
+
type: string;
|
|
42
|
+
path: string;
|
|
43
|
+
value: string;
|
|
44
|
+
}[];
|
|
45
|
+
fields: {
|
|
46
|
+
listing_created_by_company_id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
};
|
|
49
|
+
parent: {
|
|
50
|
+
name: string;
|
|
51
|
+
length: number;
|
|
52
|
+
severity: string;
|
|
53
|
+
code: string;
|
|
54
|
+
detail: string;
|
|
55
|
+
schema: string;
|
|
56
|
+
table: string;
|
|
57
|
+
constraint: string;
|
|
58
|
+
file: string;
|
|
59
|
+
line: string;
|
|
60
|
+
routine: string;
|
|
61
|
+
};
|
|
62
|
+
original: {
|
|
63
|
+
name: string;
|
|
64
|
+
length: number;
|
|
65
|
+
severity: string;
|
|
66
|
+
code: string;
|
|
67
|
+
detail: string;
|
|
68
|
+
schema: string;
|
|
69
|
+
table: string;
|
|
70
|
+
constraint: string;
|
|
71
|
+
file: string;
|
|
72
|
+
line: string;
|
|
73
|
+
routine: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swaggerSchemaValidationFailedError = {
|
|
4
|
+
code: 'SCHEMA_VALIDATION_FAILED',
|
|
5
|
+
failedValidation: true,
|
|
6
|
+
results: {
|
|
7
|
+
errors: [
|
|
8
|
+
{
|
|
9
|
+
code: 'INVALID_TYPE',
|
|
10
|
+
message: 'Expected type string but found type object',
|
|
11
|
+
path: ['contractDetails', 'petsAllowed'],
|
|
12
|
+
description: 'Are pets allowed.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
code: 'ENUM_MISMATCH',
|
|
16
|
+
message: 'No enum match for: {"YES":"YES","NO":"NO","DEPENDS":"DEPENDS"}',
|
|
17
|
+
path: ['contractDetails', 'petsAllowed'],
|
|
18
|
+
description: 'Are pets allowed.',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
warnings: [],
|
|
22
|
+
},
|
|
23
|
+
path: ['paths', '/listing', 'post', 'parameters', '0'],
|
|
24
|
+
paramName: 'body',
|
|
25
|
+
};
|
|
26
|
+
exports.swaggerRequiredError = {
|
|
27
|
+
code: 'REQUIRED',
|
|
28
|
+
failedValidation: true,
|
|
29
|
+
path: ['paths', '/listing', 'post', 'parameters', '3'],
|
|
30
|
+
paramName: 'skip',
|
|
31
|
+
};
|
|
32
|
+
exports.swaggerMissingRequiredPropertyError = {
|
|
33
|
+
code: 'SCHEMA_VALIDATION_FAILED',
|
|
34
|
+
failedValidation: true,
|
|
35
|
+
results: {
|
|
36
|
+
errors: [
|
|
37
|
+
{ code: 'OBJECT_MISSING_REQUIRED_PROPERTY', message: 'Missing required property: period', path: ['contractDetails'] },
|
|
38
|
+
],
|
|
39
|
+
warnings: [],
|
|
40
|
+
},
|
|
41
|
+
path: ['paths', '/listing/rent/short-term-apartment', 'post', 'parameters', '0'],
|
|
42
|
+
paramName: 'body',
|
|
43
|
+
};
|
|
44
|
+
exports.sequelizeError = {
|
|
45
|
+
name: 'SequelizeUniqueConstraintError',
|
|
46
|
+
message: 'Validation error',
|
|
47
|
+
errors: [
|
|
48
|
+
{
|
|
49
|
+
message: 'listing_created_by_company_id must be unique',
|
|
50
|
+
type: 'unique violation',
|
|
51
|
+
path: 'listing_created_by_company_id',
|
|
52
|
+
value: 'bc7d6200-f873-11e6-8f7f-6312d0182b41',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
message: 'title must be unique',
|
|
56
|
+
type: 'unique violation',
|
|
57
|
+
path: 'title',
|
|
58
|
+
value: 'Listing 1',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
fields: {
|
|
62
|
+
listing_created_by_company_id: 'bc7d6200-f873-11e6-8f7f-6312d0182b41',
|
|
63
|
+
title: 'Listing 1',
|
|
64
|
+
},
|
|
65
|
+
parent: {
|
|
66
|
+
name: 'error',
|
|
67
|
+
length: 339,
|
|
68
|
+
severity: 'ERROR',
|
|
69
|
+
code: '23505',
|
|
70
|
+
detail: 'Key (listing_created_by_company_id, title)=(bc7d6200-f873-11e6-8f7f-6312d0182b41, Listing 1) already exists.',
|
|
71
|
+
schema: 'public',
|
|
72
|
+
table: 'listings',
|
|
73
|
+
constraint: 'listings_listing_created_by_company_id_title_key',
|
|
74
|
+
file: 'nbtinsert.c',
|
|
75
|
+
line: '433',
|
|
76
|
+
routine: '_bt_check_unique',
|
|
77
|
+
},
|
|
78
|
+
original: {
|
|
79
|
+
name: 'error',
|
|
80
|
+
length: 339,
|
|
81
|
+
severity: 'ERROR',
|
|
82
|
+
code: '23505',
|
|
83
|
+
detail: 'Key (listing_created_by_company_id, title)=(bc7d6200-f873-11e6-8f7f-6312d0182b41, Listing 1) already exists.',
|
|
84
|
+
schema: 'public',
|
|
85
|
+
table: 'listings',
|
|
86
|
+
constraint: 'listings_listing_created_by_company_id_title_key',
|
|
87
|
+
file: 'nbtinsert.c',
|
|
88
|
+
line: '433',
|
|
89
|
+
routine: '_bt_check_unique',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=errors.mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.mock.js","sourceRoot":"","sources":["../../../src/errors/__mocks__/errors.mock.ts"],"names":[],"mappings":";;AAAa,QAAA,kCAAkC,GAAG;IAChD,IAAI,EAAE,0BAA0B;IAChC,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACP,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,4CAA4C;gBACrD,IAAI,EAAE,CAAC,iBAAiB,EAAE,aAAa,CAAC;gBACxC,WAAW,EAAE,mBAAmB;aACjC;YACD;gBACE,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,gEAAgE;gBACzE,IAAI,EAAE,CAAC,iBAAiB,EAAE,aAAa,CAAC;gBACxC,WAAW,EAAE,mBAAmB;aACjC;SACF;QACD,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC;IACtD,SAAS,EAAE,MAAM;CA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,EAAE,KAAK;QACX,OAAO,EAAE,kBAAkB;KAC5B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,8GAA8G;QACtH,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,kDAAkD;QAC9D,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,kBAAkB;KAC5B;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var errorMappers_1 = require("./../errorMappers");
|
|
4
|
+
describe('WHEN errorMappers', function () {
|
|
5
|
+
describe('WHEN calling mapErrorToJSON with a swagger validation error', function () {
|
|
6
|
+
var swaggerError = new Error();
|
|
7
|
+
// Simulate a swagger error
|
|
8
|
+
swaggerError.code = 'SCHEMA_VALIDATION_FAILED';
|
|
9
|
+
swaggerError.results = {
|
|
10
|
+
errors: [
|
|
11
|
+
{
|
|
12
|
+
SOME_ERROR_PROP: 'SOME_ERROR_PROP',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
var mappedError;
|
|
17
|
+
var mockRequest = {
|
|
18
|
+
body: {
|
|
19
|
+
test: true,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
beforeEach(function () { return (mappedError = errorMappers_1.mapErrorToJSON(swaggerError, mockRequest)); });
|
|
23
|
+
it('SHOULD return correct mapped error', function () {
|
|
24
|
+
expect(mappedError.message.toLowerCase()).toContain('swagger');
|
|
25
|
+
expect(mappedError.errors[0]).toBeDefined();
|
|
26
|
+
expect(mappedError.errors[0].SOME_ERROR_PROP).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=errorMappers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorMappers.test.js","sourceRoot":"","sources":["../../../src/errors/__tests__/errorMappers.test.ts"],"names":[],"mappings":";;AAAA,kDAAmD;AAEnD,QAAQ,CAAC,mBAAmB,EAAE;IAC5B,QAAQ,CAAC,6DAA6D,EAAE;QACtE,IAAM,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;QACjC,2BAA2B;QAC1B,YAAoB,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvD,YAAoB,CAAC,OAAO,GAAG;YAC9B,MAAM,EAAE;gBACN;oBACE,eAAe,EAAE,iBAAiB;iBACnC;aACF;SACF,CAAC;QAEF,IAAI,WAAW,CAAC;QAChB,IAAM,WAAW,GAAG;YAClB,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI;aACX;SACF,CAAC;QAEF,UAAU,CAAC,cAAM,OAAA,CAAC,WAAW,GAAG,6BAAc,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,EAAzD,CAAyD,CAAC,CAAC;QAE5E,EAAE,CAAC,oCAAoC,EAAE;YACvC,MAAM,CAAE,WAAW,CAAC,OAAkB,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YAC3E,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAC5C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var errors_mock_1 = require("../__mocks__/errors.mock");
|
|
4
|
+
var __1 = require("../");
|
|
5
|
+
var errorMappers_1 = require("./../errorMappers");
|
|
6
|
+
describe('WHEN testing errors', function () {
|
|
7
|
+
describe('WHEN testing swagger schema validation error', function () {
|
|
8
|
+
it('SHOULD be swagger error', function () { return expect(errorMappers_1.isSwaggerValidationError(errors_mock_1.swaggerSchemaValidationFailedError)).toBe(true); });
|
|
9
|
+
it('SHOULD have correct format', function () {
|
|
10
|
+
var result = errorMappers_1.formatSwaggerValidationError(errors_mock_1.swaggerSchemaValidationFailedError);
|
|
11
|
+
expect(result).toEqual({
|
|
12
|
+
isValidationError: true,
|
|
13
|
+
type: 'ValidationError',
|
|
14
|
+
error: 'Expected type string but found type object',
|
|
15
|
+
locale: 'any.api.validation.INVALID_TYPE.contractDetails.petsAllowed',
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('WHEN testing swagger required error', function () {
|
|
20
|
+
it('SHOULD be swagger error', function () { return expect(errorMappers_1.isSwaggerValidationError(errors_mock_1.swaggerRequiredError)).toBe(true); });
|
|
21
|
+
it('SHOULD be formatted correctly', function () {
|
|
22
|
+
var result = errorMappers_1.formatSwaggerValidationError(errors_mock_1.swaggerRequiredError);
|
|
23
|
+
expect(result).toEqual({
|
|
24
|
+
isValidationError: true,
|
|
25
|
+
type: 'ValidationError',
|
|
26
|
+
error: "The parameter '" + errors_mock_1.swaggerRequiredError.paramName + "' is required.",
|
|
27
|
+
locale: "any.api.validation.REQUIRED." + errors_mock_1.swaggerRequiredError.paramName,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('WHEN testing swagger schema validation error missing required property', function () {
|
|
32
|
+
it('SHOULD be swagger error', function () { return expect(errorMappers_1.isSwaggerValidationError(errors_mock_1.swaggerMissingRequiredPropertyError)).toBe(true); });
|
|
33
|
+
it('SHOULD be formatted correctly', function () {
|
|
34
|
+
var result = errorMappers_1.formatSwaggerValidationError(errors_mock_1.swaggerMissingRequiredPropertyError);
|
|
35
|
+
expect(result).toEqual({
|
|
36
|
+
isValidationError: true,
|
|
37
|
+
type: 'ValidationError',
|
|
38
|
+
error: "Missing required property: period",
|
|
39
|
+
locale: "any.api.validation.OBJECT_MISSING_REQUIRED_PROPERTY.contractDetails.period",
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe('WHEN testing sequelize error', function () {
|
|
44
|
+
it('SHOULD be sequelize error', function () { return expect(errorMappers_1.isSequelizeError(errors_mock_1.sequelizeError)).toBe(true); });
|
|
45
|
+
it('SHOULD have correct format', function () {
|
|
46
|
+
var result = errorMappers_1.formatSequelizeError(errors_mock_1.sequelizeError);
|
|
47
|
+
expect(result).toEqual({
|
|
48
|
+
errors: [
|
|
49
|
+
{
|
|
50
|
+
message: 'listing_created_by_company_id must be unique',
|
|
51
|
+
path: 'listing_created_by_company_id',
|
|
52
|
+
type: 'unique violation',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
message: 'title must be unique',
|
|
56
|
+
path: 'title',
|
|
57
|
+
type: 'unique violation',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
locale: 'validation.listing_created_by_company_id.must.be.unique',
|
|
61
|
+
name: 'SequelizeUniqueConstraintError',
|
|
62
|
+
type: 'DataValidationError',
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('WHEN error is ValidationError', function () {
|
|
67
|
+
it('SHOULD be known error', function () { return expect(errorMappers_1.isKnownError(new __1.ValidationError('Description', 'locale'))).toBe(true); });
|
|
68
|
+
});
|
|
69
|
+
describe('WHEN error is ValidationErrorWithStatus', function () {
|
|
70
|
+
it('SHOULD be known error', function () {
|
|
71
|
+
return expect(errorMappers_1.isKnownError(new __1.ValidationErrorWithStatus(404, 'Description', 'locale'))).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('WHEN error is ValidationErrorSilent', function () {
|
|
75
|
+
it('SHOULD be known error', function () { return expect(errorMappers_1.isKnownError(new __1.ValidationErrorSilent('Description', 'locale'))).toBe(true); });
|
|
76
|
+
});
|
|
77
|
+
describe('WHEN error is CriticalError', function () {
|
|
78
|
+
it('SHOULD be known error', function () { return expect(errorMappers_1.isKnownError(new __1.CriticalError('Description', 'locale'))).toBe(true); });
|
|
79
|
+
it('SHOULD be critical error', function () { return expect(errorMappers_1.isCriticalError(new __1.CriticalError('Description', 'locale'))).toBe(true); });
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=errors.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../../src/errors/__tests__/errors.test.ts"],"names":[],"mappings":";;AAAA,wDAKkC;AAClC,yBAAuG;AACvG,kDAO2B;AAE3B,QAAQ,CAAC,qBAAqB,EAAE;IAC9B,QAAQ,CAAC,8CAA8C,EAAE;QACvD,EAAE,CAAC,yBAAyB,EAAE,cAAM,OAAA,MAAM,CAAC,uCAAwB,CAAC,gDAAkC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAA/E,CAA+E,CAAC,CAAC;QAErH,EAAE,CAAC,4BAA4B,EAAE;YAC/B,IAAM,MAAM,GAAG,2CAA4B,CAAC,gDAAkC,CAAC,CAAC;YAChF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,iBAAiB,EAAE,IAAI;gBACvB,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,4CAA4C;gBACnD,MAAM,EAAE,6DAA6D;aACtE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,qCAAqC,EAAE;QAC9C,EAAE,CAAC,yBAAyB,EAAE,cAAM,OAAA,MAAM,CAAC,uCAAwB,CAAC,kCAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAjE,CAAiE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AI,CAAC,IAAI,CAAC,EAA3E,CAA2E,CAAC,CAAC;QAC/G,EAAE,CAAC,0BAA0B,EAAE,cAAM,OAAA,MAAM,CAAC,8BAAe,CAAC,IAAI,iBAAa,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAA9E,CAA8E,CAAC,CAAC;IACvH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ValidationError } from './ValidationError';
|
|
2
|
+
export declare function mapErrorToString(err: any, req: any): string;
|
|
3
|
+
export declare function mapErrorToJSON(err: Error, _req: any): any;
|
|
4
|
+
export declare function formatValidationErrorResponse(err: Error | any): any;
|
|
5
|
+
export declare function formatJoiValidationErrorResponse(err: Error | any): any;
|
|
6
|
+
export declare function formatSwaggerValidationError(err: Error | any): ValidationError;
|
|
7
|
+
export declare function formatSequelizeError(err: any): {
|
|
8
|
+
type: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
name: any;
|
|
11
|
+
errors: any;
|
|
12
|
+
};
|
|
13
|
+
export declare function formatValidationError(err: any): any;
|
|
14
|
+
export declare function isSwaggerValidationError(err: Error | any): boolean;
|
|
15
|
+
export declare function isSequelizeError(err: Error | any): boolean;
|
|
16
|
+
export declare function isJoiError(err: Error | any): any;
|
|
17
|
+
export declare function isCriticalError(err: Error | any): any;
|
|
18
|
+
export declare function isKnownError(err: Error | any): any;
|