@modernlock/common 1.0.28 → 1.0.30
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PropertyNotProvided = void 0;
|
|
4
|
+
const custom_error_1 = require("./custom-error");
|
|
5
|
+
class PropertyNotProvided extends custom_error_1.CustomError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("Property not provided");
|
|
8
|
+
this.statusCode = 400;
|
|
9
|
+
Object.setPrototypeOf(this, PropertyNotProvided.prototype);
|
|
10
|
+
}
|
|
11
|
+
;
|
|
12
|
+
serializeErrors() {
|
|
13
|
+
return [{ message: 'Property not provided' }];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.PropertyNotProvided = PropertyNotProvided;
|
|
17
|
+
;
|
package/build/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./errors/password-incorrect-error";
|
|
|
20
20
|
export * from "./errors/user-not-found-error";
|
|
21
21
|
export * from "./errors/not-primary-email-error";
|
|
22
22
|
export * from "./errors/no-key-assigned-error";
|
|
23
|
+
export * from "./errors/property-not-provided";
|
|
23
24
|
export * from "./middlewares/checkPermissions";
|
|
24
25
|
export * from "./middlewares/checkAuth";
|
|
25
26
|
export * from "./middlewares/error-handler";
|
|
@@ -28,5 +29,7 @@ export * from "./utils/jwtEncryption";
|
|
|
28
29
|
export * from "./utils/logger";
|
|
29
30
|
export * from "./logger/custom-logger";
|
|
30
31
|
export * from "./logger/transporterOptions";
|
|
31
|
-
export * from "./config/elasticsearch";
|
|
32
32
|
export * from "./config/elasticsearchConnection";
|
|
33
|
+
export * from "./@types/express";
|
|
34
|
+
export * from "./@types/reservation";
|
|
35
|
+
export * from "./@types/sendgrid";
|
package/build/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __exportStar(require("./errors/password-incorrect-error"), exports);
|
|
|
36
36
|
__exportStar(require("./errors/user-not-found-error"), exports);
|
|
37
37
|
__exportStar(require("./errors/not-primary-email-error"), exports);
|
|
38
38
|
__exportStar(require("./errors/no-key-assigned-error"), exports);
|
|
39
|
+
__exportStar(require("./errors/property-not-provided"), exports);
|
|
39
40
|
__exportStar(require("./middlewares/checkPermissions"), exports);
|
|
40
41
|
__exportStar(require("./middlewares/checkAuth"), exports);
|
|
41
42
|
__exportStar(require("./middlewares/error-handler"), exports);
|
|
@@ -44,5 +45,7 @@ __exportStar(require("./utils/jwtEncryption"), exports);
|
|
|
44
45
|
__exportStar(require("./utils/logger"), exports);
|
|
45
46
|
__exportStar(require("./logger/custom-logger"), exports);
|
|
46
47
|
__exportStar(require("./logger/transporterOptions"), exports);
|
|
47
|
-
__exportStar(require("./config/elasticsearch"), exports);
|
|
48
48
|
__exportStar(require("./config/elasticsearchConnection"), exports);
|
|
49
|
+
__exportStar(require("./@types/express"), exports);
|
|
50
|
+
__exportStar(require("./@types/reservation"), exports);
|
|
51
|
+
__exportStar(require("./@types/sendgrid"), exports);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function checkElasticSearchConnection(): Promise<void>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.checkElasticSearchConnection = void 0;
|
|
13
|
-
const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
14
|
-
const logger_1 = require("../utils/logger");
|
|
15
|
-
const log = (0, logger_1.winstonLogger)(process.env.ELASTIC_SEARCH_URL, "reservationElasticsearchServer", "debug");
|
|
16
|
-
const elasticSearchClient = new elasticsearch_1.Client({
|
|
17
|
-
node: process.env.ELASTIC_SEARCH_URL,
|
|
18
|
-
// auth: {
|
|
19
|
-
// username: process.env.ELASTIC_USERNAME as string,
|
|
20
|
-
// password: process.env.ELASTIC_PASSWORD as string
|
|
21
|
-
// }
|
|
22
|
-
});
|
|
23
|
-
function checkElasticSearchConnection() {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
let isConnected = false;
|
|
26
|
-
while (!isConnected) {
|
|
27
|
-
try {
|
|
28
|
-
const health = yield elasticSearchClient.cluster.health({});
|
|
29
|
-
log.info(`ReservationService elasticsearch health status - ${health.status}`);
|
|
30
|
-
console.log(`ReservationService elasticsearch health status - ${health.status}`);
|
|
31
|
-
isConnected = true;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
log.error("Connection to elasticSearch faild. Retrying....");
|
|
35
|
-
log.log("error", "ReservationService checkConnection() method:", error);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
exports.checkElasticSearchConnection = checkElasticSearchConnection;
|
|
41
|
-
;
|