not-node 6.1.2 → 6.1.4
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/.vscode/launch.json +19 -0
- package/bin/not-cli.mjs +6 -11
- package/package.json +1 -1
- package/playground/app/front/build/admin.js +21 -29
- package/playground/app/front/build/client.js +21 -29
- package/playground/app/front/build/guest.css +1 -1
- package/playground/app/front/build/guest.js +29 -21
- package/playground/app/front/build/root.js +21 -29
- package/playground/app/front/build/user.js +21 -29
- package/playground/app/front/src/admin/main/index.js +14 -25
- package/playground/app/front/src/client/main/index.js +14 -25
- package/playground/app/front/src/common/index.js +3 -2
- package/playground/app/front/src/common/ws.client.main.js +2 -3
- package/playground/app/front/src/guest/main/index.js +25 -14
- package/playground/app/front/src/root/main/index.js +14 -25
- package/playground/app/front/src/user/main/index.js +14 -25
- package/playground/app/server/app.js +3 -0
- package/playground/app/server/config/common.json +98 -91
- package/playground/app/server/config/development.json +32 -31
- package/playground/app/server/config/production.json +32 -31
- package/playground/app/server/config/stage.json +32 -31
- package/playground/app/server/views/parts/menu.pug +1 -1
- package/playground/app/server/views/parts/overview.pug +1 -1
- package/src/cli/readers/hostname.mjs +1 -1
- package/src/cli/readers/user.mjs +8 -1
- package/src/cli/readers/ws.mjs +12 -0
- package/src/cli/renderers/controllers.mjs +1 -0
- package/src/init/lib/modules.js +1 -2
- package/src/init/lib/routes.js +4 -1
- package/tmpl/dirs/module.front.mjs +1 -1
- package/tmpl/files/app/app.ejs +3 -0
- package/tmpl/files/module.front/common/index.ejs +7 -6
- package/tmpl/files/module.front/common/ws.client.main.ejs +2 -3
- package/tmpl/files/module.front/role/index.ejs +1 -1
|
@@ -1,99 +1,106 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
""
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
"port": 3000,
|
|
3
|
+
"host": "localhost",
|
|
4
|
+
"cors": [""],
|
|
5
|
+
"template": {
|
|
6
|
+
"engine": "pug",
|
|
7
|
+
"views": "views",
|
|
8
|
+
"partialsDir": "partials",
|
|
9
|
+
"partials": {}
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
"db": {
|
|
13
|
+
|
|
14
|
+
"mongoose": {
|
|
15
|
+
"uri": "mongodb:///test?authSource=admin",
|
|
16
|
+
"options": {
|
|
17
|
+
"useNewUrlParser": true,
|
|
18
|
+
"useUnifiedTopology": true,
|
|
19
|
+
"db": "test",
|
|
20
|
+
"host": "",
|
|
21
|
+
"user": "tester",
|
|
22
|
+
"pass": "test",
|
|
23
|
+
"autoIndex": false
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
"redis": {},
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
"ioredis": {
|
|
32
|
+
"enableOfflineQueue": false
|
|
24
33
|
}
|
|
34
|
+
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
"session": {
|
|
39
|
+
"driver": "redis",
|
|
40
|
+
"secret": "mlI1kwtmLRmcScfro2ftMkkifJIzlJBQ2FvITbKM",
|
|
41
|
+
"cookie": {
|
|
42
|
+
"maxAge": 2628000000
|
|
43
|
+
},
|
|
44
|
+
"key": "SessionID"
|
|
25
45
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"cookie": {
|
|
35
|
-
"maxAge": 2628000000
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
"path": {
|
|
49
|
+
"static": "../static",
|
|
50
|
+
"app": "/client",
|
|
51
|
+
"dbDumps": "../../../db.dumps",
|
|
52
|
+
"front": "../front/build",
|
|
53
|
+
"ws": "./ws"
|
|
36
54
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"ws": {
|
|
49
|
-
"servers": {
|
|
50
|
-
"main": {
|
|
51
|
-
"connection": {
|
|
52
|
-
"port": 3030,
|
|
53
|
-
"secure": true,
|
|
54
|
-
"secret": "2stgKj4IqCqsGE5NBV1yNQnSYR1ITyuqwro934aV"
|
|
55
|
+
"defaultUserRole": "user",
|
|
56
|
+
"modules": {
|
|
57
|
+
|
|
58
|
+
"ws": {
|
|
59
|
+
"servers": {
|
|
60
|
+
"main": {
|
|
61
|
+
"connection": {
|
|
62
|
+
"port": 3030,
|
|
63
|
+
"secure": true,
|
|
64
|
+
"secret": "zZswkyHax9xzb3hMn6fsxJkJnK2dFF02gpKTnQwh"
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
"user": {
|
|
72
|
+
"errors":{
|
|
73
|
+
"noUserData": false,
|
|
74
|
+
"noUserWithId": false
|
|
75
|
+
},
|
|
76
|
+
"debug":{
|
|
77
|
+
"loaded": false
|
|
78
|
+
},
|
|
79
|
+
"tokenTTL": 3600,
|
|
80
|
+
"secret": "zZswkyHax9xzb3hMn6fsxJkJnK2dFF02gpKTnQwh",
|
|
81
|
+
"roles": {
|
|
82
|
+
"primary": ["root","admin","client","user","guest"],
|
|
83
|
+
"secondary": ["confirmed","manager"]
|
|
84
|
+
},
|
|
85
|
+
"restrict": {
|
|
86
|
+
"registration": false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
"rateLimiter": {
|
|
93
|
+
"keyPrefix": "rateLimiterMiddleware",
|
|
94
|
+
"points": 500,
|
|
95
|
+
"duration": 1
|
|
57
96
|
}
|
|
97
|
+
|
|
98
|
+
},
|
|
99
|
+
"middleware": {
|
|
100
|
+
"not-options": {},"not-filter": {},"not-notification": {},"not-locale": {},"not-inform": {},"not-inform-rule-tag": {},"not-inform-sink-email": {},"not-inform-sink-notification": {},"not-inform-sink-ws": {},"not-key": {},"not-ws": {},"not-store": {},"not-dbdump": {},"not-user": {},"not-error": {}
|
|
58
101
|
},
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
"middleware": {
|
|
66
|
-
"not-options": {},
|
|
67
|
-
"not-filter": {},
|
|
68
|
-
"not-notification": {},
|
|
69
|
-
"not-locale": {},
|
|
70
|
-
"not-inform": {},
|
|
71
|
-
"not-inform-rule-tag": {},
|
|
72
|
-
"not-inform-sink-email": {},
|
|
73
|
-
"not-inform-sink-notification": {},
|
|
74
|
-
"not-inform-sink-ws": {},
|
|
75
|
-
"not-key": {},
|
|
76
|
-
"not-ws": {},
|
|
77
|
-
"not-store": {},
|
|
78
|
-
"not-dbdump": {},
|
|
79
|
-
"not-user": {},
|
|
80
|
-
"not-error": {}
|
|
81
|
-
},
|
|
82
|
-
"importModulesFromNPM": [
|
|
83
|
-
"not-options",
|
|
84
|
-
"not-filter",
|
|
85
|
-
"not-notification",
|
|
86
|
-
"not-locale",
|
|
87
|
-
"not-inform",
|
|
88
|
-
"not-inform-rule-tag",
|
|
89
|
-
"not-inform-sink-email",
|
|
90
|
-
"not-inform-sink-notification",
|
|
91
|
-
"not-inform-sink-ws",
|
|
92
|
-
"not-key",
|
|
93
|
-
"not-ws",
|
|
94
|
-
"not-store",
|
|
95
|
-
"not-dbdump",
|
|
96
|
-
"not-user",
|
|
97
|
-
"not-error"
|
|
98
|
-
]
|
|
99
|
-
}
|
|
102
|
+
"importModulesFromNPM": [
|
|
103
|
+
"not-options","not-filter","not-notification","not-locale","not-inform","not-inform-rule-tag","not-inform-sink-email","not-inform-sink-notification","not-inform-sink-ws","not-key","not-ws","not-store","not-dbdump","not-user","not-error"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
"hostname":"localhost",
|
|
3
|
+
"CSP": {
|
|
4
|
+
"connect": [
|
|
5
|
+
"'self'",
|
|
6
|
+
"*",
|
|
7
|
+
"wss:",
|
|
8
|
+
"https:",
|
|
9
|
+
"'unsafe-inline'"
|
|
10
|
+
],
|
|
11
|
+
"default": [
|
|
12
|
+
"'self'",
|
|
13
|
+
"*",
|
|
14
|
+
"wss:",
|
|
15
|
+
"https:",
|
|
16
|
+
"'unsafe-inline'"
|
|
17
|
+
],
|
|
18
|
+
"img": [
|
|
19
|
+
"'self'",
|
|
20
|
+
"data:"
|
|
21
|
+
],
|
|
22
|
+
"script": [
|
|
23
|
+
"'self'",
|
|
24
|
+
"'unsafe-eval'",
|
|
25
|
+
"'unsafe-inline'"
|
|
26
|
+
],
|
|
27
|
+
"style": [
|
|
28
|
+
"'self'",
|
|
29
|
+
"'unsafe-inline'",
|
|
30
|
+
"'unsafe-eval'"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
"hostname":"localhost",
|
|
3
|
+
"CSP": {
|
|
4
|
+
"connect": [
|
|
5
|
+
"'self'",
|
|
6
|
+
"*",
|
|
7
|
+
"wss:",
|
|
8
|
+
"https:",
|
|
9
|
+
"'unsafe-inline'"
|
|
10
|
+
],
|
|
11
|
+
"default": [
|
|
12
|
+
"'self'",
|
|
13
|
+
"*",
|
|
14
|
+
"wss:",
|
|
15
|
+
"https:",
|
|
16
|
+
"'unsafe-inline'"
|
|
17
|
+
],
|
|
18
|
+
"img": [
|
|
19
|
+
"'self'",
|
|
20
|
+
"data:"
|
|
21
|
+
],
|
|
22
|
+
"script": [
|
|
23
|
+
"'self'",
|
|
24
|
+
"'unsafe-eval'",
|
|
25
|
+
"'unsafe-inline'"
|
|
26
|
+
],
|
|
27
|
+
"style": [
|
|
28
|
+
"'self'",
|
|
29
|
+
"'unsafe-inline'",
|
|
30
|
+
"'unsafe-eval'"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
"hostname":"localhost",
|
|
3
|
+
"CSP": {
|
|
4
|
+
"connect": [
|
|
5
|
+
"'self'",
|
|
6
|
+
"*",
|
|
7
|
+
"wss:",
|
|
8
|
+
"https:",
|
|
9
|
+
"'unsafe-inline'"
|
|
10
|
+
],
|
|
11
|
+
"default": [
|
|
12
|
+
"'self'",
|
|
13
|
+
"*",
|
|
14
|
+
"wss:",
|
|
15
|
+
"https:",
|
|
16
|
+
"'unsafe-inline'"
|
|
17
|
+
],
|
|
18
|
+
"img": [
|
|
19
|
+
"'self'",
|
|
20
|
+
"data:"
|
|
21
|
+
],
|
|
22
|
+
"script": [
|
|
23
|
+
"'self'",
|
|
24
|
+
"'unsafe-eval'",
|
|
25
|
+
"'unsafe-inline'"
|
|
26
|
+
],
|
|
27
|
+
"style": [
|
|
28
|
+
"'self'",
|
|
29
|
+
"'unsafe-inline'",
|
|
30
|
+
"'unsafe-eval'"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
nav(class="navbar is-success" role="navigation" aria-label="dropdown navigation" id="top-menu")
|
|
1
|
+
nav(class="navbar is-success" role="navigation" aria-label="dropdown navigation" id="top-menu")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
div(class="is-success is-fullheight")
|
|
2
|
-
p Story of another little side project.
|
|
2
|
+
p Story of another little side project.
|
package/src/cli/readers/user.mjs
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
const DEFAULT_CONFIG = {
|
|
2
|
+
restrict: {
|
|
3
|
+
registration: false,
|
|
4
|
+
},
|
|
5
|
+
tokenTTL: 3600,
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
function collectRestrictions(inquirer) {
|
|
2
9
|
return inquirer.prompt([
|
|
3
10
|
{
|
|
@@ -56,7 +63,7 @@ export default (inquirer) => {
|
|
|
56
63
|
if (answer.enabled) {
|
|
57
64
|
return collectData(inquirer);
|
|
58
65
|
} else {
|
|
59
|
-
return
|
|
66
|
+
return DEFAULT_CONFIG;
|
|
60
67
|
}
|
|
61
68
|
});
|
|
62
69
|
};
|
package/src/cli/readers/ws.mjs
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
function collectData(inquirer) {
|
|
2
2
|
return inquirer.prompt([
|
|
3
|
+
{
|
|
4
|
+
type: "input",
|
|
5
|
+
name: "hostname",
|
|
6
|
+
message: "WS hostname (default: window.location.hostname)",
|
|
7
|
+
default: "",
|
|
8
|
+
},
|
|
3
9
|
{
|
|
4
10
|
type: "input",
|
|
5
11
|
name: "port",
|
|
6
12
|
message: "WS port number",
|
|
7
13
|
default: 33000,
|
|
8
14
|
},
|
|
15
|
+
{
|
|
16
|
+
type: "input",
|
|
17
|
+
name: "path",
|
|
18
|
+
message: "WS path ",
|
|
19
|
+
default: "websocket",
|
|
20
|
+
},
|
|
9
21
|
{
|
|
10
22
|
type: "config",
|
|
11
23
|
name: "secure",
|
package/src/init/lib/modules.js
CHANGED
package/src/init/lib/routes.js
CHANGED
|
@@ -59,9 +59,12 @@ module.exports = class InitRoutes {
|
|
|
59
59
|
|
|
60
60
|
async run({ master, config, options }) {
|
|
61
61
|
log.info("Setting up routes...");
|
|
62
|
+
//pages rendering
|
|
63
|
+
await master.getApp().execInModules("registerPagesRoutes", master);
|
|
64
|
+
//api first
|
|
62
65
|
master.getApp().expose(master.getServer());
|
|
66
|
+
//user defined pages
|
|
63
67
|
require(options.routesPath)(master.getServer(), master.getApp());
|
|
64
|
-
|
|
65
68
|
master.getServer().use(serveStatic(config.get("staticPath")));
|
|
66
69
|
master.getServer().use(options.indexRoute);
|
|
67
70
|
master.getServer().use(
|
package/tmpl/files/app/app.ejs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const notNode = require("not-node");
|
|
2
2
|
|
|
3
|
+
const InitIdentityTokens = require("not-user").InitIdentityTokens;
|
|
4
|
+
|
|
3
5
|
const Init = require("not-node").Init,
|
|
4
6
|
path = require("path"),
|
|
5
7
|
manifest = require("./../../project.manifest.json");
|
|
@@ -15,6 +17,7 @@ module.exports = () => {
|
|
|
15
17
|
const additional = {
|
|
16
18
|
pre({ initSequence }) {
|
|
17
19
|
initSequence.remove("InitMonitoring");
|
|
20
|
+
initSequence.insert(InitIdentityTokens);
|
|
18
21
|
},
|
|
19
22
|
};
|
|
20
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% if(modules.includes('not-ws')){ %>
|
|
1
|
+
<% if(modules.includes('not-ws') && ws){ %>
|
|
2
2
|
import main from './ws.client.main.js';
|
|
3
3
|
<% } %>
|
|
4
4
|
|
|
@@ -13,15 +13,16 @@ let manifest = {
|
|
|
13
13
|
url: '/'
|
|
14
14
|
},
|
|
15
15
|
modules:{
|
|
16
|
-
<% if(modules.includes('not-ws')){ %>
|
|
16
|
+
<% if(modules.includes('not-ws') && ws){ %>
|
|
17
17
|
ws:{
|
|
18
18
|
clients:{
|
|
19
19
|
//options for ws client here
|
|
20
20
|
main: {
|
|
21
|
-
host: window.location.hostname,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
host: '<%- ws.hostname %>' || window.location.hostname,
|
|
22
|
+
port: <%- ws.port %>,
|
|
23
|
+
path: '<%- ws.path %>',
|
|
24
|
+
secure: <%- ws.secure %>,
|
|
25
|
+
ssl: <%- !!ssl %>
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -6,9 +6,8 @@ const main = {
|
|
|
6
6
|
getToken: () => {
|
|
7
7
|
return notCommon.getApp().getModel('user', {}).$token({})
|
|
8
8
|
.then((res) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return res.result.token;
|
|
9
|
+
notCommon.getApp().setWorking('token', res.result);
|
|
10
|
+
return res.result;
|
|
12
11
|
});
|
|
13
12
|
},
|
|
14
13
|
messenger: {
|