@stacksjs/ts-cloud 0.7.80 → 0.7.82

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 (55) hide show
  1. package/dist/bin/cli.js +323 -295
  2. package/dist/{chunk-5z0an6q8.js → chunk-900rezgt.js} +41 -3
  3. package/dist/{chunk-cx2j9h3s.js → chunk-hq03wq2p.js} +2 -2
  4. package/dist/deploy/dashboard-users.test.d.ts +1 -0
  5. package/dist/deploy/index.js +2 -2
  6. package/dist/drivers/index.js +1 -1
  7. package/dist/drivers/shared/compute-deploy.d.ts +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/ui/access-denied.html +2 -2
  10. package/dist/ui/account/automation.html +4 -4
  11. package/dist/ui/account/security.html +2 -2
  12. package/dist/ui/applications/compose.html +4 -4
  13. package/dist/ui/applications/new.html +2 -2
  14. package/dist/ui/data/backups.html +4 -4
  15. package/dist/ui/data/services.html +4 -4
  16. package/dist/ui/data/volumes.html +4 -4
  17. package/dist/ui/index.html +3 -3
  18. package/dist/ui/integrations.html +2 -2
  19. package/dist/ui/operations/alerts.html +4 -4
  20. package/dist/ui/operations/configuration.html +3 -3
  21. package/dist/ui/operations/jobs.html +4 -4
  22. package/dist/ui/operations/maintenance.html +4 -4
  23. package/dist/ui/operations/observability.html +4 -4
  24. package/dist/ui/operations/previews.html +4 -4
  25. package/dist/ui/operations/queue.html +4 -4
  26. package/dist/ui/operations/regions.html +3 -3
  27. package/dist/ui/operations/releases.html +4 -4
  28. package/dist/ui/operations/workloads.html +4 -4
  29. package/dist/ui/security.html +2 -2
  30. package/dist/ui/server/actions.html +4 -4
  31. package/dist/ui/server/activity.html +2 -2
  32. package/dist/ui/server/capacity.html +4 -4
  33. package/dist/ui/server/database.html +4 -4
  34. package/dist/ui/server/deployments.html +4 -4
  35. package/dist/ui/server/diagnostics.html +2 -2
  36. package/dist/ui/server/firewall.html +4 -4
  37. package/dist/ui/server/fleet.html +4 -4
  38. package/dist/ui/server/logs.html +4 -4
  39. package/dist/ui/server/metrics.html +4 -4
  40. package/dist/ui/server/services.html +2 -2
  41. package/dist/ui/server/sites.html +4 -4
  42. package/dist/ui/server/ssh-keys.html +4 -4
  43. package/dist/ui/server/team.html +4 -4
  44. package/dist/ui/serverless/alarms.html +4 -4
  45. package/dist/ui/serverless/assets.html +2 -2
  46. package/dist/ui/serverless/cost.html +2 -2
  47. package/dist/ui/serverless/data.html +4 -4
  48. package/dist/ui/serverless/functions.html +3 -3
  49. package/dist/ui/serverless/logs.html +4 -4
  50. package/dist/ui/serverless/metrics.html +2 -2
  51. package/dist/ui/serverless/queues.html +4 -4
  52. package/dist/ui/serverless/secrets.html +4 -4
  53. package/dist/ui/serverless/traces.html +4 -4
  54. package/dist/ui/serverless.html +4 -4
  55. package/package.json +3 -3
