underpost 2.7.7 → 2.7.9

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 (79) hide show
  1. package/.github/workflows/ghpkg.yml +115 -0
  2. package/.github/workflows/publish.yml +20 -3
  3. package/.github/workflows/pwa-microservices-template.page.yml +54 -0
  4. package/.github/workflows/pwa-microservices-template.test.yml +30 -0
  5. package/.vscode/settings.json +6 -0
  6. package/CHANGELOG.md +64 -16
  7. package/bin/cron.js +47 -0
  8. package/bin/db.js +9 -1
  9. package/bin/deploy.js +207 -11
  10. package/bin/file.js +17 -1
  11. package/bin/index.js +1 -1
  12. package/bin/util.js +22 -0
  13. package/conf.js +18 -4
  14. package/docker-compose.yml +1 -1
  15. package/package.json +3 -3
  16. package/src/api/core/core.router.js +9 -9
  17. package/src/api/core/core.service.js +6 -4
  18. package/src/api/default/default.service.js +4 -4
  19. package/src/api/file/file.service.js +3 -3
  20. package/src/api/user/user.service.js +7 -7
  21. package/src/client/components/core/Css.js +0 -222
  22. package/src/client/components/core/CssCore.js +30 -3
  23. package/src/client/components/core/Docs.js +110 -10
  24. package/src/client/components/core/Modal.js +224 -22
  25. package/src/client/components/core/Panel.js +1 -1
  26. package/src/client/components/core/PanelForm.js +2 -1
  27. package/src/client/components/core/Responsive.js +15 -0
  28. package/src/client/components/core/RichText.js +4 -2
  29. package/src/client/components/core/Translate.js +6 -2
  30. package/src/client/components/core/WebComponent.js +44 -0
  31. package/src/client/components/core/Worker.js +12 -4
  32. package/src/client/public/default/plantuml/client-conf.svg +1 -1
  33. package/src/client/public/default/plantuml/client-schema.svg +1 -1
  34. package/src/client/public/default/plantuml/cron-conf.svg +1 -1
  35. package/src/client/public/default/plantuml/cron-schema.svg +1 -1
  36. package/src/client/public/default/plantuml/server-conf.svg +1 -1
  37. package/src/client/public/default/plantuml/server-schema.svg +1 -1
  38. package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
  39. package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
  40. package/src/client/public/default/site.webmanifest +69 -0
  41. package/src/client/services/default/default.management.js +118 -120
  42. package/src/client/ssr/Render.js +224 -3
  43. package/src/client/ssr/common/Alert.js +75 -0
  44. package/src/client/ssr/common/SsrCore.js +91 -0
  45. package/src/client/ssr/common/Translate.js +26 -0
  46. package/src/client/ssr/common/Worker.js +28 -0
  47. package/src/client/ssr/{body-components → components/body}/CacheControl.js +1 -1
  48. package/src/client/ssr/{body-components → components/body}/DefaultSplashScreen.js +15 -4
  49. package/src/client/ssr/components/head/Pwa.js +146 -0
  50. package/src/client/ssr/pages/404.js +12 -0
  51. package/src/client/ssr/pages/500.js +12 -0
  52. package/src/client/ssr/pages/maintenance.js +14 -0
  53. package/src/client/ssr/pages/offline.js +21 -0
  54. package/src/client/sw/default.sw.js +13 -9
  55. package/src/db/DataBaseProvider.js +12 -1
  56. package/src/db/mongo/MongooseDB.js +0 -1
  57. package/src/mailer/EmailRender.js +1 -1
  58. package/src/server/backup.js +82 -70
  59. package/src/server/client-build-live.js +6 -0
  60. package/src/server/client-build.js +76 -73
  61. package/src/server/client-formatted.js +11 -1
  62. package/src/server/client-icons.js +1 -1
  63. package/src/server/conf.js +60 -12
  64. package/src/server/crypto.js +91 -0
  65. package/src/server/dns.js +42 -13
  66. package/src/server/network.js +94 -7
  67. package/src/server/proxy.js +27 -27
  68. package/src/server/runtime.js +27 -8
  69. package/.github/workflows/test.yml +0 -80
  70. package/src/client/ssr/head-components/Microdata.js +0 -11
  71. package/src/cron.js +0 -30
  72. package/src/server/cron.js +0 -35
  73. /package/src/client/ssr/{email-components → components/email}/DefaultRecoverEmail.js +0 -0
  74. /package/src/client/ssr/{email-components → components/email}/DefaultVerifyEmail.js +0 -0
  75. /package/src/client/ssr/{head-components → components/head}/Css.js +0 -0
  76. /package/src/client/ssr/{head-components → components/head}/DefaultScripts.js +0 -0
  77. /package/src/client/ssr/{head-components → components/head}/Production.js +0 -0
  78. /package/src/client/ssr/{head-components → components/head}/PwaDefault.js +0 -0
  79. /package/src/client/ssr/{head-components → components/head}/Seo.js +0 -0
