contracts 1.21.0: demo scenarios, eight churches across every product
agent.DEMO_SCENARIOS (one per Website demo profile, each its own fictional church), DEMO_SCENARIO_ORDER (Accounts first), DEMO_SCENARIO_MIN_VERSIONS, scenario in seed-demo, accounts in DEMO_PRODUCTS, a profile per scenario for Events and the App, SEED_SCENARIO_MIN_AGENT (1.7.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,26 @@
|
|||||||
|
|
||||||
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
|
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
|
||||||
|
|
||||||
|
## contracts@1.21.0 - 2026-11-30
|
||||||
|
|
||||||
|
Demo scenarios (docs/APP-1.0-PLAN.md §12, "Demo scenarios"): one choice on a demo client in the
|
||||||
|
Hub loads every product with the same church. Additive for `seed-demo` jobs older Hubs send.
|
||||||
|
|
||||||
|
- **`agent.DEMO_SCENARIOS`**: eight, one per Website demo profile and keyed by it, each its own
|
||||||
|
fictional church (St Columba's, Grace Cathedral, Ignite Church, Harbour City, Acacia Hill, Karoo
|
||||||
|
Gemeenskapskerk, Northpoint, Riverside) with a label, description, campuses, language, the App's
|
||||||
|
active-member band, and the profile each product loads. `demoScenario(key)`,
|
||||||
|
`DEMO_SCENARIO_ORDER` (Accounts, Events, Website, App), `DEMO_SCENARIO_MIN_VERSIONS` (Accounts
|
||||||
|
1.9.0, Events 3.8.0, Website 1.8.0, App 1.0.0).
|
||||||
|
- **`seed-demo`** takes an optional `scenario`; its `profile` must then be the scenario's for the
|
||||||
|
product. `accounts` joins `DEMO_PRODUCTS` (the scenario's church profile, logo, icon and people;
|
||||||
|
no `adminEmail`). Events gets a profile per scenario next to its four (`EVENTS_DEMO_PROFILES`),
|
||||||
|
so a scenario name with no `product` is an Events demo.
|
||||||
|
- **`APP_DEMO_PROFILES`** is the eight scenarios. 1.20.0's `acacia-hill` is gone: it's the
|
||||||
|
`community-family` scenario, and no App or Hub had used it.
|
||||||
|
- `SEED_SCENARIO_MIN_AGENT` (1.7.0) and `SEED_DEMO_MIN_AGENT_BY_PRODUCT`. JSON Schema `agent-job`
|
||||||
|
regenerated.
|
||||||
|
|
||||||
## contracts@1.20.0 - 2026-11-30
|
## contracts@1.20.0 - 2026-11-30
|
||||||
|
|
||||||
The contracts for Church App 1.0.0 (docs/APP-1.0-PLAN.md §12), the first step of phase 6. Additive:
|
The contracts for Church App 1.0.0 (docs/APP-1.0-PLAN.md §12), the first step of phase 6. Additive:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ it goes on sale (crosscode-site, ROADMAP §9).
|
|||||||
|
|
||||||
**Done when:**
|
**Done when:**
|
||||||
|
|
||||||
- `app@1.0.0`, `contracts@1.20.0` (released 2026-11-30), `contracts@1.21.0`, `accounts@1.9.0`,
|
- `app@1.0.0`, `contracts@1.20.0` (released 2026-11-30), `contracts@1.21.0` (released 2026-11-30), `accounts@1.9.0`,
|
||||||
`events@3.8.0`, `website@1.8.0`, `agent@1.7.0` and Hub `v2.26.0` are tagged; the Hub installs
|
`events@3.8.0`, `website@1.8.0`, `agent@1.7.0` and Hub `v2.26.0` are tagged; the Hub installs
|
||||||
the App from New install (after Accounts) and lists its releases.
|
the App from New install (after Accounts) and lists its releases.
|
||||||
- On a demo client, **Load a demo scenario** in the Hub loads Accounts, Events, the Website and
|
- On a demo client, **Load a demo scenario** in the Hub loads Accounts, Events, the Website and
|
||||||
@@ -490,7 +490,7 @@ data that describes **the same church**, so a demo shows the three products work
|
|||||||
Between them, the App's active members cover every band from 0–100 to 2 001–5 000 and Events'
|
Between them, the App's active members cover every band from 0–100 to 2 001–5 000 and Events'
|
||||||
income bands vary, so the scenarios also show the Hub's tiers and billing. Each scenario's people
|
income bands vary, so the scenarios also show the Hub's tiers and billing. Each scenario's people
|
||||||
are sized to its band (the App's active-member count comes from them).
|
are sized to its band (the App's active-member count comes from them).
|
||||||
- **Contracts 1.21.0:** `agent.DEMO_SCENARIOS`: each scenario's key, label, description, and the
|
- **Contracts 1.21.0 (released 2026-11-30):** `agent.DEMO_SCENARIOS`: each scenario's key, label, description, and the
|
||||||
profile it uses for each product (`accounts`, `events`, `website`, `app`), so the Hub and the
|
profile it uses for each product (`accounts`, `events`, `website`, `app`), so the Hub and the
|
||||||
agent agree; a test checks every profile it names exists. `seed-demo` takes an optional
|
agent agree; a test checks every profile it names exists. `seed-demo` takes an optional
|
||||||
`scenario`, and `accounts` joins `DEMO_PRODUCTS` (its demo is the church profile and the people).
|
`scenario`, and `accounts` joins `DEMO_PRODUCTS` (its demo is the church profile and the people).
|
||||||
@@ -518,7 +518,7 @@ data that describes **the same church**, so a demo shows the three products work
|
|||||||
|------|--------|---------|
|
|------|--------|---------|
|
||||||
| `crosscode-platform` `apps/app` | New (§1–§12), with `CHANGELOG.md`, `WHATS-NEW.md`, `env.template.json`, e2e, demo data | `app@1.0.0` |
|
| `crosscode-platform` `apps/app` | New (§1–§12), with `CHANGELOG.md`, `WHATS-NEW.md`, `env.template.json`, e2e, demo data | `app@1.0.0` |
|
||||||
| `crosscode-platform` `packages/contracts` | `app` in `DEMO_PRODUCTS`, `APP_MODULES`, the `app` part of the church export, `crosscode.devotional/1` and its CSV rules, the translations, `messaging.get`, `whatsapp.optout` | `contracts@1.20.0` (**released 2026-11-30**) |
|
| `crosscode-platform` `packages/contracts` | `app` in `DEMO_PRODUCTS`, `APP_MODULES`, the `app` part of the church export, `crosscode.devotional/1` and its CSV rules, the translations, `messaging.get`, `whatsapp.optout` | `contracts@1.20.0` (**released 2026-11-30**) |
|
||||||
| `crosscode-platform` `packages/contracts` | `agent.DEMO_SCENARIOS`, `scenario` in `seed-demo`, `accounts` in `DEMO_PRODUCTS` | `contracts@1.21.0` |
|
| `crosscode-platform` `packages/contracts` | `agent.DEMO_SCENARIOS`, `scenario` in `seed-demo`, `accounts` in `DEMO_PRODUCTS` | `contracts@1.21.0` (**released 2026-11-30**) |
|
||||||
| `crosscode-platform` `apps/accounts` | `messaging.get` for linked products, a hint when the messaging settings change, the WhatsApp opt-out for every product; demo data (the scenario's church profile with its logo and icon, and its people) | `accounts@1.9.0` |
|
| `crosscode-platform` `apps/accounts` | `messaging.get` for linked products, a hint when the messaging settings change, the WhatsApp opt-out for every product; demo data (the scenario's church profile with its logo and icon, and its people) | `accounts@1.9.0` |
|
||||||
| `crosscode-platform` `apps/events` | STOP replies passed to Accounts; the opt-out read from Accounts; demo profiles reworked to the scenarios | `events@3.8.0` |
|
| `crosscode-platform` `apps/events` | STOP replies passed to Accounts; the opt-out read from Accounts; demo profiles reworked to the scenarios | `events@3.8.0` |
|
||||||
| `crosscode-platform` `apps/website` | Demo profiles take the scenario's people and events (`--scenario`) | `website@1.8.0` |
|
| `crosscode-platform` `apps/website` | Demo profiles take the scenario's people and events (`--scenario`) | `website@1.8.0` |
|
||||||
@@ -563,7 +563,7 @@ data that describes **the same church**, so a demo shows the three products work
|
|||||||
|
|
||||||
1. `contracts@1.20.0` (**released 2026-11-30**), then `accounts@1.9.0` (`messaging.get`, the
|
1. `contracts@1.20.0` (**released 2026-11-30**), then `accounts@1.9.0` (`messaging.get`, the
|
||||||
WhatsApp opt-out) and `events@3.8.0` (STOP passed to Accounts), rolled out to every church.
|
WhatsApp opt-out) and `events@3.8.0` (STOP passed to Accounts), rolled out to every church.
|
||||||
2. `contracts@1.21.0` (demo scenarios), with the scenario demo loaders in Accounts 1.9.0, Events
|
2. `contracts@1.21.0` (demo scenarios, **released 2026-11-30**), with the scenario demo loaders in Accounts 1.9.0, Events
|
||||||
3.8.0, `website@1.8.0`, and `agent@1.7.0`.
|
3.8.0, `website@1.8.0`, and `agent@1.7.0`.
|
||||||
3. Hub `v2.26.0` (vendored contracts 1.21.0) deployed, and the first 3 months of Cross Code
|
3. Hub `v2.26.0` (vendored contracts 1.21.0) deployed, and the first 3 months of Cross Code
|
||||||
devotionals written or imported.
|
devotionals written or imported.
|
||||||
|
|||||||
+7
-1
@@ -14,7 +14,7 @@ separately below; the two often differ.
|
|||||||
| Church Website | `crosscode-platform` (`apps/website`) | **1.7.1** | `website@1.7.1` | 2026-11-28 |
|
| Church Website | `crosscode-platform` (`apps/website`) | **1.7.1** | `website@1.7.1` | 2026-11-28 |
|
||||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.8.0** | `accounts@1.8.0` | 2026-11-26 |
|
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.8.0** | `accounts@1.8.0` | 2026-11-26 |
|
||||||
| Server agent | `crosscode-platform` (`apps/agent`) | **1.6.0** | `agent@1.6.0` | 2026-11-27 |
|
| Server agent | `crosscode-platform` (`apps/agent`) | **1.6.0** | `agent@1.6.0` | 2026-11-27 |
|
||||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.20.0** | `contracts@1.20.0` | 2026-11-30 |
|
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.21.0** | `contracts@1.21.0` | 2026-11-30 |
|
||||||
| Cross Code Hub | `events-hub` | **2.25.1** | `v2.25.1` | 2026-11-27 |
|
| Cross Code Hub | `events-hub` | **2.25.1** | `v2.25.1` | 2026-11-27 |
|
||||||
| crosscode.co.za | `crosscode-site` | **1.9.1** | `v1.9.1` | 2026-11-27 |
|
| crosscode.co.za | `crosscode-site` | **1.9.1** | `v1.9.1` | 2026-11-27 |
|
||||||
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-27 (last change: an uninstall keeps the Website's backup snapshots shared, `rsync -aH`) |
|
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-27 (last change: an uninstall keeps the Website's backup snapshots shared, `rsync -aH`) |
|
||||||
@@ -38,6 +38,12 @@ need their own tags until something outside this repo depends on them.
|
|||||||
|
|
||||||
## What each latest release was for
|
## What each latest release was for
|
||||||
|
|
||||||
|
- **Contracts 1.21.0 (2026-11-30):** demo scenarios (APP-1.0-PLAN §12): `agent.DEMO_SCENARIOS`,
|
||||||
|
eight fictional churches, one per Website demo profile, that load Accounts, Events, the Website
|
||||||
|
and the App alike; `scenario` in `seed-demo`, `accounts` in `DEMO_PRODUCTS`, a profile per
|
||||||
|
scenario for Events and the App (1.20.0's unused `acacia-hill` replaced by `community-family`),
|
||||||
|
the minimum releases and agent. Checked: contracts tests (335), JSON Schemas, lint, the agent's
|
||||||
|
tests. Nothing to deploy: the Hub vendors it with 2.26.0.
|
||||||
- **Contracts 1.20.0 (2026-11-30):** the contracts for Church App 1.0.0 (APP-1.0-PLAN §12), the
|
- **Contracts 1.20.0 (2026-11-30):** the contracts for Church App 1.0.0 (APP-1.0-PLAN §12), the
|
||||||
first step of phase 6: `crosscode.devotional/1` and the devotionals CSV checks shared by the Hub
|
first step of phase 6: `crosscode.devotional/1` and the devotionals CSV checks shared by the Hub
|
||||||
and the App, the Bible books and seven translations (YouVersion ids checked by Joshua),
|
and the App, the Bible books and seven translations (YouVersion ids checked by Joshua),
|
||||||
|
|||||||
Generated
+1
-1
@@ -23185,7 +23185,7 @@
|
|||||||
},
|
},
|
||||||
"packages/contracts": {
|
"packages/contracts": {
|
||||||
"name": "@crosscode/contracts",
|
"name": "@crosscode/contracts",
|
||||||
"version": "1.20.0",
|
"version": "1.21.0",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"zod": "^4.6.7"
|
"zod": "^4.6.7"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ Events and the Hub, uses it, so the key fields are the same in every product's J
|
|||||||
| Env template | `crosscode.env-template/1` | Each product's `.env` variables by layer; `missingRequired` and, from 1.6.0, `checkEnvValue` / `invalidValues` (values an app can't start with, e.g. `TRUST_PROXY=TRUE`), which the Hub checks before a job | `src/agent.ts` (exported as `agent`) |
|
| Env template | `crosscode.env-template/1` | Each product's `.env` variables by layer; `missingRequired` and, from 1.6.0, `checkEnvValue` / `invalidValues` (values an app can't start with, e.g. `TRUST_PROXY=TRUE`), which the Hub checks before a job | `src/agent.ts` (exported as `agent`) |
|
||||||
| Devotional | `crosscode.devotional/1` | From 1.20.0: one day's devotional for the Church App (Cross Code's from the Hub at `GET /api/v2/devotionals`, or the church's own), the CSV import's columns and row checks (`checkDevotionalCsv`, `DEVOTIONAL_CSV_TEMPLATE`), shared by the Hub and the App | `src/devotional.ts` |
|
| Devotional | `crosscode.devotional/1` | From 1.20.0: one day's devotional for the Church App (Cross Code's from the Hub at `GET /api/v2/devotionals`, or the church's own), the CSV import's columns and row checks (`checkDevotionalCsv`, `DEVOTIONAL_CSV_TEMPLATE`), shared by the Hub and the App | `src/devotional.ts` |
|
||||||
| Bible passages | — | From 1.20.0: the 66 books (USFM codes, English and Afrikaans names), the seven translations with their YouVersion ids and copyright lines, `parseBibleReference`, `formatBibleReference`, `youVersionUrl` | `src/bible.ts` |
|
| Bible passages | — | From 1.20.0: the 66 books (USFM codes, English and Afrikaans names), the seven translations with their YouVersion ids and copyright lines, `parseBibleReference`, `formatBibleReference`, `youVersionUrl` | `src/bible.ts` |
|
||||||
|
| Demo scenarios | — | From 1.21.0: `agent.DEMO_SCENARIOS`, eight preset churches that load every product of a demo client alike (Accounts first, `DEMO_SCENARIO_ORDER`), each product's profiles, the minimum releases and agent; `seed-demo` takes `scenario` | `src/agent.ts` (exported as `agent`) |
|
||||||
| Signing | — | HMAC request signing for the Hub and for product links (Node only) | `src/signing.ts` (`@crosscode/contracts/signing`) |
|
| Signing | — | HMAC request signing for the Hub and for product links (Node only) | `src/signing.ts` (`@crosscode/contracts/signing`) |
|
||||||
|
|
||||||
## Using it
|
## Using it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@crosscode/contracts",
|
"name": "@crosscode/contracts",
|
||||||
"version": "1.20.0",
|
"version": "1.21.0",
|
||||||
"description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads",
|
"description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
|
|||||||
@@ -824,7 +824,8 @@
|
|||||||
"enum": [
|
"enum": [
|
||||||
"events",
|
"events",
|
||||||
"website",
|
"website",
|
||||||
"app"
|
"app",
|
||||||
|
"accounts"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
@@ -835,7 +836,15 @@
|
|||||||
"small",
|
"small",
|
||||||
"events",
|
"events",
|
||||||
"ministry",
|
"ministry",
|
||||||
"multicampus"
|
"multicampus",
|
||||||
|
"heritage-parish",
|
||||||
|
"heritage-city",
|
||||||
|
"bold-youth",
|
||||||
|
"bold-plant",
|
||||||
|
"community-family",
|
||||||
|
"community-town",
|
||||||
|
"clean-modern",
|
||||||
|
"clean-campus"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -854,7 +863,14 @@
|
|||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"acacia-hill"
|
"heritage-parish",
|
||||||
|
"heritage-city",
|
||||||
|
"bold-youth",
|
||||||
|
"bold-plant",
|
||||||
|
"community-family",
|
||||||
|
"community-town",
|
||||||
|
"clean-modern",
|
||||||
|
"clean-campus"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -864,6 +880,19 @@
|
|||||||
"maxLength": 254,
|
"maxLength": 254,
|
||||||
"format": "email",
|
"format": "email",
|
||||||
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
|
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
|
||||||
|
},
|
||||||
|
"scenario": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"heritage-parish",
|
||||||
|
"heritage-city",
|
||||||
|
"bold-youth",
|
||||||
|
"bold-plant",
|
||||||
|
"community-family",
|
||||||
|
"community-town",
|
||||||
|
"clean-modern",
|
||||||
|
"clean-campus"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { dateTimeSchema, productSchema } from "./common";
|
import { dateTimeSchema, productSchema } from "./common";
|
||||||
|
import type { ACTIVE_MEMBER_BANDS } from "./hub";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server agent (docs/AGENT-1.0-PLAN.md, ROADMAP-v3 phase 1d): what the Hub and the agent on
|
* The server agent (docs/AGENT-1.0-PLAN.md, ROADMAP-v3 phase 1d): what the Hub and the agent on
|
||||||
@@ -72,18 +73,120 @@ export const WEBSITE_DEMO_PROFILES = [
|
|||||||
export const websiteDemoProfileSchema = z.enum(WEBSITE_DEMO_PROFILES);
|
export const websiteDemoProfileSchema = z.enum(WEBSITE_DEMO_PROFILES);
|
||||||
export type WebsiteDemoProfile = z.infer<typeof websiteDemoProfileSchema>;
|
export type WebsiteDemoProfile = z.infer<typeof websiteDemoProfileSchema>;
|
||||||
|
|
||||||
/** The Church App's demo data sets (1.20.0): Acacia Hill, the demo church (APP-1.0-PLAN §12). */
|
// ─── Demo scenarios (1.21.0, APP-1.0-PLAN §12 "Demo scenarios") ──────────────
|
||||||
export const APP_DEMO_PROFILES = ["acacia-hill"] as const;
|
|
||||||
|
/**
|
||||||
|
* A demo scenario loads every product of a demo client with the same church: Accounts' church
|
||||||
|
* profile (its own name, logo, icon, colours and details) and people, then Events, the Website and
|
||||||
|
* the App, each with that church's data. One per Website demo profile, keyed by it.
|
||||||
|
*/
|
||||||
|
export const DEMO_SCENARIO_KEYS = WEBSITE_DEMO_PROFILES;
|
||||||
|
export const demoScenarioSchema = z.enum(DEMO_SCENARIO_KEYS);
|
||||||
|
export type DemoScenarioKey = z.infer<typeof demoScenarioSchema>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cross Events' demo data sets: the four single-product ones (`set-demo.js`) and, from Events
|
||||||
|
* 3.8.0, one per scenario, named after it.
|
||||||
|
*/
|
||||||
|
export const EVENTS_DEMO_PROFILES = [...DEMO_PROFILES, ...DEMO_SCENARIO_KEYS] as const;
|
||||||
|
export const eventsDemoProfileSchema = z.enum(EVENTS_DEMO_PROFILES);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Church App's demo data sets: one per scenario (1.21.0; 1.20.0's `acacia-hill` is the
|
||||||
|
* `community-family` scenario, and no App had shipped with it).
|
||||||
|
*/
|
||||||
|
export const APP_DEMO_PROFILES = DEMO_SCENARIO_KEYS;
|
||||||
export const appDemoProfileSchema = z.enum(APP_DEMO_PROFILES);
|
export const appDemoProfileSchema = z.enum(APP_DEMO_PROFILES);
|
||||||
export type AppDemoProfile = z.infer<typeof appDemoProfileSchema>;
|
export type AppDemoProfile = z.infer<typeof appDemoProfileSchema>;
|
||||||
|
|
||||||
/** The products with demo data (`seed-demo` jobs). 1.20.0 adds `app`. */
|
/** Accounts' demo data sets (1.21.0): a scenario's church profile and people. One per scenario. */
|
||||||
export const DEMO_PRODUCTS = ["events", "website", "app"] as const;
|
export const ACCOUNTS_DEMO_PROFILES = DEMO_SCENARIO_KEYS;
|
||||||
|
|
||||||
|
/** The products with demo data (`seed-demo` jobs). 1.20.0 adds `app`, 1.21.0 `accounts`. */
|
||||||
|
export const DEMO_PRODUCTS = ["events", "website", "app", "accounts"] as const;
|
||||||
export const demoProductSchema = z.enum(DEMO_PRODUCTS);
|
export const demoProductSchema = z.enum(DEMO_PRODUCTS);
|
||||||
export type DemoProduct = z.infer<typeof demoProductSchema>;
|
export type DemoProduct = z.infer<typeof demoProductSchema>;
|
||||||
|
|
||||||
/** Each demo product's profiles. */
|
/** Each demo product's profiles. */
|
||||||
export const DEMO_PROFILES_BY_PRODUCT: Record<DemoProduct, readonly string[]> = { events: DEMO_PROFILES, website: WEBSITE_DEMO_PROFILES, app: APP_DEMO_PROFILES };
|
export const DEMO_PROFILES_BY_PRODUCT: Record<DemoProduct, readonly string[]> = {
|
||||||
|
events: EVENTS_DEMO_PROFILES, website: WEBSITE_DEMO_PROFILES, app: APP_DEMO_PROFILES, accounts: ACCOUNTS_DEMO_PROFILES,
|
||||||
|
};
|
||||||
|
|
||||||
|
const DEMO_PRODUCT_NAMES: Record<DemoProduct, string> = { events: "Cross Events", website: "Website", app: "App", accounts: "Accounts" };
|
||||||
|
|
||||||
|
/** The order a scenario loads in: Accounts first (the profile and people the others read). */
|
||||||
|
export const DEMO_SCENARIO_ORDER = ["accounts", "events", "website", "app"] as const satisfies readonly DemoProduct[];
|
||||||
|
|
||||||
|
/** The first release of each product that loads a scenario (`--scenario`). The Hub refuses a scenario for an older install. */
|
||||||
|
export const DEMO_SCENARIO_MIN_VERSIONS: Record<DemoProduct, string> = { accounts: "1.9.0", events: "3.8.0", website: "1.8.0", app: "1.0.0" };
|
||||||
|
|
||||||
|
export interface DemoScenario {
|
||||||
|
key: DemoScenarioKey;
|
||||||
|
/** The church's name in the demo. */
|
||||||
|
church: string;
|
||||||
|
/** For the Hub's list. */
|
||||||
|
label: string;
|
||||||
|
description: string;
|
||||||
|
/** The profile each product loads. */
|
||||||
|
profiles: { accounts: string; events: string; website: string; app: string };
|
||||||
|
/** Campuses in the church profile. */
|
||||||
|
campuses: number;
|
||||||
|
/** The demo's main language (Afrikaans content and devotionals for `af`). */
|
||||||
|
language: "en" | "af";
|
||||||
|
/** The App's active-member band its people give it, so the scenarios show the Hub's tiers. */
|
||||||
|
appActiveMembers: (typeof ACTIVE_MEMBER_BANDS)[number];
|
||||||
|
}
|
||||||
|
|
||||||
|
const scenario = (key: DemoScenarioKey, s: Omit<DemoScenario, "key" | "profiles">): DemoScenario =>
|
||||||
|
({ key, ...s, profiles: { accounts: key, events: key, website: key, app: key } });
|
||||||
|
|
||||||
|
/** The eight scenarios (Joshua, 2026-11-30). Every church and person in them is fictional. */
|
||||||
|
export const DEMO_SCENARIOS: readonly DemoScenario[] = [
|
||||||
|
scenario("heritage-parish", {
|
||||||
|
church: "St Columba's", label: "Heritage: St Columba's, a parish church",
|
||||||
|
description: "A 120-year-old parish church, small and older, one Sunday service. Carols, a harvest festival, a quiet prayer wall and a Lent campaign.",
|
||||||
|
campuses: 1, language: "en", appActiveMembers: "0–100",
|
||||||
|
}),
|
||||||
|
scenario("heritage-city", {
|
||||||
|
church: "Grace Cathedral", label: "Heritage: Grace Cathedral, a city-centre church",
|
||||||
|
description: "Three Sunday services and lunchtime prayer. A concert series, ticketed Easter services, a prayer wall full in office hours with gaps at night.",
|
||||||
|
campuses: 1, language: "en", appActiveMembers: "301–750",
|
||||||
|
}),
|
||||||
|
scenario("bold-youth", {
|
||||||
|
church: "Ignite Church", label: "Bold: Ignite Church, young and music-led",
|
||||||
|
description: "A youth conference with paid registration and a worship night, a 21-day prayer campaign before it, testimonies and WhatsApp reminders.",
|
||||||
|
campuses: 1, language: "en", appActiveMembers: "751–2 000",
|
||||||
|
}),
|
||||||
|
scenario("bold-plant", {
|
||||||
|
church: "Harbour City", label: "Bold: Harbour City, a new church plant",
|
||||||
|
description: "Two years old, meeting in a school hall. Launch Sunday, a newcomers' lunch, a prayer wall still filling up and the admin's setup half done.",
|
||||||
|
campuses: 1, language: "en", appActiveMembers: "0–100",
|
||||||
|
}),
|
||||||
|
scenario("community-family", {
|
||||||
|
church: "Acacia Hill", label: "Community: Acacia Hill, a family church",
|
||||||
|
description: "The mockup's church (cross-demo2). Kids' club, Alpha, family camp and volunteer rosters, a 21-day campaign, prayer requests waiting for approval.",
|
||||||
|
campuses: 1, language: "en", appActiveMembers: "101–300",
|
||||||
|
}),
|
||||||
|
scenario("community-town", {
|
||||||
|
church: "Karoo Gemeenskapskerk", label: "Community: Karoo Gemeenskapskerk, a country-town church",
|
||||||
|
description: "Mostly Afrikaans. A bazaar and a prayer breakfast, its own AFR83 devotionals, 30-minute prayer slots.",
|
||||||
|
campuses: 1, language: "af", appActiveMembers: "101–300",
|
||||||
|
}),
|
||||||
|
scenario("clean-modern", {
|
||||||
|
church: "Northpoint", label: "Clean: Northpoint, a contemporary church",
|
||||||
|
description: "About 600 people. Courses, a groups launch and serve teams, every prayer hour covered twice, announcements by WhatsApp.",
|
||||||
|
campuses: 1, language: "en", appActiveMembers: "301–750",
|
||||||
|
}),
|
||||||
|
scenario("clean-campus", {
|
||||||
|
church: "Riverside", label: "Clean: Riverside, three campuses near the university",
|
||||||
|
description: "Student welcome week at one campus and a combined worship night, one prayer wall for all three, announcements per campus.",
|
||||||
|
campuses: 3, language: "en", appActiveMembers: "2 001–5 000",
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
export function demoScenario(key: DemoScenarioKey): DemoScenario {
|
||||||
|
return DEMO_SCENARIOS.find((s) => s.key === key)!;
|
||||||
|
}
|
||||||
|
|
||||||
/** The first agent that runs `seed-demo` jobs (an older one refuses the unknown type). */
|
/** The first agent that runs `seed-demo` jobs (an older one refuses the unknown type). */
|
||||||
export const SEED_DEMO_MIN_AGENT = "1.2.0";
|
export const SEED_DEMO_MIN_AGENT = "1.2.0";
|
||||||
@@ -97,6 +200,14 @@ export const SEED_WEBSITE_DEMO_MIN_AGENT = "1.6.0";
|
|||||||
*/
|
*/
|
||||||
export const SEED_APP_DEMO_MIN_AGENT = "1.7.0";
|
export const SEED_APP_DEMO_MIN_AGENT = "1.7.0";
|
||||||
|
|
||||||
|
/** 1.21.0: the first agent that runs `seed-demo` for Accounts and with a `scenario` (passed on as `--scenario`). */
|
||||||
|
export const SEED_SCENARIO_MIN_AGENT = "1.7.0";
|
||||||
|
|
||||||
|
/** The first agent that runs a product's `seed-demo` jobs. */
|
||||||
|
export const SEED_DEMO_MIN_AGENT_BY_PRODUCT: Record<DemoProduct, string> = {
|
||||||
|
events: SEED_DEMO_MIN_AGENT, website: SEED_WEBSITE_DEMO_MIN_AGENT, app: SEED_APP_DEMO_MIN_AGENT, accounts: SEED_SCENARIO_MIN_AGENT,
|
||||||
|
};
|
||||||
|
|
||||||
/** The first agent that runs `env-read` and `env-set` jobs (an older one refuses the unknown types). */
|
/** The first agent that runs `env-read` and `env-set` jobs (an older one refuses the unknown types). */
|
||||||
export const ENV_JOBS_MIN_AGENT = "1.3.0";
|
export const ENV_JOBS_MIN_AGENT = "1.3.0";
|
||||||
|
|
||||||
@@ -170,22 +281,29 @@ export const jobArgsSchemas = {
|
|||||||
/** `crosscode restart <church> [product] --json` (PM2 reload) */
|
/** `crosscode restart <church> [product] --json` (PM2 reload) */
|
||||||
restart: z.strictObject({ church: shortNameSchema, product: productSchema.optional() }),
|
restart: z.strictObject({ church: shortNameSchema, product: productSchema.optional() }),
|
||||||
/**
|
/**
|
||||||
* `crosscode demo <church> [website|app] --profile <profile> [--admin-email <email>] --json`: replaces
|
* `crosscode demo <church> [website|app|accounts] --profile <profile> [--scenario <s>] [--admin-email <email>] --json`: replaces
|
||||||
* Cross Events' data (or, 1.19.0 with `product: "website"`, the Website's content) with a demo
|
* Cross Events' data (or, 1.19.0 with `product: "website"`, the Website's content) with a demo
|
||||||
* set (a backup is taken first); 1.20.0 adds `product: "app"` (the App's prayer wall, campaign,
|
* set (a backup is taken first); 1.20.0 adds `product: "app"` (the App's prayer wall, campaign,
|
||||||
* testimonies, devotionals, announcements and events). The Hub only makes it for installs marked as demo sites.
|
* testimonies, devotionals, announcements and events). The Hub only makes it for installs marked as demo sites.
|
||||||
* `adminEmail` (Events only): the account kept (default: the release's own choice). No `product`
|
* `adminEmail` (Events only): the account kept (default: the release's own choice). No `product`
|
||||||
* is Events, so older Hubs' jobs mean what they did.
|
* is Events, so older Hubs' jobs mean what they did. 1.21.0: `product: "accounts"` (the
|
||||||
|
* scenario's church profile, with its logo and icon, and its people) and `scenario`: one job per
|
||||||
|
* product in `DEMO_SCENARIO_ORDER`, each with the scenario's profile for that product.
|
||||||
*/
|
*/
|
||||||
"seed-demo": z.strictObject({
|
"seed-demo": z.strictObject({
|
||||||
church: shortNameSchema,
|
church: shortNameSchema,
|
||||||
product: demoProductSchema.optional(),
|
product: demoProductSchema.optional(),
|
||||||
profile: z.union([demoProfileSchema, websiteDemoProfileSchema, appDemoProfileSchema]),
|
profile: z.union([eventsDemoProfileSchema, websiteDemoProfileSchema, appDemoProfileSchema]),
|
||||||
adminEmail: z.email().max(254).optional(),
|
adminEmail: z.email().max(254).optional(),
|
||||||
|
/** 1.21.0: part of loading this scenario (the profile must be the scenario's for the product). */
|
||||||
|
scenario: demoScenarioSchema.optional(),
|
||||||
}).superRefine((a, ctx) => {
|
}).superRefine((a, ctx) => {
|
||||||
const product = a.product ?? "events";
|
const product = a.product ?? "events";
|
||||||
if (!DEMO_PROFILES_BY_PRODUCT[product].includes(a.profile)) ctx.addIssue({ code: "custom", path: ["profile"], message: `${a.profile} isn't a ${product} demo` });
|
if (!DEMO_PROFILES_BY_PRODUCT[product].includes(a.profile)) ctx.addIssue({ code: "custom", path: ["profile"], message: `${a.profile} isn't a ${product} demo` });
|
||||||
if (product !== "events" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: `the ${product === "app" ? "App" : "Website"}'s demo keeps every admin` });
|
if (product !== "events" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: `the ${DEMO_PRODUCT_NAMES[product]}'s demo keeps every admin` });
|
||||||
|
if (a.scenario && demoScenario(a.scenario).profiles[product] !== a.profile) {
|
||||||
|
ctx.addIssue({ code: "custom", path: ["profile"], message: `the ${a.scenario} scenario loads ${demoScenario(a.scenario).profiles[product]} in ${DEMO_PRODUCT_NAMES[product]}` });
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only
|
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only
|
||||||
|
|||||||
@@ -169,17 +169,64 @@ describe("seed-demo jobs", () => {
|
|||||||
expect(args({ church: "hope", product: "website", profile: "bold-plant" })).toBe(true);
|
expect(args({ church: "hope", product: "website", profile: "bold-plant" })).toBe(true);
|
||||||
expect(args({ church: "hope", product: "events", profile: "small" })).toBe(true);
|
expect(args({ church: "hope", product: "events", profile: "small" })).toBe(true);
|
||||||
expect(args({ church: "hope", product: "website", profile: "small" })).toBe(false);
|
expect(args({ church: "hope", product: "website", profile: "small" })).toBe(false);
|
||||||
expect(args({ church: "hope", profile: "bold-plant" })).toBe(false);
|
// 1.21.0: Events has a profile per scenario too, so a scenario name with no product is an Events demo.
|
||||||
|
expect(args({ church: "hope", profile: "bold-plant" })).toBe(true);
|
||||||
expect(args({ church: "hope", product: "website", profile: "clean-campus", adminEmail: "jane@hope.test" })).toBe(false);
|
expect(args({ church: "hope", product: "website", profile: "clean-campus", adminEmail: "jane@hope.test" })).toBe(false);
|
||||||
expect(args({ church: "hope", product: "accounts", profile: "small" })).toBe(false);
|
expect(args({ church: "hope", product: "accounts", profile: "small" })).toBe(false);
|
||||||
expect(agent.WEBSITE_DEMO_PROFILES).toHaveLength(8);
|
expect(agent.WEBSITE_DEMO_PROFILES).toHaveLength(8);
|
||||||
});
|
});
|
||||||
it("1.20.0: an App demo names the product and takes only an App profile, without an admin email", () => {
|
it("1.20.0: an App demo names the product and takes only an App profile, without an admin email", () => {
|
||||||
expect(agent.DEMO_PRODUCTS).toContain("app");
|
expect(agent.DEMO_PRODUCTS).toContain("app");
|
||||||
expect(args({ church: "demo2", product: "app", profile: "acacia-hill" })).toBe(true);
|
expect(args({ church: "demo2", product: "app", profile: "community-family" })).toBe(true);
|
||||||
expect(args({ church: "demo2", product: "app", profile: "bold-plant" })).toBe(false);
|
expect(args({ church: "demo2", product: "app", profile: "small" })).toBe(false);
|
||||||
expect(args({ church: "demo2", profile: "acacia-hill" })).toBe(false);
|
expect(args({ church: "demo2", product: "app", profile: "acacia-hill" })).toBe(false);
|
||||||
expect(args({ church: "demo2", product: "app", profile: "acacia-hill", adminEmail: "jane@hope.test" })).toBe(false);
|
expect(args({ church: "demo2", product: "app", profile: "community-family", adminEmail: "jane@hope.test" })).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("demo scenarios (1.21.0)", () => {
|
||||||
|
const args = (a: Record<string, unknown>) => agent.jobArgsSchemas["seed-demo"].safeParse(a).success;
|
||||||
|
|
||||||
|
it("has eight, one per Website demo profile, with unique churches", () => {
|
||||||
|
expect(agent.DEMO_SCENARIOS.map((s) => s.key)).toEqual([...agent.WEBSITE_DEMO_PROFILES]);
|
||||||
|
expect(new Set(agent.DEMO_SCENARIOS.map((s) => s.church)).size).toBe(8);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("names only profiles each product has", () => {
|
||||||
|
for (const s of agent.DEMO_SCENARIOS) {
|
||||||
|
for (const product of agent.DEMO_SCENARIO_ORDER) {
|
||||||
|
expect(agent.DEMO_PROFILES_BY_PRODUCT[product]).toContain(s.profiles[product]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("loads Accounts first, every demo product once, each with a minimum release and agent", () => {
|
||||||
|
expect(agent.DEMO_SCENARIO_ORDER[0]).toBe("accounts");
|
||||||
|
expect([...agent.DEMO_SCENARIO_ORDER].sort()).toEqual([...agent.DEMO_PRODUCTS].sort());
|
||||||
|
for (const p of agent.DEMO_PRODUCTS) {
|
||||||
|
expect(agent.DEMO_SCENARIO_MIN_VERSIONS[p]).toMatch(/^\d+\.\d+\.\d+$/);
|
||||||
|
expect(agent.SEED_DEMO_MIN_AGENT_BY_PRODUCT[p]).toMatch(/^\d+\.\d+\.\d+$/);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("covers the App's bands from 0–100 to 2 001–5 000", () => {
|
||||||
|
const bands = new Set(agent.DEMO_SCENARIOS.map((s) => s.appActiveMembers));
|
||||||
|
for (const b of ["0–100", "101–300", "301–750", "751–2 000", "2 001–5 000"] as const) expect(bands).toContain(b);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("takes a scenario only with that scenario's profile for the product", () => {
|
||||||
|
expect(args({ church: "demo2", product: "accounts", profile: "clean-campus", scenario: "clean-campus" })).toBe(true);
|
||||||
|
expect(args({ church: "demo2", profile: "bold-youth", scenario: "bold-youth" })).toBe(true);
|
||||||
|
expect(args({ church: "demo2", product: "website", profile: "bold-plant", scenario: "bold-youth" })).toBe(false);
|
||||||
|
expect(args({ church: "demo2", profile: "events", scenario: "bold-youth" })).toBe(false);
|
||||||
|
expect(args({ church: "demo2", product: "app", profile: "bold-youth", scenario: "nowhere" })).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps Events' four single-product demos, and Accounts takes no admin email or Events profile", () => {
|
||||||
|
expect(args({ church: "hope", profile: "multicampus" })).toBe(true);
|
||||||
|
expect(args({ church: "hope", profile: "clean-modern" })).toBe(true);
|
||||||
|
expect(args({ church: "demo2", product: "accounts", profile: "small" })).toBe(false);
|
||||||
|
expect(args({ church: "demo2", product: "accounts", profile: "clean-modern", adminEmail: "jane@hope.test" })).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user