@@ -5757,9 +5757,46 @@ async function deploySiteRelease(driver, options, logger = noopLogger2) {
5757
5757
  function shellSingleQuote(value) {
5758
5758
  return `'${value.replaceAll("'", "'\\''")}'`;
5759
5759
  }
5760
- function buildManagementDashboardServiceReconciliationScript(slug, desiredSiteNames, serverOwner = false) {
5760
+ function buildManagementDashboardServiceReconciliationScript(slug, desiredSiteNames, serverOwner = false, desiredDomains = []) {
5761
5761
  const prefix = `${slug}-dashboard-`;
5762
5762
  const desiredUnits = desiredSiteNames.map((siteName) => `${slug}-${siteName}.service`);
5763
+ const routeReconciliation = serverOwner ? [
5764
+ `export TS_CLOUD_DASHBOARD_KEEP_DOMAINS=${shellSingleQuote(JSON.stringify(desiredDomains))}`,
5765
+ "rm -f /run/ts-cloud-dashboard-routes-changed",
5766
+ `/usr/local/bin/bun --bun -e ${shellSingleQuote(`
5767
+ const { chmodSync, existsSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync } = require('node:fs')
5768
+ const { basename, join } = require('node:path')
5769
+ const root = '/etc/rpx/sites.d'
5770
+ const keep = new Set(JSON.parse(process.env.TS_CLOUD_DASHBOARD_KEEP_DOMAINS || '[]'))
5771
+ let changed = false
5772
+ for (const name of existsSync(root) ? readdirSync(root) : []) {
5773
+ if (!name.endsWith('.json')) continue
5774
+ const file = join(root, name)
5775
+ let config
5776
+ try { config = JSON.parse(readFileSync(file, 'utf8')) } catch { continue }
5777
+ if (!Array.isArray(config.proxies)) continue
5778
+ const project = basename(name, '.json')
5779
+ const proxies = config.proxies.filter((route) => {
5780
+ const domain = typeof route?.to === 'string' ? route.to.toLowerCase() : ''
5781
+ if (!/^(?:dashboard|cloud)\\./.test(domain) || keep.has(domain)) return true
5782
+ const siteName = domain.replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
5783
+ return !existsSync('/var/www/' + project + '-' + siteName)
5784
+ })
5785
+ if (proxies.length === config.proxies.length) continue
5786
+ const temporary = file + '.tmp-' + process.pid
5787
+ const mode = statSync(file).mode & 0o777
5788
+ writeFileSync(temporary, JSON.stringify({ ...config, proxies }, null, 2) + '\\n', { mode })
5789
+ chmodSync(temporary, mode)
5790
+ renameSync(temporary, file)
5791
+ changed = true
5792
+ }
5793
+ if (changed) writeFileSync('/run/ts-cloud-dashboard-routes-changed', '')
5794
+ `)}`,
5795
+ "if [ -e /run/ts-cloud-dashboard-routes-changed ]; then",
5796
+ " systemctl restart rpx-gateway.service",
5797
+ " rm -f /run/ts-cloud-dashboard-routes-changed",
5798
+ "fi"
5799
+ ] : [];
5763
5800
  return [
5764
5801
  "set -euo pipefail",
5765
5802
  `TS_CLOUD_DASHBOARD_PREFIX=${shellSingleQuote(prefix)}`,
@@ -5784,7 +5821,8 @@ function buildManagementDashboardServiceReconciliationScript(slug, desiredSiteNa
5784
5821
  " esac",
5785
5822
  "done",
5786
5823
  "systemctl daemon-reload",
5787
- "systemctl reset-failed"
5824
+ "systemctl reset-failed",
5825
+ ...routeReconciliation
5788
5826
  ];
5789
5827
  }
5790
5828
  async function reconcileManagementDashboardServices(driver, options, desiredSiteNames, logger) {
@@ -5796,7 +5834,7 @@ async function reconcileManagementDashboardServices(driver, options, desiredSite
5796
5834
  return true;
5797
5835
  const result = await driver.runRemoteDeploy({
5798
5836
  targets,
5799
- commands: buildManagementDashboardServiceReconciliationScript(slug, desiredSiteNames, !config.cloud?.attachTo),
5837
+ commands: buildManagementDashboardServiceReconciliationScript(slug, desiredSiteNames, !config.cloud?.attachTo, desiredSiteNames.map((siteName) => config.sites?.[siteName]?.domain).filter((domain) => typeof domain === "string")),
5800
5838
  comment: `ts-cloud reconcile management dashboard ${slug}`,
5801
5839
  tags: {
5802
5840
  Project: slug,
@@ -45,7 +45,7 @@ import {
45
45
  resolveSiteKind,
46
46
  resolveUiSource,
47
47
  siteInstallBase
48
- } from "./chunk-5z0an6q8.js";
48
+ } from "./chunk-900rezgt.js";
49
49
  import {
50
50
  artifactKey,
51
51
  buildCloudFormationTemplate,
@@ -40169,7 +40169,7 @@ function isValidUsername(value2) {
40169
40169
  return /^[a-z0-9][a-z0-9._-]{1,31}$/i.test(value2);
40170
40170
  }
40171
40171
  function normalizeUser(raw) {
40172
- if (!raw || typeof raw.username !== "string" || typeof raw.passwordHash !== "string")
40172
+ if (!raw || typeof raw.username !== "string" || !isValidUsername(raw.username) || typeof raw.passwordHash !== "string")
40173
40173
  return null;
40174
40174
  const role = raw.role === "admin" ? "admin" : "member";
40175
40175
  const sites = {};
@@ -0,0 +1 @@
1
+ export {};
@@ -32,7 +32,7 @@ import {
32
32
  synchronizeDashboardUsers,
33
33
  trackDashboardOperation,
34
34
  verifyStaticApiOrigin
35
- } from "../chunk-cx2j9h3s.js";
35
+ } from "../chunk-hq03wq2p.js";
36
36
  import {
37
37
  deleteStaticSite,
38
38
  deployStaticSite,
@@ -65,7 +65,7 @@ import {
65
65
  shipsARelease,
66
66
  siteInstallBase,
67
67
  validateDeploymentConfig
68
- } from "../chunk-5z0an6q8.js";
68
+ } from "../chunk-900rezgt.js";
69
69
  import"../chunk-1qjyqrc5.js";
70
70
  import"../chunk-703nkybg.js";
71
71
  import"../chunk-4cjrg98a.js";
@@ -68,7 +68,7 @@ import {
68
68
  waitForSsh,
69
69
  wrapCloudInitUserData,
70
70
  writeResizeCheckpoint
71
- } from "../chunk-5z0an6q8.js";
71
+ } from "../chunk-900rezgt.js";
72
72
  import"../chunk-1qjyqrc5.js";
73
73
  import"../chunk-703nkybg.js";
74
74
  import"../chunk-4cjrg98a.js";
@@ -42,7 +42,7 @@ export interface DeployAllSitesOptions {
42
42
  * and can keep crash-looping on its old port. Release data and shared dashboard
43
43
  * state stay on disk for recovery.
44
44
  */
45
- export declare function buildManagementDashboardServiceReconciliationScript(slug: string, desiredSiteNames: string[], serverOwner?: boolean): string[];
45
+ export declare function buildManagementDashboardServiceReconciliationScript(slug: string, desiredSiteNames: string[], serverOwner?: boolean, desiredDomains?: string[]): string[];
46
46
  /**
47
47
  * Deploy every site that targets the compute server — both dynamic apps
48
48
  * (`server` + `start`, run as systemd services) and static sites (`server`
package/dist/index.js CHANGED
@@ -285,7 +285,7 @@ import {
285
285
  volumeCapabilities,
286
286
  webhookEndpoint,
287
287
  zeroCapacity
288
- } from "./chunk-cx2j9h3s.js";
288
+ } from "./chunk-hq03wq2p.js";
289
289
  import {
290
290
  deleteStaticSite,
291
291
  deployStaticSite,
@@ -398,7 +398,7 @@ import {
398
398
  waitForCloudInit,
399
399
  waitForSsh,
400
400
  wrapCloudInitUserData
401
- } from "./chunk-5z0an6q8.js";
401
+ } from "./chunk-900rezgt.js";
402
402
  import {
403
403
  ABTestManager,
404
404
  AI,