not-node 6.2.18 → 6.2.20

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.
Files changed (54) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/package.json +7 -4
  3. package/src/auth/roles.js +9 -1
  4. package/src/auth/rules.js +5 -5
  5. package/src/cli/actions/env.mjs +1 -1
  6. package/src/cli/actions/nginx.mjs +1 -1
  7. package/src/cli/actions/pm2.mjs +1 -1
  8. package/src/common.js +1 -1
  9. package/src/domain.js +36 -24
  10. package/src/form/env_extractors/index.js +2 -2
  11. package/src/form/extractors/index.js +1 -1
  12. package/src/identity/providers/session.js +3 -0
  13. package/src/manifest/batchRunner.js +5 -1
  14. package/src/manifest/registrator/fields.js +4 -4
  15. package/src/manifest/route.js +9 -0
  16. package/src/model/exceptions.js +3 -3
  17. package/src/model/versioning.js +2 -2
  18. package/test/auth/routes.js +34 -10
  19. package/test/fakes.js +52 -0
  20. package/test/identity/providers/session.js +14 -5
  21. package/test/identity/providers/token.js +1 -1
  22. package/test/init/additional.js +31 -33
  23. package/test/init/app.js +66 -10
  24. package/test/init/bodyparser.js +4 -1
  25. package/test/init/compression.js +4 -1
  26. package/test/init/cors.js +5 -1
  27. package/test/init/csp.js +2 -2
  28. package/test/init/db.js +5 -1
  29. package/test/init/env.js +12 -2
  30. package/test/init/express.js +4 -1
  31. package/test/init/fileupload.js +4 -1
  32. package/test/init/http.js +21 -4
  33. package/test/init/middleware.js +13 -1
  34. package/test/init/routes.js +1 -0
  35. package/test/init/sessions/mongoose.js +5 -1
  36. package/test/init/sessions/redis.js +5 -1
  37. package/test/init/sessions.js +21 -15
  38. package/test/init/static.js +4 -1
  39. package/test/init/template.js +5 -1
  40. package/test/model/versioning.js +3 -3
  41. package/test/module/fields.js +45 -20
  42. package/test/module/index.js +26 -15
  43. package/test/notApp.js +221 -187
  44. package/test/notDomain.js +799 -707
  45. package/test/notManifestFilter.js +385 -322
  46. package/test/notModule.js +689 -644
  47. package/test/notRoute.js +112 -99
  48. package/test/testies/module/fields/collection.js +16 -14
  49. package/test/testies/module/fields/single.js +11 -11
  50. package/tmpl/files/module.server/layers/forms/_data.ejs +29 -29
  51. package/tmpl/files/module.server/layers/forms/create.ejs +38 -38
  52. package/tmpl/files/module.server/layers/forms/listAll.ejs +3 -3
  53. package/tmpl/files/module.server/layers/forms/listAndCount.ejs +3 -3
  54. package/tmpl/files/module.server/layers/forms/update.ejs +31 -31
@@ -3,38 +3,38 @@ const Form = require("not-node").Form;
3
3
  const getIP = require("not-node").Auth.getIP;
4
4
 
5
5
  const FIELDS = [
6
- ["targetId", { required: true }, "not-node//objectId"],
7
- ["activeUser", "not-node//requiredObject"],
8
- ["data", `${ModuleName}//_${ModelName}_data`], //sub forms validators should start with underscore
6
+ ["targetId", { required: true }, "not-node//objectId"],
7
+ ["activeUser", "not-node//requiredObject"],
8
+ ["data", `${MODULE_NAME}//_<%- ModelName %>_data`], //sub forms validators should start with underscore
9
9
  ["ip", "not-node//ip"],
10
- ];
11
- const FORM_NAME = `${ModuleName}:<%- ModelName %>UpdateForm`;
10
+ ];
11
+ const FORM_NAME = `${MODULE_NAME}:<%- ModelName %>UpdateForm`;
12
12
 
13
- module.exports = class <%- ModelName %>UpdateForm extends Form {
14
- constructor({ app }) {
15
- super({ FIELDS, FORM_NAME, app });
16
- }
13
+ module.exports = class <%- ModelName %>UpdateForm extends Form {
14
+ constructor({ app }) {
15
+ super({ FIELDS, FORM_NAME, app });
16
+ }
17
17
 
18
- extract(req) {
19
- const instructions = {
18
+ extract(req) {
19
+ const instructions = {
20
20
  <% if (fields && Array.isArray(fields)) { %>
21
- <% for(let field of fields){ %>
22
- <%- field+': "extractFromBody",' -%>
23
- <% } %>
24
- <% } %>
25
- owner: "fromBody",
26
- ownerModel: "fromBody",
27
- };
28
- const data = this.extractByInstructions(req, instructions);
29
- if (!req.user.isRoot() && !req.user.isAdmin()) {
30
- data.owner = req.user._id;
31
- data.ownerModel = "User";
32
- }
33
- return {
34
- targetId: req.params._id.toString(),
35
- activeUser: req.user,
36
- data,
37
- ip: getIP(req),
38
- };
39
- }
40
- };
21
+ <% for(let field of fields){ %>
22
+ <%- field+': "extractFromBody" ,' -%>
23
+ <% } %>
24
+ <% } %>
25
+ owner: "fromBody",
26
+ ownerModel: "fromBody",
27
+ };
28
+ const data = this.extractByInstructions(req, instructions);
29
+ if (!req.user.isRoot() && !req.user.isAdmin()) {
30
+ data.owner = req.user._id;
31
+ data.ownerModel = "User";
32
+ }
33
+ return {
34
+ targetId: req.params._id.toString(),
35
+ activeUser: req.user,
36
+ data,
37
+ ip: getIP(req),
38
+ };
39
+ }
40
+ };