diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eaab57..494d871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …). +## events@3.5.0, contracts@1.13.0, agent@1.3.1 - 2026-11-20 + +- **Agent 1.3.1:** agent 1.3.0 still reported itself as 1.2.0 (`AGENT_VERSION` in `src/stats.ts` + wasn't bumped with `package.json`), so the Hub refused `.env` jobs on it. Use 1.3.1. + +Loading demo data left a site that signs in through Accounts with no Accounts link, so nobody could +sign in (`ACCOUNTS_UNAVAILABLE`, found on events-demo). The Hub (2.9.0) now sees it. + +- **Contracts 1.13.0:** `stats.signIn` in the Cross Events heartbeat (mode, the linked Accounts, + the last sign-in failure; optional). +- **Events 3.5.0:** `set-demo.js` keeps `ProductLink` and `LinkNonce`; a site in Accounts mode + without a link reconnects at its next heartbeat even after an earlier auto-connect; sign-in + failures (start, finish, Accounts unreachable) are kept and sent to the Hub; What's New notes for + 3.4.0 (and Accounts 1.4.0) that were missing. + ## events@3.4.0, accounts@1.4.0, contracts@1.12.0, agent@1.3.0, crosscode script - 2026-11-20 Background jobs are switched on and off (and rescheduled) from each site's admin, over the .env; diff --git a/apps/accounts/WHATS-NEW.md b/apps/accounts/WHATS-NEW.md index 62065c3..4917442 100644 --- a/apps/accounts/WHATS-NEW.md +++ b/apps/accounts/WHATS-NEW.md @@ -3,6 +3,15 @@ What each version changes for the church, in plain language (read by the Hub like Cross Events' WHATS-NEW.md; a section shows once its version is tagged). +## 1.4.0 + +- **Better-looking emails.** Sign-in codes, password links, "your account is ready" and the other + emails from your church account now look like Cross Events' emails: your church's colour and logo + at the top, a clear button, and your church's contact details at the bottom. +- Admins: **Admin → Background jobs** shows what Accounts does on a schedule (backups, privacy + requests, tidying up), when it last ran, and lets you run a job now, switch it off or change when + it runs. + ## 1.3.0 - Your account and the admin pages have a new look, like Cross Events: a menu down the side, and diff --git a/apps/agent/package.json b/apps/agent/package.json index bf801e3..21d434e 100644 --- a/apps/agent/package.json +++ b/apps/agent/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/agent", - "version": "1.3.0", + "version": "1.3.1", "private": true, "description": "The server agent: runs the crosscode script for signed jobs from Cross Code Hub, reports stats (docs/AGENT-1.0-PLAN.md)", "license": "UNLICENSED", diff --git a/apps/agent/src/stats.ts b/apps/agent/src/stats.ts index 62c138c..dd76b6a 100644 --- a/apps/agent/src/stats.ts +++ b/apps/agent/src/stats.ts @@ -12,7 +12,7 @@ import { paths } from "./paths"; * the tools that are there; anything missing is null rather than an error. */ -export const AGENT_VERSION = "1.2.0"; +export const AGENT_VERSION = "1.3.1"; function run(cmd: string, args: string[], timeoutMs = 10_000): Promise { return new Promise((resolve) => { diff --git a/apps/events/CHANGELOG.md b/apps/events/CHANGELOG.md index 5b1a769..4dad74b 100644 --- a/apps/events/CHANGELOG.md +++ b/apps/events/CHANGELOG.md @@ -5,6 +5,24 @@ All notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project follows [Semantic Versioning](https://semver.org/). +## [3.5.0] - 2026-11-20 + +### Fixed + +- **After "Load demo data" nobody could sign in** ("Sign-in isn't available right now", + `ACCOUNTS_UNAVAILABLE`). `scripts/set-demo.js` emptied `ProductLink` (it keeps only a few tables) + but kept `AppSetting`, so the site stayed in Accounts mode with no Accounts link, and + `accounts_auto_connected` stopped it reconnecting. Demo data now keeps `ProductLink` and + `LinkNonce`, and a site in Accounts mode without a link connects to the Accounts the Hub lists at + its next heartbeat whatever happened before (a site on its own sign-in still keeps an admin's + Disconnect). + +### Added + +- Heartbeat `stats.signIn` (contracts 1.13.0): the sign-in mode, the linked Accounts (install id and + address) and the last failure to start or finish a sign-in (`accounts_last_signin_error`, cleared + by the next sign-in that works). The Hub 2.9.0 alerts on it. + ## [3.4.0] - 2026-11-20 ### Added diff --git a/apps/events/WHATS-NEW.md b/apps/events/WHATS-NEW.md index 8d28622..e2f472d 100644 --- a/apps/events/WHATS-NEW.md +++ b/apps/events/WHATS-NEW.md @@ -12,6 +12,21 @@ Write for church admins, not developers: no environment variables, endpoints or developer log is CHANGELOG.md. A tagged version without a section here shows "No details given". --> +## 3.5.0 + +- **Fix:** after loading demo data, nobody could sign in: the site forgot its link to the church's + sign-in (Accounts). Demo data keeps it now, and a site that lost it connects again by itself + within about 15 minutes of updating. +- When signing in fails, Cross Code is told why, so it can help sooner. + +## 3.4.0 + +- **Switch background jobs on and off yourself.** Settings → Background jobs has a switch for each + job (reminders, backups, the daily summary and so on) and lets you change when it runs, with ready + choices such as "every 15 minutes" or "daily at 07:00". It works straight away, no restart needed, + and one click puts a job back to how the server normally runs it. +- **Run now** works for a job that's switched off too, for when you want it once. + ## 3.3.0 - **Fix:** a new logo or favicon sometimes didn't show after saving. It's saved and shown properly diff --git a/apps/events/backend/package.json b/apps/events/backend/package.json index 29397cc..2e4b2c0 100644 --- a/apps/events/backend/package.json +++ b/apps/events/backend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events-backend", - "version": "3.4.0", + "version": "3.5.0", "description": "Event Management System Backend", "main": "src/index.js", "scripts": { diff --git a/apps/events/backend/scripts/set-demo.js b/apps/events/backend/scripts/set-demo.js index 1df8407..934bf56 100644 --- a/apps/events/backend/scripts/set-demo.js +++ b/apps/events/backend/scripts/set-demo.js @@ -76,6 +76,9 @@ const LIST_ONLY = process.argv.includes('--list'); const KEEP_TABLES = new Set([ '_prisma_migrations', 'AppSetting', 'User', 'SecurityEvent', 'PasswordReset', 'TwoFactorChallenge', 'TrustedDevice', + // 3.5.0: the links to the church's other products (Accounts above all: in Accounts mode, without + // its link nobody can sign in). Their feeds are data and go. + 'ProductLink', 'LinkNonce', ]); const SCHEDULED_EMAILS_PATH = path.resolve(__dirname, '../data/scheduled-emails.json'); diff --git a/apps/events/backend/src/accounts/autoConnect.ts b/apps/events/backend/src/accounts/autoConnect.ts index 0fcd55f..d693bdb 100644 --- a/apps/events/backend/src/accounts/autoConnect.ts +++ b/apps/events/backend/src/accounts/autoConnect.ts @@ -7,12 +7,16 @@ import { connectTo } from '../links/connect'; import { linkedProducts } from '../links/store'; import { accountsLink } from './client'; -import { getSetting, setSetting } from './mode'; +import { getSetting, setSetting, viaAccounts } from './mode'; export const AUTO_KEY = 'accounts_auto_connected'; export async function connectAccountsIfListed(now = new Date()): Promise<'connected' | 'skipped'> { - if (await getSetting(AUTO_KEY)) return 'skipped'; + // 3.5.0: a site that signs in through Accounts but has lost its link (before 3.5.0, loading demo + // data deleted it) can't sign anyone in, so it reconnects whatever was done before. A site on its + // own sign-in keeps an admin's Disconnect. + const stranded = (await viaAccounts()) && !(await accountsLink()); + if ((await getSetting(AUTO_KEY)) && !stranded) return 'skipped'; if (await accountsLink()) { await setSetting(AUTO_KEY, now.toISOString()); return 'skipped'; diff --git a/apps/events/backend/src/accounts/signin.ts b/apps/events/backend/src/accounts/signin.ts index 5ede6d0..c029a4a 100644 --- a/apps/events/backend/src/accounts/signin.ts +++ b/apps/events/backend/src/accounts/signin.ts @@ -20,6 +20,7 @@ import { siteUrl } from '../feed/context'; import { accounts, AccountsUnavailable } from './client'; import { viaAccounts } from './mode'; import { handleAccountsCall } from './calls'; +import { clearSignInError, recordSignInError } from './status'; /* eslint-disable @typescript-eslint/no-require-imports -- CommonJS */ const prisma = require('../config/db'); @@ -144,7 +145,10 @@ async function startSignIn(req: Request, res: Response) { return res.redirect(303, url); } catch (e) { console.warn('[accounts] sign-in could not start:', (e as Error).message); - return problem(res, e instanceof AccountsUnavailable ? 'ACCOUNTS_UNAVAILABLE' : 'START_FAILED', returnTo); + const failed = e instanceof AccountsUnavailable ? 'ACCOUNTS_UNAVAILABLE' : 'START_FAILED'; + // 3.5.0: the reason goes to the Hub with the next heartbeat (the page only says "try again"). + await recordSignInError(failed, (e as Error).message); + return problem(res, failed, returnTo); } } @@ -158,7 +162,8 @@ async function callback(req: Request, res: Response) { let auth; try { auth = await accounts(); - } catch { + } catch (e) { + await recordSignInError('ACCOUNTS_UNAVAILABLE', (e as Error).message); return problem(res, 'ACCOUNTS_UNAVAILABLE'); } let signed; @@ -168,8 +173,10 @@ async function callback(req: Request, res: Response) { } catch (e) { const code = (e as { code?: string }).code; console.warn('[accounts] sign-in could not finish:', (e as Error).message); + if (code !== 'NO_PENDING') await recordSignInError('FINISH_FAILED', (e as Error).message); return problem(res, code === 'NO_PENDING' ? 'EXPIRED' : 'FINISH_FAILED'); } + await clearSignInError(); const { claims, returnTo, idToken } = signed; const found = await userForClaims(claims); diff --git a/apps/events/backend/src/accounts/status.ts b/apps/events/backend/src/accounts/status.ts new file mode 100644 index 0000000..ede644c --- /dev/null +++ b/apps/events/backend/src/accounts/status.ts @@ -0,0 +1,32 @@ +/** + * How people sign in here, for the Hub (3.5.0, heartbeat `stats.signIn`, contracts 1.13.0): the + * mode, the Accounts this site is linked to, and the last sign-in that failed to start or finish. + * A site in `accounts` mode without a link can't sign anyone in; the Hub raises an alert for it. + */ +import { accountsLink } from './client'; +import { authMode, getSetting, setSetting } from './mode'; + +export const LAST_ERROR_KEY = 'accounts_last_signin_error'; + +type LastError = { at: string; code: string; message: string }; + +/** Keeps the last failure (a code and a sentence; never tokens or cookies). */ +export async function recordSignInError(code: string, message: string, now = new Date()): Promise { + const value: LastError = { at: now.toISOString(), code: code.slice(0, 60), message: message.replace(/\s+/g, ' ').slice(0, 500) }; + await setSetting(LAST_ERROR_KEY, JSON.stringify(value)).catch(() => {}); +} + +/** A sign-in that worked clears it. */ +export async function clearSignInError(): Promise { + if (await getSetting(LAST_ERROR_KEY).catch(() => null)) await setSetting(LAST_ERROR_KEY, null).catch(() => {}); +} + +export async function signInStatus(): Promise<{ mode: 'local' | 'accounts'; accounts: { installId: string; url: string } | null; lastError: LastError | null }> { + const [mode, link, raw] = await Promise.all([authMode(), accountsLink(), getSetting(LAST_ERROR_KEY).catch(() => null)]); + let lastError: LastError | null = null; + try { + const parsed = raw ? JSON.parse(raw) : null; + if (parsed && typeof parsed.at === 'string' && typeof parsed.code === 'string' && typeof parsed.message === 'string') lastError = parsed; + } catch { /* an unreadable value is no error */ } + return { mode, accounts: link ? { installId: link.installId, url: link.url } : null, lastError }; +} diff --git a/apps/events/backend/src/hub/report.js b/apps/events/backend/src/hub/report.js index b5a804e..15b294b 100644 --- a/apps/events/backend/src/hub/report.js +++ b/apps/events/backend/src/hub/report.js @@ -145,10 +145,13 @@ async function stats(now = new Date()) { const live = await liveNow(now).catch(() => undefined); const campusesOn = await campusesEnabled().catch(() => false); const campusCount = campusesOn ? await prisma.campus.count({ where: { archivedAt: null } }) : 0; + // 3.5.0: how people sign in (the Hub flags a site in Accounts mode without a link, or failing). + const signIn = await require('../accounts/status').signInStatus().catch(() => undefined); return { users, events: { active: activeEvents, upcoming: upcomingEvents, total: totalEvents }, ...(live ? { live } : {}), + ...(signIn ? { signIn } : {}), registrations: { last30d: regs30, total: regsTotal }, tickets: { last30d: tickets30, total: ticketsTotal }, checkIns: { last30d: checkIns30 }, diff --git a/apps/events/backend/tests/accountsAutoConnect.test.ts b/apps/events/backend/tests/accountsAutoConnect.test.ts index 94e4919..cbb64d3 100644 --- a/apps/events/backend/tests/accountsAutoConnect.test.ts +++ b/apps/events/backend/tests/accountsAutoConnect.test.ts @@ -7,7 +7,9 @@ let mockLink: object | null = null; jest.mock('../src/links/connect', () => ({ connectTo: async (...args: unknown[]) => { mockConnects.push(args); mockLink = { installId: args[0] }; } })); jest.mock('../src/links/store', () => ({ linkedProducts: async () => mockListed })); jest.mock('../src/accounts/client', () => ({ accountsLink: async () => mockLink })); +let mockMode = 'local'; jest.mock('../src/accounts/mode', () => ({ + viaAccounts: async () => mockMode === 'accounts', getSetting: async (k: string) => mockSettings.get(k) ?? null, setSetting: async (k: string, v: string | null) => { if (v === null) mockSettings.delete(k); else mockSettings.set(k, v); }, })); @@ -21,6 +23,7 @@ beforeEach(() => { mockConnects.length = 0; mockListed = []; mockLink = null; + mockMode = 'local'; }); test('connects to the Accounts the Hub lists, as the system, once', async () => { @@ -46,3 +49,13 @@ test('already connected by an admin: just remembers it', async () => { expect(mockConnects).toEqual([]); expect(mockSettings.has(AUTO_KEY)).toBe(true); }); + +test('3.5.0: a site in Accounts mode that lost its link (a demo load before 3.5.0) connects again', async () => { + mockSettings.set(AUTO_KEY, '2026-11-19T10:00:00.000Z'); + mockListed = [{ installId: ACCOUNTS, product: 'accounts' }]; + // On its own sign-in, an earlier Disconnect stays. + expect(await connectAccountsIfListed()).toBe('skipped'); + mockMode = 'accounts'; + expect(await connectAccountsIfListed()).toBe('connected'); + expect(mockConnects).toEqual([[ACCOUNTS, { id: null, role: 'system' }, null, expect.any(Date)]]); +}); diff --git a/apps/events/backend/tests/accountsStatus.test.ts b/apps/events/backend/tests/accountsStatus.test.ts new file mode 100644 index 0000000..6c8d036 --- /dev/null +++ b/apps/events/backend/tests/accountsStatus.test.ts @@ -0,0 +1,32 @@ +// 3.5.0: how people sign in, for the Hub (heartbeat stats.signIn, contracts 1.13.0). +import { hub } from '@crosscode/contracts'; + +const mockSettings = new Map(); +let mockMode = 'accounts'; +let mockLink: object | null = null; + +jest.mock('../src/accounts/client', () => ({ accountsLink: async () => mockLink })); +jest.mock('../src/accounts/mode', () => ({ + authMode: async () => mockMode, + getSetting: async (k: string) => mockSettings.get(k) ?? null, + setSetting: async (k: string, v: string | null) => { if (v === null) mockSettings.delete(k); else mockSettings.set(k, v); }, +})); + +import { clearSignInError, recordSignInError, signInStatus } from '../src/accounts/status'; + +beforeEach(() => { mockSettings.clear(); mockMode = 'accounts'; mockLink = null; }); + +test('Accounts mode without a link, and why the last sign-in failed', async () => { + await recordSignInError('ACCOUNTS_UNAVAILABLE', 'Accounts isn\'t connected.\nConnect it under Settings → Linked products.', new Date('2026-11-20T10:00:00.000Z')); + const s = await signInStatus(); + expect(s).toEqual({ mode: 'accounts', accounts: null, lastError: { at: '2026-11-20T10:00:00.000Z', code: 'ACCOUNTS_UNAVAILABLE', message: 'Accounts isn\'t connected. Connect it under Settings → Linked products.' } }); + // It fits the heartbeat's contract. + expect(hub.eventsStatsSchema.shape.signIn.safeParse(s).success).toBe(true); + await clearSignInError(); + expect((await signInStatus()).lastError).toBeNull(); +}); + +test('linked: the Accounts install and its address', async () => { + mockLink = { installId: 'acc-1', url: 'https://accounts.hope.test', secret: 'x', updatedAt: new Date() }; + expect((await signInStatus()).accounts).toEqual({ installId: 'acc-1', url: 'https://accounts.hope.test' }); +}); diff --git a/apps/events/frontend/package.json b/apps/events/frontend/package.json index a7cffc5..e3c12ea 100644 --- a/apps/events/frontend/package.json +++ b/apps/events/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events-frontend", - "version": "3.4.0", + "version": "3.5.0", "private": true, "scripts": { "dev": "next dev", diff --git a/apps/events/package.json b/apps/events/package.json index 19df283..412ca48 100644 --- a/apps/events/package.json +++ b/apps/events/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events", - "version": "3.4.0", + "version": "3.5.0", "main": "index.js", "scripts": { "dev:backend": "cd backend && npm run dev", diff --git a/docs/VERSIONS.md b/docs/VERSIONS.md index 7eab1b5..761f993 100644 --- a/docs/VERSIONS.md +++ b/docs/VERSIONS.md @@ -10,11 +10,11 @@ separately below; the two often differ. | What | Repo | Latest | Tag | Released | |------|------|--------|-----|----------| -| Cross Events | `crosscode-platform` (`apps/events`) | **3.4.0** | `events@3.4.0` | 2026-11-20 | +| Cross Events | `crosscode-platform` (`apps/events`) | **3.5.0** | `events@3.5.0` | 2026-11-20 | | Accounts | `crosscode-platform` (`apps/accounts`) | **1.4.0** | `accounts@1.4.0` | 2026-11-20 | -| Server agent | `crosscode-platform` (`apps/agent`) | **1.3.0** | `agent@1.3.0` | 2026-11-20 | -| Contracts | `crosscode-platform` (`packages/contracts`) | **1.12.0** | `contracts@1.12.0` | 2026-11-20 | -| Cross Code Hub | `events-hub` | **2.8.0** | `v2.8.0` | 2026-11-20 | +| Server agent | `crosscode-platform` (`apps/agent`) | **1.3.1** | `agent@1.3.1` | 2026-11-20 | +| Contracts | `crosscode-platform` (`packages/contracts`) | **1.13.0** | `contracts@1.13.0` | 2026-11-20 | +| Cross Code Hub | `events-hub` | **2.9.0** | `v2.9.0` | 2026-11-20 | | crosscode.co.za | `crosscode-site` | **1.6.0** | `v1.6.0` | 2026-11-19 | | `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-20 (last change: `crosscode env`) | @@ -37,6 +37,12 @@ need their own tags until something outside this repo depends on them. ## What each latest release was for +- **Events 3.5.0 + contracts 1.13.0 + agent 1.3.1 + Hub 2.9.0:** loading demo data no longer deletes + the Accounts link (on events-demo nobody could sign in); a site in Accounts mode without a link + reconnects at its next heartbeat; the heartbeat says how the site signs in and the last failure, + and the Hub alerts when it isn't linked, is linked wrongly or sign-ins fail. **Agent 1.3.0 + reported itself as 1.2.0**, so the Hub refused its .env jobs: install 1.3.1. No migrations. + - **Events 3.4.0 + Accounts 1.4.0 + contracts 1.12.0 + agent 1.3.0 + Hub 2.8.0:** background jobs switched on and off (and rescheduled) from each site's admin, over the .env (saved in the database, no migration); Accounts' emails styled as Cross Events'; the Hub shows an install's diff --git a/package-lock.json b/package-lock.json index c8444c6..e40f401 100644 --- a/package-lock.json +++ b/package-lock.json @@ -109,7 +109,7 @@ }, "apps/agent": { "name": "@crosscode/agent", - "version": "1.3.0", + "version": "1.3.1", "license": "UNLICENSED", "dependencies": { "@crosscode/contracts": "*", @@ -128,7 +128,7 @@ }, "apps/events/backend": { "name": "@crosscode/events-backend", - "version": "3.4.0", + "version": "3.5.0", "hasInstallScript": true, "dependencies": { "@cj-tech-master/excelts": "^10.2.0", @@ -178,7 +178,7 @@ }, "apps/events/frontend": { "name": "@crosscode/events-frontend", - "version": "3.4.0", + "version": "3.5.0", "dependencies": { "@crosscode/contracts": "*", "@crosscode/seo": "*", @@ -21276,7 +21276,7 @@ }, "packages/contracts": { "name": "@crosscode/contracts", - "version": "1.12.0", + "version": "1.13.0", "license": "UNLICENSED", "dependencies": { "zod": "^4.6.7" diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 40a376d..7c83f98 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/contracts", - "version": "1.12.0", + "version": "1.13.0", "description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads", "license": "UNLICENSED", "type": "commonjs", diff --git a/packages/contracts/schemas/hub-heartbeat-request.json b/packages/contracts/schemas/hub-heartbeat-request.json index 7cc56d9..3f5d497 100644 --- a/packages/contracts/schemas/hub-heartbeat-request.json +++ b/packages/contracts/schemas/hub-heartbeat-request.json @@ -324,6 +324,77 @@ "eventsNow", "checkInsLastHour" ] + }, + "signIn": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "local", + "accounts" + ] + }, + "accounts": { + "anyOf": [ + { + "type": "object", + "properties": { + "installId": { + "type": "string", + "maxLength": 100 + }, + "url": { + "type": "string", + "maxLength": 500 + } + }, + "required": [ + "installId", + "url" + ] + }, + { + "type": "null" + } + ] + }, + "lastError": { + "anyOf": [ + { + "type": "object", + "properties": { + "at": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + "code": { + "type": "string", + "maxLength": 60 + }, + "message": { + "type": "string", + "maxLength": 500 + } + }, + "required": [ + "at", + "code", + "message" + ] + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "mode", + "accounts", + "lastError" + ] } }, "required": [ diff --git a/packages/contracts/src/hub.ts b/packages/contracts/src/hub.ts index 05432e0..2c443e4 100644 --- a/packages/contracts/src/hub.ts +++ b/packages/contracts/src/hub.ts @@ -196,6 +196,18 @@ export const eventsStatsSchema = z.object({ * 30 minutes), and tickets checked in during the last hour. Optional: older installs don't send it. */ live: z.object({ eventsNow: count, checkInsLastHour: count }).optional(), + /** + * 1.13.0: how people sign in, so the Hub can flag a site that can't. `mode`: Cross Events' own + * sign-in or the church's Accounts; `accounts`: the Accounts install it's linked to (null: not + * linked, which with mode `accounts` means nobody can sign in); `lastError`: the last time + * starting or finishing a sign-in failed (cleared by the next one that works). Optional: older + * installs don't send it. + */ + signIn: z.object({ + mode: z.enum(["local", "accounts"]), + accounts: z.object({ installId: z.string().max(100), url: z.string().max(500) }).nullable(), + lastError: z.object({ at: dateTimeSchema, code: z.string().max(60), message: z.string().max(500) }).nullable(), + }).optional(), }); /** Church Website. `storage` is what the extra-storage add-on is billed on (ROADMAP-v3 §10). */