isite 2022.9.16 → 2022.9.17

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/lib/mongodb.js CHANGED
@@ -56,27 +56,23 @@ module.exports = function init(____0) {
56
56
  return doc;
57
57
  }
58
58
 
59
- if (typeof doc === 'object') {
59
+ if (typeof doc === 'array') {
60
+ doc.forEach((v, i) => {
61
+ doc[i] = _mongo.handleDoc(v);
62
+ });
63
+ return doc;
64
+ } else if (typeof doc === 'object') {
60
65
  for (let key in doc) {
61
- let val = doc[key];
62
-
63
- if (typeof key === 'string') {
64
- if (key.startsWith('$')) {
65
- delete doc[key];
66
- continue;
67
- }
68
- }
69
-
70
- if (typeof val === 'object') {
71
- val = _mongo.handleDoc(val);
72
- } else if (typeof val === 'array') {
73
- val.forEach((v) => {
74
- v = _mongo.handleDoc(v);
66
+ if (typeof key === 'string' && key.indexOf('$') === 0) {
67
+ delete doc[key];
68
+ } else if (typeof doc[key] === 'string' && ____0.fn.isDate(doc[key])) {
69
+ doc[key] = new Date(doc[key]);
70
+ } else if (typeof doc[key] === 'object') {
71
+ doc[key] = _mongo.handleDoc(doc[key]);
72
+ } else if (typeof doc[key] === 'array') {
73
+ doc[key].forEach((v, i) => {
74
+ doc[key][i] = _mongo.handleDoc(v);
75
75
  });
76
- } else if (typeof val === 'string') {
77
- if (____0.fn.isDate(val)) {
78
- doc[key] = new Date(val);
79
- }
80
76
  }
81
77
  }
82
78
  }
@@ -305,7 +301,6 @@ module.exports = function init(____0) {
305
301
  db.collection(____0.options.mongodb.prefix.collection + obj.collectionName).insertMany(obj.docs, obj.options, function (err, result) {
306
302
  if (!err) {
307
303
  callback(null, obj.docs, result);
308
- console.log(' Sessions Saved : ' + obj.docs.length);
309
304
  if (____0.options.mongodb.events) {
310
305
  ____0.call('mongodb after insert many', {
311
306
  db: obj.dbName,
@@ -314,12 +309,12 @@ module.exports = function init(____0) {
314
309
  });
315
310
  }
316
311
  } else {
317
- console.error(' Sessions Not Saved ', err.message);
312
+ console.error(' _mongo.insertMany() ', err.message);
318
313
  callback(err, obj.docs, result);
319
314
  }
320
315
  });
321
316
  } else {
322
- console.error(' Sessions Not Saved ', err.message);
317
+ console.error(' _mongo.insertMany() ', err.message);
323
318
  callback(err);
324
319
  }
325
320
  });
package/lib/session.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = function init(req, res, ____0, callback) {
2
- let session = ____0.getSession({ accessToken: req.cookie('access_token') || req.headers['access-token'] });
2
+ let session = ____0.getSession({ accessToken: req.cookie('access_token') || req.headers['Access-Token'] || req.headers['access-token'] });
3
3
 
4
4
  if (!session.accessToken) {
5
5
  session.accessToken = new Date().getTime().toString() + '_' + Math.random() * (10000 - 1000) + 1000;
package/lib/sessions.js CHANGED
@@ -179,6 +179,13 @@ module.exports = function init(____0) {
179
179
  });
180
180
  });
181
181
 
182
+ ____0.onPOST('x-api/session', (req, res) => {
183
+ res.json({
184
+ done: !0,
185
+ session: req.session,
186
+ });
187
+ });
188
+
182
189
  ____0.onPOST('x-api/sessions', (req, res) => {
183
190
  res.json({
184
191
  done: !0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.09.16",
3
+ "version": "2022.09.17",
4
4
  "description": "Create Secure Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {