blixify-server 0.1.69 → 0.1.71

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.
@@ -1,9 +1,9 @@
1
1
  export declare class CryptoMiddleware {
2
2
  secretKey: string;
3
3
  forceDecryption: boolean;
4
- constructor(secretKey: string, forceDecryption: boolean);
5
- handleEncryption: (data: any) => any;
4
+ nextJs: boolean;
5
+ constructor(secretKey: string, forceDecryption: boolean, nextJs: boolean);
6
6
  handleDecryption: (data: string) => any;
7
- init(): (req: any, res: any, next?: any) => Promise<any>;
7
+ init(): (req: any, res: any) => Promise<any>;
8
8
  }
9
9
  //# sourceMappingURL=crypto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;gBAEZ,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO;IAKvD,gBAAgB,SAAU,GAAG,SAS3B;IAEF,gBAAgB,SAAU,MAAM,SAO9B;IAEF,IAAI,UAG4C,GAAG,OAAO,GAAG,SAAS,GAAG;CAW1E"}
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;IACxB,MAAM,UAAS;gBAEH,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IAMxE,gBAAgB,SAAU,MAAM,SAiB9B;IAEF,IAAI,UAG4C,GAAG,OAAO,GAAG;CAmB9D"}
@@ -8,45 +8,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.CryptoMiddleware = void 0;
13
16
  const CryptoJS = require("crypto-js");
17
+ const moment_timezone_1 = __importDefault(require("moment-timezone"));
14
18
  class CryptoMiddleware {
15
- constructor(secretKey, forceDecryption) {
19
+ constructor(secretKey, forceDecryption, nextJs) {
16
20
  this.secretKey = "";
17
21
  this.forceDecryption = false;
18
- this.handleEncryption = (data) => {
19
- try {
20
- // Encrypt the data
21
- const encrypted = CryptoJS.AES.encrypt(JSON.stringify(data), this.secretKey).toString();
22
- return encrypted;
23
- }
24
- catch (err) { }
25
- };
22
+ this.nextJs = false;
26
23
  this.handleDecryption = (data) => {
27
- try {
28
- // Decrypt the data
29
- const bytes = CryptoJS.AES.decrypt(data, this.secretKey);
30
- const decrypted = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
31
- return decrypted;
24
+ // Decrypt the data
25
+ const bytes = CryptoJS.AES.decrypt(data, this.secretKey);
26
+ const decrypted = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
27
+ if (decrypted) {
28
+ if (decrypted.baseSignDate) {
29
+ const tolerance = moment_timezone_1.default.duration(1, "minute");
30
+ const startWindow = (0, moment_timezone_1.default)(decrypted.baseSignDate).utc();
31
+ const endWindow = startWindow.clone().add(tolerance);
32
+ const currentUTCDate = (0, moment_timezone_1.default)().utc();
33
+ if (currentUTCDate.isBetween(startWindow, endWindow)) {
34
+ delete decrypted["baseSignDate"];
35
+ return decrypted;
36
+ }
37
+ else
38
+ throw "Error";
39
+ }
40
+ else
41
+ throw "Error";
32
42
  }
33
- catch (err) { }
43
+ return {};
34
44
  };
35
45
  this.secretKey = secretKey;
36
46
  this.forceDecryption = forceDecryption;
47
+ this.nextJs = nextJs;
37
48
  }
38
49
  init() {
39
50
  // eslint-disable-next-line
40
51
  const wrapper = this;
41
- const cryptoMiddleware = function (req, res, next) {
42
- var _a;
52
+ const cryptoMiddleware = function (req, res) {
53
+ var _a, _b;
43
54
  return __awaiter(this, void 0, void 0, function* () {
44
- if (wrapper.forceDecryption && !req.body.sign)
45
- return res.status(400).json({ error: "Missing signature for signing" });
46
- if ((_a = req.body) === null || _a === void 0 ? void 0 : _a.sign)
47
- req.body = wrapper.handleDecryption(req.body.sign);
48
- if (next) {
49
- next();
55
+ try {
56
+ if (wrapper.forceDecryption && !req.body.sign) {
57
+ throw new Error("Missing signature for signing");
58
+ }
59
+ try {
60
+ if ((_a = req.body) === null || _a === void 0 ? void 0 : _a.sign)
61
+ req.body = wrapper.handleDecryption(req.body.sign);
62
+ }
63
+ catch (err) {
64
+ throw new Error("Wrong Signature");
65
+ }
66
+ }
67
+ catch (err) {
68
+ if (wrapper.nextJs)
69
+ return err;
70
+ return res.status(400).json({ error: (_b = err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : "" });
50
71
  }
51
72
  });
52
73
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fbWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/fbWrapper.ts"],"names":[],"mappings":"AASA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,EAAE,GAAG,CAAM;IAClB,UAAU,SAAM;IAChB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAEhB,YAAY,QAAS,GAAG,aAEtB;gBAGA,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,GAAG,EAAE,UAAU;IAUjB,UAAU,SAAU,GAAG,SAIrB;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,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CAAC,gCA4E5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC,gCA6CtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG,mBA6BjC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC,gCAoItC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC,gCAkFtC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC,gCAwH5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC,gCA4CtC;IAEF,QAAQ,QAAe,GAAG,OAAO,GAAG,mBAmQlC;IAEF,IAAI,YA+EF;CACH"}
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.FirebaseWrapper = void 0;
16
16
  const firestore_1 = require("firebase-admin/firestore");
17
- const moment_1 = __importDefault(require("moment"));
17
+ const moment_timezone_1 = __importDefault(require("moment-timezone"));
18
18
  const QueryModel_1 = require("../model/QueryModel");
19
19
  const utils_1 = require("./utils");
20
20
  /**
@@ -41,7 +41,7 @@ class FirebaseWrapper {
41
41
  };
42
42
  this.parseModel = (data) => {
43
43
  delete data["id"];
44
- data["baseUpdatedAt"] = (0, moment_1.default)().toDate();
44
+ data["baseUpdatedAt"] = (0, moment_timezone_1.default)().toDate();
45
45
  return data;
46
46
  };
47
47
  this.initBatchCreate = (req, res, workflow) => __awaiter(this, void 0, void 0, function* () {
@@ -94,7 +94,7 @@ class FirebaseWrapper {
94
94
  if (workflow)
95
95
  yield workflow(dataList);
96
96
  yield Promise.all(dataList.map((eachData) => __awaiter(this, void 0, void 0, function* () {
97
- eachData["baseUpdatedAt"] = (0, moment_1.default)().toDate();
97
+ eachData["baseUpdatedAt"] = (0, moment_timezone_1.default)().toDate();
98
98
  const batchRef = fbCollection.doc(eachData["id"]);
99
99
  batch.set(batchRef, Object.assign({}, eachData));
100
100
  })));
@@ -128,7 +128,7 @@ class FirebaseWrapper {
128
128
  const fbCollection = this.fbAdmin
129
129
  .firestore()
130
130
  .collection(this.collection);
131
- req.body.data["baseUpdatedAt"] = (0, moment_1.default)().toDate();
131
+ req.body.data["baseUpdatedAt"] = (0, moment_timezone_1.default)().toDate();
132
132
  if (req.body.unique && ((_a = req.body.data) === null || _a === void 0 ? void 0 : _a[req.body.unique])) {
133
133
  const querySnapshot = yield fbCollection
134
134
  .where(req.body.unique, "==", (_b = req.body.data) === null || _b === void 0 ? void 0 : _b[req.body.unique])
@@ -243,7 +243,7 @@ class FirebaseWrapper {
243
243
  const fbData = eachDataDoc.data();
244
244
  filterDataIds.push(fbData.id);
245
245
  if (req.body.sensitive) {
246
- if (!(0, moment_1.default)(req.body.data.baseUpdatedAt).isAfter((0, moment_1.default)(fbData.baseUpdatedAt.seconds * 1000))) {
246
+ if (!(0, moment_timezone_1.default)(req.body.data.baseUpdatedAt).isAfter((0, moment_timezone_1.default)(fbData.baseUpdatedAt.seconds * 1000))) {
247
247
  res.status(400).json({ err: "Refresh Sensitive Model" });
248
248
  }
249
249
  }
@@ -326,7 +326,7 @@ class FirebaseWrapper {
326
326
  }
327
327
  const { workflowUpdateFields, updatedFields } = (0, utils_1.compareUpdatedFields)(fbData, req.body.data);
328
328
  if (req.body.sensitive) {
329
- if ((0, moment_1.default)(req.body.data.baseUpdatedAt).isAfter((0, moment_1.default)(fbData.baseUpdatedAt.seconds * 1000))) {
329
+ if ((0, moment_timezone_1.default)(req.body.data.baseUpdatedAt).isAfter((0, moment_timezone_1.default)(fbData.baseUpdatedAt.seconds * 1000))) {
330
330
  if (workflow)
331
331
  yield workflow(workflowUpdateFields);
332
332
  const data = this.parseModel(updatedFields);
@@ -558,12 +558,13 @@ class FirebaseWrapper {
558
558
  });
559
559
  }
560
560
  const date = dateRange.split("-");
561
- const [startDate, endDate = (0, moment_1.default)().format("DD/MM/YYYY HH:mm:ss"),] = date;
561
+ const [startDate, endDate = (0, moment_timezone_1.default)().format("DD/MM/YYYY HH:mm:ss"),] = date;
562
562
  const isDuration = date.length === 2;
563
- const isValidStartDate = (0, moment_1.default)(startDate, "DD/MM/YYYY").isValid();
564
- const isValidEndDate = (0, moment_1.default)(endDate, "DD/MM/YYYY").isValid();
565
- const isoStartDate = (0, moment_1.default)(startDate, "DD/MM/YYYY HH:mm:ss").format("YYYY-MM-DD HH:mm:ss");
566
- const isoEndDate = (0, moment_1.default)(endDate, "DD/MM/YYYY HH:mm:ss").format("YYYY-MM-DD HH:mm:ss");
563
+ const isValidStartDate = (0, moment_timezone_1.default)(startDate, "DD/MM/YYYY").isValid();
564
+ const isValidEndDate = (0, moment_timezone_1.default)(endDate, "DD/MM/YYYY").isValid();
565
+ //TODO : Client should send timezone
566
+ const isoStartDate = (0, moment_timezone_1.default)(startDate, "DD/MM/YYYY HH:mm:ss").format("YYYY-MM-DD HH:mm:ss");
567
+ const isoEndDate = (0, moment_timezone_1.default)(endDate, "DD/MM/YYYY HH:mm:ss").format("YYYY-MM-DD HH:mm:ss");
567
568
  if (!isValidStartDate || !isValidEndDate) {
568
569
  res
569
570
  .status(400)
@@ -572,14 +573,14 @@ class FirebaseWrapper {
572
573
  }
573
574
  const id = isDuration
574
575
  ? dateRange
575
- : `Begining until ${(0, moment_1.default)(isoStartDate).format("DD/MM/YYYY")}`;
576
+ : `Begining until ${(0, moment_timezone_1.default)(isoStartDate).format("DD/MM/YYYY")}`;
576
577
  if (isDuration) {
577
578
  fbCollection = fbCollection
578
- .where(dateId, ">=", (0, moment_1.default)(isoStartDate).toDate())
579
- .where(dateId, "<=", (0, moment_1.default)(isoEndDate).toDate());
579
+ .where(dateId, ">=", (0, moment_timezone_1.default)(isoStartDate).toDate())
580
+ .where(dateId, "<=", (0, moment_timezone_1.default)(isoEndDate).toDate());
580
581
  }
581
582
  else {
582
- fbCollection = fbCollection.where(dateId, "<", (0, moment_1.default)(isoStartDate).toDate());
583
+ fbCollection = fbCollection.where(dateId, "<", (0, moment_timezone_1.default)(isoStartDate).toDate());
583
584
  }
584
585
  let value = 0;
585
586
  switch (aggregate.type) {
@@ -1,6 +1,7 @@
1
+ export { CryptoMiddleware } from "./crypto";
1
2
  export { FirebaseWrapper } from "./fbWrapper";
2
- export { MongoWrapper } from "./mongoWrapper";
3
3
  export { MondayWrapper } from "./mondayWrapper";
4
+ export { MongoWrapper } from "./mongoWrapper";
4
5
  export { SecurityMiddleware } from "./security";
5
6
  export { UploadWrapper } from "./uploadWrapper";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UploadWrapper = exports.SecurityMiddleware = exports.MondayWrapper = exports.MongoWrapper = exports.FirebaseWrapper = void 0;
3
+ exports.UploadWrapper = exports.SecurityMiddleware = exports.MongoWrapper = exports.MondayWrapper = exports.FirebaseWrapper = exports.CryptoMiddleware = void 0;
4
+ var crypto_1 = require("./crypto");
5
+ Object.defineProperty(exports, "CryptoMiddleware", { enumerable: true, get: function () { return crypto_1.CryptoMiddleware; } });
4
6
  var fbWrapper_1 = require("./fbWrapper");
5
7
  Object.defineProperty(exports, "FirebaseWrapper", { enumerable: true, get: function () { return fbWrapper_1.FirebaseWrapper; } });
6
- var mongoWrapper_1 = require("./mongoWrapper");
7
- Object.defineProperty(exports, "MongoWrapper", { enumerable: true, get: function () { return mongoWrapper_1.MongoWrapper; } });
8
8
  var mondayWrapper_1 = require("./mondayWrapper");
9
9
  Object.defineProperty(exports, "MondayWrapper", { enumerable: true, get: function () { return mondayWrapper_1.MondayWrapper; } });
10
+ var mongoWrapper_1 = require("./mongoWrapper");
11
+ Object.defineProperty(exports, "MongoWrapper", { enumerable: true, get: function () { return mongoWrapper_1.MongoWrapper; } });
10
12
  var security_1 = require("./security");
11
13
  Object.defineProperty(exports, "SecurityMiddleware", { enumerable: true, get: function () { return security_1.SecurityMiddleware; } });
12
14
  var uploadWrapper_1 = require("./uploadWrapper");
@@ -1 +1 @@
1
- {"version":3,"file":"mongoWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mongoWrapper.ts"],"names":[],"mappings":"AAQA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAmGD;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,GAAG,CAAM;IAClB,UAAU,SAAM;IAChB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,SAAM;IACb,KAAK,EAAE,GAAG,CAA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
@@ -668,6 +668,7 @@ class MongoWrapper {
668
668
  const isDuration = date.length === 2;
669
669
  const isValidStartDate = (0, moment_timezone_1.default)(startDate, "DD/MM/YYYY").isValid();
670
670
  const isValidEndDate = (0, moment_timezone_1.default)(endDate, "DD/MM/YYYY").isValid();
671
+ //TODO : Client should send timezone
671
672
  const isoStartDate = (0, moment_timezone_1.default)(startDate, "DD/MM/YYYY HH:mm:ss")
672
673
  .tz("Asia/Kuala_lumpur")
673
674
  .toDate();
@@ -1 +1 @@
1
- {"version":3,"file":"postgresqlWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/postgresqlWrapper.ts"],"names":[],"mappings":"AAQA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,IAAI,EAAE,GAAG,CAAM;IACf,UAAU,SAAM;IAChB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,GAAG,CAAC;IAEX,YAAY,QAAS,GAAG,aAEtB;gBAGA,IAAI,EAAE,GAAG,EACT,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,GAAG,EAAE,UAAU,EACf,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI;IAoB3D,gBAAgB,CAAC,MAAM,EAAE,GAAG;IAM5B,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAuDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG;;mBAiCjC;IAEF,UAAU,QACH,GAA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U,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAmCtC;IAEF,QAAQ,QAAe,GAAG,OAAO,GAAG,mBAgPlC;IAEF,IAAI,YA+EF;CACH"}
@@ -499,6 +499,7 @@ class PostgreSQLWrapper {
499
499
  //TODO: Parse Model
500
500
  //TODO: Batch Create & Update
501
501
  //TODO: Change table schema dynanically
502
+ //TODO: Count algorithm is wrong
502
503
  // parseModel = (data: any) => {
503
504
  // delete data["_id"];
504
505
  // data["baseUpdatedAt"] = moment().toDate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blixify-server",
3
- "version": "0.1.69",
3
+ "version": "0.1.71",
4
4
  "license": "MIT",
5
5
  "main": "dist/apis/index.js",
6
6
  "private": false,