throw new DBErrors.UnexpectedResult('did not upsert authentication');
}
} catch (e) {
- this.logger.error(_scope, 'failed', { error: e, identifier, scrubbedCredential })
+ this.logger.error(_scope, 'failed', { error: e, identifier, scrubbedCredential });
throw e;
}
}
httpRemoteAddr: null,
httpFrom: null,
...data,
- }
+ };
this._subscriptionUpsertDataValidate(subscriptionData);
let result;
}
- topicGetByUrl(dbCtx, topicUrl) {
+ topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) {
const _scope = _fileScope('topicGetByUrl');
this.logger.debug(_scope, 'called', { topicUrl });
try {
topic = this.statement.topicGetByUrl.get({ topicUrl });
DatabaseSQLite._topicDataToNative(topic);
- 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;
topicPublishHistory(dbCtx, topicId, days) {
const _scope = _fileScope('topicPublishHistory');
- this.logger.debug(_scope, 'called', { topicId, days })
+ this.logger.debug(_scope, 'called', { topicId, days });
const events = this.statement.topicPublishHistory.all({ topicId, daysAgo: days });
const history = Array.from({ length: days }, () => 0);
+ // eslint-disable-next-line security/detect-object-injection
events.forEach(({ daysAgo, contentUpdates }) => history[daysAgo] = Number(contentUpdates));
return history;