From 36355a694f3cd645f5d6e6b700669d71e96c2ee4 Mon Sep 17 00:00:00 2001 From: ZacxDev <22949135+ZacxDev@users.noreply.github.com> Date: Tue, 24 Nov 2026 10:27:25 +0000 Subject: [PATCH] chore(schema): re-vendor embedded manifest schema from canonical --- schema/app-block.manifest.schema.json | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/schema/app-block.manifest.schema.json b/schema/app-block.manifest.schema.json index d46432cc..31c9690b 100644 --- a/schema/app-block.manifest.schema.json +++ b/schema/app-block.manifest.schema.json @@ -536,6 +536,11 @@ "maxItems": 32, "items": { "$ref": "#/$defs/storageMigrationOp" } }, + "keyedBy": { + "type": "string", + "description": "Shared collections with `write` \"own\" only (not kind \"log\"). The server derives each document's key from the signed-in viewer, so each viewer has at most one document (\"viewer\") or at most one per parent key the app names (\"parent+viewer\"), and no viewer can write another's. The app reads and writes it at `/:collection/@me` or `/:collection/@me/:parent`, where a parent is 1 to 96 characters of A-Z, a-z, 0-9, `.`, `_` or `-` (not only dots); a \"parent+viewer\" key is `:`, so listing with `keyPrefix=:` returns one parent's documents. Writing such a collection by key, creating in it, publishing into it and counters or marks on it are refused (it declares none). Cannot be added, removed or changed on a collection any approved version declared: declare a new collection instead.", + "enum": ["viewer", "parent+viewer"] + }, "hook": { "description": "Optional, in a limited rollout: civitai.com accepts a new or changed hook only from authors the rollout includes, and refuses it otherwise. A permission hook: one ES module of the bundle whose default export decides, for every write to this collection, whether the write is allowed. It runs after the collection `schema` check, never instead of it. `file` is the hook's path in the submitted bundle, shipped verbatim — a committed source file, not a build output, so it must not be inside `outputDir` or `node_modules`; one self-contained module with no imports, at most 65536 bytes of UTF-8 text. `sha256` is the SHA-256 of that file's bytes as 64 lowercase hex characters: submit, the git-push path and approve each refuse a version whose file is missing or does not match it. `timeoutMs` is the most time one call may take, from 1 to 500 (omitted means 50). One file used by several collections must be pinned with the same sha256 in each.", "$ref": "#/$defs/storageCollectionHook" @@ -565,7 +570,8 @@ "showAuthor": false, "dailyWritesPerAuthor": false, "ownedModelVersions": false, - "registry": false + "registry": false, + "keyedBy": false } } }, @@ -593,6 +599,24 @@ }, "then": { "properties": { "ownedModelVersions": false } } }, + { + "$comment": "A viewer-keyed collection's viewer is the author of every key they address, so it is declared only under write:\"own\" (private collections are refused above); log entries have server keys.", + "if": { + "anyOf": [ + { + "required": ["write"], + "properties": { "write": { "enum": ["anyone", "owner", "none"] } } + }, + { "required": ["kind"], "properties": { "kind": { "const": "log" } } } + ] + }, + "then": { "properties": { "keyedBy": false } } + }, + { + "$comment": "A viewer-keyed document is itself the viewer's vote or entry, so a viewer-keyed collection declares no counters or marks.", + "if": { "required": ["keyedBy"] }, + "then": { "properties": { "counters": false, "marks": false } } + }, { "$comment": "A write:\"none\" collection is written only through counters and marks, so it must declare at least one.", "if": {