fix(platform): Phase 729 dual-heal gossip keys and HyperDB extract

Repair corrupted voice/stage/screen dual-heal mixins (wrong thread gossip
keys and heal contexts). Regenerate 14 dual-heal legacy json mixins with
per-entry keysField/initMethod; add json-export-gossip-registry alignment
tables and platform-hyperdb-sync.js from index.js. Behavior unchanged;
mesh dedupe now matches dedicated export mixins where aligned.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-06-03 09:59:22 -04:00
co-authored by Cursor
parent c15e539b53
commit 4ca8d53553
19 changed files with 258 additions and 142 deletions
+2
View File
@@ -54,6 +54,8 @@ Application facade: one `PearcordPlatform` class that wires identity, database,
**Phase 723 (v0.8.699):** Dedicated slash registry & invoke audit export JSON — `slash-registry-json-mixin.js`, `slash-invoke-audit-json-mixin.js`, spans `slash-registry.json` / `slash-invoke-audit.json`, `getSlashInvokeAuditExportJsonExport`, `clearSlashInvokeAuditExportJsonExports`, deep links `openSlashRegistryJson` / `openSlashInvokeAuditJson`. Bundle: `npm run test:ci-phase723`. **Phase 723 (v0.8.699):** Dedicated slash registry & invoke audit export JSON — `slash-registry-json-mixin.js`, `slash-invoke-audit-json-mixin.js`, spans `slash-registry.json` / `slash-invoke-audit.json`, `getSlashInvokeAuditExportJsonExport`, `clearSlashInvokeAuditExportJsonExports`, deep links `openSlashRegistryJson` / `openSlashInvokeAuditJson`. Bundle: `npm run test:ci-phase723`.
**Phase 729 (v0.8.705):** Dual-heal legacy json mixins repaired (voice/stage/screen gossip keys + heal contexts); per-entry `keysField`/`initMethod` on 14 dual-heal files; `json-export-gossip-registry.js` alignment tables; `platform-hyperdb-sync.js` extracted from index. Bundle: `npm run test:ci-phase729`.
**Phase 728 (v0.8.704):** Combined delegate json mixins align gossip `keysField` with dedicated mixins; `platform-message-enrichment.js` + `platform-delivery-receipts-imports.js` extracted from index. Bundle: `npm run test:ci-phase728`. **Phase 728 (v0.8.704):** Combined delegate json mixins align gossip `keysField` with dedicated mixins; `platform-message-enrichment.js` + `platform-delivery-receipts-imports.js` extracted from index. Bundle: `npm run test:ci-phase728`.
**Phase 727 (v0.8.703):** Mixin registration extracted to `apply-platform-mixins.js` (59 assigns, same order). `createJsonExportHealDelegateMixin` for slash/oauth/invite/permission/worker combined json mixins. Bundle: `npm run test:ci-phase727`. **Phase 727 (v0.8.703):** Mixin registration extracted to `apply-platform-mixins.js` (59 assigns, same order). `createJsonExportHealDelegateMixin` for slash/oauth/invite/permission/worker combined json mixins. Bundle: `npm run test:ci-phase727`.
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const activityJsonMixin = createJsonExportDualHealMixin({ const activityJsonMixin = createJsonExportDualHealMixin({
keysField: '_activityRegistryJsonGossipKeys',
initMethod: '_initActivityJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipActivityInviteRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipActivityInviteRegistryJson', keysField: '_activityInviteRegistryJsonGossipKeys', initMethod: '_initActivityInviteJsonMixinState' },
{ method: '_shouldGossipProfileBannerExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipProfileBannerExportJson', gossipHashPrefix: 'effective:', keysField: '_profileBannerRegistryJsonGossipKeys', initMethod: '_initProfileBannerJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const activityJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.activity', healContext: 'heal.activity',
countField: 'guildActivityJsonCount', countField: 'guildActivityJsonCount',
bridgeKind: 'activity.json', bridgeKind: 'activity.json',
listExportsMethod: 'listActivityInviteJsonExports', listExportsMethod: 'listActivityInviteJsonExports'
}, { },
{
watermarkField: '_profileBannerExportJsonHealWatermark', watermarkField: '_profileBannerExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipProfileBannerExportJson', shouldGossipMethod: '_shouldGossipProfileBannerExportJson',
healMethod: '_healProfileBannerExportCursorOnPartition', healMethod: '_healProfileBannerExportCursorOnPartition',
@@ -27,7 +26,7 @@ const activityJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.profile-banner', healContext: 'heal.profile-banner',
countField: 'guildActivityJsonCount', countField: 'guildActivityJsonCount',
bridgeKind: 'activity.json', bridgeKind: 'activity.json',
listExportsMethod: 'listProfileBannerExportJsonExports', listExportsMethod: 'listProfileBannerExportJsonExports'
} }
] ]
}) })
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const banJsonMixin = createJsonExportDualHealMixin({ const banJsonMixin = createJsonExportDualHealMixin({
keysField: '_banRegistryJsonGossipKeys',
initMethod: '_initPermissionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipBanRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipBanRegistryJson', keysField: '_banRegistryJsonGossipKeys', initMethod: '_initBanRegistryJsonMixinState' },
{ method: '_shouldGossipAutomodRuleExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipAutomodRuleExportJson', gossipHashPrefix: 'effective:', keysField: '_automodRuleRegistryJsonGossipKeys', initMethod: '_initAutomodRuleJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const banJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.ban', healContext: 'heal.ban',
countField: 'guildBanJsonCount', countField: 'guildBanJsonCount',
bridgeKind: 'ban.json', bridgeKind: 'ban.json',
listExportsMethod: 'listBanRegistryJsonExports', listExportsMethod: 'listBanRegistryJsonExports'
}, { },
{
watermarkField: '_automodRuleJsonHealWatermark', watermarkField: '_automodRuleJsonHealWatermark',
shouldGossipMethod: '_shouldGossipAutomodRuleExportJson', shouldGossipMethod: '_shouldGossipAutomodRuleExportJson',
healMethod: '_healAutomodRuleExportCursorOnPartition', healMethod: '_healAutomodRuleExportCursorOnPartition',
@@ -27,7 +26,7 @@ const banJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.automod', healContext: 'heal.automod',
countField: 'guildBanJsonCount', countField: 'guildBanJsonCount',
bridgeKind: 'ban.json', bridgeKind: 'ban.json',
listExportsMethod: 'listAutomodRuleExportJsonExports', listExportsMethod: 'listAutomodRuleExportJsonExports'
} }
] ]
}) })
+6 -9
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const emojiJsonMixin = createJsonExportDualHealMixin({ const emojiJsonMixin = createJsonExportDualHealMixin({
keysField: '_emojiRegistryJsonGossipKeys',
initMethod: '_initPermissionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipEmojiRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipEmojiRegistryJson', keysField: '_emojiRegistryJsonGossipKeys', initMethod: '_initEmojiRegistryJsonMixinState' },
{ method: '_shouldGossipStickerPackExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipStickerPackExportJson', gossipHashPrefix: 'effective:', keysField: '_stickerPackRegistryJsonGossipKeys', initMethod: '_initStickerPackJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const emojiJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.emoji', healContext: 'heal.emoji',
countField: 'guildEmojiJsonCount', countField: 'guildEmojiJsonCount',
bridgeKind: 'emoji.json', bridgeKind: 'emoji.json',
listExportsMethod: 'listEmojiRegistryJsonExports', listExportsMethod: 'listEmojiRegistryJsonExports'
}, { },
{
watermarkField: '_stickerPackJsonHealWatermark', watermarkField: '_stickerPackJsonHealWatermark',
shouldGossipMethod: '_shouldGossipStickerPackExportJson', shouldGossipMethod: '_shouldGossipStickerPackExportJson',
healMethod: '_healStickerPackExportCursorOnPartition', healMethod: '_healStickerPackExportCursorOnPartition',
@@ -28,9 +27,7 @@ const emojiJsonMixin = createJsonExportDualHealMixin({
countField: 'guildEmojiJsonCount', countField: 'guildEmojiJsonCount',
bridgeKind: 'emoji.json', bridgeKind: 'emoji.json',
listExportsMethod: 'listStickerPackExportJsonExports', listExportsMethod: 'listStickerPackExportJsonExports',
extraSpanEnd: (rows) => ({ extraSpanEnd: (rows) => ({ emojiCount: rows[0]?.emojiCount || 0 })
emojiCount: rows[0]?.emojiCount || 0
}),
} }
] ]
}) })
+5 -29
View File
@@ -447,35 +447,11 @@ const {
} = require('pearcord-channel-permissions') } = require('pearcord-channel-permissions')
const { viewToMask } = require('pearcord-guild-roles/permissions') const { viewToMask } = require('pearcord-guild-roles/permissions')
const { maskToPermissionView, memberPermissionMask } = require('pearcord-guild-roles/permissions') const { maskToPermissionView, memberPermissionMask } = require('pearcord-guild-roles/permissions')
const {
/** HyperDB uint fields must be positive integers. */ coerceSyncUint,
function coerceSyncUint (v, fallback = 0) { sanitizeMessageForHyperDb,
const n = Number(v) sanitizeMemberForHyperDb
const fb = Math.max(1, Math.floor(Number(fallback) || 1)) } = require('./platform-hyperdb-sync')
if (!Number.isFinite(n) || n <= 0) return fb
return Math.floor(n)
}
function sanitizeMessageForHyperDb (msg) {
if (!msg || typeof msg !== 'object') return msg
const row = { ...msg }
row.createdAt = coerceSyncUint(row.createdAt, Date.now())
if (row.editedAt != null && row.editedAt !== '') {
const ed = Number(row.editedAt)
row.editedAt =
Number.isFinite(ed) && ed > 0 ? Math.floor(ed) : null
}
return row
}
function sanitizeMemberForHyperDb (mem) {
if (!mem || typeof mem !== 'object') return mem
const row = { ...mem }
row.joinedAt = coerceSyncUint(row.joinedAt, Date.now())
if (row.updatedAt != null) row.updatedAt = coerceSyncUint(row.updatedAt, row.joinedAt)
if (row.createdAt != null) row.createdAt = coerceSyncUint(row.createdAt, row.joinedAt)
return row
}
class PearcordPlatform extends EventEmitter { class PearcordPlatform extends EventEmitter {
constructor (opts = {}) { constructor (opts = {}) {
+113
View File
@@ -0,0 +1,113 @@
'use strict'
/** Delegate combined mixins aligned with dedicated *-json-mixin.js (Phase 728). */
const DELEGATE_DEDICATED_ALIGNMENT = [
{
combined: 'slash-json-mixin.js',
dedicated: 'slash-registry-json-mixin.js',
method: '_shouldGossipSlashRegistryJson',
keysField: '_slashRegistryExportJsonGossipKeys',
initMethod: '_initSlashRegistryJsonMixinState'
},
{
combined: 'slash-json-mixin.js',
dedicated: 'slash-invoke-audit-json-mixin.js',
method: '_shouldGossipSlashInvokeAuditExportJson',
keysField: '_slashInvokeAuditRegistryJsonGossipKeys',
initMethod: '_initSlashInvokeAuditJsonMixinState',
gossipHashPrefix: 'invoke:'
},
{
combined: 'oauth-json-mixin.js',
dedicated: 'oauth-grant-json-mixin.js',
method: '_shouldGossipOAuthGrantJson',
keysField: '_oauthGrantRegistryJsonGossipKeys',
initMethod: '_initOAuthGrantJsonMixinState'
},
{
combined: 'oauth-json-mixin.js',
dedicated: 'oauth-install-token-json-mixin.js',
method: '_shouldGossipOAuthInstallTokenExportJson',
keysField: '_oauthInstallTokenRegistryJsonGossipKeys',
initMethod: '_initOAuthInstallTokenJsonMixinState',
gossipHashPrefix: 'install:'
},
{
combined: 'invite-json-mixin.js',
dedicated: 'invite-link-json-mixin.js',
method: '_shouldGossipInviteLinkJson',
keysField: '_inviteLinkRegistryJsonGossipKeys',
initMethod: '_initInviteLinkJsonMixinState'
},
{
combined: 'invite-json-mixin.js',
dedicated: 'vanity-url-json-mixin.js',
method: '_shouldGossipVanityUrlExportJson',
keysField: '_vanityUrlRegistryJsonGossipKeys',
initMethod: '_initVanityUrlJsonMixinState',
gossipHashPrefix: 'vanity:'
},
{
combined: 'permission-json-mixin.js',
dedicated: 'role-override-json-mixin.js',
method: '_shouldGossipRoleOverrideJson',
keysField: '_roleOverrideRegistryJsonGossipKeys',
initMethod: '_initRoleOverrideJsonMixinState'
},
{
combined: 'permission-json-mixin.js',
dedicated: 'effective-permission-json-mixin.js',
method: '_shouldGossipEffectivePermissionExportJson',
keysField: '_effectivePermissionRegistryJsonGossipKeys',
initMethod: '_initEffectivePermissionJsonMixinState',
gossipHashPrefix: 'effective:'
},
{
combined: 'worker-json-mixin.js',
dedicated: 'worker-release-json-mixin.js',
method: '_shouldGossipWorkerReleaseJson',
keysField: '_workerReleaseRegistryJsonGossipKeys',
initMethod: '_initWorkerReleaseJsonMixinState'
},
{
combined: 'worker-json-mixin.js',
dedicated: 'integration-manifest-json-mixin.js',
method: '_shouldGossipIntegrationManifestExportJson',
keysField: '_integrationManifestRegistryJsonGossipKeys',
initMethod: '_initIntegrationManifestJsonMixinState',
gossipHashPrefix: 'manifest:'
}
]
/** Dual-heal combined rows where one gossip method has a dedicated mixin (Phase 729). */
const DUAL_HEAL_DEDICATED_ALIGNMENT = [
{
combined: 'notification-json-mixin.js',
dedicated: 'channel-follow-json-mixin.js',
method: '_shouldGossipChannelFollowExportJson',
keysField: '_channelFollowRegistryJsonGossipKeys',
initMethod: '_initChannelFollowJsonMixinState',
gossipHashPrefix: 'effective:'
},
{
combined: 'presence-json-mixin.js',
dedicated: 'read-state-json-mixin.js',
method: '_shouldGossipReadStateExportJson',
keysField: '_readStateRegistryJsonGossipKeys',
initMethod: '_initReadStateJsonMixinState',
gossipHashPrefix: 'effective:'
},
{
combined: 'status-json-mixin.js',
dedicated: 'guild-widget-json-mixin.js',
method: '_shouldGossipGuildWidgetExportJson',
keysField: '_guildWidgetRegistryJsonGossipKeys',
initMethod: '_initGuildWidgetJsonMixinState',
gossipHashPrefix: 'effective:'
}
]
module.exports = {
DELEGATE_DEDICATED_ALIGNMENT,
DUAL_HEAL_DEDICATED_ALIGNMENT
}
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const memberJsonMixin = createJsonExportDualHealMixin({ const memberJsonMixin = createJsonExportDualHealMixin({
keysField: '_memberRosterJsonGossipKeys',
initMethod: '_initPermissionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipMemberRosterJson', gossipHashPrefix: '' }, { method: '_shouldGossipMemberRosterJson', keysField: '_memberRosterRegistryJsonGossipKeys', initMethod: '_initMemberRosterJsonMixinState' },
{ method: '_shouldGossipModerationTimeoutExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipModerationTimeoutExportJson', gossipHashPrefix: 'effective:', keysField: '_moderationTimeoutRegistryJsonGossipKeys', initMethod: '_initModerationTimeoutJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const memberJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.roster', healContext: 'heal.roster',
countField: 'guildMemberJsonCount', countField: 'guildMemberJsonCount',
bridgeKind: 'member.json', bridgeKind: 'member.json',
listExportsMethod: 'listMemberRosterJsonExports', listExportsMethod: 'listMemberRosterJsonExports'
}, { },
{
watermarkField: '_moderationTimeoutJsonHealWatermark', watermarkField: '_moderationTimeoutJsonHealWatermark',
shouldGossipMethod: '_shouldGossipModerationTimeoutExportJson', shouldGossipMethod: '_shouldGossipModerationTimeoutExportJson',
healMethod: '_healModerationTimeoutExportCursorOnPartition', healMethod: '_healModerationTimeoutExportCursorOnPartition',
@@ -27,7 +26,7 @@ const memberJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.timeout', healContext: 'heal.timeout',
countField: 'guildMemberJsonCount', countField: 'guildMemberJsonCount',
bridgeKind: 'member.json', bridgeKind: 'member.json',
listExportsMethod: 'listModerationTimeoutExportJsonExports', listExportsMethod: 'listModerationTimeoutExportJsonExports'
} }
] ]
}) })
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const notificationJsonMixin = createJsonExportDualHealMixin({ const notificationJsonMixin = createJsonExportDualHealMixin({
keysField: '_notificationRegistryJsonGossipKeys',
initMethod: '_initNotificationJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipNotificationRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipNotificationRegistryJson', keysField: '_notificationRegistryJsonGossipKeys', initMethod: '_initNotificationJsonMixinState' },
{ method: '_shouldGossipChannelFollowExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipChannelFollowExportJson', gossipHashPrefix: 'effective:', keysField: '_channelFollowRegistryJsonGossipKeys', initMethod: '_initChannelFollowJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const notificationJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.notification', healContext: 'heal.notification',
countField: 'guildNotificationJsonCount', countField: 'guildNotificationJsonCount',
bridgeKind: 'notification.json', bridgeKind: 'notification.json',
listExportsMethod: 'listNotificationOverrideJsonExports', listExportsMethod: 'listNotificationOverrideJsonExports'
}, { },
{
watermarkField: '_channelFollowExportJsonHealWatermark', watermarkField: '_channelFollowExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipChannelFollowExportJson', shouldGossipMethod: '_shouldGossipChannelFollowExportJson',
healMethod: '_healChannelFollowExportCursorOnPartition', healMethod: '_healChannelFollowExportCursorOnPartition',
@@ -27,7 +26,7 @@ const notificationJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.channel-follow', healContext: 'heal.channel-follow',
countField: 'guildNotificationJsonCount', countField: 'guildNotificationJsonCount',
bridgeKind: 'notification.json', bridgeKind: 'notification.json',
listExportsMethod: 'listChannelFollowExportJsonExports', listExportsMethod: 'listChannelFollowExportJsonExports'
} }
] ]
}) })
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const pinJsonMixin = createJsonExportDualHealMixin({ const pinJsonMixin = createJsonExportDualHealMixin({
keysField: '_pinRegistryJsonGossipKeys',
initMethod: '_initPermissionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipPinRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipPinRegistryJson', keysField: '_pinRegistryJsonGossipKeys', initMethod: '_initPinRegistryJsonMixinState' },
{ method: '_shouldGossipReactionSummaryExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipReactionSummaryExportJson', gossipHashPrefix: 'effective:', keysField: '_reactionSummaryRegistryJsonGossipKeys', initMethod: '_initReactionSummaryJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const pinJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.pin', healContext: 'heal.pin',
countField: 'guildPinJsonCount', countField: 'guildPinJsonCount',
bridgeKind: 'pin.json', bridgeKind: 'pin.json',
listExportsMethod: 'listPinRegistryJsonExports', listExportsMethod: 'listPinRegistryJsonExports'
}, { },
{
watermarkField: '_reactionSummaryJsonHealWatermark', watermarkField: '_reactionSummaryJsonHealWatermark',
shouldGossipMethod: '_shouldGossipReactionSummaryExportJson', shouldGossipMethod: '_shouldGossipReactionSummaryExportJson',
healMethod: '_healReactionSummaryExportCursorOnPartition', healMethod: '_healReactionSummaryExportCursorOnPartition',
@@ -27,7 +26,7 @@ const pinJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.reaction', healContext: 'heal.reaction',
countField: 'guildPinJsonCount', countField: 'guildPinJsonCount',
bridgeKind: 'pin.json', bridgeKind: 'pin.json',
listExportsMethod: 'listReactionSummaryExportJsonExports', listExportsMethod: 'listReactionSummaryExportJsonExports'
} }
] ]
}) })
+36
View File
@@ -0,0 +1,36 @@
'use strict'
/** HyperDB uint fields must be positive integers. */
function coerceSyncUint (v, fallback = 0) {
const n = Number(v)
const fb = Math.max(1, Math.floor(Number(fallback) || 1))
if (!Number.isFinite(n) || n <= 0) return fb
return Math.floor(n)
}
function sanitizeMessageForHyperDb (msg) {
if (!msg || typeof msg !== 'object') return msg
const row = { ...msg }
row.createdAt = coerceSyncUint(row.createdAt, Date.now())
if (row.editedAt != null && row.editedAt !== '') {
const ed = Number(row.editedAt)
row.editedAt =
Number.isFinite(ed) && ed > 0 ? Math.floor(ed) : null
}
return row
}
function sanitizeMemberForHyperDb (mem) {
if (!mem || typeof mem !== 'object') return mem
const row = { ...mem }
row.joinedAt = coerceSyncUint(row.joinedAt, Date.now())
if (row.updatedAt != null) row.updatedAt = coerceSyncUint(row.updatedAt, row.joinedAt)
if (row.createdAt != null) row.createdAt = coerceSyncUint(row.createdAt, row.joinedAt)
return row
}
module.exports = {
coerceSyncUint,
sanitizeMessageForHyperDb,
sanitizeMemberForHyperDb
}
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const pollJsonMixin = createJsonExportDualHealMixin({ const pollJsonMixin = createJsonExportDualHealMixin({
keysField: '_pollRegistryJsonGossipKeys',
initMethod: '_initPermissionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipPollRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipPollRegistryJson', keysField: '_pollRegistryJsonGossipKeys', initMethod: '_initPollRegistryJsonMixinState' },
{ method: '_shouldGossipScheduledMessageExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipScheduledMessageExportJson', gossipHashPrefix: 'effective:', keysField: '_scheduledMessageRegistryJsonGossipKeys', initMethod: '_initScheduledMessageJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const pollJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.poll', healContext: 'heal.poll',
countField: 'guildPollJsonCount', countField: 'guildPollJsonCount',
bridgeKind: 'poll.json', bridgeKind: 'poll.json',
listExportsMethod: 'listPollRegistryJsonExports', listExportsMethod: 'listPollRegistryJsonExports'
}, { },
{
watermarkField: '_scheduledMessageJsonHealWatermark', watermarkField: '_scheduledMessageJsonHealWatermark',
shouldGossipMethod: '_shouldGossipScheduledMessageExportJson', shouldGossipMethod: '_shouldGossipScheduledMessageExportJson',
healMethod: '_healScheduledMessageExportCursorOnPartition', healMethod: '_healScheduledMessageExportCursorOnPartition',
@@ -27,7 +26,7 @@ const pollJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.schedule', healContext: 'heal.schedule',
countField: 'guildPollJsonCount', countField: 'guildPollJsonCount',
bridgeKind: 'poll.json', bridgeKind: 'poll.json',
listExportsMethod: 'listScheduledMessageExportJsonExports', listExportsMethod: 'listScheduledMessageExportJsonExports'
} }
] ]
}) })
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const presenceJsonMixin = createJsonExportDualHealMixin({ const presenceJsonMixin = createJsonExportDualHealMixin({
keysField: '_presenceRegistryJsonGossipKeys',
initMethod: '_initPresenceJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipPresenceRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipPresenceRegistryJson', keysField: '_presenceRegistryJsonGossipKeys', initMethod: '_initPresenceJsonMixinState' },
{ method: '_shouldGossipReadStateExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipReadStateExportJson', gossipHashPrefix: 'effective:', keysField: '_readStateRegistryJsonGossipKeys', initMethod: '_initReadStateJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const presenceJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.presence', healContext: 'heal.presence',
countField: 'guildPresenceJsonCount', countField: 'guildPresenceJsonCount',
bridgeKind: 'presence.json', bridgeKind: 'presence.json',
listExportsMethod: 'listPresenceActivityJsonExports', listExportsMethod: 'listPresenceActivityJsonExports'
}, { },
{
watermarkField: '_readStateExportJsonHealWatermark', watermarkField: '_readStateExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipReadStateExportJson', shouldGossipMethod: '_shouldGossipReadStateExportJson',
healMethod: '_healReadStateExportCursorOnPartition', healMethod: '_healReadStateExportCursorOnPartition',
@@ -27,7 +26,7 @@ const presenceJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.read-state', healContext: 'heal.read-state',
countField: 'guildPresenceJsonCount', countField: 'guildPresenceJsonCount',
bridgeKind: 'presence.json', bridgeKind: 'presence.json',
listExportsMethod: 'listReadStateExportJsonExports', listExportsMethod: 'listReadStateExportJsonExports'
} }
] ]
}) })
+15 -7
View File
@@ -3,11 +3,18 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const relayJsonMixin = createJsonExportDualHealMixin({ const relayJsonMixin = createJsonExportDualHealMixin({
keysField: '_digestRelayHandoffJsonGossipKeys',
initMethod: '_initRelayJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipDigestRelayHandoffJson', gossipHashPrefix: '' }, {
{ method: '_shouldGossipArchivePeerExportJson', gossipHashPrefix: 'archive:' }, method: '_shouldGossipDigestRelayHandoffJson',
keysField: '_digestRelayHandoffRegistryJsonGossipKeys',
initMethod: '_initDigestRelayHandoffJsonMixinState'
},
{
method: '_shouldGossipArchivePeerExportJson',
gossipHashPrefix: 'archive:',
keysField: '_archivePeerRegistryJsonGossipKeys',
initMethod: '_initArchivePeerJsonMixinState'
}
], ],
heals: [ heals: [
{ {
@@ -18,8 +25,9 @@ const relayJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.handoff', healContext: 'heal.handoff',
countField: 'guildRelayHandoffCount', countField: 'guildRelayHandoffCount',
bridgeKind: 'relay.json', bridgeKind: 'relay.json',
listExportsMethod: 'listDigestRelayHandoffJsonExports', listExportsMethod: 'listDigestRelayHandoffJsonExports'
}, { },
{
watermarkField: '_archivePeerExportHealWatermark', watermarkField: '_archivePeerExportHealWatermark',
shouldGossipMethod: '_shouldGossipArchivePeerExportJson', shouldGossipMethod: '_shouldGossipArchivePeerExportJson',
healMethod: '_healArchivePeerExportCursorOnPartition', healMethod: '_healArchivePeerExportCursorOnPartition',
@@ -27,7 +35,7 @@ const relayJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.archive', healContext: 'heal.archive',
countField: 'guildRelayHandoffCount', countField: 'guildRelayHandoffCount',
bridgeKind: 'relay.json', bridgeKind: 'relay.json',
listExportsMethod: 'listArchivePeerExportJsonExports', listExportsMethod: 'listArchivePeerExportJsonExports'
} }
] ]
}) })
+8 -9
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const screenJsonMixin = createJsonExportDualHealMixin({ const screenJsonMixin = createJsonExportDualHealMixin({
keysField: '_threadRegistryJsonGossipKeys',
initMethod: '_initScreenJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipScreenRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipScreenRegistryJson', keysField: '_screenRegistryJsonGossipKeys', initMethod: '_initScreenJsonMixinState' },
{ method: '_shouldGossipSoundboardRegistryExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipSoundboardRegistryExportJson', gossipHashPrefix: 'effective:', keysField: '_soundboardRegistryJsonGossipKeys', initMethod: '_initSoundboardRegistryJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -15,19 +13,20 @@ const screenJsonMixin = createJsonExportDualHealMixin({
shouldGossipMethod: '_shouldGossipScreenRegistryJson', shouldGossipMethod: '_shouldGossipScreenRegistryJson',
healMethod: '_healScreenShareExportCursorOnPartition', healMethod: '_healScreenShareExportCursorOnPartition',
spanKind: 'screen.json', spanKind: 'screen.json',
healContext: 'heal.thread', healContext: 'heal.screen',
countField: 'guildScreenJsonCount', countField: 'guildScreenJsonCount',
bridgeKind: 'screen.json', bridgeKind: 'screen.json',
listExportsMethod: 'listScreenShareJsonExports', listExportsMethod: 'listScreenShareJsonExports'
}, { },
{
watermarkField: '_soundboardRegistryExportJsonHealWatermark', watermarkField: '_soundboardRegistryExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipSoundboardRegistryExportJson', shouldGossipMethod: '_shouldGossipSoundboardRegistryExportJson',
healMethod: '_healSoundboardRegistryExportCursorOnPartition', healMethod: '_healSoundboardRegistryExportCursorOnPartition',
spanKind: 'screen.json', spanKind: 'screen.json',
healContext: 'heal.forum', healContext: 'heal.soundboard',
countField: 'guildScreenJsonCount', countField: 'guildScreenJsonCount',
bridgeKind: 'screen.json', bridgeKind: 'screen.json',
listExportsMethod: 'listSoundboardRegistryExportJsonExports', listExportsMethod: 'listSoundboardRegistryExportJsonExports'
} }
] ]
}) })
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const sessionJsonMixin = createJsonExportDualHealMixin({ const sessionJsonMixin = createJsonExportDualHealMixin({
keysField: '_sessionRegistryJsonGossipKeys',
initMethod: '_initSessionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipSessionActivityRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipSessionActivityRegistryJson', keysField: '_sessionActivityRegistryJsonGossipKeys', initMethod: '_initSessionActivityJsonMixinState' },
{ method: '_shouldGossipAvatarDecorationExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipAvatarDecorationExportJson', gossipHashPrefix: 'effective:', keysField: '_avatarDecorationRegistryJsonGossipKeys', initMethod: '_initAvatarDecorationJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const sessionJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.session', healContext: 'heal.session',
countField: 'guildSessionJsonCount', countField: 'guildSessionJsonCount',
bridgeKind: 'session.json', bridgeKind: 'session.json',
listExportsMethod: 'listSessionActivityJsonExports', listExportsMethod: 'listSessionActivityJsonExports'
}, { },
{
watermarkField: '_avatarDecorationExportJsonHealWatermark', watermarkField: '_avatarDecorationExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipAvatarDecorationExportJson', shouldGossipMethod: '_shouldGossipAvatarDecorationExportJson',
healMethod: '_healAvatarDecorationExportCursorOnPartition', healMethod: '_healAvatarDecorationExportCursorOnPartition',
@@ -27,7 +26,7 @@ const sessionJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.avatar-decoration', healContext: 'heal.avatar-decoration',
countField: 'guildSessionJsonCount', countField: 'guildSessionJsonCount',
bridgeKind: 'session.json', bridgeKind: 'session.json',
listExportsMethod: 'listAvatarDecorationExportJsonExports', listExportsMethod: 'listAvatarDecorationExportJsonExports'
} }
] ]
}) })
+8 -9
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const stageJsonMixin = createJsonExportDualHealMixin({ const stageJsonMixin = createJsonExportDualHealMixin({
keysField: '_threadRegistryJsonGossipKeys',
initMethod: '_initStageJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipStageRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipStageRegistryJson', keysField: '_stageRegistryJsonGossipKeys', initMethod: '_initStageJsonMixinState' },
{ method: '_shouldGossipGuildEventExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipGuildEventExportJson', gossipHashPrefix: 'effective:', keysField: '_guildEventRegistryJsonGossipKeys', initMethod: '_initGuildEventJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -15,19 +13,20 @@ const stageJsonMixin = createJsonExportDualHealMixin({
shouldGossipMethod: '_shouldGossipStageRegistryJson', shouldGossipMethod: '_shouldGossipStageRegistryJson',
healMethod: '_healStageInstanceExportCursorOnPartition', healMethod: '_healStageInstanceExportCursorOnPartition',
spanKind: 'stage.json', spanKind: 'stage.json',
healContext: 'heal.thread', healContext: 'heal.stage',
countField: 'guildStageJsonCount', countField: 'guildStageJsonCount',
bridgeKind: 'stage.json', bridgeKind: 'stage.json',
listExportsMethod: 'listStageInstanceJsonExports', listExportsMethod: 'listStageInstanceJsonExports'
}, { },
{
watermarkField: '_guildEventExportJsonHealWatermark', watermarkField: '_guildEventExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipGuildEventExportJson', shouldGossipMethod: '_shouldGossipGuildEventExportJson',
healMethod: '_healGuildEventExportCursorOnPartition', healMethod: '_healGuildEventExportCursorOnPartition',
spanKind: 'stage.json', spanKind: 'stage.json',
healContext: 'heal.forum', healContext: 'heal.guild-event',
countField: 'guildStageJsonCount', countField: 'guildStageJsonCount',
bridgeKind: 'stage.json', bridgeKind: 'stage.json',
listExportsMethod: 'listGuildEventExportJsonExports', listExportsMethod: 'listGuildEventExportJsonExports'
} }
] ]
}) })
+6 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const statusJsonMixin = createJsonExportDualHealMixin({ const statusJsonMixin = createJsonExportDualHealMixin({
keysField: '_statusRegistryJsonGossipKeys',
initMethod: '_initStatusJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipCustomStatusRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipCustomStatusRegistryJson', keysField: '_customStatusRegistryJsonGossipKeys', initMethod: '_initCustomStatusJsonMixinState' },
{ method: '_shouldGossipGuildWidgetExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipGuildWidgetExportJson', gossipHashPrefix: 'effective:', keysField: '_guildWidgetRegistryJsonGossipKeys', initMethod: '_initGuildWidgetJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -18,8 +16,9 @@ const statusJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.status', healContext: 'heal.status',
countField: 'guildStatusJsonCount', countField: 'guildStatusJsonCount',
bridgeKind: 'status.json', bridgeKind: 'status.json',
listExportsMethod: 'listCustomStatusJsonExports', listExportsMethod: 'listCustomStatusJsonExports'
}, { },
{
watermarkField: '_guildWidgetExportJsonHealWatermark', watermarkField: '_guildWidgetExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipGuildWidgetExportJson', shouldGossipMethod: '_shouldGossipGuildWidgetExportJson',
healMethod: '_healGuildWidgetExportCursorOnPartition', healMethod: '_healGuildWidgetExportCursorOnPartition',
@@ -27,7 +26,7 @@ const statusJsonMixin = createJsonExportDualHealMixin({
healContext: 'heal.guild-widget', healContext: 'heal.guild-widget',
countField: 'guildStatusJsonCount', countField: 'guildStatusJsonCount',
bridgeKind: 'status.json', bridgeKind: 'status.json',
listExportsMethod: 'listGuildWidgetExportJsonExports', listExportsMethod: 'listGuildWidgetExportJsonExports'
} }
] ]
}) })
+3 -7
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const threadJsonMixin = createJsonExportDualHealMixin({ const threadJsonMixin = createJsonExportDualHealMixin({
keysField: '_threadRegistryJsonGossipKeys',
initMethod: '_initPermissionJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipThreadArchiveJson', gossipHashPrefix: '' }, { method: '_shouldGossipThreadArchiveJson', keysField: '_threadArchiveRegistryJsonGossipKeys', initMethod: '_initThreadArchiveJsonMixinState' },
{ method: '_shouldGossipForumTagExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipForumTagExportJson', gossipHashPrefix: 'effective:', keysField: '_forumTagRegistryJsonGossipKeys', initMethod: '_initForumTagJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -29,9 +27,7 @@ const threadJsonMixin = createJsonExportDualHealMixin({
countField: 'guildThreadJsonCount', countField: 'guildThreadJsonCount',
bridgeKind: 'thread.json', bridgeKind: 'thread.json',
listExportsMethod: 'listForumTagExportJsonExports', listExportsMethod: 'listForumTagExportJsonExports',
extraSpanEnd: (rows) => ({ extraSpanEnd: (rows) => ({ threadCount: rows[0]?.threadCount || 0 })
threadCount: rows[0]?.threadCount || 0
}),
} }
] ]
}) })
+8 -9
View File
@@ -3,11 +3,9 @@
const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin') const { createJsonExportDualHealMixin } = require('pearcord-json-export-mixin')
const voiceJsonMixin = createJsonExportDualHealMixin({ const voiceJsonMixin = createJsonExportDualHealMixin({
keysField: '_threadRegistryJsonGossipKeys',
initMethod: '_initVoiceJsonMixinState',
gossipEntries: [ gossipEntries: [
{ method: '_shouldGossipVoiceRegistryJson', gossipHashPrefix: '' }, { method: '_shouldGossipVoiceRegistryJson', keysField: '_voiceRegistryJsonGossipKeys', initMethod: '_initVoiceJsonMixinState' },
{ method: '_shouldGossipBoostLedgerExportJson', gossipHashPrefix: 'effective:' }, { method: '_shouldGossipBoostLedgerExportJson', gossipHashPrefix: 'effective:', keysField: '_boostLedgerRegistryJsonGossipKeys', initMethod: '_initBoostLedgerJsonMixinState' },
], ],
heals: [ heals: [
{ {
@@ -15,19 +13,20 @@ const voiceJsonMixin = createJsonExportDualHealMixin({
shouldGossipMethod: '_shouldGossipVoiceRegistryJson', shouldGossipMethod: '_shouldGossipVoiceRegistryJson',
healMethod: '_healVoiceStateExportCursorOnPartition', healMethod: '_healVoiceStateExportCursorOnPartition',
spanKind: 'voice.json', spanKind: 'voice.json',
healContext: 'heal.thread', healContext: 'heal.voice',
countField: 'guildVoiceJsonCount', countField: 'guildVoiceJsonCount',
bridgeKind: 'voice.json', bridgeKind: 'voice.json',
listExportsMethod: 'listVoiceStateJsonExports', listExportsMethod: 'listVoiceStateJsonExports'
}, { },
{
watermarkField: '_boostLedgerExportJsonHealWatermark', watermarkField: '_boostLedgerExportJsonHealWatermark',
shouldGossipMethod: '_shouldGossipBoostLedgerExportJson', shouldGossipMethod: '_shouldGossipBoostLedgerExportJson',
healMethod: '_healBoostLedgerExportCursorOnPartition', healMethod: '_healBoostLedgerExportCursorOnPartition',
spanKind: 'voice.json', spanKind: 'voice.json',
healContext: 'heal.forum', healContext: 'heal.boost',
countField: 'guildVoiceJsonCount', countField: 'guildVoiceJsonCount',
bridgeKind: 'voice.json', bridgeKind: 'voice.json',
listExportsMethod: 'listBoostLedgerExportJsonExports', listExportsMethod: 'listBoostLedgerExportJsonExports'
} }
] ]
}) })