underpost 3.2.5 → 3.2.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 (144) hide show
  1. package/.github/workflows/release.cd.yml +1 -2
  2. package/CHANGELOG.md +351 -1
  3. package/CLI-HELP.md +40 -13
  4. package/Dockerfile +0 -4
  5. package/README.md +4 -4
  6. package/bin/build.js +14 -5
  7. package/bin/deploy.js +570 -1
  8. package/bin/file.js +6 -0
  9. package/conf.js +11 -2
  10. package/jsconfig.json +1 -1
  11. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +2 -2
  12. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +2 -2
  13. package/manifests/deployment/dd-default-development/deployment.yaml +2 -6
  14. package/manifests/deployment/dd-test-development/deployment.yaml +136 -66
  15. package/manifests/deployment/dd-test-development/proxy.yaml +41 -5
  16. package/package.json +24 -15
  17. package/scripts/k3s-node-setup.sh +2 -2
  18. package/scripts/nat-iptables.sh +103 -18
  19. package/src/api/core/core.controller.js +10 -10
  20. package/src/api/core/core.service.js +10 -10
  21. package/src/api/default/default.controller.js +10 -10
  22. package/src/api/default/default.service.js +10 -10
  23. package/src/api/document/document.controller.js +12 -12
  24. package/src/api/document/document.model.js +10 -16
  25. package/src/api/file/file.controller.js +8 -8
  26. package/src/api/file/file.model.js +10 -10
  27. package/src/api/file/file.service.js +36 -36
  28. package/src/api/test/test.controller.js +8 -8
  29. package/src/api/test/test.service.js +8 -8
  30. package/src/api/user/guest.service.js +99 -0
  31. package/src/api/user/user.controller.js +6 -6
  32. package/src/api/user/user.model.js +8 -13
  33. package/src/api/user/user.service.js +3 -20
  34. package/src/cli/cluster.js +61 -14
  35. package/src/cli/db.js +47 -2
  36. package/src/cli/deploy.js +67 -35
  37. package/src/cli/fs.js +79 -8
  38. package/src/cli/image.js +43 -1
  39. package/src/cli/index.js +26 -1
  40. package/src/cli/release.js +57 -1
  41. package/src/cli/repository.js +69 -31
  42. package/src/cli/run.js +415 -36
  43. package/src/cli/ssh.js +1 -1
  44. package/src/cli/static.js +43 -115
  45. package/src/client/Default.index.js +21 -33
  46. package/src/client/components/core/404.js +4 -4
  47. package/src/client/components/core/500.js +4 -4
  48. package/src/client/components/core/Account.js +73 -60
  49. package/src/client/components/core/AgGrid.js +23 -33
  50. package/src/client/components/core/Alert.js +12 -13
  51. package/src/client/components/core/AppStore.js +1 -1
  52. package/src/client/components/core/Auth.js +35 -37
  53. package/src/client/components/core/Badge.js +7 -13
  54. package/src/client/components/core/BtnIcon.js +15 -17
  55. package/src/client/components/core/CalendarCore.js +42 -63
  56. package/src/client/components/core/Chat.js +13 -15
  57. package/src/client/components/core/ClientEvents.js +87 -0
  58. package/src/client/components/core/ColorPaletteElement.js +309 -0
  59. package/src/client/components/core/Content.js +17 -14
  60. package/src/client/components/core/Css.js +15 -71
  61. package/src/client/components/core/CssCore.js +12 -16
  62. package/src/client/components/core/D3Chart.js +4 -4
  63. package/src/client/components/core/Docs.js +64 -91
  64. package/src/client/components/core/DropDown.js +69 -91
  65. package/src/client/components/core/EventBus.js +92 -0
  66. package/src/client/components/core/EventsUI.js +14 -17
  67. package/src/client/components/core/FileExplorer.js +96 -228
  68. package/src/client/components/core/FullScreen.js +47 -75
  69. package/src/client/components/core/Input.js +24 -69
  70. package/src/client/components/core/Keyboard.js +25 -18
  71. package/src/client/components/core/KeyboardAvoidance.js +145 -0
  72. package/src/client/components/core/LoadingAnimation.js +25 -31
  73. package/src/client/components/core/LogIn.js +41 -41
  74. package/src/client/components/core/LogOut.js +23 -14
  75. package/src/client/components/core/Modal.js +462 -178
  76. package/src/client/components/core/NotificationManager.js +14 -18
  77. package/src/client/components/core/Panel.js +54 -50
  78. package/src/client/components/core/PanelForm.js +25 -125
  79. package/src/client/components/core/Polyhedron.js +110 -214
  80. package/src/client/components/core/PublicProfile.js +39 -32
  81. package/src/client/components/core/Recover.js +48 -44
  82. package/src/client/components/core/Responsive.js +88 -32
  83. package/src/client/components/core/RichText.js +9 -18
  84. package/src/client/components/core/Router.js +24 -3
  85. package/src/client/components/core/SearchBox.js +37 -37
  86. package/src/client/components/core/SignUp.js +39 -30
  87. package/src/client/components/core/SocketIo.js +31 -2
  88. package/src/client/components/core/SocketIoHandler.js +6 -6
  89. package/src/client/components/core/ToggleSwitch.js +8 -20
  90. package/src/client/components/core/ToolTip.js +5 -17
  91. package/src/client/components/core/Translate.js +56 -59
  92. package/src/client/components/core/Validator.js +26 -16
  93. package/src/client/components/core/Wallet.js +15 -26
  94. package/src/client/components/core/Worker.js +163 -27
  95. package/src/client/components/core/windowGetDimensions.js +7 -7
  96. package/src/client/components/default/{MenuDefault.js → AppShellDefault.js} +87 -87
  97. package/src/client/components/default/CssDefault.js +12 -12
  98. package/src/client/components/default/LogInDefault.js +6 -4
  99. package/src/client/components/default/LogOutDefault.js +6 -4
  100. package/src/client/components/default/RouterDefault.js +47 -0
  101. package/src/client/components/default/SettingsDefault.js +4 -4
  102. package/src/client/components/default/SignUpDefault.js +6 -4
  103. package/src/client/components/default/TranslateDefault.js +3 -3
  104. package/src/client/services/core/core.service.js +17 -49
  105. package/src/client/services/default/default.management.js +159 -267
  106. package/src/client/services/default/default.service.js +10 -16
  107. package/src/client/services/document/document.service.js +14 -19
  108. package/src/client/services/file/file.service.js +8 -13
  109. package/src/client/services/test/test.service.js +8 -13
  110. package/src/client/services/user/guest.service.js +86 -0
  111. package/src/client/services/user/user.management.js +5 -5
  112. package/src/client/services/user/user.service.js +14 -20
  113. package/src/client/ssr/body/404.js +3 -3
  114. package/src/client/ssr/body/500.js +3 -3
  115. package/src/client/ssr/body/CacheControl.js +5 -2
  116. package/src/client/ssr/body/DefaultSplashScreen.js +19 -12
  117. package/src/client/ssr/mailer/DefaultRecoverEmail.js +19 -20
  118. package/src/client/ssr/mailer/DefaultVerifyEmail.js +15 -16
  119. package/src/client/ssr/offline/Maintenance.js +12 -11
  120. package/src/client/ssr/offline/NoNetworkConnection.js +3 -3
  121. package/src/client/ssr/pages/Test.js +2 -2
  122. package/src/client/sw/core.sw.js +212 -0
  123. package/src/index.js +1 -1
  124. package/src/runtime/express/Dockerfile +4 -4
  125. package/src/runtime/lampp/Dockerfile +8 -7
  126. package/src/runtime/wp/Dockerfile +11 -17
  127. package/src/server/client-build-docs.js +45 -46
  128. package/src/server/client-build.js +334 -60
  129. package/src/server/client-formatted.js +47 -16
  130. package/src/server/conf.js +5 -4
  131. package/src/server/data-query.js +32 -20
  132. package/src/server/dns.js +22 -0
  133. package/src/server/ipfs-client.js +232 -91
  134. package/src/server/process.js +13 -27
  135. package/src/server/start.js +17 -3
  136. package/src/server/valkey.js +141 -235
  137. package/tsconfig.docs.json +15 -0
  138. package/typedoc.json +29 -0
  139. package/jsdoc.json +0 -52
  140. package/src/client/components/core/ColorPalette.js +0 -5267
  141. package/src/client/components/core/JoyStick.js +0 -80
  142. package/src/client/components/default/RoutesDefault.js +0 -49
  143. package/src/client/sw/default.sw.js +0 -127
  144. package/src/client/sw/template.sw.js +0 -84
