@omega.js/desktop 0.51.0 → 0.53.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 (289) hide show
  1. package/README.md +18 -13
  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.js +1 -1
  26. package/dist/commands/build.js +2 -2
  27. package/dist/commands/cdp/capture.js +2 -2
  28. package/dist/commands/cdp/quit.js +2 -2
  29. package/dist/commands/cdp/relaunch.js +2 -2
  30. package/dist/commands/cdp/theme.js +1 -1
  31. package/dist/commands/clean.js +2 -2
  32. package/dist/commands/deploy.js +4 -4
  33. package/dist/commands/finalize-release.js +4 -4
  34. package/dist/commands/install.js +3 -3
  35. package/dist/commands/launch.js +2 -2
  36. package/dist/commands/lib/deploy-precheck.js +3 -3
  37. package/dist/commands/lib/ensure-target.js +6 -6
  38. package/dist/commands/package.js +2 -2
  39. package/dist/commands/publish.js +2 -2
  40. package/dist/commands/release.js +3 -3
  41. package/dist/commands/runner.js +145 -48
  42. package/dist/commands/sign-windows.js +5 -5
  43. package/dist/commands/test.js +4 -4
  44. package/dist/commands/update.js +2 -2
  45. package/dist/commands/validate-certs.js +4 -4
  46. package/dist/commands/version.js +3 -3
  47. package/dist/defaults/.github/workflows/build.yml +2 -0
  48. package/dist/defaults/AGENTS.md +17 -8
  49. package/dist/defaults/config/omega.json5 +7 -7
  50. package/dist/defaults/hooks/build/post.js +1 -1
  51. package/dist/defaults/hooks/build/pre.js +1 -1
  52. package/dist/defaults/hooks/deploy/pre.js +1 -1
  53. package/dist/defaults/hooks/release/post.js +1 -1
  54. package/dist/defaults/hooks/release/pre.js +1 -1
  55. package/dist/defaults/src/assets/js/components/about/index.js +3 -5
  56. package/dist/defaults/src/assets/js/components/main/index.js +3 -5
  57. package/dist/defaults/src/assets/js/components/settings/index.js +3 -5
  58. package/dist/defaults/src/integrations/context-menu/index.js +2 -2
  59. package/dist/defaults/src/integrations/menu/index.js +3 -3
  60. package/dist/defaults/src/integrations/tray/index.js +3 -3
  61. package/dist/defaults/src/main.js +3 -5
  62. package/dist/defaults/src/preload.js +3 -5
  63. package/dist/defaults/test/README.md +2 -2
  64. package/dist/gulp/main.js +9 -10
  65. package/dist/gulp/tasks/audit.js +7 -7
  66. package/dist/gulp/tasks/build-config.js +8 -8
  67. package/dist/gulp/tasks/bundle.js +16 -16
  68. package/dist/gulp/tasks/defaults.js +3 -3
  69. package/dist/gulp/tasks/distribute.js +2 -2
  70. package/dist/gulp/tasks/html.js +9 -9
  71. package/dist/gulp/tasks/package-quick.js +3 -3
  72. package/dist/gulp/tasks/package.js +3 -3
  73. package/dist/gulp/tasks/release.js +3 -3
  74. package/dist/gulp/tasks/sass.js +6 -6
  75. package/dist/gulp/tasks/serve.js +4 -4
  76. package/dist/hooks/notarize-artifacts.js +1 -1
  77. package/dist/hooks/notarize.js +1 -1
  78. package/dist/index.js +5 -8
  79. package/dist/lib/_environment-mixin.js +50 -0
  80. package/dist/lib/_lifecycle-mixin.js +45 -0
  81. package/dist/lib/analytics.js +33 -35
  82. package/dist/lib/app-state.js +14 -14
  83. package/dist/lib/auth-flow.js +18 -18
  84. package/dist/lib/auth-persistence.js +12 -12
  85. package/dist/lib/auth.js +421 -0
  86. package/dist/lib/auto-updater.js +49 -49
  87. package/dist/lib/context-menu.js +13 -13
  88. package/dist/lib/context.js +19 -19
  89. package/dist/lib/deep-link.js +34 -34
  90. package/dist/lib/fontawesome.js +5 -5
  91. package/dist/lib/ipc.js +4 -4
  92. package/dist/lib/menu.js +25 -25
  93. package/dist/lib/protocol.js +5 -5
  94. package/dist/lib/remote-config.js +22 -22
  95. package/dist/lib/remote-scripts.js +21 -21
  96. package/dist/lib/restart-manager/index.js +28 -28
  97. package/dist/lib/sign-helpers/exec-with-limit.js +1 -1
  98. package/dist/lib/sign-helpers/sign-events.js +1 -1
  99. package/dist/lib/startup.js +18 -13
  100. package/dist/lib/storage.js +10 -10
  101. package/dist/lib/templating.js +16 -16
  102. package/dist/lib/theme.js +10 -10
  103. package/dist/lib/tray.js +27 -27
  104. package/dist/lib/usage.js +11 -11
  105. package/dist/lib/window-manager.js +26 -26
  106. package/dist/main.js +398 -483
  107. package/dist/preload.js +236 -176
  108. package/dist/renderer.js +417 -391
  109. package/dist/runner/job-started.js +1 -1
  110. package/dist/test/fixtures/consumer-app/config/omega.json5 +1 -1
  111. package/dist/test/fixtures/consumer-app/src/assets/js/components/main/index.js +8 -11
  112. package/dist/test/fixtures/consumer-app/src/main.js +5 -7
  113. package/dist/test/fixtures/consumer-app/src/preload.js +2 -2
  114. package/dist/test/harness/boot-entry.js +22 -20
  115. package/dist/test/harness/main-entry.js +31 -30
  116. package/dist/test/harness/renderer-entry.js +5 -5
  117. package/dist/test/harness/renderer-preload.js +137 -141
  118. package/dist/test/index.js +10 -10
  119. package/dist/test/runner.js +2 -2
  120. package/dist/test/runners/boot.js +7 -6
  121. package/dist/test/runners/electron.js +3 -2
  122. package/dist/test/runners/render-event.js +2 -2
  123. package/dist/test/suites/boot/consumer-app-boots.test.js +57 -26
  124. package/dist/test/suites/boot/restart-manager.test.js +2 -2
  125. package/dist/test/suites/boot/storage-bundled.test.js +5 -5
  126. package/dist/test/suites/boot/theme.test.js +13 -13
  127. package/dist/test/suites/build/audit.test.js +1 -1
  128. package/dist/test/suites/build/auth-persistence-resolve.test.js +6 -6
  129. package/dist/test/suites/build/boot-fixture.test.js +2 -2
  130. package/dist/test/suites/build/boot-runner-timeout.test.js +6 -5
  131. package/dist/test/suites/build/brand-scss.test.js +1 -1
  132. package/dist/test/suites/build/build-json-bake.test.js +1 -1
  133. package/dist/test/suites/build/cli.test.js +2 -2
  134. package/dist/test/suites/build/config-schema.test.js +5 -5
  135. package/dist/test/suites/build/defaults-scaffold.test.js +2 -2
  136. package/dist/test/suites/build/deploy-hook.test.js +3 -3
  137. package/dist/test/suites/build/ensure-target.test.js +2 -2
  138. package/dist/test/suites/build/env-delivery.test.js +2 -2
  139. package/dist/test/suites/build/esm-only-dependency.test.js +2 -2
  140. package/dist/test/suites/build/exports.test.js +9 -8
  141. package/dist/test/suites/build/get-config.test.js +4 -4
  142. package/dist/test/suites/build/manifest-deps.test.js +1 -1
  143. package/dist/test/suites/build/merge-line-files.test.js +1 -1
  144. package/dist/test/suites/build/omega-shell.test.js +34 -2
  145. package/dist/test/suites/build/omega.test.js +350 -0
  146. package/dist/test/suites/build/renderer-auth-bridge.test.js +211 -78
  147. package/dist/test/suites/build/runner.test.js +612 -5
  148. package/dist/test/suites/build/sentry.test.js +2 -2
  149. package/dist/test/suites/build/sign-windows-e2e.test.js +2 -2
  150. package/dist/test/suites/build/templating.test.js +3 -3
  151. package/dist/test/suites/build/test-stealth.test.js +7 -9
  152. package/dist/test/suites/build/url-helpers.test.js +55 -56
  153. package/dist/test/suites/build/validate-config.test.js +2 -2
  154. package/dist/test/suites/build/wave5-pins.test.js +2 -2
  155. package/dist/test/suites/main/analytics.test.js +59 -59
  156. package/dist/test/suites/main/app-state.test.js +66 -66
  157. package/dist/test/suites/main/auth-flow.test.js +41 -41
  158. package/dist/test/suites/main/auth-persistence.test.js +54 -43
  159. package/dist/test/suites/main/{client-bridge.integration.test.js → auth.integration.test.js} +10 -9
  160. package/dist/test/suites/main/auth.test.js +336 -0
  161. package/dist/test/suites/main/auto-updater.test.js +134 -134
  162. package/dist/test/suites/main/boot-sequence.test.js +37 -49
  163. package/dist/test/suites/main/context-menu.test.js +51 -50
  164. package/dist/test/suites/main/context.test.js +25 -25
  165. package/dist/test/suites/main/deep-link.test.js +74 -74
  166. package/dist/test/suites/main/fontawesome.test.js +27 -27
  167. package/dist/test/suites/main/ipc.test.js +35 -35
  168. package/dist/test/suites/main/menu.test.js +101 -100
  169. package/dist/test/suites/main/protocol.test.js +19 -19
  170. package/dist/test/suites/main/remote-config.test.js +63 -63
  171. package/dist/test/suites/main/remote-scripts.test.js +103 -103
  172. package/dist/test/suites/main/request.test.js +71 -0
  173. package/dist/test/suites/main/restart-manager.test.js +33 -33
  174. package/dist/test/suites/main/startup-paths-and-ua.test.js +4 -4
  175. package/dist/test/suites/main/startup.test.js +26 -26
  176. package/dist/test/suites/main/stealth-window.test.js +1 -1
  177. package/dist/test/suites/main/storage.test.js +25 -25
  178. package/dist/test/suites/main/theme.test.js +34 -34
  179. package/dist/test/suites/main/tray.test.js +79 -79
  180. package/dist/test/suites/main/url-helpers.test.js +133 -133
  181. package/dist/test/suites/main/usage.test.js +25 -25
  182. package/dist/test/suites/main/window-bounds.test.js +27 -27
  183. package/dist/test/suites/main/window-manager.test.js +44 -44
  184. package/dist/test/suites/renderer/analytics-bridge.test.js +5 -5
  185. package/dist/test/suites/renderer/cross-context-helpers.test.js +37 -31
  186. package/dist/test/suites/renderer/round-trip.test.js +3 -3
  187. package/dist/test/suites/renderer/tooltips.test.js +15 -15
  188. package/dist/test/suites/renderer/{window-em-surface.test.js → window-desktop-surface.test.js} +27 -7
  189. package/dist/test/utils/extended-mode-warning.js +1 -1
  190. package/dist/utils/boot-harness.js +56 -0
  191. package/dist/utils/mode-helpers.js +2 -15
  192. package/dist/utils/ship-keys.js +3 -3
  193. package/dist/utils/signing-status.js +51 -0
  194. package/dist/utils/test-events.js +7 -0
  195. package/dist/utils/test-stealth.js +6 -6
  196. package/dist/utils/url-helpers.js +52 -42
  197. package/dist/utils/user-agent.js +44 -0
  198. package/dist/vendor/account/engine.js +3 -3
  199. package/dist/vendor/account/index.js +14 -45
  200. package/dist/vendor/account/resolve-account.js +44 -0
  201. package/dist/vendor/account/schema.js +1 -1
  202. package/dist/vendor/account/user.js +99 -0
  203. package/dist/vendor/config/client-config.js +1 -1
  204. package/dist/vendor/config/environment.js +11 -30
  205. package/dist/vendor/config/index.js +13 -12
  206. package/dist/vendor/config/load.js +1 -2
  207. package/dist/vendor/config/platforms.js +1 -1
  208. package/dist/vendor/config/repo.js +24 -0
  209. package/dist/vendor/config/retired-keys.js +2 -2
  210. package/dist/vendor/config/schema.js +5 -8
  211. package/dist/vendor/config/site-global.js +2 -3
  212. package/dist/vendor/config/validate.js +1 -2
  213. package/dist/vendor/config/winback.js +1 -1
  214. package/dist/vendor/devkit/actions-secrets.js +1 -1
  215. package/dist/vendor/devkit/attach-log-file.js +1 -1
  216. package/dist/vendor/devkit/brand-version.js +162 -1
  217. package/dist/vendor/devkit/build-json.js +1 -1
  218. package/dist/vendor/devkit/cli-router.js +3 -4
  219. package/dist/vendor/devkit/defaults-engine.js +9 -11
  220. package/dist/vendor/devkit/deploy.js +64 -4
  221. package/dist/vendor/devkit/git-remote.js +78 -1
  222. package/dist/vendor/devkit/local.js +53 -3
  223. package/dist/vendor/devkit/lockfile.js +127 -0
  224. package/dist/vendor/devkit/merge-line-files.js +2 -3
  225. package/dist/vendor/devkit/pack-local.js +4 -7
  226. package/dist/vendor/devkit/preludes/origin-heal.js +35 -49
  227. package/dist/vendor/devkit/target-secrets.js +34 -45
  228. package/dist/vendor/devkit/test/runner-core.js +6 -6
  229. package/dist/vendor/monitoring/env.js +2 -2
  230. package/dist/vendor/monitoring/index.js +1 -1
  231. package/dist/vendor/monitoring/main.js +1 -1
  232. package/dist/vendor/monitoring/preload.js +1 -1
  233. package/dist/vendor/monitoring/renderer.js +1 -1
  234. package/docs/analytics.md +8 -8
  235. package/docs/app-state.md +19 -19
  236. package/docs/audit.md +4 -4
  237. package/docs/{client-bridge.md → auth.md} +88 -73
  238. package/docs/auto-updater.md +8 -8
  239. package/docs/boot-sequence.md +11 -6
  240. package/docs/build-system.md +1 -1
  241. package/docs/cdp-debugging.md +1 -1
  242. package/docs/common-mistakes.md +7 -7
  243. package/docs/config-schema.md +1 -1
  244. package/docs/context-menu.md +13 -13
  245. package/docs/context.md +11 -11
  246. package/docs/css.md +3 -9
  247. package/docs/deep-link.md +25 -25
  248. package/docs/environment-detection.md +16 -16
  249. package/docs/fontawesome.md +7 -5
  250. package/docs/hooks.md +8 -8
  251. package/docs/index.md +39 -28
  252. package/docs/ipc.md +10 -10
  253. package/docs/lib-modules.md +9 -9
  254. package/docs/logging.md +12 -14
  255. package/docs/menu.md +18 -18
  256. package/docs/releasing.md +4 -2
  257. package/docs/remote-config.md +9 -9
  258. package/docs/remote-scripts.md +12 -12
  259. package/docs/restart-manager.md +8 -8
  260. package/docs/runner.md +12 -10
  261. package/docs/sentry.md +4 -4
  262. package/docs/shared/analytics.md +1 -1
  263. package/docs/shared/brands.md +1 -1
  264. package/docs/shared/breaking-changes.md +79 -13
  265. package/docs/shared/config.md +24 -21
  266. package/docs/shared/deploys.md +30 -7
  267. package/docs/shared/local-dev.md +5 -3
  268. package/docs/shared/logging.md +1 -1
  269. package/docs/shared/monitoring.md +5 -5
  270. package/docs/shared/testing.md +2 -2
  271. package/docs/shared/theming.md +1 -1
  272. package/docs/shared/translation.md +19 -10
  273. package/docs/signing.md +1 -1
  274. package/docs/startup.md +16 -16
  275. package/docs/storage.md +11 -11
  276. package/docs/templating.md +3 -3
  277. package/docs/test-boot-layer.md +12 -12
  278. package/docs/test-framework.md +17 -17
  279. package/docs/themes.md +7 -7
  280. package/docs/tooltips.md +2 -2
  281. package/docs/tray.md +31 -31
  282. package/docs/usage.md +7 -7
  283. package/docs/verts.md +1 -1
  284. package/docs/windows.md +22 -22
  285. package/package.json +3 -4
  286. package/dist/lib/client-bridge.js +0 -374
  287. package/dist/lib/logger.js +0 -4
  288. package/dist/test/suites/build/manager.test.js +0 -213
  289. package/dist/test/suites/main/client-bridge.test.js +0 -262
