Hub 2.0 step 2: protocol v2 next to v1

- Accepts protocol 1 and 2 (utils/protocol.js); v2 bodies checked with the
  contracts' zod schemas (400 INVALID_REQUEST), v1 unchanged
- v2 register/heartbeat carry product (409 WRONG_PRODUCT on a mismatch),
  register stores the install's public key, stats stored per product
- v2 replies add linkedProducts (the church's other installs in use with a
  public key); v1 replies unchanged
- Licence tokens carry customerId and product
- Until releases per product, only Events installs get releases / "behind"
- Tests: every contract sample through the real routes, replies checked
  against the contract response schemas

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-04 15:37:02 +02:00
co-authored by Claude Opus 5.5
parent 56370419bb
commit ab6a0c6914
6 changed files with 378 additions and 19 deletions
+2 -1
View File
@@ -48,7 +48,8 @@ function summary(install, settings, now = new Date()) {
url: install.url,
customer: install.customer ? { id: install.customer.id, name: install.customer.name } : null,
version: install.version,
behind: !!(settings.latest_version && install.version && compareVersions(install.version, settings.latest_version) < 0),
// Releases are Cross Events' until releases per product (Hub 2.0 step 3).
behind: !!(install.product === 'events' && settings.latest_version && install.version && compareVersions(install.version, settings.latest_version) < 0),
licence: install.licence ? { id: install.licence.id, status: install.licence.status, expiresAt: install.licence.expiresAt } : null,
lastHeartbeatAt: install.lastHeartbeatAt,
status: worst,