@underpostnet/underpost 2.8.1 → 2.8.5

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 (105) hide show
  1. package/.dockerignore +1 -0
  2. package/.github/workflows/ghpkg.yml +20 -50
  3. package/.github/workflows/npmpkg.yml +67 -0
  4. package/.github/workflows/publish.yml +5 -5
  5. package/.github/workflows/pwa-microservices-template.page.yml +13 -5
  6. package/.github/workflows/pwa-microservices-template.test.yml +2 -2
  7. package/.vscode/extensions.json +17 -71
  8. package/.vscode/settings.json +14 -3
  9. package/AUTHORS.md +16 -5
  10. package/CHANGELOG.md +79 -3
  11. package/Dockerfile +24 -66
  12. package/README.md +1 -28
  13. package/bin/build.js +161 -0
  14. package/bin/db.js +2 -24
  15. package/bin/deploy.js +111 -82
  16. package/bin/file.js +59 -16
  17. package/bin/index.js +168 -58
  18. package/bin/ssl.js +19 -11
  19. package/bin/util.js +9 -97
  20. package/bin/vs.js +25 -2
  21. package/conf.js +31 -138
  22. package/docker-compose.yml +1 -1
  23. package/manifests/core/kustomization.yaml +11 -0
  24. package/manifests/core/underpost-engine-backup-access.yaml +16 -0
  25. package/manifests/core/underpost-engine-backup-pv-pvc.yaml +22 -0
  26. package/manifests/core/underpost-engine-headless-service.yaml +10 -0
  27. package/manifests/core/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
  28. package/manifests/core/underpost-engine-mongodb-configmap.yaml +26 -0
  29. package/manifests/core/underpost-engine-pv-pvc.yaml +23 -0
  30. package/manifests/core/underpost-engine-statefulset.yaml +91 -0
  31. package/manifests/deployment/mongo-express/deployment.yaml +60 -0
  32. package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
  33. package/manifests/kind-config.yaml +12 -0
  34. package/manifests/letsencrypt-prod.yaml +15 -0
  35. package/manifests/mariadb/config.yaml +10 -0
  36. package/manifests/mariadb/kustomization.yaml +9 -0
  37. package/manifests/mariadb/pv.yaml +12 -0
  38. package/manifests/mariadb/pvc.yaml +10 -0
  39. package/manifests/mariadb/secret.yaml +8 -0
  40. package/manifests/mariadb/service.yaml +10 -0
  41. package/manifests/mariadb/statefulset.yaml +55 -0
  42. package/manifests/mongodb/backup-access.yaml +16 -0
  43. package/manifests/mongodb/backup-cronjob.yaml +42 -0
  44. package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
  45. package/manifests/mongodb/configmap.yaml +26 -0
  46. package/manifests/mongodb/headless-service.yaml +10 -0
  47. package/manifests/mongodb/kustomization.yaml +11 -0
  48. package/manifests/mongodb/pv-pvc.yaml +23 -0
  49. package/manifests/mongodb/statefulset.yaml +125 -0
  50. package/manifests/valkey/kustomization.yaml +7 -0
  51. package/manifests/valkey/service.yaml +17 -0
  52. package/manifests/valkey/statefulset.yaml +39 -0
  53. package/manifests/valkey/underpost-engine-valkey-service.yaml +17 -0
  54. package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +39 -0
  55. package/package.json +26 -31
  56. package/src/api/core/core.service.js +1 -1
  57. package/src/api/user/user.model.js +16 -3
  58. package/src/api/user/user.service.js +1 -1
  59. package/src/cli/cluster.js +154 -0
  60. package/src/cli/cron.js +90 -0
  61. package/src/cli/db.js +148 -0
  62. package/src/cli/deploy.js +277 -0
  63. package/src/cli/env.js +52 -0
  64. package/src/cli/image.js +125 -0
  65. package/src/cli/repository.js +104 -0
  66. package/src/cli/script.js +29 -0
  67. package/src/cli/secrets.js +37 -0
  68. package/src/cli/test.js +83 -0
  69. package/src/client/components/core/Auth.js +22 -4
  70. package/src/client/components/core/CalendarCore.js +115 -49
  71. package/src/client/components/core/CommonJs.js +231 -19
  72. package/src/client/components/core/Css.js +1 -0
  73. package/src/client/components/core/CssCore.js +6 -0
  74. package/src/client/components/core/DropDown.js +5 -1
  75. package/src/client/components/core/Input.js +18 -4
  76. package/src/client/components/core/Modal.js +10 -6
  77. package/src/client/components/core/Panel.js +84 -25
  78. package/src/client/components/core/PanelForm.js +4 -18
  79. package/src/client/components/core/Scroll.js +1 -0
  80. package/src/client/components/core/Translate.js +47 -9
  81. package/src/client/components/core/Validator.js +9 -1
  82. package/src/client/components/core/VanillaJs.js +0 -9
  83. package/src/client/components/core/Worker.js +34 -31
  84. package/src/client/services/default/default.management.js +4 -2
  85. package/src/client/ssr/body/CacheControl.js +2 -2
  86. package/src/db/mongo/MongooseDB.js +13 -1
  87. package/src/index.js +77 -19
  88. package/src/runtime/lampp/Lampp.js +1 -13
  89. package/src/runtime/xampp/Xampp.js +0 -13
  90. package/src/server/auth.js +3 -3
  91. package/src/server/backup.js +49 -93
  92. package/src/server/client-build.js +4 -23
  93. package/src/server/client-formatted.js +5 -3
  94. package/src/server/conf.js +193 -45
  95. package/src/server/dns.js +49 -67
  96. package/src/server/logger.js +15 -10
  97. package/src/server/network.js +17 -43
  98. package/src/server/process.js +25 -2
  99. package/src/server/proxy.js +4 -26
  100. package/src/server/runtime.js +14 -29
  101. package/src/server/ssl.js +1 -1
  102. package/src/server/valkey.js +2 -0
  103. package/src/dns.js +0 -22
  104. package/src/server/prompt-optimizer.js +0 -28
  105. package/startup.js +0 -11
@@ -0,0 +1,10 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: mariadb
5
+ spec:
6
+ ports:
7
+ - port: 3306
8
+ targetPort: 3306
9
+ selector:
10
+ app: mariadb
@@ -0,0 +1,55 @@
1
+ apiVersion: apps/v1
2
+ kind: StatefulSet
3
+ metadata:
4
+ name: mariadb-statefulset
5
+ spec:
6
+ serviceName: mariadb
7
+ replicas: 1
8
+ selector:
9
+ matchLabels:
10
+ app: mariadb
11
+ template:
12
+ metadata:
13
+ labels:
14
+ app: mariadb
15
+ spec:
16
+ containers:
17
+ - name: mariadb
18
+ image: mariadb:latest
19
+ env:
20
+ - name: MYSQL_ROOT_PASSWORD
21
+ valueFrom:
22
+ secretKeyRef:
23
+ name: mariadb-secret
24
+ key: password
25
+ # - name: MYSQL_PASSWORD
26
+ # valueFrom:
27
+ # secretKeyRef:
28
+ # name: mariadb-secret
29
+ # key: password
30
+ # - name: MYSQL_USER
31
+ # valueFrom:
32
+ # secretKeyRef:
33
+ # name: mariadb-secret
34
+ # key: username
35
+ # - name: MYSQL_DATABASE
36
+ # value: default
37
+ ports:
38
+ - containerPort: 3306
39
+ volumeMounts:
40
+ - mountPath: /var/lib/mysql
41
+ name: mariadb-storage
42
+ # - mountPath: /etc/mysql/conf.d
43
+ # name: config-volume
44
+ # volumes:
45
+ # - name: config-volume
46
+ # configMap:
47
+ # name: mariadb-config
48
+ volumeClaimTemplates:
49
+ - metadata:
50
+ name: mariadb-storage
51
+ spec:
52
+ accessModes: ['ReadWriteOnce']
53
+ resources:
54
+ requests:
55
+ storage: 1Gi
@@ -0,0 +1,16 @@
1
+ apiVersion: v1
2
+ kind: Pod
3
+ metadata:
4
+ name: backup-access
5
+ spec:
6
+ containers:
7
+ - name: busybox
8
+ image: busybox
9
+ command: ['sh', '-c', 'sleep 3600']
10
+ volumeMounts:
11
+ - name: backup-storage
12
+ mountPath: /backup
13
+ volumes:
14
+ - name: backup-storage
15
+ persistentVolumeClaim:
16
+ claimName: backup-pvc
@@ -0,0 +1,42 @@
1
+ apiVersion: batch/v1
2
+ kind: CronJob
3
+ metadata:
4
+ name: mongodb-backup
5
+ spec:
6
+ schedule: '*/5 * * * *' # Runs backup every five minutes
7
+ jobTemplate:
8
+ spec:
9
+ template:
10
+ spec:
11
+ containers:
12
+ - name: mongodump
13
+ image: docker.io/library/mongo:latest
14
+ command:
15
+ - sh
16
+ - -c
17
+ - |
18
+ # Perform backup
19
+ mongodump --host=mongodb-service --port=27017 --out=/backup/$(date +\%Y-\%m-\%dT\%H-\%M-\%S)
20
+ # Remove backups older than 7 days
21
+ find /backup -type d -mtime +7 -exec rm -rf {} +
22
+ volumeMounts:
23
+ - name: backup-storage
24
+ mountPath: /backup
25
+ restartPolicy: Never
26
+ volumes:
27
+ - name: backup-storage
28
+ persistentVolumeClaim:
29
+ claimName: backup-pvc
30
+ # mongodump -u $MONGO_INITDB_ROOT_USERNAME -p $MONGO_INITDB_ROOT_PASSWORD --host=mongodb-service --port=27017 --out=/backup/$(date +\%Y-\%m-\%dT\%H-\%M-\%S)
31
+
32
+ # env:
33
+ # - name: MONGO_INITDB_ROOT_USERNAME
34
+ # valueFrom:
35
+ # secretKeyRef:
36
+ # name: mongodb-secret
37
+ # key: username
38
+ # - name: MONGO_INITDB_ROOT_PASSWORD
39
+ # valueFrom:
40
+ # secretKeyRef:
41
+ # name: mongodb-secret
42
+ # key: password
@@ -0,0 +1,22 @@
1
+ apiVersion: v1
2
+ kind: PersistentVolume
3
+ metadata:
4
+ name: backup-pv
5
+ spec:
6
+ capacity:
7
+ storage: 5Gi
8
+ accessModes:
9
+ - ReadWriteOnce
10
+ hostPath:
11
+ path: /mnt/backup
12
+ ---
13
+ apiVersion: v1
14
+ kind: PersistentVolumeClaim
15
+ metadata:
16
+ name: backup-pvc
17
+ spec:
18
+ accessModes:
19
+ - ReadWriteOnce
20
+ resources:
21
+ requests:
22
+ storage: 5Gi
@@ -0,0 +1,26 @@
1
+ # origin conf: /etc/mongod.conf
2
+ apiVersion: v1
3
+ kind: ConfigMap
4
+ metadata:
5
+ name: mongodb-config-file
6
+ namespace: default
7
+ data:
8
+ mongod.conf: |
9
+ storage:
10
+ dbPath: /data/db
11
+ systemLog:
12
+ destination: file
13
+ logAppend: true
14
+ path: /var/log/mongodb/mongod.log
15
+ replication:
16
+ replSetName: rs0
17
+ net:
18
+ bindIp: 127.0.0.1
19
+ port: 27017
20
+ processManagement:
21
+ fork: true
22
+ setParameter:
23
+ enableLocalhostAuthBypass: false
24
+ security:
25
+ authorization: enabled
26
+ keyFile: /etc/mongodb-keyfile
@@ -0,0 +1,10 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: mongodb-service
5
+ spec:
6
+ clusterIP: None
7
+ selector:
8
+ app: mongodb
9
+ ports:
10
+ - port: 27017
@@ -0,0 +1,11 @@
1
+ ---
2
+ # kubectl apply -k core/.
3
+ apiVersion: kustomize.config.k8s.io/v1beta1
4
+ kind: Kustomization
5
+ resources:
6
+ - pv-pvc.yaml
7
+ - headless-service.yaml
8
+ - statefulset.yaml
9
+ - backup-pv-pvc.yaml
10
+ - backup-cronjob.yaml
11
+ - backup-access.yaml
@@ -0,0 +1,23 @@
1
+ apiVersion: v1
2
+ kind: PersistentVolume
3
+ metadata:
4
+ name: mongodb-pv
5
+ spec:
6
+ capacity:
7
+ storage: 5Gi
8
+ accessModes:
9
+ - ReadWriteOnce
10
+ hostPath:
11
+ path: /data/mongodb
12
+ ---
13
+ apiVersion: v1
14
+ kind: PersistentVolumeClaim
15
+ metadata:
16
+ name: mongodb-pvc
17
+ spec:
18
+ storageClassName: ''
19
+ accessModes:
20
+ - ReadWriteOnce
21
+ resources:
22
+ requests:
23
+ storage: 5Gi
@@ -0,0 +1,125 @@
1
+ apiVersion: apps/v1
2
+ kind: StatefulSet
3
+ metadata:
4
+ name: mongodb # Specifies the name of the statefulset
5
+ spec:
6
+ serviceName: 'mongodb-service' # Specifies the service to use
7
+ replicas: 2
8
+ selector:
9
+ matchLabels:
10
+ app: mongodb
11
+ template:
12
+ metadata:
13
+ labels:
14
+ app: mongodb
15
+ spec:
16
+ containers:
17
+ - name: mongodb
18
+ image: docker.io/library/mongo:latest
19
+ command:
20
+ - mongod
21
+ - '--replSet'
22
+ - 'rs0'
23
+ # - '--config'
24
+ # - '-f'
25
+ # - '/etc/mongod.conf'
26
+ # - '--auth'
27
+ # - '--clusterAuthMode'
28
+ # - 'keyFile'
29
+ # - '--keyFile'
30
+ # - '/etc/mongodb-keyfile'
31
+ # - '--interleave'
32
+ # - 'all'
33
+ # - '--wiredTigerCacheSizeGB'
34
+ # - '0.25'
35
+ # - '--setParameter'
36
+ # - 'authenticationMechanisms=SCRAM-SHA-1'
37
+ # - '--fork'
38
+ - '--logpath'
39
+ - '/var/log/mongodb/mongod.log'
40
+ - '--bind_ip_all'
41
+ # command: ['sh', '-c']
42
+ # args:
43
+ # - |
44
+ # mongod --replSet rs0 --bind_ip_all &
45
+ # sleep 1000
46
+ # if mongosh --host mongodb-0.mongodb-service:27017 --eval "rs.status()" | grep -q "not yet initialized"; then
47
+ # mongosh --host mongodb-0.mongodb-service:27017 <<EOF
48
+ # use admin;
49
+ # rs.initiate({
50
+ # _id: "rs0",
51
+ # members: [
52
+ # { _id: 0, host: "mongodb-0.mongodb-service:27017", priority: 1 },
53
+ # { _id: 1, host: "mongodb-1.mongodb-service:27017", priority: 1 }
54
+ # ]
55
+ # });
56
+ # db.getSiblingDB("admin").createUser({
57
+ # user: process.env.MONGO_INITDB_ROOT_USERNAME,
58
+ # pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
59
+ # roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
60
+ # });
61
+ # use default;
62
+ # db.createUser(
63
+ # {
64
+ # user: process.env.MONGO_INITDB_ROOT_USERNAME,
65
+ # pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
66
+ # roles: [
67
+ # { role: "read", db: "test" },
68
+ # { role: "readWrite", db: "default" }
69
+ # ]
70
+ # }
71
+ # );
72
+ # EOF
73
+ # fi
74
+ # wait
75
+ ports:
76
+ - containerPort: 27017
77
+ volumeMounts:
78
+ - name: mongodb-storage
79
+ mountPath: /data/db
80
+ - name: keyfile
81
+ mountPath: /etc/mongodb-keyfile
82
+ readOnly: true
83
+ # - name: mongodb-configuration-file
84
+ # mountPath: /etc/mongod.conf
85
+ # subPath: mongod.conf
86
+ # readOnly: true
87
+ # - name: mongodb-config
88
+ # mountPath: /config
89
+ env:
90
+ - name: MONGO_INITDB_ROOT_USERNAME
91
+ valueFrom:
92
+ secretKeyRef:
93
+ name: mongodb-secret
94
+ key: username
95
+ - name: MONGO_INITDB_ROOT_PASSWORD
96
+ valueFrom:
97
+ secretKeyRef:
98
+ name: mongodb-secret
99
+ key: password
100
+ resources:
101
+ requests:
102
+ cpu: '100m'
103
+ memory: '256Mi'
104
+ limits:
105
+ cpu: '500m'
106
+ memory: '512Mi'
107
+ volumes:
108
+ - name: keyfile
109
+ secret:
110
+ secretName: mongodb-keyfile
111
+ defaultMode: 0400
112
+ # - name: mongodb-configuration-file
113
+ # configMap:
114
+ # name: mongodb-config-file
115
+ # - name: mongodb-config
116
+ # configMap:
117
+ # name: mongodb-config
118
+ volumeClaimTemplates:
119
+ - metadata:
120
+ name: mongodb-storage
121
+ spec:
122
+ accessModes: ['ReadWriteOnce']
123
+ resources:
124
+ requests:
125
+ storage: 5Gi
@@ -0,0 +1,7 @@
1
+ ---
2
+ # kubectl apply -k valkey/.
3
+ apiVersion: kustomize.config.k8s.io/v1beta1
4
+ kind: Kustomization
5
+ resources:
6
+ - service.yaml
7
+ - statefulset.yaml
@@ -0,0 +1,17 @@
1
+ ---
2
+ apiVersion: v1
3
+ kind: Service
4
+ metadata:
5
+ name: service-valkey
6
+ namespace: default
7
+ spec:
8
+ ports:
9
+ - port: 6379
10
+ targetPort: 6379
11
+ selector:
12
+ app: service-valkey
13
+ ipFamilyPolicy: PreferDualStack
14
+ ipFamilies:
15
+ - IPv4
16
+ # - IPv6
17
+ type: ClusterIP
@@ -0,0 +1,39 @@
1
+ ---
2
+ apiVersion: apps/v1
3
+ kind: StatefulSet
4
+ metadata:
5
+ name: service-valkey
6
+ namespace: default
7
+ spec:
8
+ serviceName: service-valkey
9
+ replicas: 1
10
+ selector:
11
+ matchLabels:
12
+ app: service-valkey
13
+ template:
14
+ metadata:
15
+ labels:
16
+ app: service-valkey
17
+ spec:
18
+ containers:
19
+ - name: service-valkey
20
+ image: docker.io/valkey/valkey:latest
21
+ env:
22
+ - name: TZ
23
+ value: Europe/Zurich
24
+ ports:
25
+ - containerPort: 6379
26
+ startupProbe:
27
+ tcpSocket:
28
+ port: 6379
29
+ failureThreshold: 30
30
+ periodSeconds: 5
31
+ timeoutSeconds: 5
32
+ livenessProbe:
33
+ tcpSocket:
34
+ port: 6379
35
+ failureThreshold: 2
36
+ periodSeconds: 30
37
+ timeoutSeconds: 5
38
+ restartPolicy: Always
39
+ automountServiceAccountToken: false
@@ -0,0 +1,17 @@
1
+ ---
2
+ apiVersion: v1
3
+ kind: Service
4
+ metadata:
5
+ name: service-valkey
6
+ namespace: default
7
+ spec:
8
+ ports:
9
+ - port: 6379
10
+ targetPort: 6379
11
+ selector:
12
+ app: service-valkey
13
+ ipFamilyPolicy: PreferDualStack
14
+ ipFamilies:
15
+ - IPv4
16
+ # - IPv6
17
+ type: ClusterIP
@@ -0,0 +1,39 @@
1
+ ---
2
+ apiVersion: apps/v1
3
+ kind: StatefulSet
4
+ metadata:
5
+ name: service-valkey
6
+ namespace: default
7
+ spec:
8
+ serviceName: service-valkey
9
+ replicas: 1
10
+ selector:
11
+ matchLabels:
12
+ app: service-valkey
13
+ template:
14
+ metadata:
15
+ labels:
16
+ app: service-valkey
17
+ spec:
18
+ containers:
19
+ - name: service-valkey
20
+ image: docker.io/valkey/valkey:latest
21
+ env:
22
+ - name: TZ
23
+ value: Europe/Zurich
24
+ ports:
25
+ - containerPort: 6379
26
+ startupProbe:
27
+ tcpSocket:
28
+ port: 6379
29
+ failureThreshold: 30
30
+ periodSeconds: 5
31
+ timeoutSeconds: 5
32
+ livenessProbe:
33
+ tcpSocket:
34
+ port: 6379
35
+ failureThreshold: 2
36
+ periodSeconds: 30
37
+ timeoutSeconds: 5
38
+ restartPolicy: Always
39
+ automountServiceAccountToken: false
package/package.json CHANGED
@@ -2,35 +2,27 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "@underpostnet/underpost",
5
- "version": "2.8.1",
5
+ "version": "2.8.5",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
9
- "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
10
- "ssl": "env-cmd -f .env.production node bin/ssl",
11
- "pm2-delete": "pm2 delete engine",
12
- "build": "node bin/deploy build-full-client",
13
- "build-production": "env-cmd -f .env.production node bin/deploy build-full-client",
14
- "dev": "env-cmd -f .env.development node src/client.dev",
9
+ "test": "env-cmd -f .env.test c8 mocha",
10
+ "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine",
11
+ "dev": "env-cmd -f .env.development node src/client.dev default",
12
+ "dev-img": "env-cmd -f .env.development node src/server",
15
13
  "dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
14
+ "dev-client": "env-cmd -f .env.development node src/client.dev",
15
+ "proxy": "node src/proxy proxy",
16
16
  "docs": "jsdoc -c jsdoc.json",
17
- "backup": "node bin/db default.net/ export",
18
- "install-template": "npm install && npm run build",
19
17
  "install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd && npm install -g yarn && npm install -g auto-changelog",
20
18
  "install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
21
- "install-vs-extensions": "node bin/vs import",
22
- "preinstall": "npm config set audit false && npm config set loglevel error",
23
- "restore-preinstall": "npm config set audit true && npm config set loglevel notice",
24
- "install": "npm run install-global && npm run install-test && npm run restore-preinstall --no-audit --no-warnings",
19
+ "install-underpost": "cp -a $(npm root -g)/underpost/node_modules ./node_modules && npm install --only=dev --ignore-scripts",
20
+ "install": "npm run install-global && npm run install-test",
25
21
  "docker:start": "docker-compose up",
26
22
  "prettier": "prettier --write .",
27
- "coveralls": "nyc npm run test --reporter=text-lcov | coveralls -v",
28
- "test": "env-cmd -f .env.test c8 mocha",
29
- "update": "npm update -g && npm update && npm audit fix --force && npm audit fix --force",
30
- "underpost-publish": "npm publish --provenance --access public",
31
- "underpost-unpublish": "npm unpublish underpost@2.5.x",
32
- "login": "npm adduser",
33
- "bin": "npm link --force"
23
+ "fix": "npm audit fix --force && npm audit",
24
+ "changelog": "auto-changelog",
25
+ "build": "node bin/deploy build-full-client"
34
26
  },
