not-node 6.1.1 → 6.1.3

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 (53) hide show
  1. package/.env +2 -2
  2. package/.vscode/launch.json +19 -0
  3. package/bin/not-cli.mjs +49 -13
  4. package/package.json +1 -1
  5. package/src/cli/readers/hostname.mjs +1 -1
  6. package/src/cli/readers/user.mjs +8 -1
  7. package/src/init/lib/modules.js +1 -2
  8. package/src/init/lib/routes.js +4 -1
  9. package/src/metas.js +4 -3
  10. package/tmpl/files/app/app.ejs +3 -0
  11. package/tmpl/files/app/routes/index.ejs +29 -31
  12. package/tmpl/files/app/views/parts/header.android.ejs +6 -7
  13. package/tmpl/files/app/views/parts/header.ios.ejs +5 -5
  14. package/tmpl/files/app/views/parts/menu.ejs +1 -1
  15. package/tmpl/files/app/views/parts/overview.ejs +1 -1
  16. package/playground/.babelrc +0 -11
  17. package/playground/.eslintignore +0 -4
  18. package/playground/.eslintrc.json +0 -23
  19. package/playground/app/front/build.env.js +0 -15
  20. package/playground/app/front/index.!.js +0 -64
  21. package/playground/app/front/rollup.!.js +0 -70
  22. package/playground/app/front/src/admin/main/index.js +0 -45
  23. package/playground/app/front/src/client/main/index.js +0 -45
  24. package/playground/app/front/src/common/index.js +0 -39
  25. package/playground/app/front/src/common/ncInit.js +0 -18
  26. package/playground/app/front/src/common/ws.client.main.js +0 -35
  27. package/playground/app/front/src/guest/main/index.js +0 -34
  28. package/playground/app/front/src/root/main/index.js +0 -45
  29. package/playground/app/front/src/user/main/index.js +0 -45
  30. package/playground/app/server/app.js +0 -22
  31. package/playground/app/server/config/common.json +0 -99
  32. package/playground/app/server/config/development.json +0 -34
  33. package/playground/app/server/config/production.json +0 -34
  34. package/playground/app/server/config/stage.json +0 -34
  35. package/playground/app/server/index.js +0 -20
  36. package/playground/app/server/routes/index.js +0 -36
  37. package/playground/app/server/routes/site.js +0 -71
  38. package/playground/app/server/views/admin/foot.pug +0 -1
  39. package/playground/app/server/views/admin/head.pug +0 -7
  40. package/playground/app/server/views/admin/menu.pug +0 -2
  41. package/playground/app/server/views/admin.pug +0 -19
  42. package/playground/app/server/views/dashboard.pug +0 -20
  43. package/playground/app/server/views/index.pug +0 -15
  44. package/playground/app/server/views/parts/header.android.pug +0 -7
  45. package/playground/app/server/views/parts/header.ios.pug +0 -5
  46. package/playground/app/server/views/parts/header.pug +0 -18
  47. package/playground/app/server/views/parts/menu.pug +0 -1
  48. package/playground/app/server/views/parts/overview.pug +0 -2
  49. package/playground/app/server/ws/auth.js +0 -41
  50. package/playground/app/server/ws/index.js +0 -84
  51. package/playground/bin/build.sh +0 -8
  52. package/playground/package.json +0 -85
  53. package/playground/project.manifest.json +0 -37
