{ "argumentSchema": { "$defs": { "BlobRef": { "properties": { "id": { "description": "The blob's id: `fid1:` and the hash of its name, media type and bytes.", "type": "string" }, "space": { "description": "The DID of the space whose blob store holds the bytes.", "type": "string" } }, "required": [ "space", "id" ], "type": "object" }, "EntryAdder": { "$ref": "#/$defs/FileProfile", "asCell": [ "cell" ], "ifc": { "addIntegrity": [ { "kind": "authored-by", "subject": { "__ctCurrentPrincipal": true } } ], "writeAuthorizedBy": { "__ctWriterIdentityOf": { "file": "/packages/patterns/fabrifile/store.tsx", "moduleIdentity": "XH9UA_Jw9QcE-s6Dy7K6Gk_Z7kHhYAx02tQQlzl9bXc", "path": [ "commitAdd" ] } } } }, "FileEntry": { "properties": { "addedAt": { "description": "When the file was added.", "type": "FabricEpochNsec" }, "addedBy": { "$ref": "#/$defs/FileProfile", "asCell": [ "cell" ], "description": "The profile of whoever added it." }, "blob": { "$ref": "#/$defs/BlobRef", "description": "The blob holding the bytes." }, "mediaType": { "description": "The media type of the bytes.", "type": "string" }, "name": { "description": "The name the store finds this file by, and its blob's name.", "type": "string" }, "removedAt": { "description": "When the file was removed from its store, if it has been.", "type": "FabricEpochNsec" }, "size": { "description": "The size of the file, in bytes.", "type": "number" } }, "required": [ "name", "mediaType", "blob", "size", "addedAt", "addedBy" ], "type": "object" }, "FileProfile": { "properties": { "avatar": { "description": "A URL of their picture.", "type": "string" }, "name": { "description": "The name the person goes by.", "type": "string" } }, "type": "object" }, "FileRefusalCode": { "enum": [ "invalid-request", "invalid-name", "name-taken", "other-space", "no-blob", "not-found", "not-permitted" ] }, "FileRequestOutcome": { "anyOf": [ { "properties": { "entry": { "$ref": "#/$defs/FileEntry", "asCell": [ "cell" ], "description": "The entry the request added or changed." }, "name": { "description": "The name the request gave the entry.", "type": "string" }, "status": { "enum": [ "done" ], "type": "string" } }, "required": [ "status", "entry", "name" ], "type": "object" }, { "properties": { "code": { "$ref": "#/$defs/FileRefusalCode", "description": "Why, as a code a client can act on." }, "reason": { "description": "Why, as prose for a person.", "type": "string" }, "status": { "enum": [ "refused" ], "type": "string" } }, "required": [ "status", "reason", "code" ], "type": "object" } ] }, "StoredEntry": { "$ref": "#/$defs/StoredEntryValue", "ifc": { "writePolicyAnyOf": [ { "writeAuthorizedBy": { "__ctWriterIdentityOf": { "file": "/packages/patterns/fabrifile/store.tsx", "moduleIdentity": "XH9UA_Jw9QcE-s6Dy7K6Gk_Z7kHhYAx02tQQlzl9bXc", "path": [ "commitAdd" ] } } }, { "writeAuthorizedBy": { "__ctWriterIdentityOf": { "file": "/packages/patterns/fabrifile/store.tsx", "moduleIdentity": "XH9UA_Jw9QcE-s6Dy7K6Gk_Z7kHhYAx02tQQlzl9bXc", "path": [ "commitRename" ] } } }, { "writeAuthorizedBy": { "__ctWriterIdentityOf": { "file": "/packages/patterns/fabrifile/store.tsx", "moduleIdentity": "XH9UA_Jw9QcE-s6Dy7K6Gk_Z7kHhYAx02tQQlzl9bXc", "path": [ "commitRemove" ] } } } ] } }, "StoredEntryValue": { "properties": { "addedAt": { "description": "When the file was added.", "type": "FabricEpochNsec" }, "addedBy": { "$ref": "#/$defs/EntryAdder", "description": "The profile of whoever added the file." }, "blob": { "$ref": "#/$defs/BlobRef", "description": "The blob holding the bytes." }, "mediaType": { "description": "The media type of the bytes.", "type": "string" }, "name": { "description": "The name the store finds this file by, and its blob's name.", "type": "string" }, "removedAt": { "description": "When the file was removed from its store, if it has been.", "type": "FabricEpochNsec" }, "size": { "description": "The size of the file, in bytes.", "type": "number" } }, "required": [ "addedBy", "name", "mediaType", "blob", "size", "addedAt" ], "type": "object" } }, "description": "What a store keeps. Each has a default, so a new store starts empty.", "properties": { "entries": { "asCell": [ { "kind": "cell", "scope": "space" } ], "default": [], "description": "The store's entries.", "items": { "$ref": "#/$defs/StoredEntry" }, "type": "array" }, "requests": { "additionalProperties": { "$ref": "#/$defs/FileRequestOutcome" }, "asCell": [ { "kind": "cell", "scope": "space" } ], "default": {}, "description": "The outcome of each request.", "properties": {}, "type": "object" } }, "type": "object" }, "pattern": "fabrifile/store.tsx", "resultSchema": { "$defs": { "AddFileEvent": { "properties": { "blob": { "$ref": "#/$defs/BlobRef", "description": "The blob holding the bytes." }, "mediaType": { "description": "The media type the blob was stored with.", "type": "string" }, "name": { "description": "The new entry's name, the name its blob was stored under.", "type": "string" }, "onConflict": { "$ref": "#/$defs/NameConflict", "description": "What to do when `name` is taken; `refuse` when absent." }, "requestId": { "description": "Chosen by the sender; the event's own key when there is none.", "type": "string" }, "size": { "description": "The size of the file, in bytes.", "type": "number" } }, "type": "object" }, "BlobRef": { "properties": { "id": { "description": "The blob's id: `fid1:` and the hash of its name, media type and bytes.", "type": "string" }, "space": { "description": "The DID of the space whose blob store holds the bytes.", "type": "string" } }, "required": [ "space", "id" ], "type": "object" }, "FileEntry": { "properties": { "addedAt": { "description": "When the file was added.", "type": "FabricEpochNsec" }, "addedBy": { "$ref": "#/$defs/FileProfile", "description": "The profile of whoever added it." }, "blob": { "$ref": "#/$defs/BlobRef", "description": "The blob holding the bytes." }, "mediaType": { "description": "The media type of the bytes.", "type": "string" }, "name": { "description": "The name the store finds this file by, and its blob's name.", "type": "string" }, "removedAt": { "description": "When the file was removed from its store, if it has been.", "type": "FabricEpochNsec" }, "size": { "description": "The size of the file, in bytes.", "type": "number" } }, "required": [ "name", "mediaType", "blob", "size", "addedAt", "addedBy" ], "type": "object" }, "FileProfile": { "properties": { "avatar": { "description": "A URL of their picture.", "type": "string" }, "name": { "description": "The name the person goes by.", "type": "string" } }, "type": "object" }, "FileRefusalCode": { "enum": [ "invalid-request", "invalid-name", "name-taken", "other-space", "no-blob", "not-found", "not-permitted" ] }, "FileRequestOutcome": { "anyOf": [ { "properties": { "entry": { "$ref": "#/$defs/FileEntry", "description": "The entry the request added or changed." }, "name": { "description": "The name the request gave the entry.", "type": "string" }, "status": { "enum": [ "done" ], "type": "string" } }, "required": [ "status", "entry", "name" ], "type": "object" }, { "properties": { "code": { "$ref": "#/$defs/FileRefusalCode", "description": "Why, as a code a client can act on." }, "reason": { "description": "Why, as prose for a person.", "type": "string" }, "status": { "enum": [ "refused" ], "type": "string" } }, "required": [ "status", "reason", "code" ], "type": "object" } ] }, "FileStoreFiles": { "properties": { "add": { "$ref": "#/$defs/AddFileEvent", "asCell": [ "stream" ], "description": "Adds a file, for a blob already in the store's space." }, "byName": { "additionalProperties": { "$ref": "#/$defs/FileEntry" }, "description": "The same files, by name.", "properties": {}, "type": "object" }, "entries": { "description": "Every file in the store, in the order they were added.", "items": { "$ref": "#/$defs/FileEntry" }, "type": "array" }, "remove": { "$ref": "#/$defs/RemoveFileEvent", "asCell": [ "stream" ], "description": "Takes a file out of the store, and marks it removed." }, "rename": { "$ref": "#/$defs/RenameFileEvent", "asCell": [ "stream" ], "description": "Changes a file's name, and its blob with it." }, "requests": { "additionalProperties": { "$ref": "#/$defs/FileRequestOutcome" }, "description": "The outcome of each request, by its `requestId`.", "properties": {}, "type": "object" } }, "required": [ "entries", "byName", "requests", "add", "remove", "rename" ], "type": "object" }, "NameConflict": { "enum": [ "refuse", "rename" ] }, "RemoveFileEvent": { "properties": { "entry": { "$ref": "#/$defs/FileEntry", "description": "The entry to remove." }, "requestId": { "description": "Chosen by the sender; the event's own key when there is none.", "type": "string" } }, "type": "object" }, "RenameFileEvent": { "properties": { "entry": { "$ref": "#/$defs/FileEntry", "description": "The entry to rename." }, "name": { "description": "The entry's new name.", "type": "string" }, "onConflict": { "$ref": "#/$defs/NameConflict", "description": "What to do when `name` is taken; `refuse` when absent." }, "requestId": { "description": "Chosen by the sender; the event's own key when there is none.", "type": "string" } }, "type": "object" } }, "description": "What a space's file store offers: its data face, and that as a view group.", "properties": { "$VIEWS": { "properties": { "files": { "$ref": "#/$defs/FileStoreFiles" } }, "required": [ "files" ], "type": "object" }, "add": { "$ref": "#/$defs/AddFileEvent", "asCell": [ "stream" ], "description": "Adds a file, for a blob already in the store's space." }, "byName": { "additionalProperties": { "$ref": "#/$defs/FileEntry" }, "description": "The same files, by name.", "properties": {}, "type": "object" }, "entries": { "description": "Every file in the store, in the order they were added.", "items": { "$ref": "#/$defs/FileEntry" }, "type": "array" }, "remove": { "$ref": "#/$defs/RemoveFileEvent", "asCell": [ "stream" ], "description": "Takes a file out of the store, and marks it removed." }, "rename": { "$ref": "#/$defs/RenameFileEvent", "asCell": [ "stream" ], "description": "Changes a file's name, and its blob with it." }, "requests": { "additionalProperties": { "$ref": "#/$defs/FileRequestOutcome" }, "description": "The outcome of each request, by its `requestId`.", "properties": {}, "type": "object" } }, "required": [ "$VIEWS", "entries", "byName", "requests", "add", "remove", "rename" ], "type": "object" } }