@bevel-software/platform-core-backend 0.9.1 → 0.10.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 (38) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/dist/core/create-core-server.d.ts.map +1 -1
  3. package/dist/core/create-core-server.js +4 -0
  4. package/dist/core/create-core-server.js.map +1 -1
  5. package/dist/core/create-core-services.d.ts +3 -0
  6. package/dist/core/create-core-services.d.ts.map +1 -1
  7. package/dist/core/create-core-services.js +11 -0
  8. package/dist/core/create-core-services.js.map +1 -1
  9. package/dist/core-config.d.ts +19 -1
  10. package/dist/core-config.d.ts.map +1 -1
  11. package/dist/core-config.js +44 -4
  12. package/dist/core-config.js.map +1 -1
  13. package/dist/modules/update-check/update-check.routes.d.ts +13 -0
  14. package/dist/modules/update-check/update-check.routes.d.ts.map +1 -0
  15. package/dist/modules/update-check/update-check.routes.js +21 -0
  16. package/dist/modules/update-check/update-check.routes.js.map +1 -0
  17. package/dist/modules/update-check/update-check.service.d.ts +57 -0
  18. package/dist/modules/update-check/update-check.service.d.ts.map +1 -0
  19. package/dist/modules/update-check/update-check.service.js +109 -0
  20. package/dist/modules/update-check/update-check.service.js.map +1 -0
  21. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  22. package/dist/modules/workflow/git/git.service.js +8 -0
  23. package/dist/modules/workflow/git/git.service.js.map +1 -1
  24. package/dist/version.d.ts +14 -0
  25. package/dist/version.d.ts.map +1 -1
  26. package/dist/version.js +25 -0
  27. package/dist/version.js.map +1 -1
  28. package/package.json +4 -4
  29. package/src/__tests__/core-config.domain.test.ts +92 -0
  30. package/src/core/create-core-server.ts +8 -0
  31. package/src/core/create-core-services.ts +14 -0
  32. package/src/core-config.ts +48 -4
  33. package/src/modules/update-check/__tests__/update-check.routes.test.ts +69 -0
  34. package/src/modules/update-check/__tests__/update-check.service.test.ts +170 -0
  35. package/src/modules/update-check/update-check.routes.ts +28 -0
  36. package/src/modules/update-check/update-check.service.ts +130 -0
  37. package/src/modules/workflow/git/git.service.ts +8 -0
  38. package/src/version.ts +28 -0
package/src/version.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { readFileSync } from 'node:fs';
2
+
1
3
  /**
2
4
  * The git commit the running build was produced from, surfaced by
3
5
  * `GET /api/health` so the deploy pipeline can confirm a staging/production
@@ -17,3 +19,29 @@ export function resolveGitSha(env: NodeJS.ProcessEnv = process.env): string {
17
19
  }
18
20
 
19
21
  export const GIT_SHA = resolveGitSha();
22
+
23
+ /**
24
+ * The RELEASE version of the running build — this package's own `version`
25
+ * field, which the fixed-group release process keeps equal to the deployment's
26
+ * release tag (`v<version>`). This is what the update check compares against
27
+ * the newest published release; the git sha above identifies a build, but two
28
+ * shas can't tell "behind" from "ahead".
29
+ *
30
+ * Read from the packaged `package.json`, one hop up from this module in both
31
+ * layouts (`src/` in-repo and tsx, `dist/` compiled — same trick as
32
+ * `assets.ts`). Lazily and defensively: a build that somehow ships without a
33
+ * readable manifest answers `'unknown'`, which the update check treats as
34
+ * "never announce an update" rather than an error.
35
+ */
36
+ export function resolveAppVersion(): string {
37
+ try {
38
+ const manifest = JSON.parse(
39
+ readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
40
+ ) as { version?: unknown };
41
+ return typeof manifest.version === 'string' && manifest.version
42
+ ? manifest.version
43
+ : 'unknown';
44
+ } catch {
45
+ return 'unknown';
46
+ }
47
+ }