@@ -21,7 +21,7 @@ import {
21
21
  buildReplicaId,
22
22
  writeEnv,
23
23
  } from '../server/conf.js';
24
- import { buildClient } from '../server/client-build.js';
24
+ import { buildClient, unzipClientBuild, mergeClientBuildZip } from '../server/client-build.js';
25
25
  import { DefaultConf } from '../../conf.js';
26
26
  import Underpost from '../index.js';
27
27
 
@@ -401,6 +401,7 @@ class UnderpostRepository {
401
401
 
402
402
  /**
403
403
  * Retrieves the message of the last Git commit.
404
+ * @param {number} [skip=0] - Number of commits to skip from HEAD (0 = most recent).
404
405
  * @returns {string} The last commit message.
405
406
  * @memberof UnderpostRepository
406
407
  */
@@ -642,6 +643,9 @@ class UnderpostRepository {
642
643
  * @param {boolean} [options.syncEnvPort=false] - If true, syncs environment port assignments across all deploy IDs.
643
644
  * @param {boolean} [options.singleReplica=false] - If true, builds single replica folders instead of full client.
644
645
  * @param {boolean} [options.buildZip=false] - If true, creates zip files of the builds.
646
+ * @param {string|number} [options.split=''] - Optional ZIP part size in MB. When set with buildZip, writes split parts.
647
+ * @param {string} [options.unzip=''] - Optional build ZIP prefix to extract from ./build.
648
+ * @param {string} [options.mergeZip=''] - Optional build prefix to merge split ZIP parts into a single ZIP.
645
649
  * @param {boolean} [options.liteBuild=false] - If true, skips full build (default is full build).
646
650
  * @param {boolean} [options.iconsBuild=false] - If true, builds icons.
647
651
  * @returns {Promise<boolean>} A promise that resolves when the build is complete.
@@ -656,12 +660,31 @@ class UnderpostRepository {
656
660
  syncEnvPort: false,
657
661
  singleReplica: false,
658
662
  buildZip: false,
663
+ split: '',
664
+ unzip: '',
665
+ mergeZip: '',
659
666
  liteBuild: false,
660
667
  iconsBuild: false,
661
668
  },
662
669
  ) {
663
670
  return new Promise(async (resolve, reject) => {
664
671
  try {
672
+ if (options.mergeZip) {
673
+ mergeClientBuildZip({
674
+ buildPrefix: options.mergeZip,
675
+ logger,
676
+ });
677
+ return resolve(true);
678
+ }
679
+
680
+ if (options.unzip) {
681
+ unzipClientBuild({
682
+ buildPrefix: options.unzip,
683
+ logger,
684
+ });
685
+ return resolve(true);
686
+ }
687
+
665
688
  // Handle singleReplica operation (must run before syncEnvPort to ensure replica dirs exist)
666
689
  if (options.singleReplica) {
667
690
  const replicaPath = path;
@@ -804,6 +827,9 @@ class UnderpostRepository {
804
827
  let argPath = path ? path.split(',') : [];
805
828
  let deployIdSingleReplicas = [];
806
829
  let singleReplicaHosts = [];
830
+ const isReplicaContext = resolvedDeployId
831
+ ? fs.existsSync(`./engine-private/replica/${resolvedDeployId}`)
832
+ : false;
807
833
  const serverConf = resolvedDeployId
808
834
  ? readConfJson(resolvedDeployId, 'server', { loadReplicas: true })
809
835
  : Config.default.server;
@@ -814,7 +840,7 @@ class UnderpostRepository {
814
840
  if (argHost.length && argPath.length && (!argHost.includes(host) || !argPath.includes(path))) {
815
841
  delete serverConf[host][path];
816
842
  } else {
817
- if (serverConf[host][path].singleReplica && serverConf[host][path].replicas) {
843
+ if (!isReplicaContext && serverConf[host][path].singleReplica && serverConf[host][path].replicas) {
818
844
  singleReplicaHosts.push({ host, path });
819
845
  deployIdSingleReplicas = deployIdSingleReplicas.concat(
820
846
  serverConf[host][path].replicas.map((replica) =>
@@ -827,10 +853,17 @@ class UnderpostRepository {
827
853
  }
828
854
  await buildClient({
829
855
  buildZip: options.buildZip || false,
856
+ split: options.split || '',
830
857
  fullBuild: options.liteBuild ? false : true,
831
858
  iconsBuild: options.iconsBuild || false,
832
859
  });
833
- for (const replicaDeployId of deployIdSingleReplicas) await Underpost.repo.client(replicaDeployId);
860
+ for (const replicaDeployId of deployIdSingleReplicas) {
861
+ if (!fs.existsSync(`./engine-private/replica/${replicaDeployId}`)) {
862
+ logger.warn('Skip replica client build: replica folder not found', { replicaDeployId });
863
+ continue;
864
+ }
865
+ await Underpost.repo.client(replicaDeployId);
866
+ }
834
867
 
835
868
  return resolve(true);
836
869
  }
@@ -917,6 +950,7 @@ Prevent build private config repo.`,
917
950
  /**
918
951
  * Retrieves the Git commit history.
919
952
  * @param {number} [sinceCommit=1] - The number of recent commits to retrieve.
953
+ * @param {string} [repoPath='.'] - The path to the repository.
920
954
  * @returns {Array<{hash: string, message: string, files: string}>} An array of commit objects with hash, message, and files.
921
955
  * @memberof UnderpostRepository
922
956
  */
@@ -1238,19 +1272,10 @@ Prevent build private config repo.`,
1238
1272
  },
1239
1273
 
1240
1274
  /**
1241
- * Returns metadata about unpushed commits in a git repository.
1242
- * Fetches from origin, then counts commits ahead of the remote branch.
1243
- * @param {string} [repoPath='.'] - Path to the git repository.
1244
- * @param {number} [fallback=1] - Value to return as `count` when no unpushed commits are detected.
1245
- * @returns {{ count: number, branch: string, hasUnpushed: boolean }} Unpush metadata.
1246
- * @memberof UnderpostRepository
1247
- */
1248
- /**
1249
- * Checks whether a remote Git repository URL is reachable.
1250
- * Uses `git ls-remote` with `|| true` so the process always exits 0.
1251
- * Injects `GITHUB_TOKEN` into GitHub HTTPS URLs when available.
1252
- * @param {string} url - Full HTTPS clone URL to test (e.g. "https://github.com/org/repo.git").
1253
- * @returns {boolean} `true` when the remote responded with at least one ref hash.
1275
+ * Resolves a Git remote URL, normalizing short-form owner/repo references to full
1276
+ * GitHub HTTPS URLs and injecting GITHUB_TOKEN when available.
1277
+ * @param {string} url - The repository URL or short-form (e.g. "owner/repo" or full HTTPS URL).
1278
+ * @returns {string} The resolved (and optionally authenticated) HTTPS URL.
1254
1279
  * @memberof UnderpostRepository
1255
1280
  */
1256
1281
  resolveAuthUrl(url) {
@@ -1268,7 +1293,14 @@ Prevent build private config repo.`,
1268
1293
  }
1269
1294
  return normalized;
1270
1295
  },
1271
-
1296
+ /**
1297
+ * Checks whether a remote Git repository URL is reachable.
1298
+ * Uses `git ls-remote` with `|| true` so the process always exits 0.
1299
+ * Injects `GITHUB_TOKEN` into GitHub HTTPS URLs when available.
1300
+ * @param {string} url - Full HTTPS clone URL to test (e.g. "https://github.com/org/repo.git").
1301
+ * @returns {boolean} `true` when the remote responded with at least one ref hash.
1302
+ * @memberof UnderpostRepository
1303
+ */
1272
1304
  isRemoteRepo(url) {
1273
1305
  if (!url) return false;
1274
1306
  const authUrl = Underpost.repo.resolveAuthUrl(url);
@@ -1282,6 +1314,14 @@ Prevent build private config repo.`,
1282
1314
  return typeof raw === 'string' && /^[0-9a-f]{40}\t/m.test(raw);
1283
1315
  },
1284
1316
 
1317
+ /**
1318
+ * Returns metadata about unpushed commits in a git repository.
1319
+ * Fetches from origin, then counts commits ahead of the remote branch.
1320
+ * @param {string} [repoPath='.'] - Path to the git repository.
1321
+ * @param {number} [fallback=1] - Value to return as `count` when no unpushed commits are detected.
1322
+ * @returns {{ count: number, branch: string, hasUnpushed: boolean }} Unpush metadata.
1323
+ * @memberof UnderpostRepository
1324
+ */
1285
1325
  getUnpushedCount(repoPath = '.', fallback = 1) {
1286
1326
  const branch = shellExec(`cd ${repoPath} && git branch --show-current`, {
1287
1327
  stdout: true,
@@ -1321,19 +1361,6 @@ Prevent build private config repo.`,
1321
1361
  .trim()
1322
1362
  .replaceAll('] - ', '] ');
1323
1363
  },
1324
-
1325
- /**
1326
- * Manages a cron-backup Git repository: clone, pull, commit, or push.
1327
- * Resolves the repository path as `../<repoName>` relative to the CWD.
1328
- * Requires the `GITHUB_USERNAME` environment variable to be set.
1329
- * @param {object} params
1330
- * @param {string} params.repoName - Repository name (e.g. `engine-cyberia-cron-backups`).
1331
- * @param {'clone'|'pull'|'commit'|'push'} params.operation - Git operation to perform.
1332
- * @param {string} [params.message=''] - Commit message (used by the `commit` operation).
1333
- * @param {boolean} [params.forceClone=false] - Remove existing clone before re-cloning.
1334
- * @returns {boolean} `true` on success, `false` if GITHUB_USERNAME is unset or on error.
1335
- * @memberof UnderpostRepository
1336
- */
1337
1364
  /**
1338
1365
  * Initializes a git repository at the given path and configures user identity
1339
1366
  * from environment variables (`GITHUB_USERNAME` / `GITHUB_EMAIL`).
@@ -1366,7 +1393,18 @@ Prevent build private config repo.`,
1366
1393
  }
1367
1394
  }
1368
1395
  },
1369
-
1396
+ /**
1397
+ * Manages a cron-backup Git repository: clone, pull, commit, or push.
1398
+ * Resolves the repository path as `../<repoName>` relative to the CWD.
1399
+ * Requires the `GITHUB_USERNAME` environment variable to be set.
1400
+ * @param {object} params
1401
+ * @param {string} params.repoName - Repository name (e.g. `engine-cyberia-cron-backups`).
1402
+ * @param {'clone'|'pull'|'commit'|'push'} params.operation - Git operation to perform.
1403
+ * @param {string} [params.message=''] - Commit message (used by the `commit` operation).
1404
+ * @param {boolean} [params.forceClone=false] - Remove existing clone before re-cloning.
1405
+ * @returns {boolean} `true` on success, `false` if GITHUB_USERNAME is unset or on error.
1406
+ * @memberof UnderpostRepository
1407
+ */
1370
1408
  manageBackupRepo({ repoName, operation, message = '', forceClone = false }) {
1371
1409
  try {
1372
1410
  const username = process.env.GITHUB_USERNAME;