@rocket.chat/houston 0.27.0-next.3 → 2.1.8

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 (293) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -15
  3. package/bin/houston +62 -0
  4. package/data/docs/ARCHITECTURE.md +387 -0
  5. package/data/docs/automation.md +107 -0
  6. package/data/docs/e2ee.md +76 -0
  7. package/data/docs/eks.md +258 -0
  8. package/data/docs/gui.md +282 -0
  9. package/data/docs/guide.md +669 -0
  10. package/data/docs/kubernetes.md +138 -0
  11. package/data/docs/troubleshooting.md +193 -0
  12. package/data/docs/upgrading.md +84 -0
  13. package/data/docs/voice.md +253 -0
  14. package/data/iam/engineer-policy.json +11 -0
  15. package/data/iam/engineer-rbac.yaml +42 -0
  16. package/data/iam/operator-policy.json +211 -0
  17. package/data/loadtest/badbot.js +22 -0
  18. package/data/loadtest/common.js +168 -0
  19. package/data/loadtest/custom.js +20 -0
  20. package/data/loadtest/journey.js +58 -0
  21. package/data/loadtest/login.js +18 -0
  22. package/data/loadtest/messages.js +13 -0
  23. package/data/loadtest/mixed.js +39 -0
  24. package/data/loadtest/read.js +12 -0
  25. package/data/loadtest/webhook.js +20 -0
  26. package/data/monitoring/houston-logs.json +98 -0
  27. package/data/monitoring/k6-loadtest.json +610 -0
  28. package/data/monitoring/mongodb-exporter.json +3007 -0
  29. package/data/monitoring/node-exporter-full.json +16114 -0
  30. package/data/monitoring/rocketchat-metrics.json +6471 -0
  31. package/data/presets/airgapped.yaml +16 -0
  32. package/data/presets/default.yaml +9 -0
  33. package/data/seed/avatar-0.png +0 -0
  34. package/data/seed/avatar-1.png +0 -0
  35. package/data/seed/avatar-2.png +0 -0
  36. package/data/seed/avatar-3.png +0 -0
  37. package/data/seed/avatar-4.png +0 -0
  38. package/data/seed/avatar-5.png +0 -0
  39. package/data/seed/avatar-6.png +0 -0
  40. package/data/seed/avatar-7.png +0 -0
  41. package/data/seed/seed-metrics.csv +3 -0
  42. package/data/seed/seed-preview.png +0 -0
  43. package/data/seed/seed-report.pdf +32 -0
  44. package/data/seed/seed-runbook.txt +3 -0
  45. package/data/skill/SKILL.md +399 -0
  46. package/data/versions.yaml +55 -0
  47. package/data/voice/freeswitch/drachtio.xml +52 -0
  48. package/data/voice/freeswitch/public.xml +87 -0
  49. package/data/webui/app.css +2003 -0
  50. package/data/webui/index.html +678 -0
  51. package/data/webui/js/api.js +561 -0
  52. package/data/webui/js/boot.js +44 -0
  53. package/data/webui/js/clusters-tail.js +1377 -0
  54. package/data/webui/js/clusters.js +896 -0
  55. package/data/webui/js/create.js +276 -0
  56. package/data/webui/js/detail.js +507 -0
  57. package/data/webui/js/jobs.js +636 -0
  58. package/data/webui/js/logs.js +634 -0
  59. package/data/webui/js/main.js +14 -0
  60. package/data/webui/js/options.js +408 -0
  61. package/data/webui/js/people.js +438 -0
  62. package/data/webui/js/perf.js +303 -0
  63. package/data/webui/js/render.js +438 -0
  64. package/data/webui/js/shared.js +3 -0
  65. package/data/webui/js/state.js +583 -0
  66. package/data/webui/js/theme.js +123 -0
  67. package/data/webui/js/util.js +584 -0
  68. package/dist/cli/app.js +593 -0
  69. package/dist/cli/capabilities.js +76 -0
  70. package/dist/cli/cell-widths.js +495 -0
  71. package/dist/cli/entry.js +10 -0
  72. package/dist/cli/error-panel.js +492 -0
  73. package/dist/cli/handlers/actor.js +84 -0
  74. package/dist/cli/handlers/https.js +614 -0
  75. package/dist/cli/handlers/prompt.js +299 -0
  76. package/dist/cli/handlers/users.js +226 -0
  77. package/dist/cli/handlers.js +3678 -0
  78. package/dist/cli/help.js +183 -0
  79. package/dist/cli/index.js +15 -0
  80. package/dist/cli/perf.js +810 -0
  81. package/dist/cli/render.js +254 -0
  82. package/dist/cli/serve.js +858 -0
  83. package/dist/cli/spec-data.js +2593 -0
  84. package/dist/cli/spec-types.js +8 -0
  85. package/dist/cli/usage-error.js +520 -0
  86. package/dist/cli/wire.js +70 -0
  87. package/dist/core/audit.js +346 -0
  88. package/dist/core/backup-compat.js +85 -0
  89. package/dist/core/backup.js +1639 -0
  90. package/dist/core/cluster.js +1398 -0
  91. package/dist/core/configimport.js +344 -0
  92. package/dist/core/data.js +267 -0
  93. package/dist/core/database-of.js +82 -0
  94. package/dist/core/diagnose.js +159 -0
  95. package/dist/core/doctor.js +1518 -0
  96. package/dist/core/edge/acme.js +338 -0
  97. package/dist/core/edge/engine.js +500 -0
  98. package/dist/core/edge/networks.js +174 -0
  99. package/dist/core/edge/paths.js +107 -0
  100. package/dist/core/edge/routes.js +251 -0
  101. package/dist/core/edge/routeyml.js +195 -0
  102. package/dist/core/edge/runtime.js +493 -0
  103. package/dist/core/edge/spec.js +305 -0
  104. package/dist/core/edge/types.js +202 -0
  105. package/dist/core/eks-docs.js +135 -0
  106. package/dist/core/eks.js +2240 -0
  107. package/dist/core/envvars.js +562 -0
  108. package/dist/core/eventlog.js +541 -0
  109. package/dist/core/firstrun.js +153 -0
  110. package/dist/core/journal.js +691 -0
  111. package/dist/core/kube/ask.js +231 -0
  112. package/dist/core/kube/capabilities.js +269 -0
  113. package/dist/core/kube/certmanager.js +452 -0
  114. package/dist/core/kube/chart.js +413 -0
  115. package/dist/core/kube/cluster.js +196 -0
  116. package/dist/core/kube/context.js +545 -0
  117. package/dist/core/kube/endpoints.js +448 -0
  118. package/dist/core/kube/exec.js +195 -0
  119. package/dist/core/kube/forward.js +732 -0
  120. package/dist/core/kube/grafana-ingress.js +110 -0
  121. package/dist/core/kube/ingress.js +218 -0
  122. package/dist/core/kube/manifests.js +361 -0
  123. package/dist/core/kube/monitoring.js +768 -0
  124. package/dist/core/kube/names.js +237 -0
  125. package/dist/core/kube/namespace.js +678 -0
  126. package/dist/core/kube/operator.js +941 -0
  127. package/dist/core/kube/probe.js +202 -0
  128. package/dist/core/kube/reachability.js +163 -0
  129. package/dist/core/kube/release.js +439 -0
  130. package/dist/core/kube/replicaset.js +180 -0
  131. package/dist/core/kube/scale.js +398 -0
  132. package/dist/core/kube/status.js +633 -0
  133. package/dist/core/kube/tools.js +238 -0
  134. package/dist/core/kube/transfer.js +173 -0
  135. package/dist/core/kube/workspace.js +423 -0
  136. package/dist/core/lifecycle/admin.js +64 -0
  137. package/dist/core/lifecycle/create-docker.js +1533 -0
  138. package/dist/core/lifecycle/create-k8s.js +939 -0
  139. package/dist/core/lifecycle/destroy.js +339 -0
  140. package/dist/core/lifecycle/inspect.js +635 -0
  141. package/dist/core/lifecycle/naming.js +298 -0
  142. package/dist/core/lifecycle/notes.js +726 -0
  143. package/dist/core/lifecycle/ownership.js +313 -0
  144. package/dist/core/lifecycle/payload.js +401 -0
  145. package/dist/core/lifecycle/ports.js +388 -0
  146. package/dist/core/lifecycle/preconditions.js +367 -0
  147. package/dist/core/lifecycle/pruning.js +551 -0
  148. package/dist/core/lifecycle/ready.js +753 -0
  149. package/dist/core/lifecycle/request.js +525 -0
  150. package/dist/core/lifecycle/seeding.js +281 -0
  151. package/dist/core/lifecycle/sizing.js +392 -0
  152. package/dist/core/lifecycle/state.js +286 -0
  153. package/dist/core/lifecycle/tlsplan.js +704 -0
  154. package/dist/core/lifecycle/types.js +232 -0
  155. package/dist/core/loadtest.js +995 -0
  156. package/dist/core/migrate.js +612 -0
  157. package/dist/core/monitor.js +494 -0
  158. package/dist/core/postready.js +969 -0
  159. package/dist/core/promote.js +804 -0
  160. package/dist/core/rcapi.js +1285 -0
  161. package/dist/core/recovery.js +75 -0
  162. package/dist/core/runner/engine.js +394 -0
  163. package/dist/core/runner/host.js +298 -0
  164. package/dist/core/runner/locks.js +129 -0
  165. package/dist/core/runner/paths.js +173 -0
  166. package/dist/core/runner/ports.js +172 -0
  167. package/dist/core/runner/queries.js +612 -0
  168. package/dist/core/runner/record.js +563 -0
  169. package/dist/core/scaleseed.js +271 -0
  170. package/dist/core/seed-db.js +208 -0
  171. package/dist/core/sessions.js +472 -0
  172. package/dist/core/skill.js +326 -0
  173. package/dist/core/sso-identities.js +172 -0
  174. package/dist/core/sso.js +703 -0
  175. package/dist/core/tls-local.js +311 -0
  176. package/dist/core/tls.js +878 -0
  177. package/dist/core/topology.js +482 -0
  178. package/dist/core/upgrade.js +868 -0
  179. package/dist/core/users.js +739 -0
  180. package/dist/lib/audit.js +100 -0
  181. package/dist/lib/close-matches.js +238 -0
  182. package/dist/lib/compose.js +672 -0
  183. package/dist/lib/config.js +1398 -0
  184. package/dist/lib/context.js +18 -0
  185. package/dist/lib/errors.js +305 -0
  186. package/dist/lib/events.js +208 -0
  187. package/dist/lib/float-text.js +126 -0
  188. package/dist/lib/format.js +1320 -0
  189. package/dist/lib/home.js +325 -0
  190. package/dist/lib/journal.js +122 -0
  191. package/dist/lib/json-text.js +733 -0
  192. package/dist/lib/jsonout.js +382 -0
  193. package/dist/lib/lock.js +516 -0
  194. package/dist/lib/login-name.js +202 -0
  195. package/dist/lib/map-limit.js +29 -0
  196. package/dist/lib/mkdir-parents.js +90 -0
  197. package/dist/lib/mongo-kernel.js +67 -0
  198. package/dist/lib/monitoring.js +492 -0
  199. package/dist/lib/platform-name.js +59 -0
  200. package/dist/lib/presets/common.js +390 -0
  201. package/dist/lib/presets/composite.js +326 -0
  202. package/dist/lib/presets/e2ee.js +143 -0
  203. package/dist/lib/presets/email.js +172 -0
  204. package/dist/lib/presets/guides.js +27 -0
  205. package/dist/lib/presets/index.js +490 -0
  206. package/dist/lib/presets/keycloak.js +369 -0
  207. package/dist/lib/presets/ldap.js +1285 -0
  208. package/dist/lib/presets/livechat.js +220 -0
  209. package/dist/lib/presets/multi-instance.js +124 -0
  210. package/dist/lib/presets/oidc.js +161 -0
  211. package/dist/lib/presets/public.js +496 -0
  212. package/dist/lib/presets/registry.js +64 -0
  213. package/dist/lib/presets/s3-minio.js +300 -0
  214. package/dist/lib/presets/saml.js +149 -0
  215. package/dist/lib/presets/scenario.js +51 -0
  216. package/dist/lib/presets/types.js +86 -0
  217. package/dist/lib/presets/voice-pbx.js +320 -0
  218. package/dist/lib/presets/voice.js +345 -0
  219. package/dist/lib/presets/webhooks.js +182 -0
  220. package/dist/lib/redact.js +106 -0
  221. package/dist/lib/seed-options.js +68 -0
  222. package/dist/lib/seed-profiles.js +59 -0
  223. package/dist/lib/targz.js +1383 -0
  224. package/dist/lib/teammode.js +25 -0
  225. package/dist/lib/tempdir.js +162 -0
  226. package/dist/lib/unicode-tables.js +2335 -0
  227. package/dist/lib/version-spec.js +357 -0
  228. package/dist/lib/versions.js +463 -0
  229. package/dist/lib/yaml-dump.js +1361 -0
  230. package/dist/perf/baseline.js +168 -0
  231. package/dist/perf/constrain.js +296 -0
  232. package/dist/perf/k6.js +235 -0
  233. package/dist/perf/mongoprof.js +171 -0
  234. package/dist/perf/rcmetrics.js +178 -0
  235. package/dist/perf/report.js +386 -0
  236. package/dist/perf/resources.js +224 -0
  237. package/dist/perf/slo.js +111 -0
  238. package/dist/perf/timeline.js +187 -0
  239. package/dist/perf/timings.js +85 -0
  240. package/dist/perf/verdict.js +201 -0
  241. package/dist/seams/aws-cli.js +126 -0
  242. package/dist/seams/docker-cli.js +280 -0
  243. package/dist/seams/exec.js +861 -0
  244. package/dist/seams/fs/lock.js +528 -0
  245. package/dist/seams/kubectl.js +83 -0
  246. package/dist/seams/rc-http.js +921 -0
  247. package/dist/seed/apply.js +190 -0
  248. package/dist/seed/assets.js +76 -0
  249. package/dist/seed/check.js +391 -0
  250. package/dist/seed/client.js +172 -0
  251. package/dist/seed/executor.js +726 -0
  252. package/dist/seed/history.js +281 -0
  253. package/dist/seed/kinds.js +91 -0
  254. package/dist/seed/plan.js +432 -0
  255. package/dist/seed/receipt.js +339 -0
  256. package/dist/seed/repairs.js +75 -0
  257. package/dist/seed/verification.js +363 -0
  258. package/dist/seed/wording.js +248 -0
  259. package/dist/web/app.js +326 -0
  260. package/dist/web/jobs.js +510 -0
  261. package/dist/web/route-deps.js +211 -0
  262. package/dist/web/route-table.js +213 -0
  263. package/dist/web/routes/backup.js +244 -0
  264. package/dist/web/routes/clusters.js +303 -0
  265. package/dist/web/routes/data.js +187 -0
  266. package/dist/web/routes/edge.js +82 -0
  267. package/dist/web/routes/index.js +63 -0
  268. package/dist/web/routes/jobs.js +95 -0
  269. package/dist/web/routes/logs.js +297 -0
  270. package/dist/web/routes/meta.js +191 -0
  271. package/dist/web/routes/people.js +151 -0
  272. package/dist/web/routes/perf.js +95 -0
  273. package/dist/web/routes/repros.js +550 -0
  274. package/dist/web/routes/session.js +361 -0
  275. package/dist/web/routes/spa.js +198 -0
  276. package/dist/web/security.js +475 -0
  277. package/dist/web/signin.js +246 -0
  278. package/package.json +67 -32
  279. package/.eslintrc +0 -94
  280. package/.swcrc +0 -18
  281. package/dist/bin.js +0 -3
  282. package/dist/cli.js +0 -184
  283. package/dist/commands/createBranch.js +0 -194
  284. package/dist/outputCI.js +0 -59
  285. package/src/bin.js +0 -4
  286. package/src/cli.ts +0 -25
  287. package/src/commands/createBranch.ts +0 -28
  288. package/src/outputCI.ts +0 -12
  289. package/src-old/logs.js +0 -323
  290. package/src-old/md.js +0 -191
  291. package/src-old/release-table.js +0 -60
  292. package/src-old/set-version.js +0 -614
  293. package/src-old/utils.js +0 -15
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ /**
3
+ * The sign-in document.
4
+ *
5
+ * A server-rendered page with no JavaScript, not a state inside the SPA. Three reasons,
6
+ * in order:
7
+ *
8
+ * - The SPA assumes authenticated API calls succeed and a repro list is reachable.
9
+ * Opening the module that maps the whole API surface to an unauthenticated caller is
10
+ * needless exposure for a form with two fields.
11
+ * - The server renderer is directly exercisable without booting the browser harness.
12
+ * - HTTP Basic's failure mode was the browser's own grey dialog, with no error text,
13
+ * styling or way back. A page that needs JavaScript to render its own error would keep
14
+ * half of that failure mode.
15
+ *
16
+ * The page is a real `<form method="post">`; the CSP therefore permits
17
+ * `form-action 'self'` while still refusing off-origin submissions.
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.SETUP_JS = exports.STATES = void 0;
21
+ exports.escapeHtml = escapeHtml;
22
+ exports.themeAttr = themeAttr;
23
+ exports.safeNext = safeNext;
24
+ exports.page = page;
25
+ exports.setupPage = setupPage;
26
+ const users_1 = require("../core/users");
27
+ const jsonout_1 = require("../lib/jsonout");
28
+ const format_1 = require("../lib/format");
29
+ /** Fixed banners: a query parameter selects text but can never supply it. */
30
+ exports.STATES = Object.freeze({
31
+ bad: ['bad', 'That name or password is not right.'],
32
+ rate: ['bad', 'Too many attempts from this address. Try again in a moment.'],
33
+ expired: ['warn', 'Your session expired. Sign in again to carry on.'],
34
+ signedout: ['ok', 'Signed out.'],
35
+ revoked: ['warn', 'That session was signed out from somewhere else.'],
36
+ required: ['warn', 'Sign in to use houston.'],
37
+ nouser: [
38
+ 'bad',
39
+ 'There are no accounts on this server yet. Create one on the host: ' +
40
+ 'houston users add &lt;name&gt;',
41
+ ],
42
+ // An Okta sign-in that did not complete: `sso-` and the reason code `core/sso` refused with.
43
+ 'sso-expired': ['warn', 'That Okta sign-in expired or was already used. Start again.'],
44
+ 'sso-denied': ['bad', 'Okta did not sign you in.'],
45
+ 'sso-down': [
46
+ 'bad',
47
+ 'Okta did not answer. Try again in a moment, or sign in with your houston password.',
48
+ ],
49
+ 'sso-provider': [
50
+ 'bad',
51
+ 'Okta refused the sign-in. Try again, or sign in with your houston password.',
52
+ ],
53
+ 'sso-token': ['bad', 'The answer from Okta could not be verified, so it was not trusted.'],
54
+ 'sso-email': ['bad', 'Your Okta account has no verified email address.'],
55
+ 'sso-domain': ['bad', 'Your Okta email address is not one this server accepts.'],
56
+ 'sso-disabled': ['bad', 'Okta sign-in is turned off for your account here. Ask an admin.'],
57
+ 'sso-gone': ['bad', 'Your houston account no longer exists. Ask an admin.'],
58
+ 'sso-admin': [
59
+ 'warn',
60
+ 'Your houston account is an admin, so an admin approves its first Okta sign-in, on ' +
61
+ 'the host: houston users link-sso &lt;your name&gt;',
62
+ ],
63
+ 'sso-taken': ['bad', 'That houston account is linked to a different Okta user.'],
64
+ 'sso-name': [
65
+ 'bad',
66
+ 'Your Okta username does not make a valid houston account name. Ask an admin for one.',
67
+ ],
68
+ 'sso-noaccount': [
69
+ 'bad',
70
+ 'There is no houston account for you, and this server does not create them from Okta. ' +
71
+ 'Ask an admin.',
72
+ ],
73
+ 'sso-noadmin': ['bad', 'This server has no admin yet, so it cannot create accounts from Okta.'],
74
+ 'sso-store': [
75
+ 'bad',
76
+ 'Okta sign-in is unavailable here right now. Sign in with your houston password, or ask ' +
77
+ 'an admin.',
78
+ ],
79
+ 'sso-off': ['bad', 'Okta sign-in is not available on this server.'],
80
+ 'sso-other': [
81
+ 'warn',
82
+ 'You are signed in to houston as someone else. Sign out first, then sign in with Okta.',
83
+ ],
84
+ });
85
+ /** HTML-escape `value`: `&`, `<`, `>`, `"` and `'` (as `&#x27;`). */
86
+ function escapeHtml(value) {
87
+ return value
88
+ .replaceAll('&', '&amp;')
89
+ .replaceAll('<', '&lt;')
90
+ .replaceAll('>', '&gt;')
91
+ .replaceAll('"', '&quot;')
92
+ .replaceAll("'", '&#x27;');
93
+ }
94
+ /** `data-theme="dark"` for a fixed choice, or nothing: the light theme, the default. */
95
+ function themeAttr(value) {
96
+ const selected = (0, format_1.stripText)(value || '');
97
+ return selected === 'dark' || selected === 'light' ? ` data-theme="${selected}"` : '';
98
+ }
99
+ /**
100
+ * Reduce a post-sign-in destination to one same-origin absolute path.
101
+ *
102
+ * No control character either: a browser drops a tab, CR or LF from a URL before parsing it,
103
+ * so the `Location: /\t/evil.example` this let through was `//evil.example`, another site --
104
+ * reached after a real sign-in, with a link to this server as the bait.
105
+ */
106
+ function safeNext(value) {
107
+ const destination = (0, format_1.stripText)(value || '/');
108
+ if (!destination.startsWith('/') ||
109
+ destination.startsWith('//') ||
110
+ destination.includes('\\') ||
111
+ [...destination].some((char) => char < ' ' || char === '\x7f')) {
112
+ return '/';
113
+ }
114
+ return destination;
115
+ }
116
+ /** Render the complete sign-in document. Pure: no request object is needed. */
117
+ function page({ error = '', nextUrl = '/', server = '', secure = true, retryAfter = 0, theme = '', okta = false, } = {}) {
118
+ const state = Object.hasOwn(exports.STATES, error) ? (exports.STATES[error] ?? ['', '']) : ['', ''];
119
+ const [kind, message] = state;
120
+ const banner = message ? `<p class="signin-banner ${kind}">${message}</p>` : '';
121
+ const warning = secure
122
+ ? ''
123
+ : '<p class="signin-banner bad">This connection is not encrypted — your ' +
124
+ 'password will cross the network in the clear.</p>';
125
+ const refresh = error === 'rate' && retryAfter
126
+ ? `<meta http-equiv="refresh" content="${Math.trunc(retryAfter) + 1}">`
127
+ : '';
128
+ const where = escapeHtml(server || 'this host');
129
+ const next = escapeHtml(safeNext(nextUrl));
130
+ const version = escapeHtml((0, jsonout_1.getHoustonVersion)());
131
+ const sso = okta
132
+ ? `<a class="btn primary signin-okta" href="/signin?sso=1&amp;next=` +
133
+ `${escapeHtml(encodeURIComponent(safeNext(nextUrl)))}">Sign in with Okta</a>\n` +
134
+ ' <p class="signin-foot">or with your houston password</p>\n '
135
+ : '';
136
+ return `<!doctype html>
137
+ <html lang="en"${themeAttr(theme)}>
138
+ <head>
139
+ <meta charset="utf-8">
140
+ <meta name="viewport" content="width=device-width, initial-scale=1">
141
+ <title>Sign in · houston</title>
142
+ <link rel="stylesheet" href="/app.css">
143
+ ${refresh}
144
+ </head>
145
+ <body class="signin-body">
146
+ <main class="signin">
147
+ <div class="brand"><span class="dollar">$</span> houston</div>
148
+ ${warning}
149
+ ${banner}
150
+ ${sso}<form method="post" action="/signin" class="signin-form">
151
+ <input type="hidden" name="next" value="${next}">
152
+ <label for="u">Name</label>
153
+ <input id="u" name="user" autocomplete="username" autocapitalize="none"
154
+ autocorrect="off" spellcheck="false" autofocus required>
155
+ <label for="p">Password</label>
156
+ <input id="p" name="password" type="password"
157
+ autocomplete="current-password" required>
158
+ <button class="btn primary" type="submit">Sign in</button>
159
+ </form>
160
+ <p class="signin-foot">Server: ${where} &middot; houston ${version}</p>
161
+ <p class="signin-foot">
162
+ Lost your password? An admin resets it, on the host:<br>
163
+ <code>houston users passwd &lt;name&gt;</code>
164
+ </p>
165
+ </main>
166
+ </body>
167
+ </html>
168
+ `;
169
+ }
170
+ /**
171
+ * The only script served before authentication. The setup key remains in the URL
172
+ * fragment, which browsers never send in a request or Referer header.
173
+ */
174
+ exports.SETUP_JS = `"use strict";
175
+ var key = (location.hash || "").replace(/^#k=/, "");
176
+ // Out of the address bar on first paint, so it does not survive a screenshot or
177
+ // a shared link. Doing it before anything else means even an error leaves no key.
178
+ history.replaceState(null, "", "/setup");
179
+ var form = document.getElementById("f");
180
+ var err = document.getElementById("err");
181
+ if (!key) {
182
+ err.textContent = "This page needs the setup link houston printed. "
183
+ + "Copy the whole URL, including the part after #.";
184
+ err.hidden = false;
185
+ form.hidden = true;
186
+ }
187
+ form.addEventListener("submit", function (e) {
188
+ e.preventDefault();
189
+ err.hidden = true;
190
+ var btn = form.querySelector("button");
191
+ btn.disabled = true; btn.textContent = "Creating…";
192
+ fetch("/api/session/first-run", {
193
+ method: "POST",
194
+ headers: { "Content-Type": "application/json" },
195
+ credentials: "same-origin",
196
+ body: JSON.stringify({
197
+ key: key, user: form.user.value.trim(), password: form.password.value,
198
+ }),
199
+ }).then(function (r) {
200
+ return r.json().then(function (d) { return { ok: r.ok, d: d }; });
201
+ }).then(function (res) {
202
+ if (res.ok) { location.assign("/"); return; }
203
+ err.textContent = res.d.error || "That did not work.";
204
+ err.hidden = false;
205
+ btn.disabled = false; btn.textContent = "Create admin account";
206
+ }).catch(function () {
207
+ err.textContent = "Could not reach the server.";
208
+ err.hidden = false;
209
+ btn.disabled = false; btn.textContent = "Create admin account";
210
+ });
211
+ });
212
+ `;
213
+ /** Render the one-time first-admin document. */
214
+ function setupPage(theme = '') {
215
+ return `<!doctype html>
216
+ <html lang="en"${themeAttr(theme)}>
217
+ <head>
218
+ <meta charset="utf-8">
219
+ <meta name="viewport" content="width=device-width, initial-scale=1">
220
+ <title>Set up houston</title>
221
+ <link rel="stylesheet" href="/app.css">
222
+ </head>
223
+ <body class="signin-body">
224
+ <main class="signin">
225
+ <div class="brand"><span class="dollar">$</span> houston</div>
226
+ <p class="signin-banner ok">This server has no accounts yet. Create the first
227
+ one — it will be an admin, because somebody has to be able to add everyone
228
+ else.</p>
229
+ <p class="signin-banner bad" id="err" hidden></p>
230
+ <form class="signin-form" id="f">
231
+ <label for="u">Name</label>
232
+ <input id="u" name="user" autocomplete="username" autocapitalize="none"
233
+ autocorrect="off" spellcheck="false" autofocus required>
234
+ <label for="p">Password</label>
235
+ <input id="p" name="password" type="password"
236
+ autocomplete="new-password" minlength="${users_1.MIN_PASSWORD}" required>
237
+ <button class="btn primary" type="submit">Create admin account</button>
238
+ </form>
239
+ <p class="signin-foot">At least ${users_1.MIN_PASSWORD} characters. houston stores only a
240
+ scrypt hash — there is no password recovery, an admin resets it.</p>
241
+ </main>
242
+ <script src="/setup.js"></script>
243
+ </body>
244
+ </html>
245
+ `;
246
+ }
package/package.json CHANGED
@@ -1,45 +1,80 @@
1
1
  {
2
2
  "name": "@rocket.chat/houston",
3
- "version": "0.27.0-next.3",
4
- "description": "Rocket.Chat Command Line Tools",
5
- "main": "dist/bin.js",
3
+ "version": "2.1.8",
4
+ "description": "Reproduce a customer's Rocket.Chat issue on their exact version, in minutes.",
5
+ "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/RocketChat/Rocket.Chat.Houston.git"
9
9
  },