@@ -0,0 +1,115 @@
1
+ name: Update github repo package
2
+ on:
3
+ push:
4
+ branches: ['master']
5
+ pull_request:
6
+ branches: ['master']
7
+ permissions:
8
+ contents: write
9
+ packages: write
10
+ id-token: write
11
+ jobs:
12
+ pwa-microservices-template:
13
+ if: github.repository == 'underpostnet/engine' && startsWith(github.event.head_commit.message, '[ci][package][pwa-microservices-template]')
14
+ name: Update github repo package Jobs
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+ packages: write
19
+ id-token: write
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '22.x'
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ npm install
29
+
30
+ - name: Set git credentials
31
+ run: |
32
+ git config --global credential.helper ""
33
+ git config credential.helper ""
34
+ git config --global user.name 'underpostnet'
35
+ git config --global user.email 'fcoverdugoa@underpost.net'
36
+ git config --global credential.interactive always
37
+ git config user.name 'underpostnet'
38
+ git config user.email 'fcoverdugoa@underpost.net'
39
+ git config credential.interactive always
40
+
41
+ - name: Clone github package repository
42
+ run: |
43
+ cd .. && git clone https://github.com/underpostnet/pwa-microservices-template.git
44
+ cd engine
45
+ npm run update-template
46
+ cd ../pwa-microservices-template
47
+ git remote set-url origin git@github.com:underpostnet/pwa-microservices-template.git
48
+ git add .
49
+ git commit -m "Update github repo package"
50
+ git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template.git
51
+
52
+ pwa-microservices-template-ghpk:
53
+ if: github.repository == 'underpostnet/pwa-microservices-template'
54
+ name: Update github repo package Jobs
55
+ runs-on: ubuntu-latest
56
+ permissions:
57
+ contents: write
58
+ packages: write
59
+ id-token: write
60
+ steps:
61
+ - uses: actions/checkout@v3
62
+ - uses: actions/setup-node@v4
63
+ with:
64
+ node-version: '22.x'
65
+
66
+ # - name: Get npm root
67
+ # run: sudo npm root -g
68
+
69
+ # - run: npm ci
70
+
71
+ # - name: Install underpost cli
72
+ # run: sudo npm install -g underpost
73
+
74
+ # usage: git remote set-url [--push] <name> <newurl> [<oldurl>]
75
+ # or: git remote set-url --add <name> <newurl>
76
+ # or: git remote set-url --delete <name> <url>
77
+ # --[no-]push manipulate push URLs
78
+ # --[no-]add add URL
79
+ # --[no-]delete delete URLs
80
+
81
+ - name: Install dependencies and set repo configuration
82
+ run: |
83
+ npm install
84
+ node ./bin/deploy rename-package @underpostnet/underpost
85
+ node ./bin/deploy set-repo underpostnet/pwa-microservices-template-ghpkg
86
+
87
+ - name: Clone github package repository
88
+ run: |
89
+ git clone https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
90
+ rm -rf ./.git
91
+ cp -a ./pwa-microservices-template-ghpkg/.git ./.git
92
+ rm -rf ./pwa-microservices-template-ghpkg
93
+
94
+ - name: Set git credentials
95
+ run: |
96
+ git config --global credential.helper ""
97
+ git config credential.helper ""
98
+ git config --global user.name 'underpostnet'
99
+ git config --global user.email 'fcoverdugoa@underpost.net'
100
+ git config --global credential.interactive always
101
+ git config user.name 'underpostnet'
102
+ git config user.email 'fcoverdugoa@underpost.net'
103
+ git config credential.interactive always
104
+
105
+ - name: Push to github package repository
106
+ run: |
107
+ pwd
108
+ git status
109
+ git remote set-url origin git@github.com:underpostnet/pwa-microservices-template-ghpkg.git
110
+ git add .
111
+ git commit -m "Update github repo package"
112
+ git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template-ghpkg.git
113
+
114
+ # git push -u origin https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template-ghpkg.git
115
+ # git push -u origin master
@@ -34,7 +34,26 @@ jobs:
34
34
  name: Publish to npm
