max: {
major: 1,
minor: 0,
- patch: 3,
+ patch: 4,
},
};
}
- async topicGetByUrl(dbCtx, topicUrl) {
+ async topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) {
const _scope = _fileScope('topicGetByUrl');
this.logger.debug(_scope, 'called', { topicUrl });
let topic;
try {
topic = await dbCtx.oneOrNone(this.statement.topicGetByUrl, { topicUrl });
- return this._topicDefaults(topic);
+ if (applyDefaults) {
+ topic = this._topicDefaults(topic);
+ }
+ return topic;
} catch (e) {
this.logger.error(_scope, 'failed', { error: e, topic, topicUrl });
throw e;
const events = await dbCtx.manyOrNone(this.statement.topicPublishHistory, { topicIds: [topicId], daysAgo: days });
const history = Array.from({ length: days }, () => 0);
- events.forEach(({ daysAgo, contentUpdates }) => history[daysAgo] = contentUpdates);
+ events.forEach(({ daysAgo, contentUpdates }) => history[daysAgo] = Number(contentUpdates));
return history;
}
const _scope = _fileScope('topicSetContent');
const topicSetContentData = {
contentType: null,
+ httpETag: null,
+ httpLastModified: null,
...data,
};
const logData = {
if (result.rowCount != 1) {
throw new DBErrors.UnexpectedResult('did not set topic content');
}
- result = await dbCtx.result(this.statement.topicSetContentHistory, { topicId: data.topicId, contentHash: data.contentHash, contentSize: data.content.length });
+ result = await dbCtx.result(this.statement.topicSetContentHistory, {
+ topicId: data.topicId,
+ contentHash: data.contentHash,
+ contentSize: data.content.length,
+ });
if (result.rowCount != 1) {
throw new DBErrors.UnexpectedResult('did not set topic content history');
}