10
- "scripts": {
11
- "build": "npx swc ./src -d dist",
12
- "cli": "ts-node --swc src/cli.ts",
13
- "test": "echo \"Error: no test specified\" && exit 1"
14
- },
15
- "author": "Rodrigo Nascimento <rodrigo.nascimento@rocket.chat>",
16
- "private": false,
17
- "license": "MIT",
18
- "bin": {
19
- "houston": "./dist/bin.js"
20
- },
21
- "dependencies": {
22
- "@actions/core": "^1.10.0",
23
- "@actions/exec": "^1.1.1",
24
- "@octokit/rest": "^19.0.11",
25
- "commander": "^10.0.1",
26
- "eslint": "^8.41.0",
27
- "semver": "^7.5.1",
28
- "simple-git": "^3.19.0"
10
+ "homepage": "https://github.com/RocketChat/Rocket.Chat.Houston#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/RocketChat/Rocket.Chat.Houston/issues"
29
13
  },
14
+ "keywords": [
15
+ "rocket.chat",
16
+ "reproduction",
17
+ "support",
18
+ "docker",
19
+ "kubernetes",
20
+ "cli"
21
+ ],
22
+ "bin": "bin/houston",
23
+ "packageManager": "yarn@4.18.0",
30
24
  "engines": {
31
- "node": ">= 16"
25
+ "node": ">=24.10.0"
32
26
  },