35
35
  run: npm publish --provenance --access public
36
36
 
37
- # Publish to npm
37
+ build-and-publish-ghpkg:
38
+ # prevents this action from running on forks
39
+ if: github.repository == 'underpostnet/pwa-microservices-template-ghpkg'
40
+ runs-on: ubuntu-latest
41
+ permissions:
42
+ contents: read
43
+ id-token: write
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: actions/setup-node@v4
47
+ with:
48
+ node-version: '22.x'
49
+ registry-url: 'https://registry.npmjs.org'
50
+
51
+ - name: Install Dependencies
52
+ run: npm install
53
+
54
+ - run: npm ci
55
+
56
+ # Publish to npm git hub package
38
57
  - uses: actions/setup-node@v4
39
58
  with:
40
59
  node-version: '22.x'
@@ -45,7 +64,6 @@ jobs:
45
64
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46
65
  name: Publish to npm
47
66
  run: |
48
- node ./bin/deploy rename-package @underpostnet/underpost
49
67
  npm publish --provenance --access public
50
68
 
51
69
  # Publish to GitHub Packages
@@ -58,7 +76,6 @@ jobs:
58
76
  scope: '@underpostnet'
59
77
 
60
78
  - run: |
61
- node ./bin/deploy rename-package @underpostnet/underpost
62
79
  npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GIT_AUTH_TOKEN }}
63
80
  echo "//npm.pkg.github.com/:_authToken=${{ secrets.GIT_AUTH_TOKEN }}" > ~/.npmrc
64
81
  echo "@underposnet:registry=https://npm.pkg.github.com" >> ~/.npmrc
@@ -0,0 +1,54 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: ['main']
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: 'pages'
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ if: github.repository == 'underpostnet/pwa-microservices-template-ghpkg'
28
+ environment:
29
+ name: github-pages
30
+ url: ${{ steps.deployment.outputs.page_url }}
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Checkout
34
+ uses: actions/checkout@v4
35
+ - uses: actions/setup-node@v4
36
+ with:
37
+ node-version: '22.x'
38
+
39
+ - name: Build the site
40
+ run: |
41
+ npm install
42
+ node bin/deploy update-default-conf
43
+ npm run build-production github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
44
+
45
+ - name: Setup Pages
46
+ uses: actions/configure-pages@v5
47
+ - name: Upload artifact
48
+ uses: actions/upload-pages-artifact@v3
49
+ with:
50
+ # Upload entire repository
51
+ path: './public/underpostnet.github.io/pwa-microservices-template-ghpkg/'
52
+ - name: Deploy to GitHub Pages
53
+ id: deployment
54
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,30 @@
1
+ name: Test
2
+ on: [push]
3
+ jobs:
4
+ test:
5
+ if: (github.repository == 'underpostnet/pwa-microservices-template') || (github.repository == 'underpostnet/pwa-microservices-template-ghpkg')
6
+ name: Node ${{ matrix.node }} on ${{ matrix.os }}
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ matrix:
10
+ node-version: [21.x]
11
+ os: [ubuntu-latest]
12
+ # os: [ubuntu-latest, windows-latest]
13
+
14
+ steps:
15
+ - name: Clone repository
16
+ uses: actions/checkout@v3
17
+
18
+ - name: Set Node.js version
19
+ uses: actions/setup-node@v3
20
+ with:
21
+ node-version: ${{ matrix.node }}
22
+
23
+ - name: Get npm root
24
+ run: sudo npm root -g
25
+
26
+ - name: Install underpost cli
27
+ run: sudo npm install -g underpost
28
+
29
+ - name: Run test
30
+ run: sudo underpost test
@@ -30,12 +30,14 @@
30
30
  "fileupload",
31
31
  "fontawesome",
32
32
  "fortawesome",
33
+ "gameplay",
33
34
  "googlebot",
34
35
  "Hexa",
35
36
  "htdocs",
36
37
  "htmls",
37
38
  "inlt",
38
39
  "ipfs",
40
+ "Itemledger",
39
41
  "jsonld",
40
42
  "lampp",
41
43
  "loadingio",
@@ -54,6 +56,7 @@
54
56
  "Scatterplot",
55
57
  "sortablejs",
56
58
  "supervisord",
59
+ "Tokenomics",
57
60
  "underpost",
58
61
  "Unequip",
