Contracts 1.1.0: optional requires on Hub releases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-04 15:45:40 +02:00
co-authored by Claude Opus 5.5
parent 66b0c9789b
commit 11e28502ea
6 changed files with 77 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/contracts",
"version": "1.0.0",
"version": "1.1.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",
@@ -1,7 +1,14 @@
{
"licence": "hel1.eyJ2IjoxfQ.c2lnbmF0dXJl",
"latestVersion": "2.3.1",
"latestVersion": "3.0.0",
"releases": [
{
"version": "3.0.0",
"releasedAt": "2026-12-01T10:00:00.000Z",
"urgent": false,
"notes": "- Sign in with your church account",
"requires": [{ "product": "accounts", "version": "1.2.0" }]
},
{ "version": "2.3.1", "releasedAt": "2026-11-10T10:00:00.000Z", "urgent": false, "notes": "- Fixed: feed sync after a campus is renamed" }
],
"notices": [
@@ -36,6 +36,31 @@
},
"notes": {
"type": "string"
},
"requires": {
"type": "array",
"items": {
"type": "object",
"properties": {
"product": {
"type": "string",
"enum": [
"events",
"website",
"app",
"accounts"
]
},
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
}
},
"required": [
"product",
"version"
]
}
}
},
"required": [
@@ -50,6 +50,31 @@
},
"notes": {
"type": "string"
},
"requires": {
"type": "array",
"items": {
"type": "object",
"properties": {
"product": {
"type": "string",
"enum": [
"events",
"website",
"app",
"accounts"
]
},
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
}
},
"required": [
"product",
"version"
]
}
}
},
"required": [
+10
View File
@@ -71,11 +71,21 @@ export function activeMemberBand(count: number): (typeof ACTIVE_MEMBER_BANDS)[nu
const count = z.int().nonnegative();
/** A minimum version of a sibling product that a release needs (`— requires accounts 1.2.0`). */
export const releaseRequirementSchema = z.object({ product: productSchema, version: semverSchema });
export type ReleaseRequirement = z.infer<typeof releaseRequirementSchema>;
export const releaseSchema = z.object({
version: semverSchema,
releasedAt: dateTimeSchema,
urgent: z.boolean(),
notes: z.string(),
/**
* contracts 1.1.0 (Hub 2.0): the sibling versions this release needs. The Hub refuses an update
* request (`409 REQUIREMENT_NOT_MET`) until the church's install of each product runs at least
* that version. Optional: absent from Hubs before 2.0 and from protocol v1 replies.
*/
requires: z.array(releaseRequirementSchema).optional(),
});
export const noticeSchema = z.object({