Phase 890: registry split + delivery receipt responder helper (v0.8.857)
Non-breaking refactor — split gossip-rpc-registry into entries/lookup/validate modules; buildGuildRpcTargetedDeliveryReceiptResponse() shared by audit/digest responders; platform-search-rpc-pull-mixin for search mesh config pulls. test:ci-phase890 passes (46/50, cutover deferred).
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
const {
|
||||
assertGuildRpcTargetResponder,
|
||||
buildGuildRpcDeliveryResponseEnvelope,
|
||||
buildGuildRpcTargetedDeliveryReceiptResponse,
|
||||
markRpcResponse
|
||||
} = require('../../../gossip-rpc-pull')
|
||||
|
||||
/** Audit export archive protomux-rpc responders (Phase 885 extract). */
|
||||
const platformAuditArchiveRpcRespondersMixin = {
|
||||
async _buildAuditExportArchiveResponsePayload (payload) {
|
||||
if (!payload?.archiveId) return null
|
||||
if (!assertGuildRpcTargetResponder(payload, this)) return null
|
||||
await this._initDeliveryReceipts(payload.guildId)
|
||||
const row = await this.deliveryReceipts.getAuditExportArchive(payload.archiveId)
|
||||
if (!row?.entries?.length) return null
|
||||
return buildGuildRpcDeliveryResponseEnvelope(row, this, payload)
|
||||
return buildGuildRpcTargetedDeliveryReceiptResponse(this, payload, {
|
||||
resourceIdKey: 'archiveId',
|
||||
fetchRow: (platform, p) =>
|
||||
platform.deliveryReceipts.getAuditExportArchive(p.archiveId),
|
||||
validateRow: (row) => Boolean(row?.entries?.length)
|
||||
})
|
||||
},
|
||||
|
||||
async _handleAuditExportArchiveRequestRpc (payload) {
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
const {
|
||||
assertGuildRpcTargetResponder,
|
||||
buildGuildRpcDeliveryResponseEnvelope,
|
||||
buildGuildRpcTargetedDeliveryReceiptResponse,
|
||||
markRpcResponse
|
||||
} = require('../../../gossip-rpc-pull')
|
||||
|
||||
/** Automation digest snapshot protomux-rpc responders (Phase 885 extract). */
|
||||
const platformAutomationDigestSnapshotRpcRespondersMixin = {
|
||||
async _buildAutomationDigestExportSnapshotResponsePayload (payload) {
|
||||
if (!payload?.snapshotId) return null
|
||||
if (!assertGuildRpcTargetResponder(payload, this)) return null
|
||||
await this._initDeliveryReceipts(payload.guildId)
|
||||
const row = await this.deliveryReceipts.getAutomationDigestExportSnapshot(payload.snapshotId)
|
||||
if (!row?.body?.length) return null
|
||||
return buildGuildRpcDeliveryResponseEnvelope(row, this, payload)
|
||||
return buildGuildRpcTargetedDeliveryReceiptResponse(this, payload, {
|
||||
resourceIdKey: 'snapshotId',
|
||||
fetchRow: (platform, p) =>
|
||||
platform.deliveryReceipts.getAutomationDigestExportSnapshot(p.snapshotId),
|
||||
validateRow: (row) => Boolean(row?.body?.length)
|
||||
})
|
||||
},
|
||||
|
||||
async _handleAutomationDigestExportSnapshotRequestRpc (payload) {
|
||||
|
||||
@@ -3,25 +3,17 @@
|
||||
const searchScope = require('pearcord-search')
|
||||
const sharedScope = require('../../../platform-pearcord-shared-imports')
|
||||
const { id } = require('../../../platform-class-imports')
|
||||
const {
|
||||
fetchMessageSearchGuildGossipRpcPullByConfig,
|
||||
buildMessageSearchGuildGossipRpcFetchPayload
|
||||
} = require('../../../gossip-rpc-pull')
|
||||
const { buildMessageSearchGuildGossipRpcFetchPayload } = require('../../../gossip-rpc-pull')
|
||||
const { platformSearchRpcRespondersMixin } = require('./platform-search-rpc-responders-mixin')
|
||||
const { platformSearchRpcPullMixin } = require('./platform-search-rpc-pull-mixin')
|
||||
|
||||
const platformSearchMeshGossipMixin = {
|
||||
...platformSearchRpcRespondersMixin,
|
||||
...platformSearchRpcPullMixin,
|
||||
|
||||
async _fetchGuildSearchFromMeshRpc (guildId, query, opts = {}) {
|
||||
if (!this.guild?.guild || this.guild.guild.id !== guildId) return null
|
||||
const requestId = id()
|
||||
return fetchMessageSearchGuildGossipRpcPullByConfig(
|
||||
this,
|
||||
guildId,
|
||||
query,
|
||||
opts,
|
||||
requestId
|
||||
)
|
||||
return this._fetchMessageSearchGuildGossipRpcPullByConfig(guildId, query, opts)
|
||||
},
|
||||
|
||||
async _fetchGuildSearchFromMeshOnce (guildId, query, opts = {}) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
const { id } = require('../../../platform-class-imports')
|
||||
const { fetchMessageSearchGuildGossipRpcPullByConfig } = require('../../../gossip-rpc-pull')
|
||||
|
||||
/** Message search registry config RPC mesh pull helper (Phase 890). */
|
||||
const platformSearchRpcPullMixin = {
|
||||
async _fetchMessageSearchGuildGossipRpcPullByConfig (guildId, query, opts = {}) {
|
||||
return fetchMessageSearchGuildGossipRpcPullByConfig(
|
||||
this,
|
||||
guildId,
|
||||
query,
|
||||
opts,
|
||||
id()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { platformSearchRpcPullMixin }
|
||||
Reference in New Issue
Block a user