@@ -3,7 +3,7 @@
3
3
  // The policy itself — config gating, the dev/kill switches, user normalization,
4
4
  // release tagging — is @omega.js/monitoring's, proven by its own suite
5
5
  // (packages/monitoring/test/). What belongs here is the desktop half: the
6
- // package entry resolves in a main-process context, the manager's `sentry`
6
+ // package entry resolves in a main-process context, the omega instance's `sentry`
7
7
  // surface is the one every lib calls, and a brand with no DSN gets a silent
8
8
  // no-op instead of a crash.
9
9
 
@@ -47,7 +47,7 @@ module.exports = defineCases({
47
47
  try {
48
48
  main.captureException(new Error('test'));
49
49
  main.captureMessage('test');
50
- // client-bridge calls this on every auth change — a documented no-op when off.
50
+ // lib/auth.js calls this on every auth change, a documented no-op when off.
51
51
  main.setUser({ uid: 'abc', email: 'user@example.com' });
52
52
  } catch (e) {
53
53
  threw = e;
@@ -27,7 +27,7 @@ const defineCases = require('../../../vendor/devkit/test/define-cases.js');
27
27
  const signerPath = path.join(__dirname, '..', '..', '..', 'commands', 'sign-windows.js');
28
28
  const eventsPath = path.join(__dirname, '..', '..', '..', 'lib', 'sign-helpers', 'sign-events.js');
29
29
  const signWindows = require(signerPath);
30
- const Manager = new (require(path.join(__dirname, '..', '..', '..', 'build.js')))();
30
+ const build = require(path.join(__dirname, '..', '..', '..', 'build.js'));
31
31
 
32
32
  const NOT_WINDOWS = 'Windows-only: signtool + the EV token live on the signing box';
33
33
  const NO_SIGNTOOL = 'signtool is not reachable — install the Windows SDK / VS Build Tools, or set SIGNTOOL_PATH';
@@ -76,7 +76,7 @@ function currentGate() {
76
76
  // The strategy comes from the project's own config — the same call the signer
77
77
  // makes — and is only worth resolving where the rest of the gate has passed.
78
78
  if (process.platform !== 'win32') return gateReason(process.platform, process.env, false, null);
79
- return gateReason(process.platform, process.env, signtoolOnPath(process.env), Manager.getWindowsSignStrategy());
79
+ return gateReason(process.platform, process.env, signtoolOnPath(process.env), build.getWindowsSignStrategy());
80
80
  }
81
81
 
82
82
  // The signer, loaded with its event log pointed inside this suite's scratch
@@ -52,11 +52,11 @@ module.exports = defineCases({
52
52
  },
53
53
  },
54
54
  {
55
- name: 'buildPageVars produces brand/app/page/theme/cacheBust from a manager-like object',
55
+ name: 'buildPageVars produces brand/app/page/theme/cacheBust from an omega-like object',
56
56
  run: (ctx) => {
57
57
  const t = require(path.join(__dirname, '..', '..', '..', 'lib', 'templating.js'));
58
- const fakeManager = { config: { brand: { name: 'MyApp', id: 'myapp' }, app: { productName: 'MyApp' } } };
59
- const vars = t.buildPageVars('settings', { cacheBust: '12345' }, fakeManager);
58
+ const fakeOmega = { config: { brand: { name: 'MyApp', id: 'myapp' }, app: { productName: 'MyApp' } } };
59
+ const vars = t.buildPageVars('settings', { cacheBust: '12345' }, fakeOmega);
60
60
  ctx.expect(vars.page.name).toBe('settings');
61
61
  ctx.expect(vars.page.title).toBe('MyApp');
62
62
  ctx.expect(vars.brand.id).toBe('myapp');
@@ -68,19 +68,17 @@ module.exports = defineCases({
68
68
  },
69
69
  },
70
70
  {
71
- name: 'a provided manager answers from the config IT was baked with',
71
+ name: 'a provided instance answers from the config IT was baked with',
72
72
  run: (ctx) => {
73
- // The build-time Manager carries the same mixin as the runtime Managers,
74
- // and since #817 they all read the ONE input: the process variable, or
75
- // the baked `config.environment` when the process has none.
76
- const Manager = require('../../../build.js');
73
+ // An instance carrying the shared isTesting() answers like the runtime
74
+ // `omega` instances: since #817 they all read the ONE input, the process
75
+ // variable, or the baked `config.environment` when the process has none.
76
+ const { isTesting } = require('../../../utils/mode-helpers.js');
77
77
  withEnv({ OMEGA_ENVIRONMENT: undefined, OMEGA_TEST_SHOW: undefined }, () => {
78
- const testing = new Manager();
79
- testing.config = { environment: 'testing' };
78
+ const testing = { isTesting, config: { environment: 'testing' } };
80
79
  ctx.expect(isTestStealth(testing)).toBe(true);
81
80
 
82
- const production = new Manager();
83
- production.config = { environment: 'production' };
81
+ const production = { isTesting, config: { environment: 'production' } };
84
82
  ctx.expect(isTestStealth(production)).toBe(false);
85
83
  });
86
84
  },
@@ -11,13 +11,13 @@
11
11
  // published, then composes OMEGA_WEBSITE_PORT / the baked port over https, then
12
12
  // the classic dev origin ([#747](https://github.com/Omega-JS-Stack/omega/issues/747)).
13
13
  //
14
- // The last case pins the auth emulator port client-bridge connects a testing
14
+ // The last case pins the auth emulator port lib/auth.js connects a testing
15
15
  // run to: the same three-step chain, off the same baked map.
16
16
 
17
17
  const path = require('path');
18
18
 
19
19
  const helpers = require(path.join(__dirname, '..', '..', '..', 'utils', 'url-helpers.js'));
20
- const clientBridge = require(path.join(__dirname, '..', '..', '..', 'lib', 'client-bridge.js'));
20
+ const auth = require(path.join(__dirname, '..', '..', '..', 'lib', 'auth.js'));
21
21
  const defineCases = require('../../../vendor/devkit/test/define-cases.js');
22
22
 
23
23
  function withEnv(overrides, fn) {
@@ -35,9 +35,9 @@ function withEnv(overrides, fn) {
35
35
  }
36
36
  }
37
37
 
38
- // The shape the helpers see at runtime: a Manager carrying the resolved config
38
+ // The shape the helpers see at runtime: an omega instance carrying the resolved config
39
39
  // (OMEGA_BUILD_JSON.config, `dev` block and all) plus mode-helpers' getEnvironment().
40
- function fakeManager(environment, ports, origin) {
40
+ function fakeOmega(environment, ports, origin) {
41
41
  return {
42
42
  getEnvironment: () => environment,
43
43
  isTesting: () => environment === 'testing',
@@ -51,11 +51,11 @@ function fakeManager(environment, ports, origin) {
51
51
  };
52
52
  }
53
53
 
54
- // Run `fn` with the bridge pointed at a stand-in Manager, then put the real one back.
55
- function withBridgeManager(manager, fn) {
56
- const original = clientBridge._manager;
57
- clientBridge._manager = manager;
58
- try { return fn(); } finally { clientBridge._manager = original; }
54
+ // Run `fn` with auth pointed at a stand-in instance, then put the real one back.
55
+ function withAuthOmega(omega, fn) {
56
+ const original = auth._omega;
57
+ auth._omega = omega;
58
+ try { return fn(); } finally { auth._omega = original; }
59
59
  }
60
60
 
61
61
  // No env channel published: the state a packaged main process is in.
@@ -72,9 +72,11 @@ module.exports = defineCases({
72
72
  description: 'utils/url-helpers: every local helper resolves env, then the baked dev.ports, then throws',
73
73
  tests: [
74
74
  {
75
- name: 'exports { attachTo, getApiUrl, localPort, requiredPort }',
75
+ // Plain functions the `Omega` classes call with themselves as `context`:
76
+ // no mixin onto a constructor any more
77
+ name: 'exports { getApiUrl, localPort, requiredPort } and no attachTo',
76
78
  run: (ctx) => {
77
- ctx.expect(typeof helpers.attachTo).toBe('function');
79
+ ctx.expect(helpers.attachTo).toBeUndefined();
78
80
  ctx.expect(typeof helpers.getApiUrl).toBe('function');
79
81
  ctx.expect(typeof helpers.localPort).toBe('function');
80
82
  ctx.expect(typeof helpers.requiredPort).toBe('function');
@@ -84,8 +86,8 @@ module.exports = defineCases({
84
86
  name: 'a BUMPED baked dev.ports.hosting is the api base in testing',
85
87
  run: (ctx) => {
86
88
  withEnv(NO_ENV, () => {
87
- const manager = fakeManager('testing', { hosting: 5012, auth: 9109 });
88
- ctx.expect(helpers.getApiUrl.call(manager)).toBe('http://localhost:5012');
89
+ const omega = fakeOmega('testing', { hosting: 5012, auth: 9109 });
90
+ ctx.expect(helpers.getApiUrl(omega)).toBe('http://localhost:5012');
89
91
  });
90
92
  },
91
93
  },
@@ -93,8 +95,8 @@ module.exports = defineCases({
93
95
  name: 'a BUMPED baked dev.ports.hosting is the api base in development too',
94
96
  run: (ctx) => {
95
97
  withEnv(NO_ENV, () => {
96
- const manager = fakeManager('development', { hosting: 5012 });
97
- ctx.expect(helpers.getApiUrl.call(manager)).toBe('http://localhost:5012');
98
+ const omega = fakeOmega('development', { hosting: 5012 });
99
+ ctx.expect(helpers.getApiUrl(omega)).toBe('http://localhost:5012');
98
100
  });
99
101
  },
100
102
  },
@@ -102,8 +104,8 @@ module.exports = defineCases({
102
104
  name: 'OMEGA_HOSTING_PORT wins over the baked value',
103
105
  run: (ctx) => {
104
106
  withEnv({ ...NO_ENV, OMEGA_HOSTING_PORT: '5022' }, () => {
105
- const manager = fakeManager('testing', { hosting: 5012 });
106
- ctx.expect(helpers.getApiUrl.call(manager)).toBe('http://localhost:5022');
107
+ const omega = fakeOmega('testing', { hosting: 5012 });
108
+ ctx.expect(helpers.getApiUrl(omega)).toBe('http://localhost:5022');
107
109
  });
108
110
  },
109
111
  },
@@ -116,9 +118,9 @@ module.exports = defineCases({
116
118
  run: (ctx) => {
117
119
  withEnv(NO_ENV, () => {
118
120
  for (const environment of ['testing', 'development']) {
119
- ctx.expect(() => helpers.getApiUrl.call(fakeManager(environment)))
121
+ ctx.expect(() => helpers.getApiUrl(fakeOmega(environment)))
120
122
  .toThrow(/dev port for `hosting`/);
121
- ctx.expect(() => helpers.getApiUrl.call(fakeManager(environment)))
123
+ ctx.expect(() => helpers.getApiUrl(fakeOmega(environment)))
122
124
  .toThrow(/bundle task/);
123
125
  }
124
126
  });
@@ -128,8 +130,8 @@ module.exports = defineCases({
128
130
  name: 'OMEGA_HTTPS_PORT means the mkcert proxy is up: https, not hosting',
129
131
  run: (ctx) => {
130
132
  withEnv({ ...NO_ENV, OMEGA_HTTPS_PORT: '5003' }, () => {
131
- const manager = fakeManager('testing', { hosting: 5012 });
132
- ctx.expect(helpers.getApiUrl.call(manager)).toBe('https://localhost:5003');
133
+ const omega = fakeOmega('testing', { hosting: 5012 });
134
+ ctx.expect(helpers.getApiUrl(omega)).toBe('https://localhost:5003');
133
135
  });
134
136
  },
135
137
  },
@@ -137,8 +139,8 @@ module.exports = defineCases({
137
139
  name: 'a baked dev.ports.https does the same with no env published',
138
140
  run: (ctx) => {
139
141
  withEnv(NO_ENV, () => {
140
- const manager = fakeManager('testing', { https: 5003, hosting: 5443 });
141
- ctx.expect(helpers.getApiUrl.call(manager)).toBe('https://localhost:5003');
142
+ const omega = fakeOmega('testing', { https: 5003, hosting: 5443 });
143
+ ctx.expect(helpers.getApiUrl(omega)).toBe('https://localhost:5003');
142
144
  });
143
145
  },
144
146
  },
@@ -146,8 +148,8 @@ module.exports = defineCases({
146
148
  name: 'production ignores every local channel, giving api.<brand host>',
147
149
  run: (ctx) => {
148
150
  withEnv({ ...NO_ENV, OMEGA_HOSTING_PORT: '5022' }, () => {
149
- const manager = fakeManager('production', { hosting: 5012 });
150
- ctx.expect(helpers.getApiUrl.call(manager)).toBe('https://api.playground.omegajs.dev');
151
+ const omega = fakeOmega('production', { hosting: 5012 });
152
+ ctx.expect(helpers.getApiUrl(omega)).toBe('https://api.playground.omegajs.dev');
151
153
  });
152
154
  },
153
155
  },
@@ -155,8 +157,8 @@ module.exports = defineCases({
155
157
  name: 'getFunctionsUrl: a BUMPED baked dev.ports.functions is the functions base',
156
158
  run: (ctx) => {
157
159
  withEnv(NO_ENV, () => {
158
- const manager = fakeManager('development', { functions: 5011 });
159
- ctx.expect(helpers.getFunctionsUrl.call(manager))
160
+ const omega = fakeOmega('development', { functions: 5011 });
161
+ ctx.expect(helpers.getFunctionsUrl(omega))
160
162
  .toBe('http://localhost:5011/demo-app/us-central1');
161
163
  });
162
164
  },
@@ -165,8 +167,8 @@ module.exports = defineCases({
165
167
  name: 'getFunctionsUrl: OMEGA_FUNCTIONS_PORT wins over the baked value',
166
168
  run: (ctx) => {
167
169
  withEnv({ ...NO_ENV, OMEGA_FUNCTIONS_PORT: '5021' }, () => {
168
- const manager = fakeManager('testing', { functions: 5011 });
169
- ctx.expect(helpers.getFunctionsUrl.call(manager))
170
+ const omega = fakeOmega('testing', { functions: 5011 });
171
+ ctx.expect(helpers.getFunctionsUrl(omega))
170
172
  .toBe('http://localhost:5021/demo-app/us-central1');
171
173
  });
172
174
  },
@@ -175,7 +177,7 @@ module.exports = defineCases({
175
177
  name: 'getFunctionsUrl: neither channel → a throw naming the port (#834)',
176
178
  run: (ctx) => {
177
179
  withEnv(NO_ENV, () => {
178
- ctx.expect(() => helpers.getFunctionsUrl.call(fakeManager('development')))
180
+ ctx.expect(() => helpers.getFunctionsUrl(fakeOmega('development')))
179
181
  .toThrow(/dev port for `functions`/);
180
182
  });
181
183
  },
@@ -184,8 +186,8 @@ module.exports = defineCases({
184
186
  name: 'getFunctionsUrl: production ignores every local channel',
185
187
  run: (ctx) => {
186
188
  withEnv({ ...NO_ENV, OMEGA_FUNCTIONS_PORT: '5021' }, () => {
187
- const manager = fakeManager('production', { functions: 5011 });
188
- ctx.expect(helpers.getFunctionsUrl.call(manager))
189
+ const omega = fakeOmega('production', { functions: 5011 });
190
+ ctx.expect(helpers.getFunctionsUrl(omega))
189
191
  .toBe('https://us-central1-demo-app.cloudfunctions.net');
190
192
  });
191
193
  },
@@ -194,8 +196,8 @@ module.exports = defineCases({
194
196
  name: 'getWebsiteUrl: a BUMPED baked dev.ports.website is the website base',
195
197
  run: (ctx) => {
196
198
  withEnv(NO_ENV, () => {
197
- const manager = fakeManager('development', { website: 4001 });
198
- ctx.expect(helpers.getWebsiteUrl.call(manager)).toBe('https://localhost:4001');
199
+ const omega = fakeOmega('development', { website: 4001 });
200
+ ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://localhost:4001');
199
201
  });
200
202
  },
201
203
  },
@@ -203,8 +205,8 @@ module.exports = defineCases({
203
205
  name: 'getWebsiteUrl: OMEGA_WEBSITE_PORT wins over the baked value',
204
206
  run: (ctx) => {
205
207
  withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4002' }, () => {
206
- const manager = fakeManager('testing', { website: 4001 });
207
- ctx.expect(helpers.getWebsiteUrl.call(manager)).toBe('https://localhost:4002');
208
+ const omega = fakeOmega('testing', { website: 4001 });
209
+ ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://localhost:4002');
208
210
  });
209
211
  },
210
212
  },
@@ -212,7 +214,7 @@ module.exports = defineCases({
212
214
  name: 'getWebsiteUrl: neither channel → a throw naming the port (#834)',
213
215
  run: (ctx) => {
214
216
  withEnv(NO_ENV, () => {
215
- ctx.expect(() => helpers.getWebsiteUrl.call(fakeManager('development')))
217
+ ctx.expect(() => helpers.getWebsiteUrl(fakeOmega('development')))
216
218
  .toThrow(/dev port for `website`/);
217
219
  });
218
220
  },
@@ -224,8 +226,8 @@ module.exports = defineCases({
224
226
  name: 'getWebsiteUrl: a baked dev.origin wins over OMEGA_WEBSITE_PORT',
225
227
  run: (ctx) => {
226
228
  withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4002' }, () => {
227
- const manager = fakeManager('development', { website: 4001 }, 'https://localhost:4123');
228
- ctx.expect(helpers.getWebsiteUrl.call(manager)).toBe('https://localhost:4123');
229
+ const omega = fakeOmega('development', { website: 4001 }, 'https://localhost:4123');
230
+ ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://localhost:4123');
229
231
  });
230
232
  },
231
233
  },
@@ -233,7 +235,7 @@ module.exports = defineCases({
233
235
  name: 'getWebsiteUrl: OMEGA_WEBSITE_PORT with no baked origin composes over https',
234
236
  run: (ctx) => {
235
237
  withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4321' }, () => {
236
- ctx.expect(helpers.getWebsiteUrl.call(fakeManager('development'))).toBe('https://localhost:4321');
238
+ ctx.expect(helpers.getWebsiteUrl(fakeOmega('development'))).toBe('https://localhost:4321');
237
239
  });
238
240
  },
239
241
  },
@@ -258,11 +260,8 @@ module.exports = defineCases({
258
260
  name: 'getAuthUrl: dev builds /signin and /token on the https dev origin',
259
261
  run: (ctx) => {
260
262
  withEnv(NO_ENV, () => {
261
- // getAuthUrl calls `this.getWebsiteUrl()`, which attachTo() supplies on a
262
- // real Manager — hand the stand-in the same helper.
263
- const manager = fakeManager('development', { website: 4000 });
264
- manager.getWebsiteUrl = helpers.getWebsiteUrl;
265
- const url = new URL(helpers.getAuthUrl.call(manager));
263
+ const omega = fakeOmega('development', { website: 4000 });
264
+ const url = new URL(helpers.getAuthUrl(omega));
266
265
  ctx.expect(url.origin).toBe('https://localhost:4000');
267
266
  ctx.expect(url.pathname).toBe('/signin');
268
267
  const tokenUrl = new URL(url.searchParams.get('authReturnUrl'));
@@ -276,31 +275,31 @@ module.exports = defineCases({
276
275
  name: 'getWebsiteUrl: production ignores every local channel',
277
276
  run: (ctx) => {
278
277
  withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4002' }, () => {
279
- const manager = fakeManager('production', { website: 4001 });
280
- ctx.expect(helpers.getWebsiteUrl.call(manager)).toBe('https://playground.omegajs.dev');
278
+ const omega = fakeOmega('production', { website: 4001 });
279
+ ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://playground.omegajs.dev');
281
280
  });
282
281
  },
283
282
  },
284
283
  {
285
- // client-bridge connects a TESTING run's auth to the emulator. Same chain:
284
+ // lib/auth.js connects a TESTING run's auth to the emulator. Same chain:
286
285
  // env, then the baked map, then classic 9099.
287
- name: 'the auth emulator port rides the same chain (client-bridge)',
286
+ name: 'the auth emulator port rides the same chain (lib/auth.js)',
288
287
  run: (ctx) => {
289
288
  withEnv({ OMEGA_AUTH_PORT: null }, () => {
290
- withBridgeManager(fakeManager('testing', { auth: 9109 }), () => {
291
- ctx.expect(clientBridge._authEmulatorPort()).toBe(9109);
289
+ withAuthOmega(fakeOmega('testing', { auth: 9109 }), () => {
290
+ ctx.expect(auth._authEmulatorPort()).toBe(9109);
292
291
  });
293
292
  // The classic 9099 used to answer here (#834): nothing identity-checks
294
293
  // what holds that port, so a neighbouring project's emulator read as
295
294
  // an auth mystery instead of a port problem.
296
- withBridgeManager(fakeManager('testing'), () => {
297
- ctx.expect(() => clientBridge._authEmulatorPort()).toThrow(/dev port for `auth`/);
298
- ctx.expect(() => clientBridge._authEmulatorPort()).toThrow(/bundle task/);
295
+ withAuthOmega(fakeOmega('testing'), () => {
296
+ ctx.expect(() => auth._authEmulatorPort()).toThrow(/dev port for `auth`/);
297
+ ctx.expect(() => auth._authEmulatorPort()).toThrow(/bundle task/);
299
298
  });
300
299
  });
301
300
  withEnv({ OMEGA_AUTH_PORT: '9119' }, () => {
302
- withBridgeManager(fakeManager('testing', { auth: 9109 }), () => {
303
- ctx.expect(clientBridge._authEmulatorPort()).toBe('9119');
301
+ withAuthOmega(fakeOmega('testing', { auth: 9109 }), () => {
302
+ ctx.expect(auth._authEmulatorPort()).toBe('9119');
304
303
  });
305
304
  });
306
305
  },
@@ -7,9 +7,9 @@
7
7
  const { validateConfig, runSchema, formatErrors, loadConfig } = require('../../../vendor/config/index.js');
8
8
 
9
9
  const path = require('path');
10
- const Manager = require('../../../build.js');
10
+ const build = require('../../../build.js');
11
11
  const defineCases = require('../../../vendor/devkit/test/define-cases.js');
12
- const root = Manager.getRootPath('main');
12
+ const root = build.getRootPath('main');
13
13
 
14
14
  // Minimal "good" config — passes every required check.
15
15
  const VALID = {
@@ -25,10 +25,10 @@ module.exports = defineCases({
25
25
  },
26
26
  {
27
27
  // wave-5 F1: main.js must release the deep-link boot queue after full init.
28
- name: 'main.js drains the deep-link boot queue via markManagerReady()',
28
+ name: 'main.js drains the deep-link boot queue via markOmegaReady()',
29
29
  run: (ctx) => {
30
30
  const source = fs.readFileSync(path.join(SRC, 'main.js'), 'utf8');
31
- ctx.expect(source.includes('deepLink.markManagerReady()')).toBe(true);
31
+ ctx.expect(source.includes('deepLink.markOmegaReady()')).toBe(true);
32
32
  },
33
33
  },
34
34
  ],