@omega.js/desktop 0.52.0 → 0.54.0

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 (345) hide show
  1. package/README.md +53 -48
  2. package/dist/assets/css/core/_initialize.scss +1 -1
  3. package/dist/assets/js/core/app-shell.js +14 -15
  4. package/dist/assets/themes/_template/_theme.js +6 -6
  5. package/dist/assets/themes/base/_includes/global/sections/account.html +4 -4
  6. package/dist/assets/themes/base/_includes/global/sections/app-sidebar.html +5 -5
  7. package/dist/assets/themes/base/_layouts/frontend/pages/account/index.html +3 -3
  8. package/dist/assets/themes/base/_layouts/frontend/pages/alternatives/index.html +1 -1
  9. package/dist/assets/themes/base/_layouts/frontend/pages/blog/tags/tag.html +1 -1
  10. package/dist/assets/themes/base/_layouts/frontend/pages/payment/confirmation.html +1 -1
  11. package/dist/assets/themes/base/_sections/marketing/newsletter-cta/section.js +2 -3
  12. package/dist/assets/themes/base/_sections/verts/unit/section.html +1 -1
  13. package/dist/assets/themes/base/_sections/verts/unit/section.js +3 -4
  14. package/dist/assets/themes/base/_theme.js +4 -3
  15. package/dist/assets/themes/bootstrap/_theme.js +2 -2
  16. package/dist/assets/themes/bootstrap/overrides/_links.scss +1 -1
  17. package/dist/assets/themes/classy/_theme.js +8 -6
  18. package/dist/assets/themes/classy/css/marketing/_sections.scss +1 -2
  19. package/dist/assets/themes/classy/js/hero-demo-form.js +3 -2
  20. package/dist/assets/themes/neobrutalism/_theme.js +5 -5
  21. package/dist/assets/themes/neobrutalism/js/pages/test/libraries/layers/index.js +1 -1
  22. package/dist/assets/themes/newsflash/_theme.js +6 -6
  23. package/dist/assets/themes/newsflash/js/pages/test/libraries/layers/index.js +1 -1
  24. package/dist/build.js +87 -111
  25. package/dist/cli-run.js +4 -1
  26. package/dist/cli.js +3 -3
  27. package/dist/commands/build.js +2 -2
  28. package/dist/commands/cdp/capture.js +2 -2
  29. package/dist/commands/cdp/client.js +1 -1
  30. package/dist/commands/cdp/quit.js +2 -2
  31. package/dist/commands/cdp/relaunch.js +2 -2
  32. package/dist/commands/cdp/theme.js +1 -1
  33. package/dist/commands/cdp.js +1 -1
  34. package/dist/commands/clean.js +4 -5
  35. package/dist/commands/deploy.js +4 -4
  36. package/dist/commands/dev.js +25 -0
  37. package/dist/commands/finalize-release.js +4 -4
  38. package/dist/commands/launch.js +2 -2
  39. package/dist/commands/lib/deploy-precheck.js +3 -3
  40. package/dist/commands/lib/ensure-target.js +18 -23
  41. package/dist/commands/lib/migrate.js +17 -0
  42. package/dist/commands/logs.js +1 -1
  43. package/dist/commands/package.js +2 -2
  44. package/dist/commands/publish.js +2 -2
  45. package/dist/commands/release.js +4 -4
  46. package/dist/commands/runner.js +11 -11
  47. package/dist/commands/sign-windows.js +5 -5
  48. package/dist/commands/test.js +8 -8
  49. package/dist/commands/update.js +7 -6
  50. package/dist/commands/validate-certs.js +4 -4
  51. package/dist/commands/version.js +3 -3
  52. package/dist/defaults/.github/workflows/build.yml +18 -18
  53. package/dist/defaults/_.gitignore +0 -2
  54. package/dist/defaults/_mas/README.md +3 -3
  55. package/dist/defaults/config/certs/README.md +1 -1
  56. package/dist/defaults/config/omega.json5 +43 -43
  57. package/dist/defaults/docs/README.md +3 -3
  58. package/dist/defaults/gulpfile.js +1 -1
  59. package/dist/defaults/hooks/build/post.js +2 -2
  60. package/dist/defaults/hooks/build/pre.js +2 -2
  61. package/dist/defaults/hooks/deploy/pre.js +1 -1
  62. package/dist/defaults/hooks/notarize/post.js +2 -2
  63. package/dist/defaults/hooks/release/post.js +2 -2
  64. package/dist/defaults/hooks/release/pre.js +2 -2
  65. package/dist/defaults/src/assets/js/components/about/index.js +3 -5
  66. package/dist/defaults/src/assets/js/components/main/index.js +3 -5
  67. package/dist/defaults/src/assets/js/components/settings/index.js +3 -5
  68. package/dist/defaults/src/assets/scss/pages/about.scss +1 -1
  69. package/dist/defaults/src/assets/scss/pages/main.scss +1 -1
  70. package/dist/defaults/src/assets/scss/pages/settings.scss +1 -1
  71. package/dist/defaults/src/integrations/context-menu/index.js +13 -13
  72. package/dist/defaults/src/integrations/menu/index.js +8 -8
  73. package/dist/defaults/src/integrations/tray/index.js +12 -12
  74. package/dist/defaults/src/main.js +5 -7
  75. package/dist/defaults/src/preload.js +4 -6
  76. package/dist/defaults/test/README.md +5 -5
  77. package/dist/defaults/test/_init.js +1 -1
  78. package/dist/gulp/main.js +9 -10
  79. package/dist/gulp/tasks/audit.js +11 -14
  80. package/dist/gulp/tasks/build-config.js +8 -8
  81. package/dist/gulp/tasks/bundle.js +16 -16
  82. package/dist/gulp/tasks/defaults.js +3 -3
  83. package/dist/gulp/tasks/distribute.js +2 -2
  84. package/dist/gulp/tasks/html.js +9 -9
  85. package/dist/gulp/tasks/package-quick.js +3 -3
  86. package/dist/gulp/tasks/package.js +3 -3
  87. package/dist/gulp/tasks/release.js +3 -3
  88. package/dist/gulp/tasks/sass.js +6 -6
  89. package/dist/gulp/tasks/serve.js +4 -4
  90. package/dist/hooks/notarize-artifacts.js +1 -1
  91. package/dist/hooks/notarize.js +1 -1
  92. package/dist/index.js +5 -8
  93. package/dist/lib/_environment-mixin.js +50 -0
  94. package/dist/lib/_lifecycle-mixin.js +45 -0
  95. package/dist/lib/analytics.js +33 -35
  96. package/dist/lib/app-state.js +14 -14
  97. package/dist/lib/auth-flow.js +18 -18
  98. package/dist/lib/auth-persistence.js +12 -12
  99. package/dist/lib/auth.js +421 -0
  100. package/dist/lib/auto-updater.js +49 -49
  101. package/dist/lib/context-menu.js +13 -13
  102. package/dist/lib/context.js +19 -19
  103. package/dist/lib/deep-link.js +34 -34
  104. package/dist/lib/fontawesome.js +5 -5
  105. package/dist/lib/ipc.js +4 -4
  106. package/dist/lib/menu.js +25 -25
  107. package/dist/lib/protocol.js +5 -5
  108. package/dist/lib/remote-config.js +22 -22
  109. package/dist/lib/remote-scripts.js +21 -21
  110. package/dist/lib/restart-manager/index.js +29 -29
  111. package/dist/lib/restart-manager/install.js +1 -1
  112. package/dist/lib/restart-manager/protocol.js +1 -1
  113. package/dist/lib/sign-helpers/exec-with-limit.js +1 -1
  114. package/dist/lib/sign-helpers/sign-events.js +1 -1
  115. package/dist/lib/startup.js +18 -13
  116. package/dist/lib/storage.js +10 -10
  117. package/dist/lib/templating.js +16 -16
  118. package/dist/lib/theme.js +10 -10
  119. package/dist/lib/tray.js +27 -27
  120. package/dist/lib/usage.js +11 -11
  121. package/dist/lib/window-manager.js +26 -26
  122. package/dist/main.js +399 -483
  123. package/dist/preload.js +236 -176
  124. package/dist/renderer.js +417 -391
  125. package/dist/test/fixtures/consumer-app/config/omega.json5 +1 -1
  126. package/dist/test/fixtures/consumer-app/src/assets/js/components/main/index.js +8 -11
  127. package/dist/test/fixtures/consumer-app/src/main.js +5 -7
  128. package/dist/test/fixtures/consumer-app/src/preload.js +2 -2
  129. package/dist/test/harness/boot-entry.js +22 -20
  130. package/dist/test/harness/main-entry.js +31 -30
  131. package/dist/test/harness/renderer-entry.js +5 -5
  132. package/dist/test/harness/renderer-preload.js +137 -141
  133. package/dist/test/index.js +10 -10
  134. package/dist/test/runner.js +2 -2
  135. package/dist/test/runners/boot.js +7 -6
  136. package/dist/test/runners/electron.js +3 -2
  137. package/dist/test/runners/render-event.js +2 -2
  138. package/dist/test/suites/boot/consumer-app-boots.test.js +57 -26
  139. package/dist/test/suites/boot/restart-manager.test.js +2 -2
  140. package/dist/test/suites/boot/storage-bundled.test.js +5 -5
  141. package/dist/test/suites/boot/theme.test.js +13 -13
  142. package/dist/test/suites/build/audit.test.js +21 -8
  143. package/dist/test/suites/build/auth-persistence-resolve.test.js +6 -6
  144. package/dist/test/suites/build/boot-fixture.test.js +2 -2
  145. package/dist/test/suites/build/boot-runner-timeout.test.js +6 -5
  146. package/dist/test/suites/build/brand-scss.test.js +1 -1
  147. package/dist/test/suites/build/build-json-bake.test.js +1 -1
  148. package/dist/test/suites/build/build-workflow-jobs.test.js +2 -2
  149. package/dist/test/suites/build/cli.test.js +30 -2
  150. package/dist/test/suites/build/config-schema.test.js +5 -5
  151. package/dist/test/suites/build/defaults-em-dash.test.js +22 -0
  152. package/dist/test/suites/build/defaults-scaffold.test.js +21 -7
  153. package/dist/test/suites/build/deploy-direct.test.js +7 -5
  154. package/dist/test/suites/build/deploy-dispatch.test.js +2 -1
  155. package/dist/test/suites/build/deploy-hook.test.js +7 -5
  156. package/dist/test/suites/build/dev-verb.test.js +67 -0
  157. package/dist/test/suites/build/ensure-target.test.js +13 -5
  158. package/dist/test/suites/build/env-delivery.test.js +2 -2
  159. package/dist/test/suites/build/esm-only-dependency.test.js +2 -2
  160. package/dist/test/suites/build/exports.test.js +9 -8
  161. package/dist/test/suites/build/get-config.test.js +4 -4
  162. package/dist/test/suites/build/manifest-deps.test.js +1 -1
  163. package/dist/test/suites/build/merge-line-files.test.js +7 -7
  164. package/dist/test/suites/build/migrate.test.js +29 -0
  165. package/dist/test/suites/build/omega-shell.test.js +34 -2
  166. package/dist/test/suites/build/omega.test.js +350 -0
  167. package/dist/test/suites/build/project-scripts-deps.test.js +6 -10
  168. package/dist/test/suites/build/renderer-auth-bridge.test.js +211 -78
  169. package/dist/test/suites/build/runner-env-write.test.js +73 -0
  170. package/dist/test/suites/build/runner.test.js +11 -10
  171. package/dist/test/suites/build/sentry.test.js +2 -2
  172. package/dist/test/suites/build/setup-scripts.test.js +27 -0
  173. package/dist/test/suites/build/sign-windows-e2e.test.js +2 -2
  174. package/dist/test/suites/build/templating.test.js +3 -3
  175. package/dist/test/suites/build/test-stealth.test.js +7 -9
  176. package/dist/test/suites/build/url-helpers.test.js +55 -56
  177. package/dist/test/suites/build/validate-config.test.js +15 -4
  178. package/dist/test/suites/build/verb-logs.test.js +20 -0
  179. package/dist/test/suites/build/wave5-pins.test.js +2 -2
  180. package/dist/test/suites/main/analytics.test.js +59 -59
  181. package/dist/test/suites/main/app-state.test.js +66 -66
  182. package/dist/test/suites/main/auth-flow.test.js +41 -41
  183. package/dist/test/suites/main/auth-persistence.test.js +54 -43
  184. package/dist/test/suites/main/{client-bridge.integration.test.js → auth.integration.test.js} +10 -9
  185. package/dist/test/suites/main/auth.test.js +336 -0
  186. package/dist/test/suites/main/auto-updater.test.js +134 -134
  187. package/dist/test/suites/main/boot-sequence.test.js +37 -49
  188. package/dist/test/suites/main/context-menu.test.js +51 -50
  189. package/dist/test/suites/main/context.test.js +25 -25
  190. package/dist/test/suites/main/deep-link.test.js +74 -74
  191. package/dist/test/suites/main/fontawesome.test.js +27 -27
  192. package/dist/test/suites/main/ipc.test.js +35 -35
  193. package/dist/test/suites/main/menu.test.js +101 -100
  194. package/dist/test/suites/main/protocol.test.js +19 -19
  195. package/dist/test/suites/main/remote-config.test.js +63 -63
  196. package/dist/test/suites/main/remote-scripts.test.js +103 -103
  197. package/dist/test/suites/main/request.test.js +71 -0
  198. package/dist/test/suites/main/restart-manager.test.js +33 -33
  199. package/dist/test/suites/main/startup-paths-and-ua.test.js +4 -4
  200. package/dist/test/suites/main/startup.test.js +26 -26
  201. package/dist/test/suites/main/stealth-window.test.js +1 -1
  202. package/dist/test/suites/main/storage.test.js +25 -25
  203. package/dist/test/suites/main/theme.test.js +34 -34
  204. package/dist/test/suites/main/tray.test.js +79 -79
  205. package/dist/test/suites/main/url-helpers.test.js +133 -133
  206. package/dist/test/suites/main/usage.test.js +25 -25
  207. package/dist/test/suites/main/window-bounds.test.js +27 -27
  208. package/dist/test/suites/main/window-manager.test.js +44 -44
  209. package/dist/test/suites/renderer/analytics-bridge.test.js +5 -5
  210. package/dist/test/suites/renderer/cross-context-helpers.test.js +37 -31
  211. package/dist/test/suites/renderer/round-trip.test.js +3 -3
  212. package/dist/test/suites/renderer/tooltips.test.js +15 -15
  213. package/dist/test/suites/renderer/{window-em-surface.test.js → window-desktop-surface.test.js} +28 -8
  214. package/dist/test/utils/extended-mode-warning.js +1 -1
  215. package/dist/utils/boot-harness.js +56 -0
  216. package/dist/utils/build-pipeline.js +4 -4
  217. package/dist/utils/mode-helpers.js +2 -15
  218. package/dist/utils/runner-env.js +13 -28
  219. package/dist/utils/ship-keys.js +3 -3
  220. package/dist/utils/signing-status.js +51 -0
  221. package/dist/utils/test-events.js +7 -0
  222. package/dist/utils/test-stealth.js +6 -6
  223. package/dist/utils/url-helpers.js +52 -42
  224. package/dist/utils/user-agent.js +44 -0
  225. package/dist/vendor/account/engine.js +3 -3
  226. package/dist/vendor/account/index.js +14 -45
  227. package/dist/vendor/account/resolve-account.js +44 -0
  228. package/dist/vendor/account/schema.js +1 -1
  229. package/dist/vendor/account/user.js +99 -0
  230. package/dist/vendor/config/client-config.js +1 -1
  231. package/dist/vendor/config/company.js +46 -14
  232. package/dist/vendor/config/defaults.js +30 -7
  233. package/dist/vendor/config/edit.js +25 -3
  234. package/dist/vendor/config/env-delivery.js +1 -1
  235. package/dist/vendor/config/env-schema.js +3 -6
  236. package/dist/vendor/config/env.js +34 -22
  237. package/dist/vendor/config/environment.js +11 -30
  238. package/dist/vendor/config/index.js +21 -28
  239. package/dist/vendor/config/load.js +16 -9
  240. package/dist/vendor/config/platforms.js +1 -1
  241. package/dist/vendor/config/repo.js +10 -27
  242. package/dist/vendor/config/schema-client.js +64 -0
  243. package/dist/vendor/config/schema-cloud.js +38 -0
  244. package/dist/vendor/config/schema-manager.js +118 -0
  245. package/dist/vendor/config/schema-overrides.js +68 -0
  246. package/dist/vendor/config/schema.js +104 -160
  247. package/dist/vendor/config/site-global.js +2 -3
  248. package/dist/vendor/config/validate.js +97 -78
  249. package/dist/vendor/config/winback.js +1 -1
  250. package/dist/vendor/devkit/actions-secrets.js +1 -1
  251. package/dist/vendor/devkit/agents-md.js +233 -0
  252. package/dist/vendor/devkit/attach-log-file.js +16 -2
  253. package/dist/vendor/devkit/build-json.js +1 -1
  254. package/dist/vendor/devkit/ci-workflows.js +30 -30
  255. package/dist/vendor/devkit/cli-router.js +16 -11
  256. package/dist/vendor/devkit/defaults-engine.js +15 -51
  257. package/dist/vendor/devkit/deploy-snapshot.js +44 -9
  258. package/dist/vendor/devkit/env-lines.js +183 -0
  259. package/dist/vendor/devkit/local.js +64 -10
  260. package/dist/vendor/devkit/lockfile.js +32 -13
  261. package/dist/vendor/devkit/logger.js +7 -2
  262. package/dist/vendor/devkit/merge-line-files.js +219 -177
  263. package/dist/vendor/devkit/omega-bin.js +208 -111
  264. package/dist/vendor/devkit/preludes/docs-sync.js +52 -0
  265. package/dist/vendor/devkit/preludes/index.js +1 -0
  266. package/dist/vendor/devkit/target-picker.js +45 -0
  267. package/dist/vendor/devkit/test/dashed-files.js +37 -0
  268. package/dist/vendor/devkit/test/run-verb-under-tee.js +71 -0
  269. package/dist/vendor/devkit/test/runner-core.js +6 -6
  270. package/dist/vendor/devkit/update.js +15 -15
  271. package/dist/vendor/devkit/verb-scripts.js +40 -0
  272. package/dist/vendor/devkit/verbs.js +170 -0
  273. package/dist/vendor/monitoring/env.js +2 -2
  274. package/dist/vendor/monitoring/index.js +1 -1
  275. package/dist/vendor/monitoring/main.js +1 -1
  276. package/dist/vendor/monitoring/preload.js +1 -1
  277. package/dist/vendor/monitoring/renderer.js +1 -1
  278. package/package.json +19 -26
  279. package/dist/commands/install.js +0 -37
  280. package/dist/defaults/AGENTS.md +0 -110
  281. package/dist/defaults/CLAUDE.md +0 -1
  282. package/dist/lib/client-bridge.js +0 -374
  283. package/dist/lib/logger.js +0 -4
  284. package/dist/test/suites/build/manager.test.js +0 -213
  285. package/dist/test/suites/main/client-bridge.test.js +0 -262
  286. package/dist/vendor/config/env-retired.js +0 -137
  287. package/dist/vendor/config/retired-keys.js +0 -635
  288. package/docs/analytics.md +0 -140
  289. package/docs/app-state.md +0 -92
  290. package/docs/audit.md +0 -69
  291. package/docs/auto-updater.md +0 -243
  292. package/docs/boot-sequence.md +0 -39
  293. package/docs/build-system.md +0 -169
  294. package/docs/cdp-debugging.md +0 -169
  295. package/docs/client-bridge.md +0 -269
  296. package/docs/common-mistakes.md +0 -21
  297. package/docs/config-schema.md +0 -120
  298. package/docs/context-menu.md +0 -112
  299. package/docs/context.md +0 -81
  300. package/docs/css.md +0 -90
  301. package/docs/deep-link.md +0 -186
  302. package/docs/environment-detection.md +0 -112
  303. package/docs/fontawesome.md +0 -107
  304. package/docs/hooks.md +0 -89
  305. package/docs/icons.md +0 -79
  306. package/docs/index.md +0 -317
  307. package/docs/installer-options.md +0 -165
  308. package/docs/ipc.md +0 -61
  309. package/docs/lib-modules.md +0 -53
  310. package/docs/logging.md +0 -229
  311. package/docs/menu.md +0 -160
  312. package/docs/releasing.md +0 -239
  313. package/docs/remote-config.md +0 -118
  314. package/docs/remote-scripts.md +0 -144
  315. package/docs/restart-manager.md +0 -144
  316. package/docs/runner.md +0 -290
  317. package/docs/sentry.md +0 -97
  318. package/docs/shared/agent-docs.md +0 -89
  319. package/docs/shared/analytics.md +0 -612
  320. package/docs/shared/brands.md +0 -57
  321. package/docs/shared/breaking-changes.md +0 -851
  322. package/docs/shared/config.md +0 -1952
  323. package/docs/shared/deploys.md +0 -341
  324. package/docs/shared/icons.md +0 -219
  325. package/docs/shared/local-dev.md +0 -167
  326. package/docs/shared/logging.md +0 -205
  327. package/docs/shared/monitoring.md +0 -167
  328. package/docs/shared/publishing.md +0 -187
  329. package/docs/shared/rulings.md +0 -34
  330. package/docs/shared/testing.md +0 -147
  331. package/docs/shared/theming.md +0 -629
  332. package/docs/shared/translation.md +0 -333
  333. package/docs/shared/updates.md +0 -61
  334. package/docs/signing.md +0 -293
  335. package/docs/startup.md +0 -142
  336. package/docs/storage.md +0 -59
  337. package/docs/templating.md +0 -101
  338. package/docs/test-boot-layer.md +0 -157
  339. package/docs/test-framework.md +0 -362
  340. package/docs/themes.md +0 -149
  341. package/docs/tooltips.md +0 -99
  342. package/docs/tray.md +0 -164
  343. package/docs/usage.md +0 -58
  344. package/docs/verts.md +0 -62
  345. package/docs/windows.md +0 -149