35
27
  "bin": {
36
28
  "underpost": "bin/index.js"
@@ -40,6 +32,10 @@
40
32
  "url": "git+https://github.com/underpostnet/pwa-microservices-template-ghpkg.git"
41
33
  },
42
34
  "keywords": [
35
+ "pwa",
36
+ "microservices",
37
+ "template",
38
+ "builder",
43
39
  "engine",
44
40
  "server",
45
41
  "proxy",
@@ -53,6 +49,7 @@
53
49
  "homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
54
50
  "dependencies": {
55
51
  "@fortawesome/fontawesome-free": "^6.4.2",
52
+ "@fullcalendar/rrule": "^6.1.15",
56
53
  "@loadingio/css-spinner": "^2.0.2",
57
54
  "@neodrag/vanilla": "^2.0.3",
58
55
  "adm-zip": "^0.5.10",
@@ -61,19 +58,16 @@
61
58
  "chai": "^5.1.0",
62
59
  "cli-progress": "^3.12.0",
63
60
  "cli-spinners": "^3.0.0",
61
+ "clipboardy": "^4.0.0",
64
62
  "color": "^4.2.3",
65
63
  "colors": "^1.4.0",
66
64
  "commander": "^12.1.0",
67
65
  "compression": "^1.7.4",
68
- "copy-paste": "^1.5.3",
69
66
  "cors": "^2.8.5",
70
67
  "d3": "^7.9.0",
71
- "deepmerge": "^4.3.1",
72
- "detect-port": "^1.5.1",
73
68
  "dotenv": "^16.3.1",
74
69
  "easymde": "^2.18.0",
75
70
  "env-cmd": "^10.1.0",
76
- "eventemitter3": "^5.0.1",
77
71
  "express": "^4.18.2",
78
72
  "express-fileupload": "^1.4.3",
79
73
  "favicons": "^7.2.0",
@@ -84,14 +78,11 @@
84
78
  "http-proxy-middleware": "^2.0.6",
85
79
  "ignore-walk": "^6.0.4",
86
80
  "iovalkey": "^0.2.1",
87
- "is-admin": "^4.0.0",
88
- "is-ip": "^5.0.1",
89
81
  "jimp": "^0.22.12",
90
82
  "joystick-controller": "^1.0.15",
91
83
  "json-colorizer": "^2.2.2",
92
84
  "jsonwebtoken": "^9.0.2",
93
85
  "keyword-extractor": "^0.0.28",
94
- "kill-port-process": "^3.2.0",
95
86
  "log-update": "^6.0.0",
96
87
  "mariadb": "^3.2.2",
97
88
  "marked": "^12.0.2",
@@ -106,9 +97,9 @@
106
97
  "prom-client": "^15.1.2",
107
98
  "public-ip": "^6.0.1",
108
99
  "read": "^2.1.0",
100
+ "rrule": "^2.8.1",
109
101
  "sharp": "^0.32.5",
110
102
  "shelljs": "^0.8.5",
111
- "simple-git": "^3.26.0",
112
103
  "simple-icons": "^13.9.0",
113
104
  "sitemap": "^7.1.1",
114
105
  "socket.io": "^4.8.0",
@@ -119,13 +110,17 @@
119
110
  "uglify-js": "^3.17.4",
120
111
  "validator": "^13.11.0",
121
112
  "vanilla-jsoneditor": "^2.3.2",
122
- "web3": "^4.13.0",
123
- "winston": "^3.11.0"
113
+ "winston": "^3.11.0",
114
+ "clean-jsdoc-theme": "^4.3.0",
115
+ "easy-json-schema": "^0.0.2-beta",
116
+ "mocha": "^10.8.2",
117
+ "plantuml": "^0.0.2",
118
+ "swagger-autogen": "^2.23.7"
124
119
  },
125
120
  "devDependencies": {
126
121
  "clean-jsdoc-theme": "^4.3.0",
127
122
  "easy-json-schema": "^0.0.2-beta",
128
- "mocha": "^10.4.0",
123
+ "mocha": "^10.8.2",
129
124
  "plantuml": "^0.0.2",
130
125
  "swagger-autogen": "^2.23.7"
131
126
  },
@@ -9,7 +9,7 @@ const CoreService = {
9
9
  /** @type {import('./core.model.js').CoreModel} */
10
10
  const Core = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Core;
11
11
  if (req.path.startsWith('/sh')) {
12
- if (req.body.print) return shellExec(req.body.sh, { stdout: true });
12
+ if (req.body.stdout) return shellExec(req.body.sh, { stdout: true });
13
13
  shellExec(req.body.sh, { async: true });
14
14
  return 'Command "' + req.body.sh + '" running';
15
15
  }
@@ -1,10 +1,9 @@
1
1
  import { Schema, model } from 'mongoose';
2
2
  import validator from 'validator';
3
+ import { userRoleEnum } from '../../client/components/core/CommonJs.js';
3
4
 
4
5
  // https://mongoosejs.com/docs/2.7.x/docs/schematypes.html
5
6
 
6
- const userRoleEnum = ['admin', 'moderator', 'user', 'guest'];
7
-
8
7
  const UserSchema = new Schema(
9
8
  {
10
9
  email: {
@@ -26,7 +25,11 @@ const UserSchema = new Schema(
26
25
  profileImageId: { type: Schema.Types.ObjectId, ref: 'File' },
27
26
  phoneNumbers: [
28
27
  {
29
- type: { type: String, enum: ['office', 'home', 'private'], number: { type: String } },
28
+ type: {
29
+ type: String,
30
+ enum: ['office', 'home', 'private'],
31
+ },
32
+ number: { type: String },
30
33
  },
31
34
  ],
32
35
  publicKey: {
@@ -38,6 +41,12 @@ const UserSchema = new Schema(
38
41
  ],
39
42
  default: [],
40
43
  },
44
+ associatedCompanies: [
45
+ {
46
+ company: { type: Schema.Types.ObjectId, ref: 'Company', required: true },
47
+ context: [{ type: String, enum: ['client', 'supplier', 'employee', 'owner'] }],
48
+ },
49
+ ],
41
50
  },
42
51
  {
43
52
  timestamps: true,
@@ -58,6 +67,10 @@ const UserDto = {
58
67
  },
59
68
  },
60
69
  auth: {
70
+ // TODO: -> set login device, location, ip, fingerprint
71
+ // and validate on authorization middleware
72
+ // -> dynamic refresh 100 tokens per session with 12h interval
73
+ // -> back secret per user, registrarion user model -> secret: { type: String }
61
74
  payload: (user) => ({ _id: user._id.toString(), role: user.role, email: user.email }),
62
75
  },
63
76
  };
@@ -237,7 +237,7 @@ const UserService = {
237
237
  const validatePassword = validatePasswordMiddleware(req.body.password);
238
238
  if (validatePassword.status === 'error') throw new Error(validatePassword.message);
239
239
  req.body.password = await hashPassword(req.body.password);
240
- req.body.role = 'user';
240
+ req.body.role = req.body.role === 'guest' ? 'guest' : 'user';
241
241
  req.body.profileImageId = await getDefaultProfileImageId(File);
242
242
  const { _id } = await new User(req.body).save();
243
243
  if (_id) {