@@ -1,84 +0,0 @@
1
- const jwt = require("jsonwebtoken"),
2
- config = require("not-config").createReader(),
3
- log = require("not-log")(module, "WS"),
4
- authRoute = require("./auth.js");
5
-
6
- const { notWSMessenger } = require("not-ws");
7
- const { notRequestError, notValidationError } = require("not-error");
8
-
9
- const mainValidators = {
10
- credentials(credentials, serviceData) {
11
- try {
12
- log.log(serviceData.type, serviceData.name);
13
- let cred = jwt.verify(
14
- credentials,
15
- config.get("modules:user:secret")
16
- );
17
- if (cred) {
18
- return authRoute({ serviceData, cred });
19
- } else {
20
- return false;
21
- }
22
- } catch (e) {
23
- log.error(e);
24
- return false;
25
- }
26
- },
27
- };
28
-
29
- function wrapError(data, serviceData, error) {
30
- if (error instanceof notRequestError) {
31
- return {
32
- status: "error",
33
- message: error.getResult().message,
34
- errors: error.getResult().errors,
35
- };
36
- } else if (error instanceof notValidationError) {
37
- return {
38
- status: "error",
39
- message: error.message,
40
- errors: error.getFieldsErrors(),
41
- };
42
- } else {
43
- return {
44
- status: "error",
45
- message: error.message,
46
- };
47
- }
48
- }
49
-
50
- function wrapOk(result) {
51
- return {
52
- status: "ok",
53
- result,
54
- };
55
- }
56
-
57
- module.exports = {
58
- servers: {
59
- main: {
60
- logger: log,
61
- jwt: {
62
- key: config.get("modules:user:secret"),
63
- },
64
- getMessenger() {
65
- return new notWSMessenger({
66
- logger: log,
67
- secure: true,
68
- validateTypeAndName: false,
69
- validators: mainValidators,
70
- wrap: {
71
- ok: wrapOk,
72
- error: wrapError,
73
- },
74
- types: {
75
- request: [],
76
- response: [],
77
- event: [],
78
- __service: [],
79
- },
80
- });
81
- },
82
- },
83
- },
84
- };
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
- echo 'building for' $ENV 'environment'
3
- rm -rf ./app/front/build/${TARGET_ROLE}.min.js
4
- rm -rf ./app/front/build/${TARGET_ROLE}.js
5
- rm -rf ./app/front/build/${TARGET_ROLE}.css
6
- NODE_ENV=$ENV ./node_modules/.bin/eslint ./src/controllers
7
- NODE_ENV=$ENV ./node_modules/.bin/rollup -c ./rollup/${TARGET_ROLE}.js --environment ENV:$ENV
8
- NODE_ENV=$ENV ./node_modules/.bin/terser --compress --mangle -- build/${TARGET_ROLE}.js > ./build/${TARGET_ROLE}.min.js
@@ -1,85 +0,0 @@
1
- {
2
- "name": "not-node-application",
3
- "version": "0.0.1",
4
- "description": "notNodeApplication",
5
- "main": "app/server/index.js",
6
- "private": true,
7
- "engines": {
8
- "node": ">14.9"
9
- },
10
- "scripts": {
11
- "start":"node ./app/server/index.js",
12
- "test": "./node_modules/.bin/mocha --reporter spec ./tests/**.js",
13
- "lint": "./node_modules/.bin/eslint ./app/**/**.js ./app/server/**/**/**.js ./app/server/**/**/**/**.js ./app/server/**/**/**/**/**.js --fix",
14
- "docs": "./node_modules/.bin/jsdoc -c jsdoc.json",
15
- "cover": "nyc npm test",
16
- "build:dev:guest:watch": "watch 'npm run build:dev:guest' ./app/front/src --interval=5",
17
- "build": "./node_modules/.bin/not-builder --config='./project.manifest.json'",
18
- "build:dev": "npm run development",
19
- "build:dev:guest": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=guest --environment=development",
20
- "build:dev:user": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=user --environment=development",
21
- "build:dev:client": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=client --environment=development",
22
- "build:dev:admin": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=admin --environment=development",
23
- "build:dev:root": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=root --environment=development",
24
- "archive": "./bin/archive.sh",
25
- "production": "./node_modules/.bin/not-builder --config='./project.manifest.json' --environment=production",
26
- "development": "./node_modules/.bin/not-builder --config='./project.manifest.json' --environment=development",
27
- "stage": "./node_modules/.bin/not-builder --config='./project.manifest.json' --environment=stage",
28
- "update": "ncu -u -x escape-string-regexp && npm i",
29
- "urd:dev": "npm run update && npm run build:dev && pm2 restart not-node-application.dev"
30
- },
31
- "dependencies": {
32
- "redis": "*",
33
- "pug":"*",
34
- "not-node": "*",
35
- "not-options":"*",
36
- "not-filter":"*",
37
- "not-notification":"*",
38
- "not-locale":"*",
39
- "not-inform":"*",
40
- "not-inform-rule-tag":"*",
41
- "not-inform-sink-email":"*",
42
- "not-inform-sink-notification":"*",
43
- "not-inform-sink-ws":"*",
44
- "not-key":"*",
45
- "not-ws":"*",
46
- "not-store":"*",
47
- "not-dbdump":"*",
48
- "not-user":"*",
49
- "not-error":"*",
50
-
51
- "dotenv": "*"
52
- },
53
- "devDependencies": {
54
- "@babel/core": "^7.18.9",
55
- "@babel/polyfill": "^7.12.1",
56
- "@babel/preset-env": "^7.18.9",
57
- "@babel/plugin-syntax-class-properties": "^7.12.13",
58
- "@rollup/plugin-babel": "^5.3.1",
59
- "@rollup/plugin-commonjs": "^22.0.1",
60
- "@rollup/plugin-node-resolve": "^13.3.0",
61
- "@rollup/plugin-json": "^4.1.0",
62
- "babel-core": "*",
63
- "babel-polyfill": "*",
64
- "babel-preset-es2015-rollup": "*",
65
- "babel-runtime": "*",
66
- "chai": "^4.3.6",
67
- "eslint": "^8.20.0",
68
- "ink-docstrap": "^1.3.2",
69
- "jsdoc": "^3.6.11",
70
- "mocha": "^10.0.0",
71
- "ndb": "^1.1.5",
72
- "nyc": "^15.1.0",
73
- "rollup": "^2.77.2",
74
- "rollup-plugin-postcss": "^4.0.2",
75
- "rollup-plugin-sass": "^1.2.13",
76
- "rollup-plugin-svelte": "^7.1.0",
77
- "rollup-plugin-eslint": "^7.0.0",
78
- "rollup-plugin-filesize": "^9.1.2",
79
- "rollup-plugin-sizes": "^1.0.4",
80
- "rollup-watch": "*",
81
- "should": "^13.2.3",
82
- "svelte": "*",
83
- "yargs": "^17.5.1"
84
- }
85
- }
@@ -1,37 +0,0 @@
1
- {
2
- "name": "notNodeApplication",
3
- "targets": {
4
- "server": {
5
- "name": "notNodeApplication",
6
- "roles": ["root","admin","client","user","guest"],
7
- "builder": "server",
8
- "root": "app/front/",
9
- "src": "app/front/",
10
- "build": "app/front/build/",
11
- "index": "app/front/index.!.js",
12
- "rollup": "app/front/rollup.!.js",
13
- "modules": {
14
- "serverModulesDir": "app/server/modules",
15
- "frontModulesDir": "app/front/src",
16
- "npm": {
17
- "not-options": {},
18
- "not-filter": {},
19
- "not-notification": {},
20
- "not-locale": {},
21
- "not-inform": {},
22
- "not-inform-rule-tag": {},
23
- "not-inform-sink-email": {},
24
- "not-inform-sink-notification": {},
25
- "not-inform-sink-ws": {},
26
- "not-key": {},
27
- "not-ws": {},
28
- "not-store": {},
29
- "not-dbdump": {},
30
- "not-user": {},
31
- "not-error": {}
32
-
33
- }
34
- }
35
- }
36
- }
37
- }