59
62
  "webroot",
@@ -96,5 +99,8 @@
96
99
  "prometheus_data": true,
97
100
  "grafana_data": true,
98
101
  ".nyc_output": true
102
+ },
103
+ "[solidity]": {
104
+ "editor.defaultFormatter": "JuanBlanco.solidity"
99
105
  }
100
106
  }
package/CHANGELOG.md CHANGED
@@ -4,34 +4,82 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### [v2.7.2](https://github.com/underpostnet/pwa-microservices-template/compare/v2.7.1...v2.7.2)
7
+ #### [v2.7.83](https://github.com/underpostnet/engine/compare/v2.7.7...v2.7.83)
8
+
9
+ > 28 October 2024
10
+
11
+ - update version 2.7.83 [`3d22671`](https://github.com/underpostnet/engine/commit/3d22671a23f25767cc01c244090e237ab3a300da)
12
+ - ssr refactor [`836b848`](https://github.com/underpostnet/engine/commit/836b8488b8b5156c4c5d376fefd592e25071a212)
13
+ - fix pixi js render [`93aaee3`](https://github.com/underpostnet/engine/commit/93aaee3683b070874b65ca2c00d27f2a787a0a5d)
14
+
15
+ #### [v2.7.7](https://github.com/underpostnet/engine/compare/v2.7.6...v2.7.7)
16
+
17
+ > 25 October 2024
18
+
19
+ - update version 2.7.7 [`df31617`](https://github.com/underpostnet/engine/commit/df316174ca563251fbaca62a6717771f3056e59b)
20
+ - cyberia ssr lore advance [`ad1f214`](https://github.com/underpostnet/engine/commit/ad1f2144bdd2f3b5b1f2ebc4b9f6b83716df800a)
21
+ - advance ssr lore cyberia [`03b2292`](https://github.com/underpostnet/engine/commit/03b2292f6e092fc9b98cfb6aba9eee6eb0f21a06)
22
+
23
+ #### [v2.7.6](https://github.com/underpostnet/engine/compare/v2.7.5...v2.7.6)
24
+
25
+ > 17 October 2024
26
+
27
+ - update version v2.7.6 [`ddbc2c4`](https://github.com/underpostnet/engine/commit/ddbc2c4bd366e75b580be288c28c68830ed390d5)
28
+ - update node version 22.9.0 and hardhat refactor [`8ba9281`](https://github.com/underpostnet/engine/commit/8ba92818cd67438359dd1aa0938fd33bb932e718)
29
+ - remove pinata [`e231b00`](https://github.com/underpostnet/engine/commit/e231b00919d9d0e31c9718d4dc512384779cf2bb)
30
+
31
+ #### [v2.7.5](https://github.com/underpostnet/engine/compare/v2.7.2...v2.7.5)
32
+
33
+ > 10 October 2024
34
+
35
+ - remove os switchs [`78f7c17`](https://github.com/underpostnet/engine/commit/78f7c17bdaa1789101bf3038544d105b51f25309)
36
+ - update version 2.7.5 [`ca059d9`](https://github.com/underpostnet/engine/commit/ca059d99f95121cbd51f4582c60458734e21b70d)
37
+ - add mondo db server daemon [`b3bab7e`](https://github.com/underpostnet/engine/commit/b3bab7e8ba4204da459660d5fdba25c076c6cd33)
38
+
39
+ #### [v2.7.2](https://github.com/underpostnet/engine/compare/v2.7.1...v2.7.2)
8
40
 
9
41
  > 8 October 2024
10
42
 
11
- - update src v2.7.2 [`12f3b14`](https://github.com/underpostnet/pwa-microservices-template/commit/12f3b14af0170f3a9e1ae1d341a586a2852f6056)
12
- - add npm publish workflow [`843623a`](https://github.com/underpostnet/pwa-microservices-template/commit/843623a582bb00bf16ef167b420f325540fc5327)
13
- - publish yml update [`dc5593b`](https://github.com/underpostnet/pwa-microservices-template/commit/dc5593bb4f480d24b81cf24045c24626542bfee9)
43
+ - underpost panel advance [`60087d5`](https://github.com/underpostnet/engine/commit/60087d55920ae9ddf7d7a3396606088d028cc996)
44
+ - file explorer content ui ux refactor [`38e87a0`](https://github.com/underpostnet/engine/commit/38e87a0f0bd222e1d8c9d76904d086aa9d2125ea)
45
+ - add macro db restore logic [`9cfd41c`](https://github.com/underpostnet/engine/commit/9cfd41c5d7adcd309976e7d327af800ffcf92dac)
14
46
 
15
- #### [v2.7.1](https://github.com/underpostnet/pwa-microservices-template/compare/v2.6.3...v2.7.1)
47
+ #### [v2.7.1](https://github.com/underpostnet/engine/compare/v2.6.3...v2.7.1)
16
48
 
17
49
  > 19 September 2024
18
50
 
19
- - add backup, dns and prompt-optimizer base [`507669e`](https://github.com/underpostnet/pwa-microservices-template/commit/507669e2f1c9b4145643cbac583762eb91b1d18d)
20
- - update version 2.6.8 [`3d765bf`](https://github.com/underpostnet/pwa-microservices-template/commit/3d765bfa6f06866ce46260d2e4af4432c91f072f)
21
- - update version batch 2.6.4 [`fd4fed5`](https://github.com/underpostnet/pwa-microservices-template/commit/fd4fed55f2bbac1a9d4760e804ed6b7f4cde1272)
51
+ - update version 2.7.0 [`03c5c35`](https://github.com/underpostnet/engine/commit/03c5c35a71e7ffb35203a668bfa2f8e2f86125e0)
52
+ - update [`d410da6`](https://github.com/underpostnet/engine/commit/d410da62fadbbb841eb9dcfa5922f105d35ad81d)
53
+ - add changelog generator [`28b3256`](https://github.com/underpostnet/engine/commit/28b3256ab9cebaa9caf2b52426e48f0b3105c8b7)
22
54
 
23
- #### [v2.6.3](https://github.com/underpostnet/pwa-microservices-template/compare/v2.6.2...v2.6.3)
55
+ #### [v2.6.3](https://github.com/underpostnet/engine/compare/v2.6.2...v2.6.3)
24
56
 
25
57
  > 14 September 2024
26
58
 
27
- - update version 2.6.3 [`c8f6f8e`](https://github.com/underpostnet/pwa-microservices-template/commit/c8f6f8ec31470eff977163c5b31be37a05ff96ba)
28
- - update [`7214fbb`](https://github.com/underpostnet/pwa-microservices-template/commit/7214fbb608f7f59c6bf8e189093fd9c7e9a5a80a)
29
- - update [`b99c869`](https://github.com/underpostnet/pwa-microservices-template/commit/b99c8697e96a5141b15f0d28386ba29871746825)
59
+ - update version 2.6.3 [`85c585d`](https://github.com/underpostnet/engine/commit/85c585d1cce30de4389772605cf56e774e2b7d3c)
60
+ - update refactor docs and coverage [`b455016`](https://github.com/underpostnet/engine/commit/b455016f5f2b2bdc142aacb4dfd66ab890125662)
61
+ - update [`b8f01f2`](https://github.com/underpostnet/engine/commit/b8f01f258999c9ebc1173b0616f0f7b8f7171048)
30
62
 
31
- #### v2.6.2
63
+ #### [v2.6.2](https://github.com/underpostnet/engine/compare/v2.5.1...v2.6.2)
32
64
 
33
65
  > 13 September 2024
34
66
 
35
- - add Base project [`4124a60`](https://github.com/underpostnet/pwa-microservices-template/commit/4124a601a8226587bb09db942a8e33b1486828ea)
36
- - set 0.0.1 env template version [`e38a062`](https://github.com/underpostnet/pwa-microservices-template/commit/e38a06281599a2138d3564ae4ed70f61dad55f88)
37
- - update dependabot security [`b6f221a`](https://github.com/underpostnet/pwa-microservices-template/commit/b6f221aecae1e00723c15f726ac1bff60199b10b)
67
+ - update version 2.6.2 [`0895afb`](https://github.com/underpostnet/engine/commit/0895afbde42dd5a573507ccfcb07c328648b4eb0)
68
+ - update version 2.5.6 [`ca57b87`](https://github.com/underpostnet/engine/commit/ca57b87c56a544e7b7e53baa5a6e15415e16b99b)
69
+ - update [`eec4943`](https://github.com/underpostnet/engine/commit/eec49433f50b4dfa7b7bbff48891a60f5be25545)
70
+
71
+ #### [v2.5.1](https://github.com/underpostnet/engine/compare/v2.0.0...v2.5.1)
72
+
73
+ > 27 August 2024
74
+
75
+ - css refactor [`49b1904`](https://github.com/underpostnet/engine/commit/49b1904e83162f9066fbf843ced37d4e87db5581)
76
+ - refactor [`dad4f95`](https://github.com/underpostnet/engine/commit/dad4f9567629b737254702ce8be6b243e68fb01e)
77
+ - add sitemap builder [`53d05a6`](https://github.com/underpostnet/engine/commit/53d05a62d03ea327df3d37181a4b5c272d417289)
78
+
79
+ #### v2.0.0
80
+
81
+ > 30 March 2024
82
+
83
+ - seed-city assets [`6d9decb`](https://github.com/underpostnet/engine/commit/6d9decbae96b828aa001777f96dd75aab3fc71d1)
84
+ - update [`1069fc5`](https://github.com/underpostnet/engine/commit/1069fc5268aa5ef7c101695393de59edfc14daf8)
85
+ - update [`41ae7d4`](https://github.com/underpostnet/engine/commit/41ae7d4c969cce0608171c820e05ebab42610a7f)
package/bin/cron.js ADDED
@@ -0,0 +1,47 @@
1
+ import { BackUpManagement } from '../src/server/backup.js';
2
+ import { Cmd } from '../src/server/conf.js';
3
+ import { Dns } from '../src/server/dns.js';
4
+ import { loggerFactory } from '../src/server/logger.js';
5
+ import { netWorkCron, saveRuntimeCron } from '../src/server/network.js';
6
+ import { shellExec } from '../src/server/process.js';
7
+ import fs from 'fs-extra';
8
+
9
+ const logger = loggerFactory(import.meta);
10
+
11
+ await logger.setUpInfo();
12
+
13
+ switch (process.argv[2]) {
14
+ case 'backups':
15
+ {
16
+ await BackUpManagement.Init({ deployId: process.argv[3] });
17
+ }
18
+ break;
19
+ case 'dns':
20
+ {
21
+ await Dns.InitIpDaemon({ deployId: process.argv[3] });
22
+ }
23
+ break;
24
+
25
+ case 'run': {
26
+ const confCronConfig = JSON.parse(fs.readFileSync(`./engine-private/conf/${process.argv[3]}/conf.cron.json`));
27
+ if (confCronConfig.jobs && Object.keys(confCronConfig.jobs).length > 0) {
28
+ shellExec(`node bin/deploy conf ${process.argv[3]} production`);
29
+ for (const job of Object.keys(confCronConfig.jobs)) {
30
+ if (confCronConfig.jobs[job].enabled) {
31
+ shellExec(Cmd.cron(process.argv[3], job, confCronConfig.jobs[job].expression));
32
+ netWorkCron.push({
33
+ deployId: process.argv[3],
34
+ jobId: job,
35
+ expression: confCronConfig.jobs[job].expression,
36
+ });
37
+ }
38
+ }
39
+ }
40
+ await saveRuntimeCron();
41
+ if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
42
+ break;
43
+ }
44
+
45
+ default:
46
+ break;
47
+ }
package/bin/db.js CHANGED
@@ -113,7 +113,7 @@ try {
113
113
  case 'update':
114
114
  {
115
115
  await DataBaseProvider.load({ apis: [arg0], host, path, db });
116
- const models = DataBaseProvider.instance[`${host}${path}`].mongoose[getCapVariableName(arg0)];
116
+ const models = DataBaseProvider.instance[`${host}${path}`].mongoose.models[getCapVariableName(arg0)];
117
117
 
118
118
  const select = JSON.parse(arg1.replaceAll("'", `"`));
119
119
  const update = JSON.parse(arg2.replaceAll("'", `"`));
@@ -133,6 +133,7 @@ try {
133
133
  runValidators: true,
134
134
  });
135
135
  logger.info(`successfully updated doc`, doc._doc);
136
+ await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
136
137
  } else throw new Error(`no doc found`);
137
138
  }
138
139
  break;
@@ -143,6 +144,13 @@ try {
143
144
  case 'create':
144
145
  break;
145
146
  case 'delete':
147
+ {
148
+ await DataBaseProvider.load({ apis: [arg0], host, path, db });
149
+ const models = DataBaseProvider.instance[`${host}${path}`].mongoose.models[getCapVariableName(arg0)];
150
+ await models.collection.drop();
151
+ logger.info(`successfully drop collection`, arg0);
152
+ await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
153
+ }
146
154
  break;
147
155
  case 'export':
148
156
  // mongodump -d <database_name> -o <directory_backup>