Events 3.3.0, Accounts 1.3.0, contracts 1.11.0: Accounts looks like Events, backups; sign-out and upload fixes
- Accounts: account and admin pages in Cross Events' layout (top bar, sidebar, a page per section, dark footer); quick links to the church's sites (GET /me/apps); nightly pg_dump backups with Admin -> Backups (run, keep, download, audited; heartbeat lastBackupAt); a fuller built-in privacy notice with headings and bullets; a fixed favicon. /backups/ ignored (anchored, so src/backups is kept). - Contracts 1.11.0: people.removeDemo (only @example.com, never an admin). - Events: uploads served from the folder they're saved in (a backend started outside backend/ answered 404 for a logo it had just saved); Branding checks the file loads before saving; logout waits for the sign-out call so Accounts signs out too; set-demo removes the last demo's people from Accounts. Tests: Accounts 62 + e2e 8, Events 782, contracts 225; npm run check passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,8 @@ import { schemaName } from "./schema-name";
|
||||
* - **`people.*`**: what a product's admin can do to someone's account from the product (add a
|
||||
* person, change their name or email, reset 2FA, unlock, deactivate, news off from an
|
||||
* unsubscribe link). Accounts only acts on people the product knows (signed in through it or
|
||||
* imported by it), and audits each with the product and the admin's `sub`.
|
||||
* imported by it), and audits each with the product and the admin's `sub`. 1.11.0 adds
|
||||
* `people.removeDemo`: new demo data in a product removes the old demo people's accounts.
|
||||
*/
|
||||
|
||||
export const IDENTITY_REQUEST_SCHEMA = schemaName("identity-request", 1);
|
||||
@@ -155,6 +156,21 @@ export const peopleSetActiveSchema = base.extend({ type: z.literal("people.setAc
|
||||
/** Only ever turns news off (an unsubscribe link); turning it on is the person's own choice in Accounts. */
|
||||
export const peopleNewsOffSchema = base.extend({ type: z.literal("people.newsOff"), ...onePerson, channel: z.enum(["email", "whatsapp", "all"]) });
|
||||
|
||||
/** The one address domain demo people have (RFC 2606: reserved, so no real person has it). */
|
||||
export const DEMO_EMAIL_DOMAIN = "example.com";
|
||||
/** Accounts per `people.removeDemo`. */
|
||||
export const REMOVE_DEMO_MAX = 1000;
|
||||
|
||||
/**
|
||||
* 1.11.0: the product's demo data was replaced (a new demo profile), so the old demo people's
|
||||
* accounts go too: signed out everywhere and anonymised. Accounts only removes accounts the
|
||||
* product knows, at `@example.com`, that aren't Accounts admins; it says why it kept any other.
|
||||
*/
|
||||
export const peopleRemoveDemoSchema = base.extend({
|
||||
type: z.literal("people.removeDemo"),
|
||||
subs: z.array(idSchema).max(REMOVE_DEMO_MAX),
|
||||
});
|
||||
|
||||
// ─── messaging.* (contracts 1.9.0) ───────────────────────────────────────────
|
||||
|
||||
/** SMTP settings as Cross Events and Accounts both keep them (`smtp_*`). `pass` sealed; null: keep the saved one. */
|
||||
@@ -200,7 +216,7 @@ export const churchBrandingSchema = base.extend({ type: z.literal("church.brandi
|
||||
export const identityRequestSchema = z.discriminatedUnion("type", [
|
||||
importBeginSchema, importBatchSchema, importFinishSchema, importAbortSchema,
|
||||
peopleEnsureSchema, peopleUpdateSchema, peopleResetTwoFactorSchema, peopleUnlockSchema, peopleSetActiveSchema, peopleNewsOffSchema,
|
||||
messagingStatusSchema, messagingTestSchema, messagingSetSchema, churchBrandingSchema,
|
||||
peopleRemoveDemoSchema, messagingStatusSchema, messagingTestSchema, messagingSetSchema, churchBrandingSchema,
|
||||
]);
|
||||
export type IdentityRequest = z.infer<typeof identityRequestSchema>;
|
||||
export type IdentityRequestType = IdentityRequest["type"];
|
||||
@@ -250,6 +266,14 @@ export const peopleEnsureReplySchema = z.object({
|
||||
emailSent: z.boolean().optional(),
|
||||
});
|
||||
|
||||
/** people.removeDemo: how many accounts went, and each one kept with why. */
|
||||
export const peopleRemoveDemoReplySchema = z.object({
|
||||
schema: z.literal(IDENTITY_REQUEST_SCHEMA),
|
||||
removed: z.int().nonnegative(),
|
||||
kept: z.array(z.object({ sub: idSchema, reason: z.enum(["not_demo", "admin", "unknown"]) })).max(REMOVE_DEMO_MAX),
|
||||
});
|
||||
export type PeopleRemoveDemoReply = z.infer<typeof peopleRemoveDemoReplySchema>;
|
||||
|
||||
export const okReplySchema = z.object({ schema: z.literal(IDENTITY_REQUEST_SCHEMA), ok: z.literal(true) });
|
||||
|
||||
/** messaging.status: what's set up (no secrets; `from` and `host` to recognise it). */
|
||||
|
||||
Reference in New Issue
Block a user