biz-slide-core 1.2.39 → 1.2.41

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,9 @@ var PPTSchema = new mongoose_1.Schema({
20
20
  hasError: { type: Boolean, default: false },
21
21
  slideRefs: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'ppt-slide' }], default: [], _id: false },
22
22
  version: { type: String, default: null },
23
+ noOfSlides: { type: Number, default: null },
24
+ trackIP: { type: String, default: null },
25
+ sessionId: { type: String, default: null }
23
26
  }, {
24
27
  timestamps: true,
25
28
  });
@@ -58,7 +58,7 @@ var __rest = (this && this.__rest) || function (s, e) {
58
58
  return t;
59
59
  };
60
60
  Object.defineProperty(exports, "__esModule", { value: true });
61
- exports.authorizeWithSlideApp = exports.authorize = void 0;
61
+ exports.nonAuthorizeWithSlideApp = exports.authorizeWithSlideApp = exports.authorize = void 0;
62
62
  var utilities_1 = require("../utilities");
63
63
  var entity_1 = require("../entity");
64
64
  var authorize = function (roles) {
@@ -136,3 +136,40 @@ var authorizeWithSlideApp = function () {
136
136
  };
137
137
  };
138
138
  exports.authorizeWithSlideApp = authorizeWithSlideApp;
139
+ var nonAuthorizeWithSlideApp = function () {
140
+ return function (req, res, next) {
141
+ var _a;
142
+ return __awaiter(this, void 0, void 0, function () {
143
+ var ipAddress, sessionId, userId, token;
144
+ return __generator(this, function (_b) {
145
+ switch (_b.label) {
146
+ case 0:
147
+ ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
148
+ sessionId = req.headers['x-fingerprint-key'];
149
+ userId = "guest";
150
+ if (!req.headers.authorization) return [3 /*break*/, 2];
151
+ return [4 /*yield*/, (0, utilities_1.verifyUid)(req.headers.authorization)];
152
+ case 1:
153
+ token = _b.sent();
154
+ if (!token) {
155
+ return [2 /*return*/, res.status(401).json({ message: 'Session Expired' })];
156
+ }
157
+ userId = (token === null || token === void 0 ? void 0 : token.customer_id) || ((_a = token === null || token === void 0 ? void 0 : token.value) === null || _a === void 0 ? void 0 : _a.email);
158
+ if (!userId) {
159
+ return [2 /*return*/, res.status(401).json({ message: 'userId not found' })];
160
+ }
161
+ _b.label = 2;
162
+ case 2:
163
+ req.user = {
164
+ userId: userId,
165
+ sessionId: sessionId,
166
+ ipAddress: ipAddress
167
+ };
168
+ next();
169
+ return [2 /*return*/];
170
+ }
171
+ });
172
+ });
173
+ };
174
+ };
175
+ exports.nonAuthorizeWithSlideApp = nonAuthorizeWithSlideApp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz-slide-core",
3
- "version": "1.2.39",
3
+ "version": "1.2.41",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -63,7 +63,7 @@ function callWithRetries(retryCount, failedMessage, functionRef) {
63
63
  error_1 = _a.sent();
64
64
  if (retryCount <= 0)
65
65
  throw error_1;
66
- console.log("callWithRetries", error_1 === null || error_1 === void 0 ? void 0 : error_1.message);
66
+ console.log("callWithRetries", (error_1 === null || error_1 === void 0 ? void 0 : error_1.message) || error_1);
67
67
  return [2 /*return*/, callWithRetries.apply(void 0, __spreadArray([retryCount - 1, failedMessage, functionRef], args, false))];
68
68
  case 3: return [2 /*return*/];
69
69
  }