33
- "bugs": {
34
- "url": "https://github.com/RocketChat/Rocket.Chat.Houston/issues"
27
+ "files": [
28
+ "dist/",
29
+ "data/",
30
+ "bin/"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc -p tsconfig.build.json",
37
+ "prepack": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json",
38
+ "typecheck": "tsc -p tsconfig.json --noEmit",
39
+ "lint": "eslint .",
40
+ "lint:fix": "eslint . --fix",
41
+ "format": "prettier --check \"{src,test,tools}/**/*.{ts,js}\" \"*.mjs\" \"jest*.config.js\" .dependency-cruiser.js",
42
+ "format:write": "prettier --write \"{src,test,tools}/**/*.{ts,js}\" \"*.mjs\" \"jest*.config.js\" .dependency-cruiser.js",
43
+ "test": "jest",
44
+ "test:browser": "jest --config jest.browser.config.js --runInBand",
45
+ "verify:gui-hash": "node tools/gui-hash.js",
46
+ "test:process-contracts": "jest test/seams/exec.test.ts test/seams/docker-cli.test.ts --runInBand",
47
+ "test:timing": "node tools/timing.js",
48
+ "lint:truthiness": "node tools/lint-truthiness.js",
49
+ "depcruise": "node tools/depcruise.js",
50
+ "depcruise:selftest": "node tools/depcruise-selftest.js",
51
+ "test:zero-skips:selftest": "node tools/zero-skips-selftest.js",
52
+ "skill:generate": "node tools/skill-generate.js",
53
+ "skill:check": "node tools/skill-generate.js --check",
54
+ "skill:eval": "node tools/skill-eval.js"
35
55
  },
36
- "homepage": "https://github.com/RocketChat/Rocket.Chat.Houston#readme",
37
56
  "devDependencies": {
38
- "@swc/cli": "^0.1.62",
39
- "@swc/core": "^1.3.61",
40
- "@types/node": "16",
41
- "prettier": "^2.8.8",
42
- "ts-node": "^10.9.1",
43
- "typescript": "^5.0.4"
57
+ "@eslint/js": "^10.0.1",
58
+ "@swc/core": "^1.15.10",
59
+ "@swc/jest": "^0.2.39",
60
+ "@types/jest": "^30.0.0",
61
+ "@types/node": "~24.13.4",
62
+ "dependency-cruiser": "~18.2.0",
63
+ "eslint": "^10.10.0",
64
+ "jest": "^30.5.1",
65
+ "playwright": "^1.63.0",
66
+ "prettier": "^3.9.6",
67
+ "ts-morph": "~27.0.2",
68
+ "typescript": "~5.9.3",
69
+ "typescript-eslint": "^8.70.0"
70
+ },
71
+ "dependencies": {
72
+ "@fastify/formbody": "^9.0.0",
73
+ "@fastify/multipart": "^10.1.1",
74
+ "@fastify/sse": "^0.6.0",
75
+ "@fastify/websocket": "^11.3.0",
76
+ "commander": "~14.0.2",
77
+ "fastify": "5.12.6",
78
+ "yaml": "^2.9.1"
44
79
  }
45
80
  }
