diff --git a/src/chat-messages.js b/src/chat-messages.js index 76a4eec..5e25d8b 100644 --- a/src/chat-messages.js +++ b/src/chat-messages.js @@ -14,7 +14,7 @@ function parseDate (date) { const ChatMessages = function (privateClient, publicClient) { /** - * Schema: chat-messages/daily + * Schema: chat-messages/daily-archive * * Represents one calendar day of chat messages * @@ -144,6 +144,51 @@ const ChatMessages = function (privateClient, publicClient) { privateClient.declareType("daily-archive", "https://kosmos.org/ns/v2", archiveSchema); publicClient.declareType("daily-archive", "https://kosmos.org/ns/v2", archiveSchema); + /** + * Schema: chat-messages/daily-archive-meta + * + * Stores meta information about the daily archives + * + * @example + * { + * "@context": "https://kosmos.org/ns/v2", + * "@id": "chat-messages/irc.libera.chat/channels/kosmos/meta", + * "@type": "ChatChannelMetadata", + * "first": "2009/01/03", + * "last": "2021/11/05" + * } + * } + */ + const archiveMetaSchema = { + "type": "object", + "properties": { + "@context": { + "type": "string", + "default": "https://kosmos.org/ns/v2", + "enum": ["https://kosmos.org/ns/v2"] + }, + "@id": { + "type": "string", + }, + "@type": { + "type": "string", + "default": "ChatChannel", + "enum": ["ChatChannel"] + }, + "first": { + "type": "string", + "pattern": "^[0-9]{4}\/[0-9]{2}\/[0-9]{2}$" + }, + "last": { + "type": "string", + "pattern": "^[0-9]{4}\/[0-9]{2}\/[0-9]{2}$" + } + }, + "required": ["@id", "first", "last"] + }; + + privateClient.declareType("daily-archive-meta", "https://kosmos.org/ns/v2", archiveMetaSchema); + /** * A daily archive stores chat messages by calendar day. * @@ -537,6 +582,13 @@ const ChatMessages = function (privateClient, publicClient) { }); } + _createArchiveMetaDocument () { + + } + + _updateArchiveMetaDocument () { + } + /* * Write archive document *