blixify-server 0.2.5 → 0.2.7

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.
@@ -32,6 +32,8 @@ export declare class MondayWrapper {
32
32
  id: string;
33
33
  text: string;
34
34
  value: string;
35
+ type?: string;
36
+ display_value?: string;
35
37
  }[];
36
38
  }) => any;
37
39
  initCreate: (req: any, res: any, workflow?: ((data: any) => Promise<any>) | undefined) => Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"mondayWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mondayWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA0B5C,eAAO,MAAM,cAAc,UAClB,MAAM,SACN,GAAG,cACE,GAAG,qDAchB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAa;IACxB,WAAW,SAAM;IACjB,OAAO,SAAM;IACb,OAAO,SAAM;IACb,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAEhB,YAAY,QAAS,GAAG,aAEtB;IACF,SAAS;cAAe,MAAM,EAAE;;;;MAK9B;gBAGA,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,SAAS,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE;YAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE,EACpE,GAAG,EAAE,UAAU;IAWjB,UAAU,eAAgB;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,MAAM,CAAC;QACb,aAAa,EAAE;YAAE,EAAE,EAAE,MAAM,CAA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,UAAU;IAWjB,UAAU,eAAgB;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,MAAM,CAAC;QACb,aAAa,EAAE;YACb,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,EAAE,CAAC;KACL,SAiBC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAuDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG;;mBAiDjC;IAEF,QAAQ,QAAe,GAAG,OAAO,GAAG;;;mBAgOlC;IAEF,UAAU,QAAe,GAAG,OAAO,GAAG;;mBAsFpC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBA8DtC;IAEF,IAAI,YA8CF;CACH"}
@@ -71,13 +71,20 @@ class MondayWrapper {
71
71
  name: mondayData.name,
72
72
  };
73
73
  mondayData.column_values.map((eachColumn) => {
74
+ var _a;
74
75
  if (eachColumn.id === "subitems")
75
76
  return;
76
77
  let retrieveText = true;
78
+ let resultValue = eachColumn.value;
77
79
  const modelType = this.modelType().read;
78
80
  if (modelType.includes(eachColumn.id))
79
81
  retrieveText = false;
80
- data[eachColumn.id] = retrieveText ? eachColumn.text : eachColumn.value;
82
+ if (eachColumn.type === "mirror") {
83
+ resultValue = (_a = eachColumn.display_value) !== null && _a !== void 0 ? _a : eachColumn.value;
84
+ }
85
+ else if (retrieveText)
86
+ resultValue = eachColumn.text;
87
+ data[eachColumn.id] = resultValue;
81
88
  });
82
89
  return data;
83
90
  };
@@ -142,10 +149,12 @@ class MondayWrapper {
142
149
  id
143
150
  name
144
151
  column_values {
145
- id
146
- text
147
- value
148
- }
152
+ id text value type
153
+ ... on MirrorValue {
154
+ display_value
155
+ id
156
+ }
157
+ }
149
158
  }
150
159
  }
151
160
  }
@@ -206,9 +215,11 @@ class MondayWrapper {
206
215
  id
207
216
  name
208
217
  column_values {
209
- id
210
- text
211
- value
218
+ id text value type
219
+ ... on MirrorValue {
220
+ display_value
221
+ id
222
+ }
212
223
  }
213
224
  }
214
225
  }
@@ -324,9 +335,11 @@ class MondayWrapper {
324
335
  id
325
336
  name
326
337
  column_values {
327
- id
328
- text
329
- value
338
+ id text value type
339
+ ... on MirrorValue {
340
+ display_value
341
+ id
342
+ }
330
343
  }
331
344
  }
332
345
  }
@@ -342,9 +355,11 @@ class MondayWrapper {
342
355
  id
343
356
  name
344
357
  column_values {
345
- id
346
- text
347
- value
358
+ id text value type
359
+ ... on MirrorValue {
360
+ display_value
361
+ id
362
+ }
348
363
  }
349
364
  }
350
365
  }
