Events 2.4.0 backend: protocol v2, Linked products, the event feed

- Hub client: register and heartbeat on protocol v2 with the site's
  Ed25519 key (sent on the heartbeat until the Hub has it); falls back to
  v1 for a day if the Hub refuses v2, so the licence always refreshes.
- crosscode.link/1 Connect / Disconnect, both directions, trusted through
  the Hub's cached linkedProducts (ProductLink, LinkNonce).
- GET /api/feed/v1/events from FeedEntry (go-live, closing and selling
  out are changes; deactivated events go in deleted), event.changed to
  connected products, and showing their events (ImportedEvent).
- /api/v2/linked-products, /api/v2/linked-events; /events/:id/full gains
  crosscodeEvent and priceRangeCents for the JSON-LD.
- Contracts: FEED_PATHS, typesVersions for @crosscode/contracts/signing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 12:24:29 +02:00
co-authored by Claude Opus 5.5
parent 390b80e56e
commit 8a930d07c6
30 changed files with 5874 additions and 17 deletions
File diff suppressed because it is too large Load Diff
+825
View File
@@ -7326,6 +7326,178 @@ export interface paths {
patch?: never;
trace?: never;
};
"/linked-products": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* The church's other products
* @description As the Hub last listed them (with each heartbeat), with whether each is connected and its events shown here.
*
* **Who:** Admins only.
*/
get: operations["getLinked-products"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-products/settings": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
/**
* Publish my events (on or off)
* @description Whether this site publishes its public events for the church's other products (GET /api/feed/v1/events).
*
* **Who:** Admins only.
*/
put: operations["putLinked-productsSettings"];
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-products/{installId}/connect": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Connect to one of the church's products
* @description Sets up a signed link with it (crosscode.link/1). Both products must be in each other's list from the Hub. Connecting again replaces the link's secret.
*
* **Who:** Admins only.
*/
post: operations["postLinked-productsInstallIdConnect"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-products/{installId}/disconnect": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Disconnect a product
* @description Ends the link on both sides (the other product is told when it can be reached) and removes its events from this site.
*
* **Who:** Admins only.
*/
post: operations["postLinked-productsInstallIdDisconnect"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-products/{installId}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
/**
* Show events from a connected product (on or off)
* @description On: its events are fetched now and every 15 minutes, and shown on the public pages. Off: they are removed from this site.
*
* **Who:** Admins only.
*/
put: operations["putLinked-productsInstallId"];
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-products/{installId}/sync": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Fetch a product's events now
* @description **Who:** Admins only.
*/
post: operations["postLinked-productsInstallIdSync"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-events": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Upcoming events from the church's other products
* @description Read-only copies of the events of connected products shown here (Settings → Linked products), soonest first. Each links back to its own page.
*
* **Who:** Anyone.
*/
get: operations["getLinked-events"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/linked-events/{product}/{id}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* One event from another of the church's products
* @description **Who:** Anyone.
*/
get: operations["getLinked-eventsProductId"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -8217,6 +8389,19 @@ export interface operations {
} & {
[key: string]: unknown;
})[];
/** @description The event as crosscode.event/1 (2.4.0), what its page builds its schema.org JSON-LD from (@crosscode/seo). The same shape the event feed publishes. */
crosscodeEvent: ({
/** @constant */
schema: "crosscode.event/1";
id: string;
} & {
[key: string]: unknown;
}) | null;
/** @description The lowest and highest current ticket prices in cents, for the JSON-LD price range (null when free) */
priceRangeCents: {
lowCents: number;
highCents: number;
} | null;
} & {
[key: string]: unknown;
};
@@ -38772,4 +38957,644 @@ export interface operations {
};
};
};
"getLinked-products": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
hubConnected: boolean;
/** @description The Hub has this site's public key (sent with the heartbeat), so the church's other products are told about it */
keyKnownToHub: boolean;
/** @description The Hub has a different key for this site (ask the provider to clear it) */
keyMismatch: boolean;
publishEvents: boolean;
products: {
installId: string;
product: string;
name: string;
url: string;
/** @description In the list the Hub last gave (false: connected before, no longer listed) */
listed: boolean;
publishesEvents: boolean;
/** @description null = not connected */
link: {
/** Format: date-time */
connectedAt: string;
/** @description Who pressed Connect here; null when the other product connected */
connectedBy: string | null;
showEvents: boolean;
lastSyncAt: string | null;
/** @description When its events were last fetched successfully */
lastGoodAt: string | null;
lastSyncError: string | null;
importedEvents: number;
} | null;
}[];
};
};
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"putLinked-productsSettings": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
publishEvents: boolean;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
hubConnected: boolean;
/** @description The Hub has this site's public key (sent with the heartbeat), so the church's other products are told about it */
keyKnownToHub: boolean;
/** @description The Hub has a different key for this site (ask the provider to clear it) */
keyMismatch: boolean;
publishEvents: boolean;
products: {
installId: string;
product: string;
name: string;
url: string;
/** @description In the list the Hub last gave (false: connected before, no longer listed) */
listed: boolean;
publishesEvents: boolean;
/** @description null = not connected */
link: {
/** Format: date-time */
connectedAt: string;
/** @description Who pressed Connect here; null when the other product connected */
connectedBy: string | null;
showEvents: boolean;
lastSyncAt: string | null;
/** @description When its events were last fetched successfully */
lastGoodAt: string | null;
lastSyncError: string | null;
importedEvents: number;
} | null;
}[];
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"postLinked-productsInstallIdConnect": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The product's Hub install id */
installId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
hubConnected: boolean;
/** @description The Hub has this site's public key (sent with the heartbeat), so the church's other products are told about it */
keyKnownToHub: boolean;
/** @description The Hub has a different key for this site (ask the provider to clear it) */
keyMismatch: boolean;
publishEvents: boolean;
products: {
installId: string;
product: string;
name: string;
url: string;
/** @description In the list the Hub last gave (false: connected before, no longer listed) */
listed: boolean;
publishesEvents: boolean;
/** @description null = not connected */
link: {
/** Format: date-time */
connectedAt: string;
/** @description Who pressed Connect here; null when the other product connected */
connectedBy: string | null;
showEvents: boolean;
lastSyncAt: string | null;
/** @description When its events were last fetched successfully */
lastGoodAt: string | null;
lastSyncError: string | null;
importedEvents: number;
} | null;
}[];
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not found (NOT_FOUND) */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"postLinked-productsInstallIdDisconnect": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The product's Hub install id */
installId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
hubConnected: boolean;
/** @description The Hub has this site's public key (sent with the heartbeat), so the church's other products are told about it */
keyKnownToHub: boolean;
/** @description The Hub has a different key for this site (ask the provider to clear it) */
keyMismatch: boolean;
publishEvents: boolean;
products: {
installId: string;
product: string;
name: string;
url: string;
/** @description In the list the Hub last gave (false: connected before, no longer listed) */
listed: boolean;
publishesEvents: boolean;
/** @description null = not connected */
link: {
/** Format: date-time */
connectedAt: string;
/** @description Who pressed Connect here; null when the other product connected */
connectedBy: string | null;
showEvents: boolean;
lastSyncAt: string | null;
/** @description When its events were last fetched successfully */
lastGoodAt: string | null;
lastSyncError: string | null;
importedEvents: number;
} | null;
}[];
otherSideTold: boolean;
problem: string | null;
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not found (NOT_FOUND) */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"putLinked-productsInstallId": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The product's Hub install id */
installId: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
showEvents: boolean;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
hubConnected: boolean;
/** @description The Hub has this site's public key (sent with the heartbeat), so the church's other products are told about it */
keyKnownToHub: boolean;
/** @description The Hub has a different key for this site (ask the provider to clear it) */
keyMismatch: boolean;
publishEvents: boolean;
products: {
installId: string;
product: string;
name: string;
url: string;
/** @description In the list the Hub last gave (false: connected before, no longer listed) */
listed: boolean;
publishesEvents: boolean;
/** @description null = not connected */
link: {
/** Format: date-time */
connectedAt: string;
/** @description Who pressed Connect here; null when the other product connected */
connectedBy: string | null;
showEvents: boolean;
lastSyncAt: string | null;
/** @description When its events were last fetched successfully */
lastGoodAt: string | null;
lastSyncError: string | null;
importedEvents: number;
} | null;
}[];
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not found (NOT_FOUND) */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"postLinked-productsInstallIdSync": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The product's Hub install id */
installId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
hubConnected: boolean;
/** @description The Hub has this site's public key (sent with the heartbeat), so the church's other products are told about it */
keyKnownToHub: boolean;
/** @description The Hub has a different key for this site (ask the provider to clear it) */
keyMismatch: boolean;
publishEvents: boolean;
products: {
installId: string;
product: string;
name: string;
url: string;
/** @description In the list the Hub last gave (false: connected before, no longer listed) */
listed: boolean;
publishesEvents: boolean;
/** @description null = not connected */
link: {
/** Format: date-time */
connectedAt: string;
/** @description Who pressed Connect here; null when the other product connected */
connectedBy: string | null;
showEvents: boolean;
lastSyncAt: string | null;
/** @description When its events were last fetched successfully */
lastGoodAt: string | null;
lastSyncError: string | null;
importedEvents: number;
} | null;
}[];
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not found (NOT_FOUND) */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"getLinked-events": {
parameters: {
query?: {
/** @description A campus slug (its events, church-wide ones and ones for a campus this site doesn't have), or 'all' for church-wide only */
campus?: string;
/** @description How many per page */
limit?: number;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
/** @description "<product>:<id>", unique across products */
key: string;
product: string;
productName: string;
/** @description The event as crosscode.event/1, as the other product published it */
event: {
/** @constant */
schema: "crosscode.event/1";
id: string;
title: string;
/** Format: date-time */
startsAt: string;
/** Format: date-time */
endsAt: string;
} & {
[key: string]: unknown;
};
}[];
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"getLinked-eventsProductId": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The product the event comes from */
product: "website" | "app";
/** @description The event's id in that product */
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
/** @description "<product>:<id>", unique across products */
key: string;
product: string;
productName: string;
/** @description The event as crosscode.event/1, as the other product published it */
event: {
/** @constant */
schema: "crosscode.event/1";
id: string;
title: string;
/** Format: date-time */
startsAt: string;
/** Format: date-time */
endsAt: string;
} & {
[key: string]: unknown;
};
/** @description When the copy was last refreshed from its product */
lastSyncedAt: string | null;
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not found (NOT_FOUND) */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
}