contracts 1.20.0: devotionals, Bible passages, messaging.get, WhatsApp opt-out, App export

The contracts for Church App 1.0.0 (docs/APP-1.0-PLAN.md §12). Additive.

- crosscode.devotional/1, the Hub's devotionals reply, and the devotionals CSV
  import (parseCsv, checkDevotionalCsv, template), shared by the Hub and the App
- Bible books (USFM, English and Afrikaans), seven translations with YouVersion
  ids and copyright lines, parseBibleReference, youVersionUrl
- messaging.get and the messaging.changed hint; whatsapp.optout and
  whatsapp_opted_out on the profile
- APP_MODULES, hub.DEVOTIONALS_PATH, agent.APP_DEMO_PROFILES, app in DEMO_PRODUCTS
- the app section of the church export, people[].roles
- Accounts refuses the two new requests until 1.9.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 09:54:25 +02:00
co-authored by Claude Opus 5.5
parent 8372ef8c6b
commit 514a6d8bc0
39 changed files with 2993 additions and 15 deletions
+12
View File
@@ -222,6 +222,7 @@ export const websiteStatsSchema = z.object({
/** Church App. `activeMembers90d` is what the App tier is billed on. */
export const appStatsSchema = z.object({
activeMembers90d: activeMemberBandSchema,
/** The modules switched on (`APP_MODULES`; any slug, so a later module never breaks an older Hub). */
modules: z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)),
prayer: z.object({
/** Share of the last 7 days' hours with at least one commitment, 0–100. */
@@ -324,6 +325,17 @@ export const storageRequestResponseSchema = z.object({
});
export type StorageRequestResponse = z.infer<typeof storageRequestResponseSchema>;
// ---------------------------------------------------------------------------------------------
// Cross Code's devotionals (contracts 1.20.0, Hub 2.26.0, APP-1.0-PLAN §6): an App set to "From
// Cross Code" fetches the next 3 months once a night (and on "Sync now"), and keeps its copy, so a
// Hub outage changes nothing. `GET /api/v2/devotionals?from=YYYY-MM-DD` with
// `Authorization: Bearer <the install's licence token>`; App licences only (`403 NOT_AN_APP`),
// active or in grace (`403 LICENCE_INACTIVE`). The answer is a `devotionalsReplySchema`.
// ---------------------------------------------------------------------------------------------
export const DEVOTIONALS_PATH = "/api/v2/devotionals";
export const DEVOTIONALS_ERROR_CODES = ["NOT_AN_APP", "LICENCE_INACTIVE", "BAD_LICENCE", "INVALID_REQUEST"] as const;
// ---------------------------------------------------------------------------------------------
// AI (as v1; usage is recorded per product on the Hub, the cap stays per customer)
// ---------------------------------------------------------------------------------------------