package/.eslintrc DELETED
@@ -1,94 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "sourceType": "script",
4
- "ecmaVersion": 2017,
5
- "ecmaFeatures": {
6
- "experimentalObjectRestSpread" : true
7
- }
8
- },
9
- "env": {
10
- "browser": true,
11
- "commonjs": true,
12
- "es6": true,
13
- "node": true,
14
- "jquery": true
15
- },
16
- "rules": {
17
- "no-multi-spaces": 2,
18
- "no-eval": 2,
19
- "no-extend-native": 2,
20
- "no-multi-str": 2,
21
- "no-use-before-define": 2,
22
- "no-const-assign": 2,
23
- "no-cond-assign": 2,
24
- "no-constant-condition": 2,
25
- "no-control-regex": 2,
26
- "no-debugger": 2,
27
- "no-delete-var": 2,
28
- "no-dupe-keys": 2,
29
- "no-dupe-args": 2,
30
- "no-dupe-class-members": 2,
31
- "no-duplicate-case": 2,
32
- "no-empty": 2,
33
- "no-empty-character-class": 2,
34
- "no-ex-assign": 2,
35
- "no-extra-boolean-cast": 2,
36
- "no-extra-semi": 2,
37
- "no-fallthrough": 2,
38
- "no-func-assign": 2,
39
- "no-inner-declarations": [2, "functions"],
40
- "no-invalid-regexp": 2,
41
- "no-irregular-whitespace": 2,
42
- "no-mixed-spaces-and-tabs": 2,
43
- "no-sparse-arrays": 2,
44
- "no-negated-in-lhs": 2,
45
- "no-obj-calls": 2,
46
- "no-octal": 2,
47
- "no-redeclare": 2,
48
- "no-regex-spaces": 2,
49
- "no-undef": 2,
50
- "no-unreachable": 2,
51
- "no-unused-vars": [2, {
52
- "vars": "all",
53
- "args": "after-used"
54
- }],
55
- "no-void": 2,
56
- "no-var": 2,
57
- "one-var": [2, "never"],
58
- "no-lonely-if": 2,
59
- "no-trailing-spaces": 2,
60
- "complexity": [1, 31],
61
- "space-in-parens": [2, "never"],
62
- "space-before-function-paren": [2, "never"],
63
- "space-before-blocks": [2, "always"],
64
- "indent": [2, "tab", {"SwitchCase": 1}],
65
- "eol-last": [2, "always"],
66
- "comma-dangle": [2, "never"],
67
- "keyword-spacing": 2,
68
- "block-spacing": 2,
69
- "brace-style": [2, "1tbs", { "allowSingleLine": true }],
70
- "computed-property-spacing": 2,
71
- "comma-spacing": 2,
72
- "comma-style": 2,
73
- "guard-for-in": 2,
74
- "wrap-iife": 2,
75
- "block-scoped-var": 2,
76
- "curly": [2, "all"],
77
- "eqeqeq": [2, "allow-null"],
78
- "new-cap": [2, {
79
- "capIsNewExceptions": ["Match.Optional", "Match.Maybe", "Match.OneOf", "Match.Where", "Match.ObjectIncluding", "Push.Configure", "SHA256"]
80
- }],
81
- "use-isnan": 2,
82
- "valid-typeof": 2,
83
- "linebreak-style": [2, "unix"],
84
- "prefer-template": 2,
85
- "template-curly-spacing": [2, "always"],
86
- "quotes": [2, "single"],
87
- "semi": [2, "always"],
88
- "prefer-const": 2,
89
- "object-shorthand": 2
90
- },
91
- "globals": {
92
-
93
- }
94
- }
package/.swcrc DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "$schema": "http://json.schemastore.org/swcrc",
3
- "jsc": {
4
- "parser": {
5
- "syntax": "typescript",
6
- "tsx": false
7
- }
8
- },
9
- "module": {
10
- "type": "commonjs",
11
-
12
- // These are defaults.
13
- "strict": false,
14
- "strictMode": true,
15
- "lazy": false,
16
- "noInterop": false
17
- }
18
- }
package/dist/bin.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- require("./cli");
package/dist/cli.js DELETED
@@ -1,184 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- var _commander = require("commander");
6
- var _createBranch = require("./commands/createBranch");
7
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8
- try {
9
- var info = gen[key](arg);
10
- var value = info.value;
11
- } catch (error) {
12
- reject(error);
13
- return;
14
- }
15
- if (info.done) {
16
- resolve(value);
17
- } else {
18
- Promise.resolve(value).then(_next, _throw);
19
- }
20
- }
21
- function _async_to_generator(fn) {
22
- return function() {
23
- var self = this, args = arguments;
24
- return new Promise(function(resolve, reject) {
25
- var gen = fn.apply(self, args);
26
- function _next(value) {
27
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
28
- }
29
- function _throw(err) {
30
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
31
- }
32
- _next(undefined);
33
- });
34
- };
35
- }
36
- function _ts_generator(thisArg, body) {
37
- var f, y, t, g, _ = {
38
- label: 0,
39
- sent: function() {
40
- if (t[0] & 1) throw t[1];
41
- return t[1];
42
- },
43
- trys: [],
44
- ops: []
45
- };
46
- return(g = {
47
- next: verb(0),
48
- "throw": verb(1),
49
- "return": verb(2)
50
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
51
- return this;
52
- }), g);
53
- function verb(n) {
54
- return function(v) {
55
- return step([
56
- n,
57
- v
58
- ]);
59
- };
60
- }
61
- function step(op) {
62
- if (f) throw new TypeError("Generator is already executing.");
63
- while(_)try {
64
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
65
- if (y = 0, t) op = [
66
- op[0] & 2,
67
- t.value
68
- ];
69
- switch(op[0]){
70
- case 0:
71
- case 1:
72
- t = op;
73
- break;
74
- case 4:
75
- _.label++;
76
- return {
77
- value: op[1],
78
- done: false
79
- };
80
- case 5:
81
- _.label++;
82
- y = op[1];
83
- op = [
84
- 0
85
- ];
86
- continue;
87
- case 7:
88
- op = _.ops.pop();
89
- _.trys.pop();
90
- continue;
91
- default:
92
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
93
- _ = 0;
94
- continue;
95
- }
96
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
97
- _.label = op[1];
98
- break;
99
- }
100
- if (op[0] === 6 && _.label < t[1]) {
101
- _.label = t[1];
102
- t = op;
103
- break;
104
- }
105
- if (t && _.label < t[2]) {
106
- _.label = t[2];
107
- _.ops.push(op);
108
- break;
109
- }
110
- if (t[2]) _.ops.pop();
111
- _.trys.pop();
112
- continue;
113
- }
114
- op = body.call(thisArg, _);
115
- } catch (e) {
116
- op = [
117
- 6,
118
- e
119
- ];
120
- y = 0;
121
- } finally{
122
- f = t = 0;
123
- }
124
- if (op[0] & 5) throw op[1];
125
- return {
126
- value: op[0] ? op[1] : void 0,
127
- done: true
128
- };
129
- }
130
- }
131
- var program = new _commander.Command();
132
- program.name("houston");
133
- program.command("create-branch").description("Create a new branch for a new release").requiredOption("-b, --base <branch or version>", "Base branch or version to create the new branch from").requiredOption("-t, --type <patch|minor|major>", "Type of release").action(function() {
134
- var _ref = _async_to_generator(function(str) {
135
- var error;
136
- return _ts_generator(this, function(_state) {
137
- switch(_state.label){
138
- case 0:
139
- _state.trys.push([
140
- 0,
141
- 2,
142
- ,
143
- 3
144
- ]);
145
- if (![
146
- "patch",
147
- "minor",
148
- "major"
149
- ].includes(str.type)) {
150
- throw new Error("Invalid release type");
151
- }
152
- return [
153
- 4,
154
- (0, _createBranch.createBranch)({
155
- base: str.base,
156
- type: str.type
157
- })
158
- ];
159
- case 1:
160
- _state.sent();
161
- return [
162
- 3,
163
- 3
164
- ];
165
- case 2:
166
- error = _state.sent();
167
- console.error(error);
168
- process.exit(1);
169
- return [
170
- 3,
171
- 3
172
- ];
173
- case 3:
174
- return [
175
- 2
176
- ];
177
- }
178
- });
179
- });
180
- return function(str) {
181
- return _ref.apply(this, arguments);
182
- };
183
- }());
184
- program.parse(process.argv);