@@ -1,213 +0,0 @@
1
- // Build-time tests for the Manager class (build.js).
2
-
3
- const Manager = require('../../../build.js');
4
- const defineCases = require('../../../vendor/devkit/test/define-cases.js');
5
-
6
- // The one input and the two lane flags that decide it, saved and restored
7
- // around every case that touches them (#817).
8
- const LANE_KEYS = ['OMEGA_ENVIRONMENT', 'OMEGA_BUILD_MODE', 'OMEGA_TEST_MODE', 'NODE_ENV'];
9
-
10
- /**
11
- * Run `fn` with exactly `vars` set on the lane keys (null clears them all).
12
- * @param {object|null} vars - the lane env for this case.
13
- * @param {function} fn - the body.
14
- * @returns {*} whatever `fn` returns.
15
- */
16
- function withEnvironment(vars, fn) {
17
- const saved = {};
18
- for (const key of LANE_KEYS) saved[key] = process.env[key];
19
- try {
20
- for (const key of LANE_KEYS) delete process.env[key];
21
- Object.assign(process.env, vars || {});
22
- return fn();
23
- } finally {
24
- for (const key of LANE_KEYS) {
25
- if (saved[key] === undefined) delete process.env[key];
26
- else process.env[key] = saved[key];
27
- }
28
- }
29
- }
30
-
31
- /**
32
- * What src/build.js resolves at LOAD for a given lane. build.js sets the input
33
- * once, at require time, so this loads a fresh copy of it per lane.
34
- * @param {object} vars - the lane env.
35
- * @returns {string} the resolved environment.
36
- */
37
- function laneEnvironment(vars) {
38
- const buildPath = require.resolve('../../../build.js');
39
- return withEnvironment(vars, () => {
40
- const saved = require.cache[buildPath];
41
- delete require.cache[buildPath];
42
- try {
43
- return require(buildPath).getEnvironment();
44
- } finally {
45
- if (saved) require.cache[buildPath] = saved;
46
- else delete require.cache[buildPath];
47
- }
48
- });
49
- }
50
-
51
- module.exports = defineCases({
52
- type: 'group', // independent tests; run all even on failure
53
- layer: 'build',
54
- description: 'Manager (build.js)',
55
- tests: [
56
- {
57
- name: 'class is exported and instantiable',
58
- run: (ctx) => {
59
- ctx.expect(typeof Manager).toBe('function');
60
- ctx.expect(new Manager()).toBeInstanceOf(Manager);
61
- },
62
- },
63
- {
64
- name: 'getMode returns the mode shape',
65
- run: (ctx) => {
66
- const mode = Manager.getMode();
67
- ctx.expect(mode).toHaveProperty('build');
68
- ctx.expect(mode).toHaveProperty('publish');
69
- ctx.expect(mode).toHaveProperty('server');
70
- ctx.expect(mode).toHaveProperty('environment');
71
- ctx.expect(['development', 'testing', 'production']).toContain(mode.environment);
72
- },
73
- },
74
- {
75
- // The environment reads ONE input, `OMEGA_ENVIRONMENT`
76
- // ([#817](https://github.com/Omega-JS-Stack/omega/issues/817)), and the
77
- // lane that boots or builds this app sets it (src/build.js does, at load).
78
- // Nothing sniffs NODE_ENV, app.isPackaged or OMEGA_TEST_MODE any more.
79
- name: 'getEnvironment answers the one input, for each of the three names',
80
- run: (ctx) => {
81
- withEnvironment(null, () => {
82
- for (const name of ['development', 'testing', 'production']) {
83
- process.env.OMEGA_ENVIRONMENT = name;
84
- ctx.expect(Manager.getEnvironment()).toBe(name);
85
- }
86
- });
87
- },
88
- },
89
- {
90
- // The bug this replaced: with no signal desktop's own copy answered
91
- // 'production', so a plain `npm start` bundled itself as a production
92
- // artifact, while @omega.js/extension's copy of the same function
93
- // answered 'development' from the same inputs (#817).
94
- name: 'the build lane resolves production, a dev boot resolves development',
95
- run: (ctx) => {
96
- const buildLane = laneEnvironment({ OMEGA_BUILD_MODE: 'true' });
97
- ctx.expect(buildLane).toBe('production');
98
-
99
- const devBoot = laneEnvironment({});
100
- ctx.expect(devBoot).toBe('development');
101
-
102
- // A lane that already named one keeps it, EXCEPT a build lane: a
103
- // production build spawned from a test run still bakes production.
104
- ctx.expect(laneEnvironment({ OMEGA_ENVIRONMENT: 'testing' })).toBe('testing');
105
- ctx.expect(laneEnvironment({ OMEGA_ENVIRONMENT: 'testing', OMEGA_BUILD_MODE: 'true' })).toBe('production');
106
- },
107
- },
108
- {
109
- name: 'no input at all is a loud error naming OMEGA_ENVIRONMENT, never a default',
110
- run: (ctx) => {
111
- withEnvironment(null, () => {
112
- delete process.env.OMEGA_ENVIRONMENT;
113
- ctx.expect(() => Manager.getEnvironment()).toThrow(/OMEGA_ENVIRONMENT/);
114
- process.env.OMEGA_ENVIRONMENT = 'staging';
115
- ctx.expect(() => Manager.getEnvironment()).toThrow(/OMEGA_ENVIRONMENT/);
116
- });
117
- },
118
- },
119
- {
120
- // The core invariant: is*() DERIVE from getEnvironment(), so they can
121
- // NEVER disagree with it, and exactly one is always true.
122
- name: 'invariant: is*() exactly matches getEnvironment() + mutually exclusive (every scenario)',
123
- run: (ctx) => {
124
- withEnvironment(null, () => {
125
- for (const name of ['development', 'testing', 'production']) {
126
- process.env.OMEGA_ENVIRONMENT = name;
127
- const e = Manager.getEnvironment();
128
- ctx.expect(e).toBe(name);
129
- ctx.expect(Manager.isDevelopment()).toBe(e === 'development');
130
- ctx.expect(Manager.isTesting()).toBe(e === 'testing');
131
- ctx.expect(Manager.isProduction()).toBe(e === 'production');
132
- const trueCount = [Manager.isDevelopment(), Manager.isTesting(), Manager.isProduction()].filter(Boolean).length;
133
- ctx.expect(trueCount).toBe(1);
134
- }
135
- });
136
- },
137
- },
138
- {
139
- name: 'getPackage("main") resolves to @omega.js/desktop package.json',
140
- run: (ctx) => {
141
- const pkg = Manager.getPackage('main');
142
- ctx.expect(pkg.name).toBe('@omega.js/desktop');
143
- ctx.expect(pkg).toHaveProperty('version');
144
- ctx.expect(pkg).toHaveProperty('exports');
145
- },
146
- },
147
- {
148
- name: 'getRootPath("main") returns a non-empty string',
149
- run: (ctx) => {
150
- const root = Manager.getRootPath('main');
151
- ctx.expect(typeof root).toBe('string');
152
- ctx.expect(root.length).toBeGreaterThan(0);
153
- },
154
- },
155
- {
156
- name: 'getLiveReloadPort defaults to 35729',
157
- run: (ctx) => {
158
- const prev = process.env.OMEGA_LIVERELOAD_PORT;
159
- delete process.env.OMEGA_LIVERELOAD_PORT;
160
- try {
161
- ctx.expect(Manager.getLiveReloadPort()).toBe(35729);
162
- } finally {
163
- if (prev !== undefined) process.env.OMEGA_LIVERELOAD_PORT = prev;
164
- }
165
- },
166
- },
167
- {
168
- name: 'getWindowsSignStrategy defaults to self-hosted when no config',
169
- run: (ctx) => {
170
- // No EM_WIN_SIGN_STRATEGY env-var support anymore — config is the only source.
171
- // Run from a cwd with no omega.json5 to confirm the default.
172
- const fs = require('fs'); const os = require('os'); const path = require('path');
173
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'desktop-strategy-'));
174
- const orig = process.cwd();
175
- try {
176
- process.chdir(tmp);
177
- ctx.expect(Manager.getWindowsSignStrategy()).toBe('self-hosted');
178
- } finally {
179
- process.chdir(orig);
180
- fs.rmSync(tmp, { recursive: true, force: true });
181
- }
182
- },
183
- },
184
- {
185
- name: 'getWindowsSignStrategy reads config platforms.windows.signing.strategy',
186
- run: (ctx) => {
187
- const fs = require('fs'); const os = require('os'); const path = require('path');
188
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'desktop-strategy-'));
189
- fs.mkdirSync(path.join(tmp, 'config'), { recursive: true });
190
- fs.writeFileSync(path.join(tmp, 'config', 'omega.json5'),
191
- `{ targets: { desktop: { type: 'desktop', platforms: { windows: { signing: { strategy: 'cloud' } } } } } }`);
192
- const orig = process.cwd();
193
- try {
194
- process.chdir(tmp);
195
- ctx.expect(Manager.getWindowsSignStrategy()).toBe('cloud');
196
- } finally {
197
- process.chdir(orig);
198
- fs.rmSync(tmp, { recursive: true, force: true });
199
- }
200
- },
201
- },
202
- {
203
- name: 'logger returns a named logger',
204
- run: (ctx) => {
205
- const m = new Manager();
206
- const logger = m.logger('test-name');
207
- ctx.expect(logger.name).toBe('test-name');
208
- ctx.expect(typeof logger.log).toBe('function');
209
- ctx.expect(typeof logger.error).toBe('function');
210
- },
211
- },
212
- ],
213
- });
@@ -1,262 +0,0 @@
1
- // Main-process tests for lib/client-bridge.js — unit-level coverage that doesn't hit Firebase.
2
- //
3
- // Real Firebase integration tests live in client-bridge.integration.test.js
4
- // (gated on extended mode); the sign-in proof itself is #904's, through a
5
- // persona the backend emulator seeds.
6
-
7
- const defineCases = require('../../../vendor/devkit/test/define-cases.js');
8
-
9
- module.exports = defineCases({
10
- type: 'suite',
11
- layer: 'main',
12
- description: 'client-bridge (main, unit)',
13
- cleanup: async (ctx) => {
14
- await ctx.manager.omega._resetForTests();
15
- },
16
- tests: [
17
- {
18
- name: 'initialize ran during boot',
19
- run: (ctx) => {
20
- ctx.expect(ctx.manager.omega._initialized).toBe(true);
21
- },
22
- },
23
- {
24
- name: 'IPC handlers are registered',
25
- run: (ctx) => {
26
- ctx.expect(ctx.manager.ipc.hasHandler('desktop:auth:sync-request')).toBe(true);
27
- ctx.expect(ctx.manager.ipc.hasHandler('desktop:auth:sign-out')).toBe(true);
28
- ctx.expect(ctx.manager.ipc.hasHandler('desktop:auth:get-user')).toBe(true);
29
- },
30
- },
31
- {
32
- name: 'getCurrentUser returns null when nothing is signed in',
33
- run: (ctx) => {
34
- // The harness boots without auth; either firebase isn't loaded (no cloud.config
35
- // in default config) or it is and there's no user. Either way, currentUser is null.
36
- ctx.expect(ctx.manager.omega.getCurrentUser()).toBeNull();
37
- },
38
- },
39
- {
40
- name: 'getIdToken returns null when nothing is signed in',
41
- run: async (ctx) => {
42
- // Same no-auth harness as getCurrentUser above — signed-in token
43
- // round-trips are the integration suite's domain.
44
- ctx.expect(await ctx.manager.omega.getIdToken()).toBeNull();
45
- },
46
- },
47
- {
48
- name: 'handleAuthToken returns no-op result when firebase not loaded',
49
- run: async (ctx) => {
50
- // Default config has empty cloud.config → firebase fails to init → _firebaseAuth=null.
51
- if (ctx.manager.omega._firebaseAuth) {
52
- ctx.skip('firebase did load (cloud.config was set) — covered by integration tests');
53
- }
54
- const r = await ctx.manager.omega.handleAuthToken('whatever');
55
- ctx.expect(r.success).toBe(false);
56
- ctx.expect(r.reason).toBe('firebase-not-loaded');
57
- },
58
- },
59
- {
60
- name: 'handleAuthToken with empty token returns no-token failure',
61
- run: async (ctx) => {
62
- // Stub _firebaseAuth so we hit the "no token" branch instead of "firebase-not-loaded."
63
- const origAuth = ctx.manager.omega._firebaseAuth;
64
- ctx.manager.omega._firebaseAuth = { currentUser: null }; // truthy so we pass the firebase check
65
- try {
66
- const r = await ctx.manager.omega.handleAuthToken('');
67
- ctx.expect(r.success).toBe(false);
68
- ctx.expect(r.reason).toBe('no-token');
69
- } finally {
70
- ctx.manager.omega._firebaseAuth = origAuth;
71
- }
72
- },
73
- },
74
- {
75
- name: 'sync-request: same UID → no sync needed',
76
- run: async (ctx) => {
77
- // Stub the auth so we control bgUid.
78
- const origAuth = ctx.manager.omega._firebaseAuth;
79
- ctx.manager.omega._firebaseAuth = { currentUser: { uid: 'abc' } };
80
- try {
81
- const result = await ctx.manager.ipc.invoke('desktop:auth:sync-request', { contextUid: 'abc' });
82
- ctx.expect(result.needsSync).toBe(false);
83
- } finally {
84
- ctx.manager.omega._firebaseAuth = origAuth;
85
- }
86
- },
87
- },
88
- {
89
- name: 'sync-request: main signed out, renderer signed in → tells renderer to sign out',
90
- run: async (ctx) => {
91
- const origAuth = ctx.manager.omega._firebaseAuth;
92
- ctx.manager.omega._firebaseAuth = { currentUser: null };
93
- try {
94
- const result = await ctx.manager.ipc.invoke('desktop:auth:sync-request', { contextUid: 'someone' });
95
- ctx.expect(result.needsSync).toBe(true);
96
- ctx.expect(result.signOut).toBe(true);
97
- } finally {
98
- ctx.manager.omega._firebaseAuth = origAuth;
99
- }
100
- },
101
- },
102
- {
103
- name: 'sync-request: firebase not loaded → no sync',
104
- run: async (ctx) => {
105
- const origAuth = ctx.manager.omega._firebaseAuth;
106
- ctx.manager.omega._firebaseAuth = null;
107
- try {
108
- const result = await ctx.manager.ipc.invoke('desktop:auth:sync-request', { contextUid: null });
109
- ctx.expect(result.needsSync).toBe(false);
110
- ctx.expect(result.reason).toBe('firebase-not-loaded');
111
- } finally {
112
- ctx.manager.omega._firebaseAuth = origAuth;
113
- }
114
- },
115
- },
116
- {
117
- name: 'sign-out IPC succeeds when nothing is signed in',
118
- run: async (ctx) => {
119
- const result = await ctx.manager.ipc.invoke('desktop:auth:sign-out');
120
- ctx.expect(result.success).toBe(true);
121
- },
122
- },
123
- {
124
- name: 'get-user IPC returns null when no current user',
125
- run: async (ctx) => {
126
- const result = await ctx.manager.ipc.invoke('desktop:auth:get-user');
127
- ctx.expect(result).toBeNull();
128
- },
129
- },
130
- {
131
- name: 'onAuthChange returns an unsubscribe fn',
132
- run: (ctx) => {
133
- const fn = () => {};
134
- const off = ctx.manager.omega.onAuthChange(fn);
135
- ctx.expect(ctx.manager.omega._stateSubs.has(fn)).toBe(true);
136
- off();
137
- ctx.expect(ctx.manager.omega._stateSubs.has(fn)).toBe(false);
138
- },
139
- },
140
- {
141
- name: '_snapshotUser returns the public user shape (no token)',
142
- run: (ctx) => {
143
- const snap = ctx.manager.omega._snapshotUser({
144
- uid: 'u1',
145
- email: 'a@b.com',
146
- displayName: 'Bob',
147
- photoURL: 'http://x/p.png',
148
- emailVerified: true,
149
- // sensitive stuff that should NOT be exposed
150
- stsTokenManager: { accessToken: 'SECRET' },
151
- providerData: ['xxx'],
152
- });
153
- ctx.expect(snap).toEqual({
154
- uid: 'u1',
155
- email: 'a@b.com',
156
- displayName: 'Bob',
157
- photoURL: 'http://x/p.png',
158
- emailVerified: true,
159
- });
160
- },
161
- },
162
- {
163
- // The emulator gate (#46). _getFirebaseAuth resolves firebase through the
164
- // bridge's OWN seams (_firebase / _firebaseModule, filled by
165
- // _tryLoadFirebase) — swapping those recording namespaces in drives the real
166
- // method, no stubbing of the module under test. The manager is an input too:
167
- // isTesting() is the whole gate.
168
- name: 'auth emulator: a testing run connects, dev/production never do',
169
- run: (ctx) => {
170
- const bridge = ctx.manager.omega;
171
- const saved = {
172
- firebase: bridge._firebase,
173
- module: bridge._firebaseModule,
174
- auth: bridge._firebaseAuth,
175
- manager: bridge._manager,
176
- port: process.env.OMEGA_AUTH_PORT,
177
- };
178
-
179
- // One recording firebase namespace pair, reused per run
180
- const connects = [];
181
- const authInstance = { __auth: true };
182
- bridge._firebase = {
183
- getApp: () => { throw new Error('no app'); },
184
- initializeApp: () => ({ __app: true }),
185
- };
186
- bridge._firebaseModule = {
187
- getAuth: () => authInstance,
188
- connectAuthEmulator: (auth, url, opts) => connects.push({ auth, url, opts }),
189
- };
190
-
191
- const run = (isTesting, dev) => {
192
- bridge._firebaseAuth = null;
193
- bridge._manager = {
194
- config: { cloud: { config: { apiKey: 'AIza-test', projectId: 'demo-desktop' } }, ...(dev ? { dev } : {}) },
195
- isTesting: () => isTesting,
196
- };
197
- return bridge._getFirebaseAuth(null);
198
- };
199
-
200
- try {
201
- delete process.env.OMEGA_AUTH_PORT;
202
-
203
- // production / dev shape — no emulator, ever
204
- ctx.expect(run(false)).toBe(authInstance);
205
- ctx.expect(connects.length).toBe(0);
206
-
207
- // testing shape: the port comes from the map the bundle baked, which
208
- // carries @omega.js/config's classic 9099 as its floor
209
- // ([#834](https://github.com/Omega-JS-Stack/omega/issues/834)).
210
- ctx.expect(run(true, { ports: { auth: 9099 } })).toBe(authInstance);
211
- ctx.expect(connects.length).toBe(1);
212
- ctx.expect(connects[0].auth).toBe(authInstance);
213
- ctx.expect(connects[0].url).toBe('http://localhost:9099');
214
-
215
- // a bumped port arrives on OMEGA_AUTH_PORT (N7)
216
- process.env.OMEGA_AUTH_PORT = '9199';
217
- run(true, { ports: { auth: 9099 } });
218
- ctx.expect(connects.length).toBe(2);
219
- ctx.expect(connects[1].url).toBe('http://localhost:9199');
220
-
221
- // Neither channel is a broken artifact, and it says so by name
222
- // rather than dialling a port nothing identity-checks (#834).
223
- delete process.env.OMEGA_AUTH_PORT;
224
- let threw;
225
- try { run(true); } catch (e) { threw = e; }
226
- ctx.expect(threw).toBeDefined();
227
- ctx.expect(threw.message).toMatch(/dev port for `auth`/);
228
- ctx.expect(threw.message).toMatch(/bundle task/);
229
- ctx.expect(connects.length).toBe(2);
230
- } finally {
231
- bridge._firebase = saved.firebase;
232
- bridge._firebaseModule = saved.module;
233
- bridge._firebaseAuth = saved.auth;
234
- bridge._manager = saved.manager;
235
- if (saved.port === undefined) delete process.env.OMEGA_AUTH_PORT;
236
- else process.env.OMEGA_AUTH_PORT = saved.port;
237
- }
238
- },
239
- },
240
- {
241
- name: 'deep-link auth/token route is wired to handleAuthToken',
242
- run: async (ctx) => {
243
- // We've already tested the deep-link side in deep-link.test.js. Here we verify
244
- // the integration is actually live: dispatching the route triggers our spy.
245
- let received = null;
246
- const orig = ctx.manager.omega.handleAuthToken;
247
- ctx.manager.omega.handleAuthToken = async (token) => {
248
- received = token;
249
- return { success: true };
250
- };
251
- try {
252
- ctx.manager.deepLink.dispatch('myapp://auth/token?authToken=BRIDGE-TEST-TOKEN');
253
- // Built-in handler is sync up to the await — give it a tick.
254
- await new Promise((r) => setImmediate(r));
255
- ctx.expect(received).toBe('BRIDGE-TEST-TOKEN');
256
- } finally {
257
- ctx.manager.omega.handleAuthToken = orig;
258
- }
259
- },
260
- },
261
- ],
262
- });
@@ -1,137 +0,0 @@
1
- /**
2
- * Retired ENV keys ([#893](https://github.com/Omega-JS-Stack/omega/issues/893))
3
- * - the `.env` half of retired-keys.js.
4
- *
5
- * Six values were declared in both homes at once: the env schema carried them
6
- * as non-secret keys while the config schema already declared (or now
7
- * declares) the same fact. Two homes for one value drift, and the rule that
8
- * settles which one wins is in docs/shared/config.md ("Config or env?"):
9
- * config holds what is PUBLIC by design (an id a store URL carries, a key a
10
- * browser bundle ships, a value printed in a binary), `.env` holds secrets,
11
- * the login coordinates that only travel with a secret, and machine paths.
12
- *
13
- * There is no dual-read anywhere in OMEGA, so a `.env` line left behind is a
14
- * value nothing reads: the id a brand carefully pasted would be ignored and
15
- * the publish would address the wrong listing, or none. Every layer read
16
- * therefore FAILS on one, naming the config path the value moved to
17
- * (env.js's parseEnvFile, the one place a `.env` layer is parsed).
18
- *
19
- * The config-side register gets nothing from this move: these were never
20
- * config keys, so nothing there was renamed.
21
- *
22
- * The register also carries the env-side RENAMES
23
- * ([#845](https://github.com/Omega-JS-Stack/omega/issues/845)): a key that is
24
- * still a secret and still lives in `.env`, under a new name. Same silence,
25
- * same refusal; the fix it names is renaming the line, not deleting it.
26
- *
27
- * And it carries the keys that are retired OUTRIGHT
28
- * ([#819](https://github.com/Omega-JS-Stack/omega/issues/819)): no config path,
29
- * no new env name, because what replaced the key is a MECHANISM rather than a
30
- * value. Such a row declares `replacement: null` and its refusal reads as a
31
- * deletion with nowhere to move the value to.
32
- */
33
-
34
- // env var name -> { replacement, why, home } (docs/shared/config.md carries the
35
- // rows). `home` is where the replacement LIVES: 'config' by default (the #893
36
- // move), or 'env' for a key that stayed a secret and only changed NAME, which
37
- // is a rename of the line rather than a deletion. `replacement: null` is a key
38
- // with no successor of any kind (#819): the line is simply deleted, and the
39
- // row's `why` names the mechanism that made it unnecessary.
40
- const RETIRED_ENV_KEYS = {
41
- CHROME_EXTENSION_ID: {
42
- replacement: 'targets.<name>.listings.chrome.id',
43
- why: 'a store item id is public by design (it is in the listing URL), so it lives beside that listing in config',
44
- },
45
- FIREFOX_EXTENSION_ID: {
46
- replacement: 'targets.<name>.listings.firefox.id',
47
- why: "the AMO add-on id IS the manifest's gecko id, and config is its ONE home: the local scaffold pins the derived id there and the package task writes it into the manifest",
48
- },
49
- EDGE_PRODUCT_ID: {
50
- replacement: 'targets.<name>.listings.edge.id',
51
- why: 'a store product id is public by design (it is in the listing URL), so it lives beside that listing in config',
52
- },
53
- RECAPTCHA_SITE_KEY: {
54
- replacement: 'captcha.providers.recaptcha.siteKey',
55
- why: 'the site key is rendered into every page that carries a form, so it is public by definition; RECAPTCHA_SECRET_KEY stays in .env',
56
- },
57
- PAYPAL_CLIENT_ID: {
58
- replacement: 'payment.providers.paypal.clientId',
59
- why: 'the public half of the PayPal pair, already declared in config; the backend read it through a boot bridge that copied config into env',
60
- },
61
- CHARGEBEE_SITE: {
62
- replacement: 'payment.providers.chargebee.site',
63
- why: 'the site name is in every Chargebee URL, already declared in config; the backend read it through a boot bridge that copied config into env',
64
- },
65
- // The connections pair ([#845](https://github.com/Omega-JS-Stack/omega/issues/845)):
66
- // these are SECRETS and stayed in `.env`, so the row is a rename, not a move.
67
- // Exact names only, one per provider: the register is a name lookup, so the
68
- // `OAUTH2_*` family is spelled out a row at a time as a brand needs it, and
69
- // Google is the pair every brand carries today.
70
- OAUTH2_GOOGLE_CLIENT_ID: {
71
- home: 'env',
72
- replacement: 'CONNECTIONS_GOOGLE_CLIENT_ID',
73
- why: '#788 renamed the oauth2 feature to connections, the env family included; the backend reads only CONNECTIONS_<PROVIDER>_CLIENT_ID now',
74
- },
75
- OAUTH2_GOOGLE_CLIENT_SECRET: {
76
- home: 'env',
77
- replacement: 'CONNECTIONS_GOOGLE_CLIENT_SECRET',
78
- why: '#788 renamed the oauth2 feature to connections, the env family included; the backend reads only CONNECTIONS_<PROVIDER>_CLIENT_SECRET now',
79
- },
80
- // The test-lane pair ([#819](https://github.com/Omega-JS-Stack/omega/issues/819),
81
- // Ian 2026-09-13): retired outright, so neither row names a replacement. A
82
- // suite no longer holds a credential of its own, which is why there is
83
- // nothing to move the value to.
84
- OMEGA_TEST_FIREBASE_ADMIN_KEY: {
85
- replacement: null,
86
- why: 'retired: desktop, extension and web test their own sign-in through a seeded persona from the backend emulator (#904), so no suite mints a custom token from a service account any more',
87
- },
88
- OMEGA_TEST_USER_UID: {
89
- replacement: null,
90
- why: 'retired: desktop, extension and web test their own sign-in through a seeded persona from the backend emulator (#904), and the roster names the persona, so no uid is configured anywhere',
91
- },
92
- };
93
-
94
- /**
95
- * The retired keys a parsed `.env` layer carries, in the layer's own order.
96
- *
97
- * Presence is the whole test: an empty value (`KEY=`) documents a key nothing
98
- * reads, so it is owed the same deletion as a valued one.
99
- *
100
- * @param {Object<string, string>} values - Parsed `.env` values.
101
- * @returns {Array<{ key: string, replacement: string|null, why: string }>}
102
- */
103
- function findRetiredEnvKeys(values) {
104
- return Object.keys(values || {})
105
- .filter((key) => RETIRED_ENV_KEYS[key])
106
- .map((key) => ({ key, ...RETIRED_ENV_KEYS[key] }));
107
- }
108
-
109
- /**
110
- * Refuse a `.env` layer that still carries a retired key, spelling the move
111
- * out. A row with no replacement says so plainly: the line is deleted and
112
- * nothing takes the value anywhere (#819).
113
- *
114
- * @param {Object<string, string>} values - Parsed `.env` values.
115
- * @param {string} envPath - The file the values came from (named in the error).
116
- * @throws {Error} Naming every retired key in the layer, its new home, and why.
117
- */
118
- function assertNoRetiredEnvKeys(values, envPath) {
119
- const found = findRetiredEnvKeys(values);
120
- if (found.length === 0) return;
121
-
122
- const moves = found.map(({ key, replacement, why, home }) => {
123
- if (!replacement) return ` ${key} is retired outright: delete the .env line, nothing replaces the value (${why})`;
124
-
125
- return home === 'env'
126
- ? ` ${key} renamed to ${replacement}; rename the .env line (${why})`
127
- : ` ${key} moved to ${replacement} in config/omega.json5; delete the .env line (${why})`;
128
- });
129
-
130
- throw new Error(
131
- `${envPath} carries ${found.length} retired env key(s). Nothing reads them, so the value is silently lost:\n`
132
- + `${moves.join('\n')}\n`
133
- + 'The rule, and the whole register: docs/shared/config.md ("Config or env?").',
134
- );
135
- }
136
-
137
- module.exports = { RETIRED_ENV_KEYS, findRetiredEnvKeys, assertNoRetiredEnvKeys };