Move 136 prototype mixins under mixins/domain, json-export, and runtime/* so the package root stays navigable. Manifest assign order is unchanged; apply-platform-mixins and runtime registry paths updated. Co-authored-by: Cursor <[email protected]>
74 lines
2.2 KiB
JavaScript
74 lines
2.2 KiB
JavaScript
'use strict'
|
|
|
|
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
|
|
|
|
const auditJsonMixin = Object.assign(
|
|
createJsonExportDualHealMixin({
|
|
keysField: '_auditExportJsonGossipKeys',
|
|
initMethod: '_initAuditJsonMixinState',
|
|
gossipEntries: [
|
|
{
|
|
method: '_shouldGossipAuditExportJson',
|
|
gossipHashPrefix: '',
|
|
gossipHashExtraFields: ['filter']
|
|
}
|
|
],
|
|
heals: [
|
|
{
|
|
watermarkField: '_auditJsonHealWatermark',
|
|
shouldGossipMethod: '_shouldGossipAuditExportJson',
|
|
healMethod: '_healAuditJsonExportCursorOnPartition',
|
|
spanKind: 'audit.json',
|
|
healContext: 'heal.export',
|
|
countField: 'guildJsonExportCount',
|
|
bridgeKind: 'audit.json',
|
|
listExportsMethod: 'listAuditExportJsonExports'
|
|
}
|
|
]
|
|
}),
|
|
{
|
|
_modDigestNotifyHealWatermark: null,
|
|
|
|
async _healModDigestNotifyCursorOnPartition (guildId) {
|
|
const gid = guildId || this.guild?.guild?.id || null
|
|
const span = this.log.time('audit.json', {
|
|
spanKind: 'audit.json',
|
|
guildId: gid,
|
|
context: 'heal.modDigest'
|
|
})
|
|
try {
|
|
if (!gid) {
|
|
span.end({ relisted: 0, skipped: true, guildJsonExportCount: 0 })
|
|
return { relisted: 0, skipped: true }
|
|
}
|
|
await this._initDeliveryReceipts(gid)
|
|
const prefs = await this.deliveryReceipts.getHookFailureDigestNotifyPrefs()
|
|
const watermark = Date.now()
|
|
this._modDigestNotifyHealWatermark = watermark
|
|
span.end({
|
|
relisted: prefs.modDigestGroupDmEnabled ? 1 : 0,
|
|
watermark,
|
|
guildJsonExportCount: 0,
|
|
modDigestEnabled: !!prefs.modDigestGroupDmEnabled,
|
|
bridgeKind: 'audit.json'
|
|
})
|
|
return {
|
|
relisted: prefs.modDigestGroupDmEnabled ? 1 : 0,
|
|
watermark,
|
|
modDigestEnabled: !!prefs.modDigestGroupDmEnabled
|
|
}
|
|
} catch (err) {
|
|
this.log.error('audit.json error', {
|
|
guildId: gid,
|
|
context: 'heal.modDigest',
|
|
error: err?.message || String(err)
|
|
})
|
|
span.fail(err)
|
|
return { relisted: 0, error: err?.message || String(err) }
|
|
}
|
|
}
|
|
}
|
|
)
|
|
|
|
module.exports = { auditJsonMixin }
|