Various pre-release fixes #5

Merged
raucao merged 5 commits from dev/prerelease_fixes into master 2021-09-13 11:43:27 +00:00
3 changed files with 13 additions and 10 deletions

View File

@ -12,9 +12,10 @@
}, },
"author": "Kosmos Contributors <mail@kosmos.org> (https://kosmos.org)", "author": "Kosmos Contributors <mail@kosmos.org> (https://kosmos.org)",
"license": "MIT", "license": "MIT",
"homepage": "https://gitea.kosmos.org/kosmos/rs-module-chat-messages",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/67P/remotestorage-module-chat-messages.git" "url": "https://gitea.kosmos.org/kosmos/rs-module-chat-messages.git"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.8", "@babel/core": "^7.14.8",

View File

@ -20,7 +20,7 @@ const ChatMessages = function (privateClient, publicClient) {
* *
* @example * @example
* { * {
* "@context": "https://kosmos.org/ns/v1", * "@context": "https://kosmos.org/ns/v2",
* "@id": "chat-messages/irc.libera.chat/channels/kosmos/", * "@id": "chat-messages/irc.libera.chat/channels/kosmos/",
* "@type": "ChatChannel", * "@type": "ChatChannel",
* "service": { * "service": {
@ -48,8 +48,8 @@ const ChatMessages = function (privateClient, publicClient) {
"properties": { "properties": {
"@context": { "@context": {
"type": "string", "type": "string",
"default": "https://kosmos.org/ns/v1", "default": "https://kosmos.org/ns/v2",
"enum": ["https://kosmos.org/ns/v1"] "enum": ["https://kosmos.org/ns/v2"]
}, },
"@id": { "@id": {
"type": "string", "type": "string",
@ -141,8 +141,8 @@ const ChatMessages = function (privateClient, publicClient) {
"required": [] "required": []
}; };
privateClient.declareType("daily-archive", "https://kosmos.org/ns/v1", archiveSchema); privateClient.declareType("daily-archive", "https://kosmos.org/ns/v2", archiveSchema);
publicClient.declareType("daily-archive", "https://kosmos.org/ns/v1", archiveSchema); publicClient.declareType("daily-archive", "https://kosmos.org/ns/v2", archiveSchema);
/** /**
* A daily archive stores chat messages by calendar day. * A daily archive stores chat messages by calendar day.
@ -158,7 +158,7 @@ const ChatMessages = function (privateClient, publicClient) {
* @param {string} options.channelName - Name of room/channel (e.g. "#kosmos") * @param {string} options.channelName - Name of room/channel (e.g. "#kosmos")
* @param {string} [options.channelType] - Type of channel ("room" or "person") * @param {string} [options.channelType] - Type of channel ("room" or "person")
* @param {date} options.date - Date of archive day * @param {date} options.date - Date of archive day
* @param {boolean} options.isPublic - Store logs in public folder (defaults to false) * @param {boolean} [options.isPublic] - Store logs in public folder (defaults to false)
* @param {string} [options.previous] - Date of previous log file as `YYYY/MM/DD`. Looked up automatically when not given * @param {string} [options.previous] - Date of previous log file as `YYYY/MM/DD`. Looked up automatically when not given
* @param {string} [options.next] - Date of next log file as `YYYY/MM/DD`. looked up automatically when not given * @param {string} [options.next] - Date of next log file as `YYYY/MM/DD`. looked up automatically when not given
* *
@ -360,7 +360,7 @@ const ChatMessages = function (privateClient, publicClient) {
* @private * @private
*/ */
_updateDocument (archive, messages) { _updateDocument (archive, messages) {
console.debug('[chat-messages] Updating archive document', archive); console.debug('[chat-messages] Updating archive document');
if (Array.isArray(messages)) { if (Array.isArray(messages)) {
messages.forEach(function(message) { messages.forEach(function(message) {
@ -545,7 +545,7 @@ const ChatMessages = function (privateClient, publicClient) {
* @private * @private
*/ */
_sync (obj) { _sync (obj) {
console.debug('[chat-messages] Writing archive object', obj); console.debug(`[chat-messages] Writing archive object with ${obj.today.messages.length} messages`);
return this.client.storeObject('daily-archive', this.path, obj).then(function(){ return this.client.storeObject('daily-archive', this.path, obj).then(function(){
console.debug('[chat-messages] Archive written to remote storage'); console.debug('[chat-messages] Archive written to remote storage');

View File

@ -9,7 +9,9 @@ module.exports = {
filename: 'build.js', filename: 'build.js',
library: 'ChatMessages', library: 'ChatMessages',
libraryTarget: 'umd', libraryTarget: 'umd',
libraryExport: 'default' libraryExport: 'default',
umdNamedDefine: true,
globalObject: 'this'
}, },
mode: isProd ? 'production' : 'development', mode: isProd ? 'production' : 'development',
devtool: isProd ? 'source-map' : 'eval-source-map', devtool: isProd ? 'source-map' : 'eval-source-map',