not-node 6.3.65 → 6.3.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.3.65",
3
+ "version": "6.3.67",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/form/form.js CHANGED
@@ -189,7 +189,7 @@ class Form {
189
189
  getModelName(req) {
190
190
  if (this.#MODEL_NAME) {
191
191
  return this.#MODEL_NAME;
192
- } else if (req) {
192
+ } else if (req && req.notRouteData) {
193
193
  return firstLetterToUpper(req.notRouteData.modelName);
194
194
  }
195
195
  return undefined;
@@ -185,6 +185,8 @@ module.exports = ({
185
185
  LogAction(action, identity, {
186
186
  targetId,
187
187
  version: result?.__version,
188
+ populate,
189
+ query,
188
190
  });
189
191
  return result;
190
192
  }
@@ -242,6 +244,8 @@ module.exports = ({
242
244
  );
243
245
  LogAction(action, identity, {
244
246
  targetID,
247
+ query,
248
+ populate,
245
249
  version: result?.__version,
246
250
  });
247
251
  return result;
@@ -292,6 +296,7 @@ module.exports = ({
292
296
  const result = await getModel().getOneRaw(targetId, query);
293
297
  LogAction(action, identity, {
294
298
  targetId,
299
+ query,
295
300
  version: result?.__version,
296
301
  });
297
302
  return result;
@@ -344,7 +349,12 @@ module.exports = ({
344
349
  if (!itm) {
345
350
  throw new DBExceptionDocumentIsNotFound();
346
351
  }
347
- if (shouldOwn && !isOwner(itm, identity?.uid)) {
352
+ if (
353
+ shouldOwn &&
354
+ identity &&
355
+ identity?.uid &&
356
+ !isOwner(itm, identity.uid)
357
+ ) {
348
358
  throw new DBExceptionDocumentIsNotOwnerByActiveUser({
349
359
  params: {
350
360
  targetId,
@@ -442,12 +452,12 @@ module.exports = ({
442
452
  shouldOwn = false,
443
453
  }) {
444
454
  logDebugAction(action, identity);
445
- const { skip, size, sorter, filter, search } = query;
455
+ let { skip, size, sorter, filter, search } = query;
446
456
  let populate = await getPopulate(action, {
447
457
  identity,
448
458
  });
449
459
  if (shouldOwn) {
450
- notFilter.filter.modifyRules(filter, {
460
+ filter = notFilter.filter.modifyRules(filter, {
451
461
  [ownerFieldName]: identity?.uid,
452
462
  });
453
463
  }
@@ -484,12 +494,12 @@ module.exports = ({
484
494
 
485
495
  static async _list({ query, identity, action, shouldOwn = false }) {
486
496
  logDebugAction(action, identity);
487
- const { skip, size, sorter, filter } = query;
497
+ let { skip, size, sorter, filter } = query;
488
498
  let populate = await getPopulate(action, {
489
499
  identity,
490
500
  });
491
501
  if (shouldOwn) {
492
- notFilter.filter.modifyRules(filter, {
502
+ filter = notFilter.filter.modifyRules(filter, {
493
503
  [ownerFieldName]: identity?.uid,
494
504
  });
495
505
  }
@@ -524,14 +534,14 @@ module.exports = ({
524
534
 
525
535
  static async _count({ query, action, identity, shouldOwn = false }) {
526
536
  logDebugAction(action, identity);
527
- const { filter, search } = query;
537
+ let { filter, search } = query;
528
538
  if (shouldOwn) {
529
- notFilter.filter.modifyRules(filter, {
539
+ filter = notFilter.filter.modifyRules(filter, {
530
540
  [ownerFieldName]: identity?.uid,
531
541
  });
532
542
  }
533
543
  if (search) {
534
- notFilter.filter.modifyRules(search, filter);
544
+ filter = notFilter.filter.modifyRules(search, filter);
535
545
  }
536
546
  const result = await getModel().countWithFilter(search || filter);
537
547
  LogAction(action, identity, { shouldOwn });
@@ -18,13 +18,13 @@ module.exports = class OwnageBeforeAction {
18
18
  if (identity.uid) {
19
19
  //if searching, counting, listing and so on
20
20
  //adding condition of ownership by this excat user
21
- const { filter, search } = query;
21
+ let { filter, search } = query;
22
22
  if (filter) {
23
- notFilter.filter.modifyRules(filter, {
23
+ filter = notFilter.filter.modifyRules(filter, {
24
24
  [OwnageBeforeAction.ownerFieldName]: identity?.uid,
25
25
  });
26
26
  if (search) {
27
- notFilter.filter.modifyRules(search, filter);
27
+ search = notFilter.filter.modifyRules(search, filter);
28
28
  }
29
29
  }
30
30
  args.defaultQueryById = {