@@ -0,0 +1,18 @@
1
+ import type { WrapperLib } from "./mongoWrapper";
2
+ export declare class TrackVisionWrapper {
3
+ static readonly BASE_URL: string;
4
+ username: string;
5
+ password: string;
6
+ lib: WrapperLib;
7
+ constructor(username: string, password: string, lib: WrapperLib);
8
+ handleSafeTruckRequest: (endpoint: string, data: any) => Promise<any>;
9
+ initGetVehiclesPositionData: () => Promise<any>;
10
+ initGetVehiclePositionDataByPlateNo: (plateNo: string) => Promise<any>;
11
+ initGetVehicleHistoricalPlayback: (plateNo: string, fromDateTime?: string, toDateTime?: string) => Promise<any>;
12
+ initGetVehicleListing: () => Promise<any>;
13
+ initGetVehicleLicenseDocuments: () => Promise<any>;
14
+ initGetGeofenceListing: () => Promise<any>;
15
+ initGetGeofenceNotification: (fromDateTime: string, toDateTime: string) => Promise<any>;
16
+ init: () => any;
17
+ }
18
+ //# sourceMappingURL=trackVisionWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackVisionWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/trackVisionWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAkC;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,UAAU,CAAC;gBAEJ,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU;IAM/D,sBAAsB,aAAoB,MAAM,QAAQ,GAAG,kBAoBzD;IAEF,2BAA2B,qBAEzB;IAEF,mCAAmC,YAAa,MAAM,kBAOpD;IAEF,gCAAgC,YACrB,MAAM,iBACA,MAAM,eACR,MAAM,kBAOnB;IAEF,qBAAqB,qBAKnB;IAEF,8BAA8B,qBAK5B;IAEF,sBAAsB,qBAEpB;IAEF,2BAA2B,iBAAkB,MAAM,cAAc,MAAM,kBAKrE;IAEF,IAAI,YAwHF;CACH"}
@@ -0,0 +1,187 @@
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.TrackVisionWrapper = void 0;
13
+ class TrackVisionWrapper {
14
+ constructor(username, password, lib) {
15
+ this.handleSafeTruckRequest = (endpoint, data) => __awaiter(this, void 0, void 0, function* () {
16
+ const response = yield fetch(`${TrackVisionWrapper.BASE_URL}${endpoint}`, {
17
+ method: "POST",
18
+ headers: {
19
+ "Content-Type": "application/json",
20
+ },
21
+ body: JSON.stringify(Object.assign({ username: this.username, password: this.password }, data)),
22
+ });
23
+ const result = yield response.json();
24
+ if (result.isERROR) {
25
+ throw new Error(result.errorMessage);
26
+ }
27
+ return result;
28
+ });
29
+ this.initGetVehiclesPositionData = () => {
30
+ return this.handleSafeTruckRequest("/api2/gps/getVehiclePositionData", {});
31
+ };
32
+ this.initGetVehiclePositionDataByPlateNo = (plateNo) => {
33
+ return this.handleSafeTruckRequest("/api2/gps/getVehiclePositionDataByPlateNo", {
34
+ plateNo,
35
+ });
36
+ };
37
+ this.initGetVehicleHistoricalPlayback = (plateNo, fromDateTime, toDateTime) => {
38
+ return this.handleSafeTruckRequest("/api2/gps/getHistoricalPB", {
39
+ plateNo,
40
+ fromDateTime,
41
+ toDateTime,
42
+ });
43
+ };
44
+ this.initGetVehicleListing = () => {
45
+ return this.handleSafeTruckRequest("/api2/vehicle/getVehicleListingData", {});
46
+ };
47
+ this.initGetVehicleLicenseDocuments = () => {
48
+ return this.handleSafeTruckRequest("/api2/vehicle/getVehiclesLicenseDocumentsData", {});
49
+ };
50
+ this.initGetGeofenceListing = () => {
51
+ return this.handleSafeTruckRequest("/api2/gps/getGeofence", {});
52
+ };
53
+ this.initGetGeofenceNotification = (fromDateTime, toDateTime) => {
54
+ return this.handleSafeTruckRequest("/api2/gps/getGeofenceNotification", {
55
+ fromDateTime,
56
+ toDateTime,
57
+ });
58
+ };
59
+ this.init = () => {
60
+ const router = this.lib.express.Router();
61
+ /**
62
+ * @Input :
63
+ * None
64
+ */
65
+ router.post("/getVehiclesPositionData", (_req, res) => __awaiter(this, void 0, void 0, function* () {
66
+ try {
67
+ const result = yield this.initGetVehiclesPositionData();
68
+ res.json(result);
69
+ }
70
+ catch (err) {
71
+ if (err.message)
72
+ res.status(400).json({ err: err.message });
73
+ else
74
+ res.status(400).json({ err: err });
75
+ }
76
+ }));
77
+ /**
78
+ * @Input :
79
+ * plateNo - string
80
+ */
81
+ router.post("/getVehiclePositionDataByPlateNo", (req, res) => __awaiter(this, void 0, void 0, function* () {
82
+ try {
83
+ const { plateNo } = req.body;
84
+ const result = yield this.initGetVehiclePositionDataByPlateNo(plateNo);
85
+ res.json(result);
86
+ }
87
+ catch (err) {
88
+ if (err.message)
89
+ res.status(400).json({ err: err.message });
90
+ else
91
+ res.status(400).json({ err: err });
92
+ }
93
+ }));
94
+ /**
95
+ * @Input :
96
+ * plateNo - string
97
+ * fromDateTime - string (Optional)
98
+ * toDateTime - string (Optional)
99
+ */
100
+ router.post("/getVehicleHistoricalPlayback", (req, res) => __awaiter(this, void 0, void 0, function* () {
101
+ try {
102
+ const { plateNo, fromDateTime, toDateTime } = req.body;
103
+ const result = yield this.initGetVehicleHistoricalPlayback(plateNo, fromDateTime, toDateTime);
104
+ res.json(result);
105
+ }
106
+ catch (err) {
107
+ if (err.message)
108
+ res.status(400).json({ err: err.message });
109
+ else
110
+ res.status(400).json({ err: err });
111
+ }
112
+ }));
113
+ /**
114
+ * @Input :
115
+ * None
116
+ */
117
+ router.post("/getVehicleListing", (_req, res) => __awaiter(this, void 0, void 0, function* () {
118
+ try {
119
+ const result = yield this.initGetVehicleListing();
120
+ res.json(result);
121
+ }
122
+ catch (err) {
123
+ if (err.message)
124
+ res.status(400).json({ err: err.message });
125
+ else
126
+ res.status(400).json({ err: err });
127
+ }
128
+ }));
129
+ /**
130
+ * @Input :
131
+ * None
132
+ */
133
+ router.post("/getVehicleLicenseDocuments", (_req, res) => __awaiter(this, void 0, void 0, function* () {
134
+ try {
135
+ const result = yield this.initGetVehicleLicenseDocuments();
136
+ res.json(result);
137
+ }
138
+ catch (err) {
139
+ if (err.message)
140
+ res.status(400).json({ err: err.message });
141
+ else
142
+ res.status(400).json({ err: err });
143
+ }
144
+ }));
145
+ /**
146
+ * @Input :
147
+ * None
148
+ */
149
+ router.post("/getGeofenceListing", (_req, res) => __awaiter(this, void 0, void 0, function* () {
150
+ try {
151
+ const result = yield this.initGetGeofenceListing();
152
+ res.json(result);
153
+ }
154
+ catch (err) {
155
+ if (err.message)
156
+ res.status(400).json({ err: err.message });
157
+ else
158
+ res.status(400).json({ err: err });
159
+ }
160
+ }));
161
+ /**
162
+ * @Input :
163
+ * fromDateTime - string
164
+ * toDateTime - string
165
+ */
166
+ router.post("/getGeofenceNotification", (req, res) => __awaiter(this, void 0, void 0, function* () {
167
+ try {
168
+ const { fromDateTime, toDateTime } = req.body;
169
+ const result = yield this.initGetGeofenceNotification(fromDateTime, toDateTime);
170
+ res.json(result);
171
+ }
172
+ catch (err) {
173
+ if (err.message)
174
+ res.status(400).json({ err: err.message });
175
+ else
176
+ res.status(400).json({ err: err });
177
+ }
178
+ }));
179
+ return router;
180
+ };
181
+ this.username = username;
182
+ this.password = password;
183
+ this.lib = lib;
184
+ }
185
+ }
186
+ exports.TrackVisionWrapper = TrackVisionWrapper;
187
+ TrackVisionWrapper.BASE_URL = "http://trackvision2.ddns.net";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blixify-server",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "license": "MIT",
5
5
  "main": "dist/apis/index.js",
6
6
  "private": false,
@@ -27,6 +27,7 @@
27
27
  "start:auth": "cd dist && node authServer.js",
28
28
  "start:aws": "cd dist && node awsServer.js",
29
29
  "start:monday": "cd dist && node mondayServer.js",
30
+ "start:trackVision": "cd dist && node trackVisionServer.js",
30
31
  "install:husky": "yarn husky install"
31
32
  },
32
33
  "config": {