chore: publish pearcord-platform from pearcord workspace

This commit is contained in:
Pearcord
2026-07-13 00:17:47 -04:00
commit c101ac832a
546 changed files with 59585 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
node_modules/
package-lock.json
*.log
.DS_Store
pearcord-storage/
+1782
View File
File diff suppressed because it is too large Load Diff
+307
View File
@@ -0,0 +1,307 @@
'use strict'
/* AUTO-GENERATED by apps/pearcord/scripts/regenerate-apply-platform-mixins.py — do not edit */
const {
PLATFORM_MIXIN_ASSIGNMENT_COUNT,
PLATFORM_MIXIN_ASSIGNMENTS
} = require('./platform-mixin-assign-manifest')
const { pollSchedulingMixin } = require('./mixins/domain/polls-scheduling.js')
const { notificationsActivityMixin } = require('./mixins/domain/notifications-activity.js')
const { userSettingsMixin } = require('./mixins/domain/user-settings.js')
const { moderationMixin } = require('./mixins/domain/moderation.js')
const { invitesDiscoveryMixin } = require('./mixins/domain/invites-discovery.js')
const { threadsForumMixin } = require('./mixins/domain/threads-forum.js')
const { announcementsMixin } = require('./mixins/domain/announcements-mixin.js')
const { permissionsMixin } = require('./mixins/domain/permissions-mixin.js')
const { memberRolesMixin } = require('./mixins/domain/member-roles-mixin.js')
const { slashMixin } = require('./mixins/domain/slash-mixin.js')
const { botsMixin } = require('./mixins/domain/bots-mixin.js')
const { webhooksMixin } = require('./mixins/domain/webhooks-mixin.js')
const { automationMixin } = require('./mixins/domain/automation-mixin.js')
const { workersMixin } = require('./mixins/domain/workers-mixin.js')
const { deliveryMixin } = require('./mixins/domain/delivery-mixin.js')
const { healthMixin } = require('./mixins/domain/health-mixin.js')
const { auditJsonMixin } = require('./mixins/json-export/audit-json-mixin.js')
const { digestJsonMixin } = require('./mixins/json-export/digest-json-mixin.js')
const { relayJsonMixin } = require('./mixins/json-export/relay-json-mixin.js')
const { workerJsonMixin } = require('./mixins/json-export/worker-json-mixin.js')
const { botRegistryJsonMixin } = require('./mixins/json-export/bot-registry-json-mixin.js')
const { slashJsonMixin } = require('./mixins/json-export/slash-json-mixin.js')
const { oauthJsonMixin } = require('./mixins/json-export/oauth-json-mixin.js')
const { inviteJsonMixin } = require('./mixins/json-export/invite-json-mixin.js')
const { permissionJsonMixin } = require('./mixins/json-export/permission-json-mixin.js')
const { emojiJsonMixin } = require('./mixins/json-export/emoji-json-mixin.js')
const { memberJsonMixin } = require('./mixins/json-export/member-json-mixin.js')
const { banJsonMixin } = require('./mixins/json-export/ban-json-mixin.js')
const { pollJsonMixin } = require('./mixins/json-export/poll-json-mixin.js')
const { pinJsonMixin } = require('./mixins/json-export/pin-json-mixin.js')
const { threadJsonMixin } = require('./mixins/json-export/thread-json-mixin.js')
const { stageJsonMixin } = require('./mixins/json-export/stage-json-mixin.js')
const { voiceJsonMixin } = require('./mixins/json-export/voice-json-mixin.js')
const { screenJsonMixin } = require('./mixins/json-export/screen-json-mixin.js')
const { presenceJsonMixin } = require('./mixins/json-export/presence-json-mixin.js')
const { notificationJsonMixin } = require('./mixins/json-export/notification-json-mixin.js')
const { statusJsonMixin } = require('./mixins/json-export/status-json-mixin.js')
const { activityJsonMixin } = require('./mixins/json-export/activity-json-mixin.js')
const { sessionJsonMixin } = require('./mixins/json-export/session-json-mixin.js')
const { deviceJsonMixin } = require('./mixins/json-export/device-json-mixin.js')
const { discoveryJsonMixin } = require('./mixins/json-export/discovery-json-mixin.js')
const { federationJsonMixin } = require('./mixins/json-export/federation-json-mixin.js')
const { meshJsonMixin } = require('./mixins/json-export/mesh-json-mixin.js')
const { multiGuildJsonMixin } = require('./mixins/json-export/multi-guild-json-mixin.js')
const { partitionHealJsonMixin } = require('./mixins/json-export/partition-heal-json-mixin.js')
const { channelFollowJsonMixin } = require('./mixins/json-export/channel-follow-json-mixin.js')
const { guildWidgetJsonMixin } = require('./mixins/json-export/guild-widget-json-mixin.js')
const { readStateJsonMixin } = require('./mixins/json-export/read-state-json-mixin.js')
const { webhookJsonMixin } = require('./mixins/json-export/webhook-json-mixin.js')
const { vanityUrlJsonMixin } = require('./mixins/json-export/vanity-url-json-mixin.js')
const { effectivePermissionJsonMixin } = require('./mixins/json-export/effective-permission-json-mixin.js')
const { inviteLinkJsonMixin } = require('./mixins/json-export/invite-link-json-mixin.js')
const { roleOverrideJsonMixin } = require('./mixins/json-export/role-override-json-mixin.js')
const { oauthGrantJsonMixin } = require('./mixins/json-export/oauth-grant-json-mixin.js')
const { oauthInstallTokenJsonMixin } = require('./mixins/json-export/oauth-install-token-json-mixin.js')
const { slashRegistryJsonMixin } = require('./mixins/json-export/slash-registry-json-mixin.js')
const { slashInvokeAuditJsonMixin } = require('./mixins/json-export/slash-invoke-audit-json-mixin.js')
const { workerReleaseJsonMixin } = require('./mixins/json-export/worker-release-json-mixin.js')
const { integrationManifestJsonMixin } = require('./mixins/json-export/integration-manifest-json-mixin.js')
const { platformHyperswarmRuntimeMixin } = require('./mixins/runtime/core/platform-hyperswarm-runtime-mixin.js')
const { platformSessionStartupMixin } = require('./mixins/runtime/core/platform-session-startup-mixin.js')
const { platformGuildOpenFallbackMixin } = require('./mixins/runtime/core/platform-guild-open-fallback-mixin.js')
const { platformPartitionHealStateMixin } = require('./mixins/runtime/partition-heal/platform-partition-heal-state-mixin.js')
const { platformGuildMeshBoundedMixin } = require('./mixins/runtime/mesh/platform-guild-mesh-bounded-mixin.js')
const { platformFederationViewMixin } = require('./mixins/runtime/mesh/platform-federation-view-mixin.js')
const { platformGuildMeshPeerMixin } = require('./mixins/runtime/mesh/platform-guild-mesh-peer-mixin.js')
const { platformGuildTopicReplicationMixin } = require('./mixins/runtime/mesh/platform-guild-topic-replication-mixin.js')
const { platformMeshAutoHealMixin } = require('./mixins/runtime/mesh/platform-mesh-auto-heal-mixin.js')
const { platformGuildMeshPeerRetryMixin } = require('./mixins/runtime/mesh/platform-guild-mesh-peer-retry-mixin.js')
const { platformMeshViewMixin } = require('./mixins/runtime/mesh/platform-mesh-view-mixin.js')
const { platformMeshLoggingMixin } = require('./mixins/runtime/mesh/platform-mesh-logging-mixin.js')
const { platformMemberPageBurstMixin } = require('./mixins/runtime/mesh/platform-member-page-burst-mixin.js')
const { platformGuildSyncWatermarkMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-watermark-mixin.js')
const { platformGuildGossipOutboxMixin } = require('./mixins/runtime/guild-sync/platform-guild-gossip-outbox-mixin.js')
const { platformGuildSyncBandwidthMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-bandwidth-mixin.js')
const { platformGuildSyncHealthPatchMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-health-patch-mixin.js')
const { platformGuildSyncGossipViewMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-gossip-view-mixin.js')
const { platformGuildSyncPushScheduleMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-push-schedule-mixin.js')
const { platformGuildPresenceVectorMixin } = require('./mixins/runtime/guild-sync/platform-guild-presence-vector-mixin.js')
const { platformSettingsMeshHealthMixin } = require('./mixins/runtime/features/platform-settings-mesh-health-mixin.js')
const { platformGuildSyncWireSparseMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-wire-sparse-mixin.js')
const { platformGuildSparseSyncQosMixin } = require('./mixins/runtime/guild-sync/platform-guild-sparse-sync-qos-mixin.js')
const { platformGuildContactsPresenceMixin } = require('./mixins/runtime/voice-dm/platform-guild-contacts-presence-mixin.js')
const { platformVoiceMeshStateMixin } = require('./mixins/runtime/voice-dm/platform-voice-mesh-state-mixin.js')
const { platformGuildThreadForumExportMixin } = require('./mixins/runtime/guild-sync/platform-guild-thread-forum-export-mixin.js')
const { platformDiscoveryListingScheduleMixin } = require('./mixins/runtime/search-discovery/platform-discovery-listing-schedule-mixin.js')
const { platformGuildMemberSyncScheduleMixin } = require('./mixins/runtime/guild-sync/platform-guild-member-sync-schedule-mixin.js')
const { platformViewListCacheMixin } = require('./mixins/runtime/view/platform-view-list-cache-mixin.js')
const { platformSearchCacheMixin } = require('./mixins/runtime/search-discovery/platform-search-cache-mixin.js')
const { platformDiscoveryPrefsBaselineMixin } = require('./mixins/runtime/search-discovery/platform-discovery-prefs-baseline-mixin.js')
const { platformSearchIndexStoreMixin } = require('./mixins/runtime/search-discovery/platform-search-index-store-mixin.js')
const { platformSearchIndexRebuildMixin } = require('./mixins/runtime/search-discovery/platform-search-index-rebuild-mixin.js')
const { platformSearchMeshGossipMixin } = require('./mixins/runtime/search-discovery/platform-search-mesh-gossip-mixin.js')
const { platformDiscoveryMeshRefreshMixin } = require('./mixins/runtime/search-discovery/platform-discovery-mesh-refresh-mixin.js')
const { platformSearchGuildMessagesMixin } = require('./mixins/runtime/search-discovery/platform-search-guild-messages-mixin.js')
const { platformSearchQueryFiltersMixin } = require('./mixins/runtime/search-discovery/platform-search-query-filters-mixin.js')
const { platformSearchMeshResolveMixin } = require('./mixins/runtime/search-discovery/platform-search-mesh-resolve-mixin.js')
const { platformForumSearchMixin } = require('./mixins/runtime/search-discovery/platform-forum-search-mixin.js')
const { platformForumPartitionHealMixin } = require('./mixins/runtime/search-discovery/platform-forum-partition-heal-mixin.js')
const { platformViewChannelConsistencyMixin } = require('./mixins/runtime/view/platform-view-channel-consistency-mixin.js')
const { platformPinOrphanRepairMixin } = require('./mixins/runtime/view/platform-pin-orphan-repair-mixin.js')
const { platformViewUnreadAuditMixin } = require('./mixins/runtime/view/platform-view-unread-audit-mixin.js')
const { platformDiscoveryTagsMixin } = require('./mixins/runtime/search-discovery/platform-discovery-tags-mixin.js')
const { platformPartitionPinSearchHealMixin } = require('./mixins/runtime/partition-heal/platform-partition-pin-search-heal-mixin.js')
const { platformForumFilterMixin } = require('./mixins/runtime/search-discovery/platform-forum-filter-mixin.js')
const { platformPartitionReactionStickerHealMixin } = require('./mixins/runtime/partition-heal/platform-partition-reaction-sticker-heal-mixin.js')
const { platformPartitionRosterHealMixin } = require('./mixins/runtime/partition-heal/platform-partition-roster-heal-mixin.js')
const { platformPartitionEmbedHealMixin } = require('./mixins/runtime/partition-heal/platform-partition-embed-heal-mixin.js')
const { platformPartitionVoicenoteHealMixin } = require('./mixins/runtime/partition-heal/platform-partition-voicenote-heal-mixin.js')
const { platformPartitionAttachmentHealMixin } = require('./mixins/runtime/partition-heal/platform-partition-attachment-heal-mixin.js')
const { platformCapabilitiesMixin } = require('./mixins/runtime/core/platform-capabilities-mixin.js')
const { platformPartitionHealOrchestratorMixin } = require('./mixins/runtime/partition-heal/platform-partition-heal-orchestrator-mixin.js')
const { platformSidecarReplicatorMixin } = require('./mixins/runtime/features/platform-sidecar-replicator-mixin.js')
const { platformGuildSyncExportMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-export-mixin.js')
const { platformGuildSyncIngestMixin } = require('./mixins/runtime/guild-sync/platform-guild-sync-ingest-mixin.js')
const { platformGuildWireMixin } = require('./mixins/runtime/guild-sync/platform-guild-wire-mixin.js')
const { platformViewMixin } = require('./mixins/runtime/view/platform-view-mixin.js')
const { platformJsonExportSurfaceMixin } = require('./mixins/runtime/features/platform-json-export-surface-mixin.js')
const { platformAuditAutomationExportMixin } = require('./mixins/runtime/features/platform-audit-automation-export-mixin.js')
const { platformAuditArchiveRpcMixin } = require('./mixins/runtime/features/platform-audit-archive-rpc-mixin.js')
const { platformAutomationDigestSnapshotRpcMixin } = require('./mixins/runtime/features/platform-automation-digest-snapshot-rpc-mixin.js')
const { platformDmVoiceMediaMixin } = require('./mixins/runtime/voice-dm/platform-dm-voice-media-mixin.js')
const { platformDmSessionMixin } = require('./mixins/runtime/voice-dm/platform-dm-session-mixin.js')
const { platformProfileContactsMixin } = require('./mixins/runtime/features/platform-profile-contacts-mixin.js')
const { platformDiscoveryApiMixin } = require('./mixins/runtime/search-discovery/platform-discovery-api-mixin.js')
const { platformSearchApiMixin } = require('./mixins/runtime/search-discovery/platform-search-api-mixin.js')
const { platformRegistryMediaMixin } = require('./mixins/runtime/features/platform-registry-media-mixin.js')
const { platformVoiceStageScreenMixin } = require('./mixins/runtime/features/platform-voice-stage-screen-mixin.js')
const { platformAttachmentsEmbedsMixin } = require('./mixins/runtime/features/platform-attachments-embeds-mixin.js')
const { platformPermissionsRolesAdminMixin } = require('./mixins/runtime/features/platform-permissions-roles-admin-mixin.js')
const { platformBotsWebhooksSlashMixin } = require('./mixins/runtime/features/platform-bots-webhooks-slash-mixin.js')
const { platformAutomationHooksDeliveryMixin } = require('./mixins/runtime/features/platform-automation-hooks-delivery-mixin.js')
const { platformAnnouncementsBoostsMixin } = require('./mixins/runtime/features/platform-announcements-boosts-mixin.js')
const { platformGuildAdminMixin } = require('./mixins/runtime/features/platform-guild-admin-mixin.js')
const { platformSettingsFoldersPrefsMixin } = require('./mixins/runtime/features/platform-settings-folders-prefs-mixin.js')
const { platformMessagingMixin } = require('./mixins/runtime/features/platform-messaging-mixin.js')
const { platformChannelsThreadsForumMixin } = require('./mixins/runtime/features/platform-channels-threads-forum-mixin.js')
const { platformDiagnosticsMixin } = require('./mixins/runtime/core/platform-diagnostics-mixin.js')
const ORDERED_PLATFORM_MIXINS = [
pollSchedulingMixin,
notificationsActivityMixin,
userSettingsMixin,
moderationMixin,
invitesDiscoveryMixin,
threadsForumMixin,
announcementsMixin,
permissionsMixin,
memberRolesMixin,
slashMixin,
botsMixin,
webhooksMixin,
automationMixin,
workersMixin,
deliveryMixin,
healthMixin,
auditJsonMixin,
digestJsonMixin,
relayJsonMixin,
workerJsonMixin,
botRegistryJsonMixin,
slashJsonMixin,
oauthJsonMixin,
inviteJsonMixin,
permissionJsonMixin,
emojiJsonMixin,
memberJsonMixin,
banJsonMixin,
pollJsonMixin,
pinJsonMixin,
threadJsonMixin,
stageJsonMixin,
voiceJsonMixin,
screenJsonMixin,
presenceJsonMixin,
notificationJsonMixin,
statusJsonMixin,
activityJsonMixin,
sessionJsonMixin,
deviceJsonMixin,
discoveryJsonMixin,
federationJsonMixin,
meshJsonMixin,
multiGuildJsonMixin,
partitionHealJsonMixin,
channelFollowJsonMixin,
guildWidgetJsonMixin,
readStateJsonMixin,
webhookJsonMixin,
vanityUrlJsonMixin,
effectivePermissionJsonMixin,
inviteLinkJsonMixin,
roleOverrideJsonMixin,
oauthGrantJsonMixin,
oauthInstallTokenJsonMixin,
slashRegistryJsonMixin,
slashInvokeAuditJsonMixin,
workerReleaseJsonMixin,
integrationManifestJsonMixin,
platformHyperswarmRuntimeMixin,
platformSessionStartupMixin,
platformGuildOpenFallbackMixin,
platformPartitionHealStateMixin,
platformGuildMeshBoundedMixin,
platformFederationViewMixin,
platformGuildMeshPeerMixin,
platformGuildTopicReplicationMixin,
platformMeshAutoHealMixin,
platformGuildMeshPeerRetryMixin,
platformMeshViewMixin,
platformMeshLoggingMixin,
platformMemberPageBurstMixin,
platformGuildSyncWatermarkMixin,
platformGuildGossipOutboxMixin,
platformGuildSyncBandwidthMixin,
platformGuildSyncHealthPatchMixin,
platformGuildSyncGossipViewMixin,
platformGuildSyncPushScheduleMixin,
platformGuildPresenceVectorMixin,
platformSettingsMeshHealthMixin,
platformGuildSyncWireSparseMixin,
platformGuildSparseSyncQosMixin,
platformGuildContactsPresenceMixin,
platformVoiceMeshStateMixin,
platformGuildThreadForumExportMixin,
platformDiscoveryListingScheduleMixin,
platformGuildMemberSyncScheduleMixin,
platformViewListCacheMixin,
platformSearchCacheMixin,
platformDiscoveryPrefsBaselineMixin,
platformSearchIndexStoreMixin,
platformSearchIndexRebuildMixin,
platformSearchMeshGossipMixin,
platformDiscoveryMeshRefreshMixin,
platformSearchGuildMessagesMixin,
platformSearchQueryFiltersMixin,
platformSearchMeshResolveMixin,
platformForumSearchMixin,
platformForumPartitionHealMixin,
platformViewChannelConsistencyMixin,
platformPinOrphanRepairMixin,
platformViewUnreadAuditMixin,
platformDiscoveryTagsMixin,
platformPartitionPinSearchHealMixin,
platformForumFilterMixin,
platformPartitionReactionStickerHealMixin,
platformPartitionRosterHealMixin,
platformPartitionEmbedHealMixin,
platformPartitionVoicenoteHealMixin,
platformPartitionAttachmentHealMixin,
platformCapabilitiesMixin,
platformPartitionHealOrchestratorMixin,
platformSidecarReplicatorMixin,
platformGuildSyncExportMixin,
platformGuildSyncIngestMixin,
platformGuildWireMixin,
platformViewMixin,
platformJsonExportSurfaceMixin,
platformAuditAutomationExportMixin,
platformAuditArchiveRpcMixin,
platformAutomationDigestSnapshotRpcMixin,
platformDmVoiceMediaMixin,
platformDmSessionMixin,
platformProfileContactsMixin,
platformDiscoveryApiMixin,
platformSearchApiMixin,
platformRegistryMediaMixin,
platformVoiceStageScreenMixin,
platformAttachmentsEmbedsMixin,
platformPermissionsRolesAdminMixin,
platformBotsWebhooksSlashMixin,
platformAutomationHooksDeliveryMixin,
platformAnnouncementsBoostsMixin,
platformGuildAdminMixin,
platformSettingsFoldersPrefsMixin,
platformMessagingMixin,
platformChannelsThreadsForumMixin,
platformDiagnosticsMixin
]
if (ORDERED_PLATFORM_MIXINS.length !== PLATFORM_MIXIN_ASSIGNMENT_COUNT) {
throw new Error(
`ORDERED_PLATFORM_MIXINS mismatch: ${ORDERED_PLATFORM_MIXINS.length} !== ${PLATFORM_MIXIN_ASSIGNMENT_COUNT}`
)
}
if (ORDERED_PLATFORM_MIXINS.length !== PLATFORM_MIXIN_ASSIGNMENTS.length) {
throw new Error(
`ORDERED_PLATFORM_MIXINS manifest mismatch: ${ORDERED_PLATFORM_MIXINS.length} !== ${PLATFORM_MIXIN_ASSIGNMENTS.length}`
)
}
/** Side-effect mixin registration for PearcordPlatform (preserves manifest order). */
function applyPlatformMixins (PearcordPlatform) {
for (const mixin of ORDERED_PLATFORM_MIXINS) {
Object.assign(PearcordPlatform.prototype, mixin)
}
}
module.exports = { applyPlatformMixins, PLATFORM_MIXIN_ASSIGNMENTS }
+32
View File
@@ -0,0 +1,32 @@
'use strict'
/** Suppress duplicate discovery.list span emissions in the same view-build frame (P409-10). */
const DEFAULT_WINDOW_MS = Math.max(
8,
Number(process.env.PEARCORD_DISCOVERY_LIST_DEDUPE_MS) || 16
)
function createDiscoveryListFrameDedupe (windowMs = DEFAULT_WINDOW_MS) {
let lastEmitAt = 0
let suppressed = 0
return {
shouldEmitSpan () {
const now = Date.now()
if (now - lastEmitAt < windowMs) {
suppressed += 1
return false
}
lastEmitAt = now
return true
},
stats () {
return { suppressed, windowMs, lastEmitAt }
},
reset () {
lastEmitAt = 0
suppressed = 0
}
}
}
module.exports = { createDiscoveryListFrameDedupe, DEFAULT_WINDOW_MS }
+88
View File
@@ -0,0 +1,88 @@
'use strict'
const {
buildTargetedGuildGossipRpcFetchPayload,
buildMessageSearchGuildGossipRpcFetchPayload
} = require('./gossip-rpc-payload')
const { lookupGuildGossipRpcPullRegistryEntryByConfig } = require('./gossip-rpc-registry')
const {
buildGuildGossipRpcPullOptsFromRegistry,
buildTargetedGuildGossipRpcPullOptsFromRegistry
} = require('./gossip-rpc-registry-pull')
const {
fetchGuildGossipRpcPullHit,
fetchGuildGossipRpcFromHostHit,
fetchGuildGossipRpcPullMerged
} = require('./gossip-rpc-orchestrators-core')
/** Targeted audit/digest pick-first pull via registry opts builder (Phase 885/889). */
async function fetchTargetedGuildGossipRpcPullHit (
platform,
configKey,
{ resourceIdField, rpcMethod, opts = {}, nextRequestId } = {}
) {
const pullOpts = buildTargetedGuildGossipRpcPullOptsFromRegistry(
platform,
configKey,
resourceIdField,
{ opts, nextRequestId, rpcMethod }
)
if (!pullOpts) return null
return fetchGuildGossipRpcPullHit(platform, pullOpts)
}
/** Dispatch pull orchestrator by registry config key (Phase 885). */
async function fetchGuildGossipRpcPullByConfig (platform, configKey, overrides = {}) {
const entry = lookupGuildGossipRpcPullRegistryEntryByConfig(configKey)
if (!entry) return null
const opts = buildGuildGossipRpcPullOptsFromRegistry(configKey, overrides)
if (!opts) return null
if (entry.pullKind === 'hostHit') return fetchGuildGossipRpcFromHostHit(platform, opts)
if (entry.pullKind === 'pullMerged') return fetchGuildGossipRpcPullMerged(platform, opts)
return fetchGuildGossipRpcPullHit(platform, opts)
}
/** Message search merge pull via registry config + payload builder (Phase 888). */
async function fetchMessageSearchGuildGossipRpcPullByConfig (
platform,
guildId,
query,
opts = {},
requestId
) {
if (!platform.guild?.guild || platform.guild.guild.id !== guildId) return null
return fetchGuildGossipRpcPullByConfig(platform, 'messageSearchMerge', {
buildPayload: async ({ guildId: gid }) =>
buildMessageSearchGuildGossipRpcFetchPayload({
guildId: gid,
requestId,
query,
opts,
requestedBy: platform.identity?.user?.id || null
})
})
}
/** Targeted pullHit via registry config (Phase 887/889 — rpcMethod auto-resolved). */
async function fetchTargetedGuildGossipRpcPullByConfig (
platform,
configKey,
resourceIdField,
opts = {},
nextRequestId
) {
const entry = lookupGuildGossipRpcPullRegistryEntryByConfig(configKey)
if (!entry || entry.pullKind !== 'pullHit') return null
return fetchTargetedGuildGossipRpcPullHit(platform, configKey, {
resourceIdField,
opts,
nextRequestId
})
}
module.exports = {
fetchTargetedGuildGossipRpcPullHit,
fetchTargetedGuildGossipRpcPullByConfig,
fetchGuildGossipRpcPullByConfig,
fetchMessageSearchGuildGossipRpcPullByConfig
}
+24
View File
@@ -0,0 +1,24 @@
'use strict'
/** Attempt/retry/gossip-wait/fetch-once export mesh group (Phase 946). */
const attempt = require('./gossip-rpc-export-mesh-attempt')
const attemptScope = require('./gossip-rpc-export-mesh-attempt-scope')
const retry = require('./gossip-rpc-export-mesh-retry')
const retryPolicy = require('./gossip-rpc-export-mesh-retry-policy')
const gossipWait = require('./gossip-rpc-export-mesh-gossip-wait')
const gossipWaitOptions = require('./gossip-rpc-export-mesh-gossip-wait-options')
const gossipWaitBuild = require('./gossip-rpc-export-mesh-gossip-wait-build')
const fetchOnce = require('./gossip-rpc-export-mesh-fetch-once')
const waiterResolve = require('./gossip-rpc-export-mesh-waiter-resolve')
module.exports = {
...attempt,
...attemptScope,
...retry,
...retryPolicy,
...gossipWait,
...gossipWaitOptions,
...gossipWaitBuild,
...fetchOnce,
...waiterResolve
}
+11
View File
@@ -0,0 +1,11 @@
'use strict'
function exportMeshFetchAttemptNumber (opts = {}) {
return (Number(opts.attempt) || 0) + 1
}
function withExportMeshFetchAttemptFromScope (opts, result) {
return { ...result, fetchAttempt: exportMeshFetchAttemptNumber(opts) }
}
module.exports = { exportMeshFetchAttemptNumber, withExportMeshFetchAttemptFromScope }
+12
View File
@@ -0,0 +1,12 @@
'use strict'
const {
exportMeshFetchAttemptNumber,
withExportMeshFetchAttemptFromScope
} = require('./gossip-rpc-export-mesh-attempt-scope')
function withExportMeshFetchAttempt (opts, result) {
return withExportMeshFetchAttemptFromScope(opts, result)
}
module.exports = { exportMeshFetchAttemptNumber, withExportMeshFetchAttempt }
+33
View File
@@ -0,0 +1,33 @@
'use strict'
const {
buildGuildExportMeshFetchMixin,
buildGuildExportMeshFetchMixinsFromRegistry,
pickGuildExportMeshFetchMixinMethods,
buildPlatformExportMeshFetchMixins
} = require('./gossip-rpc-export-mesh-mixin')
const {
buildGuildExportMeshGossipRequestBase,
buildGuildExportMeshGossipWaitCallback
} = require('./gossip-rpc-export-mesh-gossip-wait-build')
const exportMeshBindMixinHandlers = {
buildGuildExportMeshFetchMixin,
buildGuildExportMeshFetchMixinsFromRegistry,
pickGuildExportMeshFetchMixinMethods,
buildPlatformExportMeshFetchMixins
}
const exportMeshBindGossipWireHandlers = {
buildGuildExportMeshGossipRequestBase,
buildGuildExportMeshGossipWaitCallback
}
const exportMeshBindHandlerKeys = [
...Object.keys(exportMeshBindMixinHandlers),
...Object.keys(exportMeshBindGossipWireHandlers)
]
const exportMeshBindHandlersByKey = { ...exportMeshBindMixinHandlers, ...exportMeshBindGossipWireHandlers }
module.exports = {
exportMeshBindMixinHandlers,
exportMeshBindGossipWireHandlers,
exportMeshBindHandlerKeys,
exportMeshBindHandlersByKey,
...exportMeshBindHandlersByKey
}
+4
View File
@@ -0,0 +1,4 @@
'use strict'
/** Backward-compatible bind wire barrel (Phase 906, 952 thin handlers spread). */
module.exports = require('./gossip-rpc-export-mesh-bind-handlers')
+55
View File
@@ -0,0 +1,55 @@
'use strict'
const { deliveryScope } = require('./platform-class-imports')
const { fetchGuildGossipRpcThenMeshWait } = require('./gossip-rpc-mesh-wait-fallback')
const { exportMeshFetchAttemptNumber } = require('./gossip-rpc-export-mesh-attempt-scope')
const { resolveExportMeshFetchRetryPolicy } = require('./gossip-rpc-export-mesh-retry-policy')
const {
runGuildExportMeshFetchWithRetry,
assertGuildExportMeshFetchPermission
} = require('./gossip-rpc-export-mesh-retry')
async function fetchGuildExportMeshFromMesh (platform, {
resourceId,
opts = {},
permissionError,
notFoundMessage,
fetchOnce
}) {
await assertGuildExportMeshFetchPermission(platform, permissionError)
const policy = resolveExportMeshFetchRetryPolicy({ ...opts, notFoundMessage })
return runGuildExportMeshFetchWithRetry(fetchOnce, resourceId, {
...opts,
...policy,
attempt: exportMeshFetchAttemptNumber(opts) - 1,
computeBackoffMs: deliveryScope.computeArchiveFetchBackoffMs
})
}
async function fetchGuildExportMeshResourceOnce (platform, {
opts = {},
getLocalRow,
validateLocal,
formatLocalHit,
tryRpc,
ingestRpc,
formatRpcHit,
meshGossipWait
}) {
await platform._initDeliveryReceipts(platform.guild.guild.id)
const row = await getLocalRow()
if (validateLocal(row)) return formatLocalHit(row)
return fetchGuildGossipRpcThenMeshWait(
tryRpc,
{
isSuccess: validateLocal,
onRpcHit: async (rpc) => {
await Promise.resolve(ingestRpc(rpc)).catch(() => {})
return formatRpcHit(rpc)
},
meshWait: meshGossipWait
}
)
}
module.exports = { fetchGuildExportMeshFromMesh, fetchGuildExportMeshResourceOnce }
@@ -0,0 +1,13 @@
'use strict'
const { withExportMeshFetchAttemptFromScope } = require('./gossip-rpc-export-mesh-attempt-scope')
/** Format audit export archive mesh local row hit (Phase 935). */
async function formatAuditExportArchiveMeshLocalHit (platform, archiveId, opts) {
return withExportMeshFetchAttemptFromScope(
opts,
await platform.exportAuditExportArchive(archiveId, opts)
)
}
module.exports = { formatAuditExportArchiveMeshLocalHit }
+37
View File
@@ -0,0 +1,37 @@
'use strict'
const { markRpcResponse } = require('./gossip-rpc-validators')
const { withExportMeshFetchAttempt } = require('./gossip-rpc-export-mesh-attempt')
const { buildGuildExportMeshGossipRequestBase } = require('./gossip-rpc-export-mesh-gossip-wait-build')
const { formatAuditExportArchiveMeshLocalHit } = require('./gossip-rpc-export-mesh-format-audit-local')
async function formatAuditExportArchiveMeshRpcHit (platform, archiveId, opts, rpcArch) {
return markRpcResponse(withExportMeshFetchAttempt(
opts,
await platform.exportAuditExportArchive(rpcArch.id || archiveId, opts)
))
}
async function formatAuditExportArchiveMeshGossipResult (platform, archiveId, opts, fetched) {
return withExportMeshFetchAttempt(
opts,
await platform.exportAuditExportArchive(fetched.id || archiveId, opts)
)
}
function sendAuditExportArchiveMeshGossipRequest (platform, archiveId, opts, requestId) {
if (platform.guild.gossipAuditExportArchiveRequest) {
platform.guild.gossipAuditExportArchiveRequest({
...buildGuildExportMeshGossipRequestBase(platform, opts, requestId),
archiveId,
attempt: Number(opts.attempt) || 0
})
}
}
module.exports = {
formatAuditExportArchiveMeshLocalHit,
formatAuditExportArchiveMeshRpcHit,
formatAuditExportArchiveMeshGossipResult,
sendAuditExportArchiveMeshGossipRequest
}
@@ -0,0 +1,24 @@
'use strict'
const { withExportMeshFetchAttemptFromScope } = require('./gossip-rpc-export-mesh-attempt-scope')
/** Format automation digest snapshot mesh row with attempt metadata (Phase 935). */
function formatAutomationDigestSnapshotMeshRow (row, opts) {
return withExportMeshFetchAttemptFromScope(opts, {
snapshotId: row.id,
format: row.format,
body: row.body,
summaryLines: row.summaryLines,
exportedAt: row.exportedAt
})
}
/** Format automation digest snapshot mesh local row hit (Phase 935). */
function formatAutomationDigestSnapshotMeshLocalHit (platform, snapshotId, opts, row) {
return formatAutomationDigestSnapshotMeshRow(row, opts)
}
module.exports = {
formatAutomationDigestSnapshotMeshRow,
formatAutomationDigestSnapshotMeshLocalHit
}
+38
View File
@@ -0,0 +1,38 @@
'use strict'
const { markRpcResponse } = require('./gossip-rpc-validators')
const { buildGuildExportMeshGossipRequestBase } = require('./gossip-rpc-export-mesh-gossip-wait-build')
const {
formatAutomationDigestSnapshotMeshLocalHit,
formatAutomationDigestSnapshotMeshRow
} = require('./gossip-rpc-export-mesh-format-digest-local')
function formatAutomationDigestSnapshotMeshRpcHit (platform, snapshotId, opts, rpcSnap) {
return markRpcResponse(formatAutomationDigestSnapshotMeshRow({
id: rpcSnap.id || snapshotId,
format: rpcSnap.format,
body: rpcSnap.body,
summaryLines: rpcSnap.summaryLines,
exportedAt: rpcSnap.exportedAt
}, opts))
}
function formatAutomationDigestSnapshotMeshGossipResult (platform, snapshotId, opts, fetched) {
return formatAutomationDigestSnapshotMeshRow(fetched, opts)
}
function sendAutomationDigestSnapshotMeshGossipRequest (platform, snapshotId, opts, requestId) {
if (platform.guild.gossipAutomationDigestExportSnapshotRequest) {
platform.guild.gossipAutomationDigestExportSnapshotRequest({
...buildGuildExportMeshGossipRequestBase(platform, opts, requestId),
snapshotId
})
}
}
module.exports = {
formatAutomationDigestSnapshotMeshLocalHit,
formatAutomationDigestSnapshotMeshRpcHit,
formatAutomationDigestSnapshotMeshGossipResult,
sendAutomationDigestSnapshotMeshGossipRequest
}
@@ -0,0 +1,25 @@
'use strict'
const { awaitGuildExportMeshGossipWait } = require('./gossip-rpc-export-mesh-gossip-wait')
const { buildGuildExportMeshGossipWaitOptions } = require('./gossip-rpc-export-mesh-gossip-wait-options')
function buildGuildExportMeshGossipRequestBase (platform, opts = {}, requestId) {
return {
guildId: platform.guild.guild.id,
requestId,
requestedBy: platform.identity.user?.id || null,
targetMemberId: opts.targetMemberId || null,
at: Date.now()
}
}
function buildGuildExportMeshGossipWaitCallback (config) {
return () => awaitGuildExportMeshGossipWait(config)
}
function buildGuildExportMeshGossipWaitCallbackForEntry (platform, entry, resourceId, opts = {}) {
return buildGuildExportMeshGossipWaitCallback(
buildGuildExportMeshGossipWaitOptions(platform, entry, resourceId, opts)
)
}
module.exports = {
buildGuildExportMeshGossipRequestBase,
buildGuildExportMeshGossipWaitCallback,
buildGuildExportMeshGossipWaitCallbackForEntry
}
@@ -0,0 +1,19 @@
'use strict'
/** Build awaitGuildExportMeshGossipWait config from registry entry + platform (Phase 936). */
function buildGuildExportMeshGossipWaitOptions (platform, entry, resourceId, opts = {}) {
return {
resourceId,
opts,
waiters: platform[entry.waitersKey],
waiterMode: entry.waiterMode,
timeoutErrorMessage: entry.timeoutErrorMessage,
notFoundMessage: entry.notFoundMessage,
sendGossipRequest: (requestId) => entry.sendGossipRequest(platform, resourceId, opts, requestId),
refetchLocal: () => entry.getLocalRow(platform, resourceId),
validateLocal: entry.validateLocal,
formatResult: (fetched) => entry.formatGossipResult(platform, resourceId, opts, fetched)
}
}
module.exports = { buildGuildExportMeshGossipWaitOptions }
+49
View File
@@ -0,0 +1,49 @@
'use strict'
const { id } = require('./platform-class-imports')
/** Shared timeout + waiter registration for export mesh gossip fetch (Phase 896). */
async function awaitGuildExportMeshGossipWait ({
resourceId,
opts = {},
waiters,
waiterMode = 'append',
timeoutErrorMessage,
notFoundMessage,
sendGossipRequest,
refetchLocal,
validateLocal,
formatResult
}) {
const timeoutMs = Math.min(12000, Math.max(800, Number(opts.timeoutMs) || 3500))
const requestId = id()
const waitPromise = new Promise((resolve, reject) => {
const timer = setTimeout(() => {
waiters.delete(resourceId)
reject(new Error(timeoutErrorMessage))
}, timeoutMs)
const handler = (row) => {
clearTimeout(timer)
resolve(row)
}
if (waiterMode === 'replace') {
waiters.set(resourceId, [handler])
} else {
const handlers = waiters.get(resourceId) || []
handlers.push(handler)
waiters.set(resourceId, handlers)
}
})
if (typeof sendGossipRequest === 'function') {
sendGossipRequest(requestId)
}
const fetched = await waitPromise.catch(async () => {
const row = await refetchLocal()
if (validateLocal(row)) return row
throw new Error(notFoundMessage)
})
if (!validateLocal(fetched)) throw new Error(notFoundMessage)
return formatResult(fetched)
}
module.exports = { awaitGuildExportMeshGossipWait }
+10
View File
@@ -0,0 +1,10 @@
'use strict'
const { buildPlatformExportMeshFetchMixins } = require('./gossip-rpc-export-mesh-mixin-platform')
const { exportMeshFetchRegistry } = require('./gossip-rpc-export-mesh-registry')
function bootstrapPlatformExportMeshFetchMixinsFromRegistry (registry = exportMeshFetchRegistry) {
return buildPlatformExportMeshFetchMixins(registry)
}
module.exports = { bootstrapPlatformExportMeshFetchMixinsFromRegistry }
+16
View File
@@ -0,0 +1,16 @@
'use strict'
const { buildGuildExportMeshResolveWaiterMethod } = require('./gossip-rpc-export-mesh-mixin-resolve-waiter')
const { buildGuildExportMeshFetchFromMeshMethod } = require('./gossip-rpc-export-mesh-mixin-fetch-from-mesh')
const { buildGuildExportMeshFetchOnceMethod } = require('./gossip-rpc-export-mesh-mixin-fetch-once')
/** Build platform mesh fetch mixin methods from a registry entry (Phase 899930). */
function buildGuildExportMeshFetchMixin (entry) {
return {
[entry.resolveWaiterMethod]: buildGuildExportMeshResolveWaiterMethod(entry),
[entry.fetchFromMeshMethod]: buildGuildExportMeshFetchFromMeshMethod(entry),
[entry.fetchOnceMethod]: buildGuildExportMeshFetchOnceMethod(entry)
}
}
module.exports = { buildGuildExportMeshFetchMixin }
@@ -0,0 +1,18 @@
'use strict'
const { fetchGuildExportMeshFromMesh } = require('./gossip-rpc-export-mesh-fetch-once')
/** Build fetch-from-mesh mixin method for one export mesh registry entry (Phase 930). */
function buildGuildExportMeshFetchFromMeshMethod (entry) {
return async function fetchFromMeshMethod (resourceId, opts = {}) {
return fetchGuildExportMeshFromMesh(this, {
resourceId,
opts,
permissionError: entry.permissionError,
notFoundMessage: entry.notFoundMessage,
fetchOnce: (id, o) => this[entry.fetchOnceMethod](id, o)
})
}
}
module.exports = { buildGuildExportMeshFetchFromMeshMethod }
@@ -0,0 +1,12 @@
'use strict'
/** Build try/ingest/format RPC leg for export mesh fetch-once mixin (Phase 947). */
function buildGuildExportMeshFetchOnceRpcLeg (platform, entry, resourceId, opts = {}) {
return {
tryRpc: () => entry.tryRpc(platform, resourceId, opts),
ingestRpc: (rpc) => entry.ingestRpc(platform, rpc),
formatRpcHit: (rpc) => entry.formatRpcHit(platform, resourceId, opts, rpc)
}
}
module.exports = { buildGuildExportMeshFetchOnceRpcLeg }
@@ -0,0 +1,24 @@
'use strict'
const { buildGuildExportMeshGossipWaitOptions } = require('./gossip-rpc-export-mesh-gossip-wait-options')
const { buildGuildExportMeshGossipWaitCallback } = require('./gossip-rpc-export-mesh-gossip-wait-build')
const { fetchGuildExportMeshResourceOnce } = require('./gossip-rpc-export-mesh-fetch-once')
const { buildGuildExportMeshFetchOnceRpcLeg } = require('./gossip-rpc-export-mesh-mixin-fetch-once-rpc')
function buildGuildExportMeshFetchOnceMethod (entry) {
return async function fetchOnceMethod (resourceId, opts = {}) {
const platform = this
return fetchGuildExportMeshResourceOnce(platform, {
opts,
getLocalRow: () => entry.getLocalRow(platform, resourceId),
validateLocal: entry.validateLocal,
formatLocalHit: (row) => entry.formatLocalHit(platform, resourceId, opts, row),
...buildGuildExportMeshFetchOnceRpcLeg(platform, entry, resourceId, opts),
meshGossipWait: buildGuildExportMeshGossipWaitCallback(
buildGuildExportMeshGossipWaitOptions(platform, entry, resourceId, opts)
)
})
}
}
module.exports = { buildGuildExportMeshFetchOnceMethod }
+22
View File
@@ -0,0 +1,22 @@
'use strict'
const { exportMeshFetchNamedMixinMap } = require('./gossip-rpc-export-mesh-registry-named')
const {
buildGuildExportMeshFetchMixinsFromRegistry,
pickGuildExportMeshFetchMixinMethods
} = require('./gossip-rpc-export-mesh-mixin-registry')
/** Build consolidated + named platform export mesh fetch mixins (Phase 904930). */
function buildPlatformExportMeshFetchMixins (registry) {
const platformExportMeshFetchMixin = buildGuildExportMeshFetchMixinsFromRegistry(registry)
const named = { platformExportMeshFetchMixin }
for (const [exportKey, registryName] of Object.entries(exportMeshFetchNamedMixinMap)) {
named[exportKey] = pickGuildExportMeshFetchMixinMethods(
registry[registryName],
platformExportMeshFetchMixin
)
}
return named
}
module.exports = { buildPlatformExportMeshFetchMixins }
+27
View File
@@ -0,0 +1,27 @@
'use strict'
const { buildGuildExportMeshFetchMixin } = require('./gossip-rpc-export-mesh-mixin-entry')
const { listExportMeshFetchMixinMethodKeysForEntry } = require('./gossip-rpc-export-mesh-registry-lists-mixin-keys')
/** Build mesh fetch mixin methods for every registry entry (Phase 901930). */
function buildGuildExportMeshFetchMixinsFromRegistry (registry) {
const mixins = {}
for (const entry of Object.values(registry)) {
Object.assign(mixins, buildGuildExportMeshFetchMixin(entry))
}
return mixins
}
/** Pick one registry entry's methods from a consolidated mixin (Phase 902930). */
function pickGuildExportMeshFetchMixinMethods (entry, mixin) {
const picked = {}
for (const methodKey of listExportMeshFetchMixinMethodKeysForEntry(entry)) {
picked[methodKey] = mixin[methodKey]
}
return picked
}
module.exports = {
buildGuildExportMeshFetchMixinsFromRegistry,
pickGuildExportMeshFetchMixinMethods
}
@@ -0,0 +1,10 @@
'use strict'
/** Build resolve-waiter mixin method for one export mesh registry entry (Phase 930). */
function buildGuildExportMeshResolveWaiterMethod (entry) {
return function resolveWaiterMethod (resource) {
entry.resolveWaiter(this[entry.waitersKey], resource, entry.validateLocal)
}
}
module.exports = { buildGuildExportMeshResolveWaiterMethod }
+19
View File
@@ -0,0 +1,19 @@
'use strict'
const { buildGuildExportMeshFetchMixin } = require('./gossip-rpc-export-mesh-mixin-entry')
const { buildGuildExportMeshFetchOnceRpcLeg } = require('./gossip-rpc-export-mesh-mixin-fetch-once-rpc')
const {
buildGuildExportMeshFetchMixinsFromRegistry,
pickGuildExportMeshFetchMixinMethods
} = require('./gossip-rpc-export-mesh-mixin-registry')
const { buildPlatformExportMeshFetchMixins } = require('./gossip-rpc-export-mesh-mixin-platform')
const { bootstrapPlatformExportMeshFetchMixinsFromRegistry } = require('./gossip-rpc-export-mesh-mixin-bootstrap')
module.exports = {
buildGuildExportMeshFetchOnceRpcLeg,
buildGuildExportMeshFetchMixin,
buildGuildExportMeshFetchMixinsFromRegistry,
pickGuildExportMeshFetchMixinMethods,
buildPlatformExportMeshFetchMixins,
bootstrapPlatformExportMeshFetchMixinsFromRegistry
}
+32
View File
@@ -0,0 +1,32 @@
'use strict'
const { gossipRpcPullConfigs } = require('./gossip-rpc-pull-config')
let exportMeshGossipRpcPullConfigKeys = null
function listExportMeshGossipRpcPullConfigKeys () {
if (!exportMeshGossipRpcPullConfigKeys) {
const { exportMeshFetchRegistry } = require('./gossip-rpc-export-mesh-registry')
exportMeshGossipRpcPullConfigKeys = Object.values(exportMeshFetchRegistry).map((e) => e.pullConfigKey)
}
return exportMeshGossipRpcPullConfigKeys
}
function isExportMeshGossipRpcPullConfigKey (configKey) {
return listExportMeshGossipRpcPullConfigKeys().includes(configKey)
}
function assertExportMeshGossipRpcPullConfigAligned () {
for (const key of listExportMeshGossipRpcPullConfigKeys()) {
if (!gossipRpcPullConfigs[key]) {
throw new Error(`export mesh pullConfigKey missing from gossipRpcPullConfigs: ${key}`)
}
}
}
async function dispatchExportMeshGossipRpcPullByConfig (platform, configKey, resourceIdField, opts = {}, nextRequestId) {
if (!isExportMeshGossipRpcPullConfigKey(configKey)) return null
const { fetchTargetedGuildGossipRpcPullByConfig } = require('./gossip-rpc-config-orchestrators')
return fetchTargetedGuildGossipRpcPullByConfig(platform, configKey, resourceIdField, opts, nextRequestId)
}
module.exports = {
listExportMeshGossipRpcPullConfigKeys,
isExportMeshGossipRpcPullConfigKey,
assertExportMeshGossipRpcPullConfigAligned,
dispatchExportMeshGossipRpcPullByConfig
}
@@ -0,0 +1,29 @@
'use strict'
const { resolveExportMeshFetchWaiterByPrefix } = require('./gossip-rpc-export-mesh-waiter-resolve')
const { isValidAuditExportArchiveMeshRow } = require('./gossip-rpc-export-mesh-validators-audit')
const { formatAuditExportArchiveMeshLocalHit, formatAuditExportArchiveMeshRpcHit, formatAuditExportArchiveMeshGossipResult, sendAuditExportArchiveMeshGossipRequest } = require('./gossip-rpc-export-mesh-format-audit')
const { getAuditExportArchiveMeshLocalRow } = require('./gossip-rpc-export-mesh-row-audit-mesh')
const { tryFetchAuditExportArchiveMeshRpc, ingestAuditExportArchiveMeshRpc } = require('./gossip-rpc-export-mesh-row-audit')
function buildAuditExportArchiveMeshFetchEntrySpec () {
return {
pullConfigKey: 'auditExportArchive',
resolveWaiterMethod: '_resolveAuditArchiveFetchWaiter',
fetchFromMeshMethod: 'fetchAuditExportArchiveFromMesh',
fetchOnceMethod: '_fetchAuditExportArchiveFromMeshOnce',
waitersKey: '_auditArchiveFetchWaiters',
resolveWaiter: resolveExportMeshFetchWaiterByPrefix,
permissionError: 'no permission to fetch audit export archive',
notFoundMessage: 'audit export archive not found on mesh',
validateLocal: isValidAuditExportArchiveMeshRow,
waiterMode: 'append',
timeoutErrorMessage: 'audit archive fetch timed out',
getLocalRow: getAuditExportArchiveMeshLocalRow,
tryRpc: tryFetchAuditExportArchiveMeshRpc,
ingestRpc: ingestAuditExportArchiveMeshRpc,
formatLocalHit: formatAuditExportArchiveMeshLocalHit,
formatRpcHit: formatAuditExportArchiveMeshRpcHit,
formatGossipResult: formatAuditExportArchiveMeshGossipResult,
sendGossipRequest: sendAuditExportArchiveMeshGossipRequest
}
}
module.exports = { buildAuditExportArchiveMeshFetchEntrySpec }
+7
View File
@@ -0,0 +1,7 @@
'use strict'
const { buildExportMeshFetchRegistryEntry } = require('./gossip-rpc-export-mesh-registry-entry')
const { buildAuditExportArchiveMeshFetchEntrySpec } = require('./gossip-rpc-export-mesh-registry-audit-spec')
const auditExportArchiveMeshFetchEntry = buildExportMeshFetchRegistryEntry(
buildAuditExportArchiveMeshFetchEntrySpec()
)
module.exports = { auditExportArchiveMeshFetchEntry }
@@ -0,0 +1,12 @@
'use strict'
const {
buildExportMeshFetchRegistryDiagnosticsPayloadFromScope
} = require('./gossip-rpc-export-mesh-registry-diagnostics-payload-scope')
/** Build export mesh registry diagnostics snapshot from scope (Phase 914927). */
function buildExportMeshFetchRegistryDiagnosticsSnapshot () {
return buildExportMeshFetchRegistryDiagnosticsPayloadFromScope()
}
module.exports = { buildExportMeshFetchRegistryDiagnosticsSnapshot }
@@ -0,0 +1,13 @@
'use strict'
const {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames
} = require('./gossip-rpc-export-mesh-registry-named-lists')
module.exports = {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames
}
@@ -0,0 +1,24 @@
'use strict'
const {
listExportMeshFetchMixinMethodsFromScope,
listExportMeshFetchWaitersKeysFromScope,
buildExportMeshFetchRegistrySnapshotFromScope
} = require('./gossip-rpc-export-mesh-registry-scope-lists')
const {
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames
} = require('./gossip-rpc-export-mesh-registry-diagnostics-inputs-named')
/** Build export mesh registry diagnostics inputs from scope (Phase 921). */
function buildExportMeshFetchRegistryDiagnosticsInputsFromScope (_registry, keys) {
return {
registryKeys: keys,
registrySnapshot: buildExportMeshFetchRegistrySnapshotFromScope(),
mixinMethods: listExportMeshFetchMixinMethodsFromScope(),
waitersKeys: listExportMeshFetchWaitersKeysFromScope(),
namedMixinExportKeys: listExportMeshFetchNamedMixinExportKeys(),
namedMixinRegistryNames: listExportMeshFetchNamedMixinRegistryNames()
}
}
module.exports = { buildExportMeshFetchRegistryDiagnosticsInputsFromScope }
@@ -0,0 +1,20 @@
'use strict'
const {
buildExportMeshFetchRegistryDiagnosticsPayload
} = require('./gossip-rpc-export-mesh-registry-snapshot')
const { withExportMeshFetchRegistryScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-scope')
const {
buildExportMeshFetchRegistryDiagnosticsInputsFromScope
} = require('./gossip-rpc-export-mesh-registry-diagnostics-inputs')
/** Build export mesh registry diagnostics payload from scope (Phase 918927). */
function buildExportMeshFetchRegistryDiagnosticsPayloadFromScope () {
return withExportMeshFetchRegistryScope((registry, keys) =>
buildExportMeshFetchRegistryDiagnosticsPayload(
buildExportMeshFetchRegistryDiagnosticsInputsFromScope(registry, keys)
)
)
}
module.exports = { buildExportMeshFetchRegistryDiagnosticsPayloadFromScope }
@@ -0,0 +1,7 @@
'use strict'
const {
buildExportMeshFetchRegistryDiagnosticsSnapshot
} = require('./gossip-rpc-export-mesh-registry-diagnostics-build')
module.exports = { buildExportMeshFetchRegistryDiagnosticsSnapshot }
@@ -0,0 +1,13 @@
'use strict'
const {
buildExportMeshFetchRegistryDiagnosticsPayloadFromScope
} = require('./gossip-rpc-export-mesh-registry-diagnostics-payload-scope')
const {
buildExportMeshFetchRegistryDiagnosticsSnapshot
} = require('./gossip-rpc-export-mesh-registry-diagnostics-build')
module.exports = {
buildExportMeshFetchRegistryDiagnosticsPayloadFromScope,
buildExportMeshFetchRegistryDiagnosticsSnapshot
}
@@ -0,0 +1,29 @@
'use strict'
const { resolveExportMeshFetchWaiterByExactKey } = require('./gossip-rpc-export-mesh-waiter-resolve')
const { isValidAutomationDigestSnapshotMeshRow } = require('./gossip-rpc-export-mesh-validators-digest')
const { formatAutomationDigestSnapshotMeshLocalHit, formatAutomationDigestSnapshotMeshRpcHit, formatAutomationDigestSnapshotMeshGossipResult, sendAutomationDigestSnapshotMeshGossipRequest } = require('./gossip-rpc-export-mesh-format-digest')
const { getAutomationDigestSnapshotMeshLocalRow } = require('./gossip-rpc-export-mesh-row-digest-mesh')
const { tryFetchAutomationDigestSnapshotMeshRpc, ingestAutomationDigestSnapshotMeshRpc } = require('./gossip-rpc-export-mesh-row-digest')
function buildAutomationDigestSnapshotMeshFetchEntrySpec () {
return {
pullConfigKey: 'automationDigestSnapshot',
resolveWaiterMethod: '_resolveAutomationDigestSnapshotFetchWaiter',
fetchFromMeshMethod: 'fetchAutomationDigestSnapshotFromMesh',
fetchOnceMethod: '_fetchAutomationDigestSnapshotFromMeshOnce',
waitersKey: '_automationDigestSnapshotFetchWaiters',
resolveWaiter: resolveExportMeshFetchWaiterByExactKey,
permissionError: 'no permission to fetch automation digest snapshot',
notFoundMessage: 'automation digest snapshot not found on mesh',
validateLocal: isValidAutomationDigestSnapshotMeshRow,
waiterMode: 'replace',
timeoutErrorMessage: 'automation digest snapshot fetch timed out',
getLocalRow: getAutomationDigestSnapshotMeshLocalRow,
tryRpc: tryFetchAutomationDigestSnapshotMeshRpc,
ingestRpc: ingestAutomationDigestSnapshotMeshRpc,
formatLocalHit: formatAutomationDigestSnapshotMeshLocalHit,
formatRpcHit: formatAutomationDigestSnapshotMeshRpcHit,
formatGossipResult: formatAutomationDigestSnapshotMeshGossipResult,
sendGossipRequest: sendAutomationDigestSnapshotMeshGossipRequest
}
}
module.exports = { buildAutomationDigestSnapshotMeshFetchEntrySpec }
@@ -0,0 +1,7 @@
'use strict'
const { buildExportMeshFetchRegistryEntry } = require('./gossip-rpc-export-mesh-registry-entry')
const { buildAutomationDigestSnapshotMeshFetchEntrySpec } = require('./gossip-rpc-export-mesh-registry-digest-spec')
const automationDigestSnapshotMeshFetchEntry = buildExportMeshFetchRegistryEntry(
buildAutomationDigestSnapshotMeshFetchEntrySpec()
)
module.exports = { automationDigestSnapshotMeshFetchEntry }
@@ -0,0 +1,9 @@
'use strict'
/** Shallow clone one export mesh fetch registry entry (Phase 934). */
function cloneExportMeshFetchRegistryEntry (entry) {
if (!entry) return null
return { ...entry }
}
module.exports = { cloneExportMeshFetchRegistryEntry }
@@ -0,0 +1,26 @@
'use strict'
/** Export mesh registry entry field groups for factory wiring (Phase 934). */
const exportMeshFetchRegistryEntryFieldGroups = [
['pullConfigKey', 'waitersKey', 'waiterMode'],
['resolveWaiterMethod', 'fetchFromMeshMethod', 'fetchOnceMethod'],
['permissionError', 'notFoundMessage', 'timeoutErrorMessage'],
[
'resolveWaiter', 'validateLocal', 'getLocalRow', 'tryRpc', 'ingestRpc',
'formatLocalHit', 'formatRpcHit', 'formatGossipResult', 'sendGossipRequest'
]
]
/** Build one export mesh fetch registry entry from a spec (Phase 934). */
function buildExportMeshFetchRegistryEntryFromSpec (spec) {
const entry = {}
for (const group of exportMeshFetchRegistryEntryFieldGroups) {
for (const key of group) entry[key] = spec[key]
}
return entry
}
module.exports = {
exportMeshFetchRegistryEntryFieldGroups,
buildExportMeshFetchRegistryEntryFromSpec
}
+23
View File
@@ -0,0 +1,23 @@
'use strict'
const { buildExportMeshFetchRegistryEntryFromSpec } = require('./gossip-rpc-export-mesh-registry-entry-fields')
const { cloneExportMeshFetchRegistryEntry } = require('./gossip-rpc-export-mesh-registry-entry-clone')
/** Build one export mesh fetch registry entry from a spec (Phase 905). */
function buildExportMeshFetchRegistryEntry (spec) {
return buildExportMeshFetchRegistryEntryFromSpec(spec)
}
/** Clone one export mesh registry entry by name from scope (Phase 916920). */
function lookupExportMeshFetchRegistryEntryFromScope (name) {
const { withExportMeshFetchRegistryScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-scope')
return withExportMeshFetchRegistryScope((registry) =>
cloneExportMeshFetchRegistryEntry(registry[name])
)
}
module.exports = {
buildExportMeshFetchRegistryEntry,
cloneExportMeshFetchRegistryEntry,
lookupExportMeshFetchRegistryEntryFromScope
}
+66
View File
@@ -0,0 +1,66 @@
'use strict'
/** Registry lookup/validate/diagnostics export mesh group (Phase 946). */
function spread (...mods) { return Object.assign({}, ...mods) }
module.exports = spread(
require('./gossip-rpc-export-mesh-registry'),
require('./gossip-rpc-export-mesh-registry-lookup-facade'),
require('./gossip-rpc-export-mesh-registry-scope-lists-alias-map'),
require('./gossip-rpc-export-mesh-registry-lookup-entry'),
require('./gossip-rpc-export-mesh-registry-lookup-entry-resolve'),
require('./gossip-rpc-export-mesh-registry-lookup-entry-bind'),
require('./gossip-rpc-export-mesh-registry-lookup-entry-bind-factory'),
require('./gossip-rpc-export-mesh-registry-lookup-bind-exports'),
require('./gossip-rpc-export-mesh-registry-lookup-bind'),
require('./gossip-rpc-export-mesh-registry-lookup-map'),
require('./gossip-rpc-export-mesh-registry-lookup-name'),
require('./gossip-rpc-export-mesh-registry-lookup-name-entry-field-scope'),
require('./gossip-rpc-export-mesh-registry-lookup-name-mixin-method-scope'),
require('./gossip-rpc-export-mesh-registry-lookup-name-field-shortcuts'),
require('./gossip-rpc-export-mesh-registry-lookup-name-scope'),
require('./gossip-rpc-export-mesh-registry-scope'),
require('./gossip-rpc-export-mesh-registry-scope-lists-derive'),
require('./gossip-rpc-export-mesh-registry-scope-lists'),
require('./gossip-rpc-export-mesh-registry-scope-lists-build'),
require('./gossip-rpc-export-mesh-registry-scope-lists-aliases'),
require('./gossip-rpc-export-mesh-registry-diagnostics'),
require('./gossip-rpc-export-mesh-registry-diagnostics-build'),
require('./gossip-rpc-export-mesh-registry-diagnostics-payload-scope'),
require('./gossip-rpc-export-mesh-registry-diagnostics-snapshot'),
require('./gossip-rpc-export-mesh-registry-diagnostics-inputs'),
require('./gossip-rpc-export-mesh-registry-diagnostics-inputs-named'),
require('./gossip-rpc-export-mesh-registry-lists'),
require('./gossip-rpc-export-mesh-registry-lists-keys'),
require('./gossip-rpc-export-mesh-registry-lists-entry-field'),
require('./gossip-rpc-export-mesh-registry-lists-find'),
require('./gossip-rpc-export-mesh-registry-lists-mixin-keys'),
require('./gossip-rpc-export-mesh-registry-named'),
require('./gossip-rpc-export-mesh-registry-named-lists'),
require('./gossip-rpc-export-mesh-registry-pull-keys'),
require('./gossip-rpc-export-mesh-registry-snapshot-keys'),
require('./gossip-rpc-export-mesh-registry-snapshot'),
require('./gossip-rpc-export-mesh-registry-snapshot-entry'),
require('./gossip-rpc-export-mesh-registry-validate-facade'),
require('./gossip-rpc-export-mesh-registry-validate-alignment-wrapper'),
require('./gossip-rpc-export-mesh-registry-validate-alignment'),
require('./gossip-rpc-export-mesh-registry-validate-alignment-scope'),
require('./gossip-rpc-export-mesh-registry-validate-alignment-entries-scope'),
require('./gossip-rpc-export-mesh-registry-validate-entries'),
require('./gossip-rpc-export-mesh-registry-validate-entry-fields-scope'),
require('./gossip-rpc-export-mesh-registry-validate-entry-uniqueness-scope'),
require('./gossip-rpc-export-mesh-registry-validate-coverage'),
require('./gossip-rpc-export-mesh-registry-validate-pull-config-coverage-scope'),
require('./gossip-rpc-export-mesh-registry-validate-named-mixin-coverage-scope'),
require('./gossip-rpc-export-mesh-registry-validate-scope-list-counts-scope'),
require('./gossip-rpc-export-mesh-registry-validate-pull-keys'),
require('./gossip-rpc-export-mesh-registry-validate-e2e'),
require('./gossip-rpc-export-mesh-registry-validate-fields-unique'),
require('./gossip-rpc-export-mesh-registry-validate-fields'),
require('./gossip-rpc-export-mesh-registry-validate-unique'),
require('./gossip-rpc-export-mesh-registry-entry'),
require('./gossip-rpc-export-mesh-registry-entry-fields'),
require('./gossip-rpc-export-mesh-registry-entry-clone'),
require('./gossip-rpc-export-mesh-registry-audit-spec'),
require('./gossip-rpc-export-mesh-registry-digest-spec')
)
@@ -0,0 +1,16 @@
'use strict'
/** List one field across export mesh registry entries (Phase 932). */
function listExportMeshFetchRegistryEntryField (registry, keys, field) {
return keys.map((name) => registry[name][field])
}
/** Derive pull config keys from registry entries (Phase 932). */
function listExportMeshPullConfigKeysFromRegistry (registry, keys) {
return listExportMeshFetchRegistryEntryField(registry, keys, 'pullConfigKey')
}
module.exports = {
listExportMeshFetchRegistryEntryField,
listExportMeshPullConfigKeysFromRegistry
}
@@ -0,0 +1,34 @@
'use strict'
const { listExportMeshFetchMixinMethodKeysForEntry } = require('./gossip-rpc-export-mesh-registry-lists-mixin-keys')
/** Find export mesh registry name by predicate (Phase 908929). */
function findExportMeshFetchRegistryName (registry, keys, predicate) {
return keys.find((key) => predicate(registry[key], key)) || null
}
/** Find export mesh registry name by entry field value (Phase 909929). */
function findExportMeshFetchRegistryNameByEntryField (registry, keys, field, value) {
return findExportMeshFetchRegistryName(registry, keys, (entry) => entry[field] === value)
}
/** Test whether an entry exposes a mixin method key (Phase 910929). */
function entryMatchesExportMeshFetchMixinMethod (entry, methodName) {
return listExportMeshFetchMixinMethodKeysForEntry(entry).includes(methodName)
}
/** Find export mesh registry name by mixin method (Phase 910929). */
function findExportMeshFetchRegistryNameByMixinMethod (registry, keys, methodName) {
return findExportMeshFetchRegistryName(
registry,
keys,
(entry) => entryMatchesExportMeshFetchMixinMethod(entry, methodName)
)
}
module.exports = {
findExportMeshFetchRegistryName,
findExportMeshFetchRegistryNameByEntryField,
entryMatchesExportMeshFetchMixinMethod,
findExportMeshFetchRegistryNameByMixinMethod
}
@@ -0,0 +1,10 @@
'use strict'
const { exportMeshFetchRegistry } = require('./gossip-rpc-export-mesh-registry')
/** List export mesh fetch registry entry names (Phase 932). */
function listExportMeshFetchRegistryKeys (registry = exportMeshFetchRegistry) {
return Object.keys(registry)
}
module.exports = { listExportMeshFetchRegistryKeys }
@@ -0,0 +1,24 @@
'use strict'
/** List mixin method keys for one export mesh registry entry (Phase 906929). */
function listExportMeshFetchMixinMethodKeysForEntry (entry) {
return [
entry.resolveWaiterMethod,
entry.fetchFromMeshMethod,
entry.fetchOnceMethod
]
}
/** List mixin methods across all registry entries (Phase 903929). */
function listExportMeshFetchMixinMethodsFromRegistry (registry, keys) {
const methods = []
for (const name of keys) {
methods.push(...listExportMeshFetchMixinMethodKeysForEntry(registry[name]))
}
return methods
}
module.exports = {
listExportMeshFetchMixinMethodKeysForEntry,
listExportMeshFetchMixinMethodsFromRegistry
}
+29
View File
@@ -0,0 +1,29 @@
'use strict'
const { listExportMeshFetchRegistryKeys } = require('./gossip-rpc-export-mesh-registry-lists-keys')
const {
listExportMeshFetchRegistryEntryField,
listExportMeshPullConfigKeysFromRegistry
} = require('./gossip-rpc-export-mesh-registry-lists-entry-field')
const {
listExportMeshFetchMixinMethodKeysForEntry,
listExportMeshFetchMixinMethodsFromRegistry
} = require('./gossip-rpc-export-mesh-registry-lists-mixin-keys')
const {
findExportMeshFetchRegistryName,
findExportMeshFetchRegistryNameByEntryField,
entryMatchesExportMeshFetchMixinMethod,
findExportMeshFetchRegistryNameByMixinMethod
} = require('./gossip-rpc-export-mesh-registry-lists-find')
module.exports = {
listExportMeshFetchRegistryKeys,
listExportMeshFetchRegistryEntryField,
listExportMeshFetchMixinMethodsFromRegistry,
listExportMeshFetchMixinMethodKeysForEntry,
listExportMeshPullConfigKeysFromRegistry,
findExportMeshFetchRegistryName,
findExportMeshFetchRegistryNameByEntryField,
entryMatchesExportMeshFetchMixinMethod,
findExportMeshFetchRegistryNameByMixinMethod
}
@@ -0,0 +1,24 @@
'use strict'
const { buildExportMeshFetchRegistryEntryLookupBind } = require('./gossip-rpc-export-mesh-registry-lookup-entry-bind-factory')
const { buildExportMeshFetchRegistryEntryNameLookupMap } = require('./gossip-rpc-export-mesh-registry-lookup-map')
/** Build export mesh registry lookup bind exports (Phase 931). */
function buildExportMeshFetchRegistryLookupBindExports () {
const { lookupExportMeshFetchRegistryEntryFromScope } = require('./gossip-rpc-export-mesh-registry-entry')
const entryLookups = buildExportMeshFetchRegistryEntryLookupBind(
lookupExportMeshFetchRegistryEntryFromScope,
buildExportMeshFetchRegistryEntryNameLookupMap()
)
return {
lookupExportMeshFetchRegistryEntry: lookupExportMeshFetchRegistryEntryFromScope,
...entryLookups
}
}
const bindExports = buildExportMeshFetchRegistryLookupBindExports()
module.exports = {
buildExportMeshFetchRegistryLookupBindExports,
...bindExports
}
@@ -0,0 +1,11 @@
'use strict'
const {
buildExportMeshFetchRegistryLookupBindExports,
...bindExports
} = require('./gossip-rpc-export-mesh-registry-lookup-bind-exports')
module.exports = {
buildExportMeshFetchRegistryLookupBindExports,
...bindExports
}
@@ -0,0 +1,24 @@
'use strict'
const { bindExportMeshFetchRegistryEntryLookup } = require('./gossip-rpc-export-mesh-registry-lookup-entry-bind')
function bindExportMeshFetchRegistryEntryLookupForNameLookup (lookupEntry, nameLookupFn) {
const resolveEntry = bindExportMeshFetchRegistryEntryLookup(lookupEntry)
return (arg) => resolveEntry(() => nameLookupFn(arg))
}
function buildExportMeshFetchRegistryEntryLookupBind (lookupEntry, nameLookups) {
const lookups = {}
for (const [lookupName, nameLookupFn] of Object.entries(nameLookups)) {
lookups[lookupName] = bindExportMeshFetchRegistryEntryLookupForNameLookup(lookupEntry, nameLookupFn)
}
return lookups
}
const buildExportMeshFetchRegistryEntryLookups = buildExportMeshFetchRegistryEntryLookupBind
module.exports = {
bindExportMeshFetchRegistryEntryLookupForNameLookup,
buildExportMeshFetchRegistryEntryLookupBind,
buildExportMeshFetchRegistryEntryLookups
}
@@ -0,0 +1,12 @@
'use strict'
const {
lookupExportMeshFetchRegistryEntryByResolvedName
} = require('./gossip-rpc-export-mesh-registry-lookup-entry-resolve')
/** Bind entry lookup to a name resolver callback chain (Phase 913930, 948 resolve-only). */
function bindExportMeshFetchRegistryEntryLookup (lookupEntry) {
return (resolveName) => lookupExportMeshFetchRegistryEntryByResolvedName(resolveName, lookupEntry)
}
module.exports = { bindExportMeshFetchRegistryEntryLookup }
@@ -0,0 +1,17 @@
'use strict'
/** Resolve a cloned registry entry when a registry name is present (Phase 911930). */
function lookupExportMeshFetchRegistryEntryIfName (name, lookupEntry) {
if (!name) return null
return lookupEntry(name)
}
/** Resolve entry via a name resolver callback (Phase 912930). */
function lookupExportMeshFetchRegistryEntryByResolvedName (resolveName, lookupEntry) {
return lookupExportMeshFetchRegistryEntryIfName(resolveName(), lookupEntry)
}
module.exports = {
lookupExportMeshFetchRegistryEntryIfName,
lookupExportMeshFetchRegistryEntryByResolvedName
}
@@ -0,0 +1,21 @@
'use strict'
const {
lookupExportMeshFetchRegistryEntryIfName,
lookupExportMeshFetchRegistryEntryByResolvedName
} = require('./gossip-rpc-export-mesh-registry-lookup-entry-resolve')
const { bindExportMeshFetchRegistryEntryLookup } = require('./gossip-rpc-export-mesh-registry-lookup-entry-bind')
const {
bindExportMeshFetchRegistryEntryLookupForNameLookup,
buildExportMeshFetchRegistryEntryLookupBind,
buildExportMeshFetchRegistryEntryLookups
} = require('./gossip-rpc-export-mesh-registry-lookup-entry-bind-factory')
module.exports = {
lookupExportMeshFetchRegistryEntryIfName,
lookupExportMeshFetchRegistryEntryByResolvedName,
bindExportMeshFetchRegistryEntryLookup,
bindExportMeshFetchRegistryEntryLookupForNameLookup,
buildExportMeshFetchRegistryEntryLookupBind,
buildExportMeshFetchRegistryEntryLookups
}
@@ -0,0 +1,24 @@
'use strict'
const { listExportMeshFetchRegistryKeys } = require('./gossip-rpc-export-mesh-registry-lists')
const { exportMeshFetchRegistryScopeListAliases } = require('./gossip-rpc-export-mesh-registry-scope-lists-aliases')
const lookupName = require('./gossip-rpc-export-mesh-registry-lookup-name')
const lookupBind = require('./gossip-rpc-export-mesh-registry-lookup-bind')
const { buildExportMeshFetchRegistryDiagnosticsSnapshot } = require('./gossip-rpc-export-mesh-registry-diagnostics-snapshot')
function buildExportMeshFetchRegistryLookupFacade () {
return {
listExportMeshFetchRegistryKeys,
...exportMeshFetchRegistryScopeListAliases,
buildExportMeshFetchRegistryDiagnosticsSnapshot,
...lookupName,
...lookupBind
}
}
const exportMeshFetchRegistryLookupFacade = buildExportMeshFetchRegistryLookupFacade()
module.exports = {
buildExportMeshFetchRegistryLookupFacade,
...exportMeshFetchRegistryLookupFacade
}
@@ -0,0 +1,20 @@
'use strict'
/** Map entry lookup export names to scope-bound name resolver functions (Phase 931, 948 lazy scope). */
function buildExportMeshFetchRegistryEntryNameLookupMap () {
const { buildExportMeshFetchRegistryNameLookupByEntryFieldFromScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-entry-field-scope')
const { buildExportMeshFetchRegistryNameLookupByMixinMethodFromScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-mixin-method-scope')
const { buildExportMeshFetchRegistryNameFieldShortcuts } = require('./gossip-rpc-export-mesh-registry-lookup-name-field-shortcuts')
const { lookupExportMeshFetchRegistryNameByNamedMixinExport: lookupNamedMixinExportKey } = require('./gossip-rpc-export-mesh-registry-named')
const lookupByEntryField = buildExportMeshFetchRegistryNameLookupByEntryFieldFromScope()
const pullWaiters = buildExportMeshFetchRegistryNameFieldShortcuts(lookupByEntryField)
const lookupMixin = buildExportMeshFetchRegistryNameLookupByMixinMethodFromScope()
return {
lookupExportMeshFetchRegistryEntryByPullConfig: pullWaiters.lookupExportMeshFetchRegistryNameByPullConfig,
lookupExportMeshFetchRegistryEntryByMixinMethod: lookupMixin,
lookupExportMeshFetchRegistryEntryByWaitersKey: pullWaiters.lookupExportMeshFetchRegistryNameByWaitersKey,
lookupExportMeshFetchRegistryEntryByNamedMixinExport: (exportKey) => lookupNamedMixinExportKey(exportKey)
}
}
module.exports = { buildExportMeshFetchRegistryEntryNameLookupMap }
@@ -0,0 +1,11 @@
'use strict'
const { findExportMeshFetchRegistryNameByEntryField } = require('./gossip-rpc-export-mesh-registry-lists-find')
const { buildExportMeshFetchRegistryNameLookupFromScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-scope')
/** Build scope-bound export mesh registry name lookup by entry field (Phase 929). */
function buildExportMeshFetchRegistryNameLookupByEntryFieldFromScope () {
return buildExportMeshFetchRegistryNameLookupFromScope(findExportMeshFetchRegistryNameByEntryField)
}
module.exports = { buildExportMeshFetchRegistryNameLookupByEntryFieldFromScope }
@@ -0,0 +1,15 @@
'use strict'
/** Build pull config + waiters key name lookup shortcuts from entry-field resolver (Phase 929). */
function buildExportMeshFetchRegistryNameFieldShortcuts (lookupByEntryField) {
return {
lookupExportMeshFetchRegistryNameByPullConfig (pullConfigKey) {
return lookupByEntryField('pullConfigKey', pullConfigKey)
},
lookupExportMeshFetchRegistryNameByWaitersKey (waitersKey) {
return lookupByEntryField('waitersKey', waitersKey)
}
}
}
module.exports = { buildExportMeshFetchRegistryNameFieldShortcuts }
@@ -0,0 +1,11 @@
'use strict'
const { findExportMeshFetchRegistryNameByMixinMethod } = require('./gossip-rpc-export-mesh-registry-lists-find')
const { buildExportMeshFetchRegistryNameLookupFromScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-scope')
/** Build scope-bound export mesh registry name lookup by mixin method (Phase 929). */
function buildExportMeshFetchRegistryNameLookupByMixinMethodFromScope () {
return buildExportMeshFetchRegistryNameLookupFromScope(findExportMeshFetchRegistryNameByMixinMethod)
}
module.exports = { buildExportMeshFetchRegistryNameLookupByMixinMethodFromScope }
@@ -0,0 +1,19 @@
'use strict'
const { getExportMeshFetchRegistryScope } = require('./gossip-rpc-export-mesh-registry-scope')
/** Run callback with registry scope tuple (Phase 919). */
function withExportMeshFetchRegistryScope (fn) {
const { registry, keys } = getExportMeshFetchRegistryScope()
return fn(registry, keys)
}
/** Build name lookup bound to registry scope (Phase 919). */
function buildExportMeshFetchRegistryNameLookupFromScope (findFn) {
return (...args) => withExportMeshFetchRegistryScope((registry, keys) => findFn(registry, keys, ...args))
}
module.exports = {
withExportMeshFetchRegistryScope,
buildExportMeshFetchRegistryNameLookupFromScope
}
@@ -0,0 +1,32 @@
'use strict'
const {
buildExportMeshFetchRegistryNameLookupByEntryFieldFromScope
} = require('./gossip-rpc-export-mesh-registry-lookup-name-entry-field-scope')
const {
buildExportMeshFetchRegistryNameLookupByMixinMethodFromScope
} = require('./gossip-rpc-export-mesh-registry-lookup-name-mixin-method-scope')
const { buildExportMeshFetchRegistryNameFieldShortcuts } = require('./gossip-rpc-export-mesh-registry-lookup-name-field-shortcuts')
const {
lookupExportMeshFetchRegistryNameByNamedMixinExport: lookupNamedMixinExportKey
} = require('./gossip-rpc-export-mesh-registry-named')
const lookupExportMeshFetchRegistryNameByEntryField =
buildExportMeshFetchRegistryNameLookupByEntryFieldFromScope()
const lookupExportMeshFetchRegistryNameByMixinMethod =
buildExportMeshFetchRegistryNameLookupByMixinMethodFromScope()
const fieldShortcuts = buildExportMeshFetchRegistryNameFieldShortcuts(
lookupExportMeshFetchRegistryNameByEntryField
)
/** Resolve export mesh registry name by named mixin export key (Phase 916). */
function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) {
return lookupNamedMixinExportKey(exportKey)
}
module.exports = {
lookupExportMeshFetchRegistryNameByEntryField,
lookupExportMeshFetchRegistryNameByMixinMethod,
...fieldShortcuts,
lookupExportMeshFetchRegistryNameByNamedMixinExport
}
@@ -0,0 +1,20 @@
'use strict'
const exportMeshFetchNamedMixinMap = {
platformAuditExportMeshFetchMixin: 'auditExportArchive',
platformAutomationDigestMeshFetchMixin: 'automationDigestSnapshot'
}
function listExportMeshFetchNamedMixinExportKeys () {
return Object.keys(exportMeshFetchNamedMixinMap)
}
function listExportMeshFetchNamedMixinRegistryNames () {
return Object.values(exportMeshFetchNamedMixinMap)
}
module.exports = {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames
}
+18
View File
@@ -0,0 +1,18 @@
'use strict'
const {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames
} = require('./gossip-rpc-export-mesh-registry-named-lists')
function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) {
return exportMeshFetchNamedMixinMap[exportKey] || null
}
module.exports = {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames,
lookupExportMeshFetchRegistryNameByNamedMixinExport
}
@@ -0,0 +1,8 @@
'use strict'
function listExportMeshPullConfigKeys () {
const { listExportMeshPullConfigKeysFromScope } = require('./gossip-rpc-export-mesh-registry-scope-lists')
return listExportMeshPullConfigKeysFromScope()
}
module.exports = { listExportMeshPullConfigKeys }
@@ -0,0 +1,14 @@
'use strict'
const { exportMeshFetchRegistryScopeListSpread } = require('./gossip-rpc-export-mesh-registry-scope-lists-derive')
function buildExportMeshFetchRegistryScopeListAliasMap () {
return exportMeshFetchRegistryScopeListSpread.aliases
}
const exportMeshFetchRegistryScopeListAliases = buildExportMeshFetchRegistryScopeListAliasMap()
module.exports = {
buildExportMeshFetchRegistryScopeListAliasMap,
exportMeshFetchRegistryScopeListAliases
}
@@ -0,0 +1,5 @@
'use strict'
const { exportMeshFetchRegistryScopeListAliases } = require('./gossip-rpc-export-mesh-registry-scope-lists-alias-map')
module.exports = { exportMeshFetchRegistryScopeListAliases }
@@ -0,0 +1,13 @@
'use strict'
const { getExportMeshFetchRegistryScope } = require('./gossip-rpc-export-mesh-registry-scope')
/** Build scope-bound list helper from registry derive fn (Phase 919). */
function buildExportMeshFetchRegistryScopeListFn (deriveFn) {
return function exportMeshFetchRegistryScopeList () {
const { registry, keys } = getExportMeshFetchRegistryScope()
return deriveFn(registry, keys)
}
}
module.exports = { buildExportMeshFetchRegistryScopeListFn }
@@ -0,0 +1,27 @@
'use strict'
const { listExportMeshFetchRegistryEntryField, listExportMeshPullConfigKeysFromRegistry } = require('./gossip-rpc-export-mesh-registry-lists-entry-field')
const { listExportMeshFetchMixinMethodsFromRegistry } = require('./gossip-rpc-export-mesh-registry-lists-mixin-keys')
const { buildExportMeshFetchRegistrySnapshotFromKeys } = require('./gossip-rpc-export-mesh-registry-snapshot')
const { buildExportMeshFetchRegistryScopeListFn } = require('./gossip-rpc-export-mesh-registry-scope-lists-build')
function buildExportMeshFetchRegistryScopeListDeriveRegistry () {
return {
listExportMeshFetchMixinMethods: listExportMeshFetchMixinMethodsFromRegistry,
listExportMeshFetchWaitersKeys: (registry, keys) => listExportMeshFetchRegistryEntryField(registry, keys, 'waitersKey'),
buildExportMeshFetchRegistrySnapshot: (registry, keys) => buildExportMeshFetchRegistrySnapshotFromKeys(registry, keys),
listExportMeshPullConfigKeys: listExportMeshPullConfigKeysFromRegistry
}
}
const exportMeshFetchRegistryScopeListDeriveByAlias = buildExportMeshFetchRegistryScopeListDeriveRegistry()
const exportMeshFetchRegistryScopeListSpread = spreadExportMeshFetchRegistryScopeListsFromDerive(exportMeshFetchRegistryScopeListDeriveByAlias)
function spreadExportMeshFetchRegistryScopeListsFromDerive (deriveByAlias) {
const aliases = {}
for (const [alias, deriveFn] of Object.entries(deriveByAlias)) aliases[alias] = buildExportMeshFetchRegistryScopeListFn(deriveFn)
return {
aliases,
listExportMeshFetchMixinMethodsFromScope: aliases.listExportMeshFetchMixinMethods,
listExportMeshFetchWaitersKeysFromScope: aliases.listExportMeshFetchWaitersKeys,
buildExportMeshFetchRegistrySnapshotFromScope: aliases.buildExportMeshFetchRegistrySnapshot,
listExportMeshPullConfigKeysFromScope: aliases.listExportMeshPullConfigKeys
}
}
module.exports = { buildExportMeshFetchRegistryScopeListDeriveRegistry, exportMeshFetchRegistryScopeListDeriveByAlias, spreadExportMeshFetchRegistryScopeListsFromDerive, exportMeshFetchRegistryScopeListSpread }
@@ -0,0 +1,10 @@
'use strict'
const { exportMeshFetchRegistryScopeListSpread } = require('./gossip-rpc-export-mesh-registry-scope-lists-derive')
module.exports = {
listExportMeshFetchMixinMethodsFromScope: exportMeshFetchRegistryScopeListSpread.listExportMeshFetchMixinMethodsFromScope,
listExportMeshFetchWaitersKeysFromScope: exportMeshFetchRegistryScopeListSpread.listExportMeshFetchWaitersKeysFromScope,
buildExportMeshFetchRegistrySnapshotFromScope: exportMeshFetchRegistryScopeListSpread.buildExportMeshFetchRegistrySnapshotFromScope,
listExportMeshPullConfigKeysFromScope: exportMeshFetchRegistryScopeListSpread.listExportMeshPullConfigKeysFromScope
}
+12
View File
@@ -0,0 +1,12 @@
'use strict'
const { exportMeshFetchRegistry } = require('./gossip-rpc-export-mesh-registry')
const { listExportMeshFetchRegistryKeys } = require('./gossip-rpc-export-mesh-registry-lists')
/** Resolve export mesh registry map + key list (Phase 913). */
function getExportMeshFetchRegistryScope () {
const keys = listExportMeshFetchRegistryKeys()
return { registry: exportMeshFetchRegistry, keys }
}
module.exports = { getExportMeshFetchRegistryScope }
@@ -0,0 +1,16 @@
'use strict'
/** Build one export mesh registry entry snapshot row (Phase 933). */
function buildExportMeshFetchRegistryEntrySnapshot (name, entry) {
return {
name,
pullConfigKey: entry.pullConfigKey,
fetchFromMeshMethod: entry.fetchFromMeshMethod,
fetchOnceMethod: entry.fetchOnceMethod,
resolveWaiterMethod: entry.resolveWaiterMethod,
waitersKey: entry.waitersKey,
waiterMode: entry.waiterMode
}
}
module.exports = { buildExportMeshFetchRegistryEntrySnapshot }
@@ -0,0 +1,12 @@
'use strict'
const { exportMeshViewSnapshotFieldKeys, exportMeshDiagnosticsPayloadKeyByViewField } = require('./gossip-rpc-export-mesh-view-snapshot-fields')
const exportMeshRegistrySnapshotPayloadKeys = exportMeshViewSnapshotFieldKeys
const exportMeshRegistryDiagnosticsPayloadInputKeyByViewField = exportMeshDiagnosticsPayloadKeyByViewField
function pickExportMeshRegistryDiagnosticsPayloadFromInputs (inputs) {
const payload = {}
for (const viewKey of exportMeshRegistrySnapshotPayloadKeys) {
payload[viewKey] = inputs[exportMeshRegistryDiagnosticsPayloadInputKeyByViewField[viewKey]]
}
return payload
}
module.exports = { exportMeshRegistrySnapshotPayloadKeys, exportMeshRegistryDiagnosticsPayloadInputKeyByViewField, pickExportMeshRegistryDiagnosticsPayloadFromInputs }
@@ -0,0 +1,20 @@
'use strict'
const { buildExportMeshFetchRegistryEntrySnapshot } = require('./gossip-rpc-export-mesh-registry-snapshot-entry')
const { pickExportMeshRegistryDiagnosticsPayloadFromInputs } = require('./gossip-rpc-export-mesh-registry-snapshot-keys')
/** Build export mesh registry snapshot rows from keys + registry map (Phase 907). */
function buildExportMeshFetchRegistrySnapshotFromKeys (registry, keys) {
return keys.map((name) => buildExportMeshFetchRegistryEntrySnapshot(name, registry[name]))
}
/** Build export mesh registry diagnostics payload (Phase 907). */
function buildExportMeshFetchRegistryDiagnosticsPayload (inputs) {
return pickExportMeshRegistryDiagnosticsPayloadFromInputs(inputs)
}
module.exports = {
buildExportMeshFetchRegistryEntrySnapshot,
buildExportMeshFetchRegistrySnapshotFromKeys,
buildExportMeshFetchRegistryDiagnosticsPayload
}
@@ -0,0 +1,15 @@
'use strict'
const { validateExportMeshFetchRegistryEntriesFromScope } = require('./gossip-rpc-export-mesh-registry-validate-entries')
const { listExportMeshFetchRegistryValidatePullConfigKeys } = require('./gossip-rpc-export-mesh-registry-validate-pull-keys')
/** Validate export mesh registry entries alignment from scope (Phase 928). */
function validateExportMeshFetchRegistryAlignmentEntriesFromScope (registry, keys) {
validateExportMeshFetchRegistryEntriesFromScope(
registry,
keys,
listExportMeshFetchRegistryValidatePullConfigKeys()
)
}
module.exports = { validateExportMeshFetchRegistryAlignmentEntriesFromScope }
@@ -0,0 +1,15 @@
'use strict'
const {
validateExportMeshFetchRegistryAlignmentEntriesFromScope
} = require('./gossip-rpc-export-mesh-registry-validate-alignment-entries-scope')
const { validateExportMeshFetchRegistryCoverageFromScope } = require('./gossip-rpc-export-mesh-registry-validate-coverage')
/** Run export mesh registry alignment validation from scope tuple (Phase 921928). */
function validateExportMeshFetchRegistryAlignmentFromScope (registry, keys) {
validateExportMeshFetchRegistryAlignmentEntriesFromScope(registry, keys)
validateExportMeshFetchRegistryCoverageFromScope(registry, keys)
return true
}
module.exports = { validateExportMeshFetchRegistryAlignmentFromScope }
@@ -0,0 +1,10 @@
'use strict'
const { withExportMeshFetchRegistryScope } = require('./gossip-rpc-export-mesh-registry-lookup-name-scope')
const { validateExportMeshFetchRegistryAlignmentFromScope } = require('./gossip-rpc-export-mesh-registry-validate-alignment-scope')
function validateExportMeshFetchRegistryAlignment () {
return withExportMeshFetchRegistryScope(validateExportMeshFetchRegistryAlignmentFromScope)
}
module.exports = { validateExportMeshFetchRegistryAlignment }
@@ -0,0 +1,9 @@
'use strict'
const { validateExportMeshFetchRegistryAlignment } = require('./gossip-rpc-export-mesh-registry-validate-alignment-wrapper')
const { validateExportMeshFetchRegistryAlignmentFromScope } = require('./gossip-rpc-export-mesh-registry-validate-alignment-scope')
module.exports = {
validateExportMeshFetchRegistryAlignmentFromScope,
validateExportMeshFetchRegistryAlignment
}
@@ -0,0 +1,25 @@
'use strict'
const {
validateExportMeshFetchRegistryPullConfigCoverageFromScope
} = require('./gossip-rpc-export-mesh-registry-validate-pull-config-coverage-scope')
const {
validateExportMeshFetchRegistryNamedMixinCoverageFromScope
} = require('./gossip-rpc-export-mesh-registry-validate-named-mixin-coverage-scope')
const {
validateExportMeshFetchRegistryScopeListCountsFromScope
} = require('./gossip-rpc-export-mesh-registry-validate-scope-list-counts-scope')
/** Validate export mesh registry coverage from scope (Phase 921927). */
function validateExportMeshFetchRegistryCoverageFromScope (registry, keys) {
validateExportMeshFetchRegistryPullConfigCoverageFromScope(registry, keys)
validateExportMeshFetchRegistryNamedMixinCoverageFromScope(registry)
validateExportMeshFetchRegistryScopeListCountsFromScope(keys)
}
module.exports = {
validateExportMeshFetchRegistryPullConfigCoverageFromScope,
validateExportMeshFetchRegistryNamedMixinCoverageFromScope,
validateExportMeshFetchRegistryScopeListCountsFromScope,
validateExportMeshFetchRegistryCoverageFromScope
}
@@ -0,0 +1,19 @@
'use strict'
const { getExportMeshFetchRegistryScope } = require('./gossip-rpc-export-mesh-registry-scope')
const { validateExportMeshFetchRegistryEntriesFromScope } = require('./gossip-rpc-export-mesh-registry-validate-entries')
const { validateExportMeshFetchRegistryAlignmentFromScope } = require('./gossip-rpc-export-mesh-registry-validate-alignment-scope')
const { validateExportMeshFetchRegistryAlignment } = require('./gossip-rpc-export-mesh-registry-validate-alignment-wrapper')
const { listExportMeshFetchRegistryValidatePullConfigKeys } = require('./gossip-rpc-export-mesh-registry-validate-pull-keys')
/** Run export mesh registry end-to-end validate chain (Phase 954). */
function runExportMeshFetchRegistryValidateE2e () {
const { registry, keys } = getExportMeshFetchRegistryScope()
const pullConfigKeys = listExportMeshFetchRegistryValidatePullConfigKeys()
validateExportMeshFetchRegistryEntriesFromScope(registry, keys, pullConfigKeys)
validateExportMeshFetchRegistryAlignmentFromScope(registry, keys)
validateExportMeshFetchRegistryAlignment()
return { registryKeyCount: keys.length, pullConfigKeyCount: pullConfigKeys.length }
}
module.exports = { runExportMeshFetchRegistryValidateE2e }
@@ -0,0 +1,21 @@
'use strict'
const {
validateExportMeshFetchRegistryEntryFieldsFromScope
} = require('./gossip-rpc-export-mesh-registry-validate-entry-fields-scope')
const {
createExportMeshFetchRegistryEntryUniquenessSets,
validateExportMeshFetchRegistryEntryUniquenessFromScope
} = require('./gossip-rpc-export-mesh-registry-validate-entry-uniqueness-scope')
/** Validate export mesh registry entries from scope (Phase 919928). */
function validateExportMeshFetchRegistryEntriesFromScope (registry, keys, pullConfigKeys) {
const uniquenessSets = createExportMeshFetchRegistryEntryUniquenessSets()
for (const name of keys) {
const entry = registry[name]
validateExportMeshFetchRegistryEntryFieldsFromScope(entry, name, pullConfigKeys)
validateExportMeshFetchRegistryEntryUniquenessFromScope(entry, uniquenessSets)
}
}
module.exports = { validateExportMeshFetchRegistryEntriesFromScope }
@@ -0,0 +1,20 @@
'use strict'
const { exportMeshFetchRegistryStringFields } = require('./gossip-rpc-export-mesh-registry-validate-fields-unique')
/** Validate one export mesh registry entry field contract from scope (Phase 928). */
function validateExportMeshFetchRegistryEntryFieldsFromScope (entry, name, pullConfigKeys) {
if (!entry?.pullConfigKey) {
throw new Error(`export mesh registry entry missing pullConfigKey: ${name}`)
}
if (!pullConfigKeys.includes(entry.pullConfigKey)) {
throw new Error(`export mesh pullConfigKey missing from gossipRpcPullConfigs: ${entry.pullConfigKey}`)
}
for (const methodKey of exportMeshFetchRegistryStringFields) {
if (!entry[methodKey] || typeof entry[methodKey] !== 'string') {
throw new Error(`export mesh registry entry missing ${methodKey}: ${name}`)
}
}
}
module.exports = { validateExportMeshFetchRegistryEntryFieldsFromScope }
@@ -0,0 +1,26 @@
'use strict'
const { assertUniqueExportMeshRegistryValue } = require('./gossip-rpc-export-mesh-registry-validate-fields-unique')
/** Create uniqueness sets for export mesh registry entry validation (Phase 928). */
function createExportMeshFetchRegistryEntryUniquenessSets () {
return {
fetchFromMeshMethods: new Set(),
resolveWaiterMethods: new Set(),
fetchOnceMethods: new Set(),
waitersKeys: new Set()
}
}
/** Validate one export mesh registry entry uniqueness from scope (Phase 928). */
function validateExportMeshFetchRegistryEntryUniquenessFromScope (entry, sets) {
assertUniqueExportMeshRegistryValue(sets.fetchFromMeshMethods, entry.fetchFromMeshMethod, 'fetchFromMeshMethod')
assertUniqueExportMeshRegistryValue(sets.resolveWaiterMethods, entry.resolveWaiterMethod, 'resolveWaiterMethod')
assertUniqueExportMeshRegistryValue(sets.fetchOnceMethods, entry.fetchOnceMethod, 'fetchOnceMethod')
assertUniqueExportMeshRegistryValue(sets.waitersKeys, entry.waitersKey, 'waitersKey')
}
module.exports = {
createExportMeshFetchRegistryEntryUniquenessSets,
validateExportMeshFetchRegistryEntryUniquenessFromScope
}
@@ -0,0 +1,5 @@
'use strict'
const { validateExportMeshFetchRegistryAlignment } = require('./gossip-rpc-export-mesh-registry-validate-alignment-wrapper')
module.exports = { validateExportMeshFetchRegistryAlignment }
@@ -0,0 +1,9 @@
'use strict'
const { exportMeshFetchRegistryStringFields } = require('./gossip-rpc-export-mesh-registry-validate-fields')
const { assertUniqueExportMeshRegistryValue } = require('./gossip-rpc-export-mesh-registry-validate-unique')
module.exports = {
exportMeshFetchRegistryStringFields,
assertUniqueExportMeshRegistryValue
}
@@ -0,0 +1,11 @@
'use strict'
/** String fields validated on each export mesh registry entry (Phase 908909). */
const exportMeshFetchRegistryStringFields = [
'fetchFromMeshMethod',
'fetchOnceMethod',
'resolveWaiterMethod',
'waitersKey'
]
module.exports = { exportMeshFetchRegistryStringFields }
@@ -0,0 +1,21 @@
'use strict'
const {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinRegistryNames
} = require('./gossip-rpc-export-mesh-registry-named')
/** Validate export mesh named mixin registry coverage from scope (Phase 920927). */
function validateExportMeshFetchRegistryNamedMixinCoverageFromScope (registry) {
for (const registryName of listExportMeshFetchNamedMixinRegistryNames()) {
if (!registry[registryName]) {
throw new Error(`export mesh named mixin missing registry entry: ${registryName}`)
}
}
const namedRegistryNames = listExportMeshFetchNamedMixinRegistryNames()
if (namedRegistryNames.length !== Object.keys(exportMeshFetchNamedMixinMap).length) {
throw new Error(`export mesh named mixin registry name count ${namedRegistryNames.length}`)
}
}
module.exports = { validateExportMeshFetchRegistryNamedMixinCoverageFromScope }
@@ -0,0 +1,14 @@
'use strict'
const { listExportMeshPullConfigKeysFromScope } = require('./gossip-rpc-export-mesh-registry-scope-lists')
/** Validate export mesh pull config coverage from scope (Phase 920927). */
function validateExportMeshFetchRegistryPullConfigCoverageFromScope (registry, keys) {
for (const pullConfigKey of listExportMeshPullConfigKeysFromScope()) {
if (!keys.some((name) => registry[name].pullConfigKey === pullConfigKey)) {
throw new Error(`export mesh registry missing pull config entry: ${pullConfigKey}`)
}
}
}
module.exports = { validateExportMeshFetchRegistryPullConfigCoverageFromScope }
@@ -0,0 +1,11 @@
'use strict'
const { gossipRpcPullConfigs } = require('./gossip-rpc-pull-config')
/** List gossip RPC pull config keys for export mesh registry validation (Phase 922, 944). */
function listExportMeshFetchRegistryValidatePullConfigKeys () {
const { assertExportMeshGossipRpcPullConfigAligned } = require('./gossip-rpc-export-mesh-pull-dispatch')
assertExportMeshGossipRpcPullConfigAligned()
return Object.keys(gossipRpcPullConfigs)
}
module.exports = { listExportMeshFetchRegistryValidatePullConfigKeys }
@@ -0,0 +1,20 @@
'use strict'
const {
listExportMeshFetchMixinMethodsFromScope,
listExportMeshFetchWaitersKeysFromScope
} = require('./gossip-rpc-export-mesh-registry-scope-lists')
/** Validate export mesh scope list counts from scope (Phase 920927). */
function validateExportMeshFetchRegistryScopeListCountsFromScope (keys) {
const mixinMethods = listExportMeshFetchMixinMethodsFromScope()
if (mixinMethods.length !== keys.length * 3) {
throw new Error(`export mesh mixin method count ${mixinMethods.length}`)
}
const waiterKeyList = listExportMeshFetchWaitersKeysFromScope()
if (waiterKeyList.length !== keys.length) {
throw new Error(`export mesh waiters key count ${waiterKeyList.length}`)
}
}
module.exports = { validateExportMeshFetchRegistryScopeListCountsFromScope }
@@ -0,0 +1,11 @@
'use strict'
/** Assert unique string values during export mesh registry validation (Phase 908). */
function assertUniqueExportMeshRegistryValue (valueSet, value, label) {
if (valueSet.has(value)) {
throw new Error(`duplicate export mesh ${label}: ${value}`)
}
valueSet.add(value)
}
module.exports = { assertUniqueExportMeshRegistryValue }
+34
View File
@@ -0,0 +1,34 @@
'use strict'
const { auditExportArchiveMeshFetchEntry } = require('./gossip-rpc-export-mesh-registry-audit')
const { automationDigestSnapshotMeshFetchEntry } = require('./gossip-rpc-export-mesh-registry-digest')
const { listExportMeshPullConfigKeys } = require('./gossip-rpc-export-mesh-registry-pull-keys')
const {
isValidAuditExportArchiveMeshRow,
isValidAutomationDigestSnapshotMeshRow,
formatAutomationDigestSnapshotMeshRow
} = require('./gossip-rpc-export-mesh-validators')
const exportMeshFetchRegistry = {
auditExportArchive: auditExportArchiveMeshFetchEntry,
automationDigestSnapshot: automationDigestSnapshotMeshFetchEntry
}
const exportMeshPullConfigKeys = Object.keys(exportMeshFetchRegistry).map(
(name) => exportMeshFetchRegistry[name].pullConfigKey
)
function exportMeshFetchConfig (name) {
const { lookupExportMeshFetchRegistryEntryFromScope } = require('./gossip-rpc-export-mesh-registry-entry')
return lookupExportMeshFetchRegistryEntryFromScope(name)
}
module.exports = {
exportMeshFetchRegistry,
exportMeshPullConfigKeys,
listExportMeshPullConfigKeys,
exportMeshFetchConfig,
isValidAuditExportArchiveMeshRow,
isValidAutomationDigestSnapshotMeshRow,
formatAutomationDigestSnapshotMeshRow
}
+24
View File
@@ -0,0 +1,24 @@
'use strict'
const EXPORT_MESH_FETCH_RETRY_MAX_CAP = 5
const EXPORT_MESH_FETCH_RETRY_ATTEMPTS_DEFAULT = 3
const EXPORT_MESH_FETCH_RETRY_ATTEMPTS_MIN = 1
const EXPORT_MESH_FETCH_RETRY_BASE_DELAY_MS_DEFAULT = 400
const EXPORT_MESH_FETCH_RETRY_BASE_DELAY_MS_MIN = 100
const EXPORT_MESH_FETCH_RETRY_NOT_FOUND_DEFAULT = 'export not found on mesh'
function resolveExportMeshFetchRetryPolicy (opts = {}) {
const maxAttempts = Math.min(EXPORT_MESH_FETCH_RETRY_MAX_CAP, Math.max(EXPORT_MESH_FETCH_RETRY_ATTEMPTS_MIN, Number(opts.maxAttempts) || EXPORT_MESH_FETCH_RETRY_ATTEMPTS_DEFAULT))
const baseDelayMs = Math.max(EXPORT_MESH_FETCH_RETRY_BASE_DELAY_MS_MIN, Number(opts.baseDelayMs) || EXPORT_MESH_FETCH_RETRY_BASE_DELAY_MS_DEFAULT)
return { maxAttempts, baseDelayMs, notFoundMessage: opts.notFoundMessage || EXPORT_MESH_FETCH_RETRY_NOT_FOUND_DEFAULT }
}
module.exports = {
EXPORT_MESH_FETCH_RETRY_MAX_CAP,
EXPORT_MESH_FETCH_RETRY_ATTEMPTS_DEFAULT,
EXPORT_MESH_FETCH_RETRY_ATTEMPTS_MIN,
EXPORT_MESH_FETCH_RETRY_BASE_DELAY_MS_DEFAULT,
EXPORT_MESH_FETCH_RETRY_BASE_DELAY_MS_MIN,
EXPORT_MESH_FETCH_RETRY_NOT_FOUND_DEFAULT,
resolveExportMeshFetchRetryPolicy
}
+42
View File
@@ -0,0 +1,42 @@
'use strict'
const sharedScope = require('pearcord-shared')
const { resolveExportMeshFetchRetryPolicy } = require('./gossip-rpc-export-mesh-retry-policy')
async function runGuildExportMeshFetchWithRetry (fetchOnce, resourceId, opts = {}) {
const { maxAttempts, baseDelayMs, notFoundMessage } = resolveExportMeshFetchRetryPolicy(opts)
const computeBackoffMs = opts.computeBackoffMs
let lastErr = null
for (let attempt = 0; attempt < maxAttempts; attempt++) {
try {
const out = await fetchOnce(resourceId, { ...opts, attempt })
return {
...out,
fetchMesh: true,
fetchAttempts: attempt + 1,
targetMemberId: opts.targetMemberId || null
}
} catch (err) {
lastErr = err
lastErr.fetchAttempts = attempt + 1
if (attempt < maxAttempts - 1 && typeof computeBackoffMs === 'function') {
await new Promise((resolve) =>
setTimeout(resolve, computeBackoffMs(attempt, baseDelayMs))
)
}
}
}
const fail = lastErr || new Error(notFoundMessage)
fail.fetchAttempts = maxAttempts
throw fail
}
async function assertGuildExportMeshFetchPermission (platform, permissionError) {
if (!platform.guild?.guild) throw new Error('no guild')
const roles = await platform._memberRoles()
if (!sharedScope.roleHasPermission(roles, sharedScope.PERMISSION.MANAGE_GUILD)) {
throw new Error(permissionError)
}
}
module.exports = { runGuildExportMeshFetchWithRetry, assertGuildExportMeshFetchPermission }
+7
View File
@@ -0,0 +1,7 @@
'use strict'
function getAuditExportArchiveMeshLocalRow (platform, archiveId) {
return platform.deliveryReceipts.getAuditExportArchive(archiveId)
}
module.exports = { getAuditExportArchiveMeshLocalRow }
+17
View File
@@ -0,0 +1,17 @@
'use strict'
const { getAuditExportArchiveMeshLocalRow } = require('./gossip-rpc-export-mesh-row-audit-mesh')
function tryFetchAuditExportArchiveMeshRpc (platform, archiveId, opts) {
return platform._tryFetchAuditExportArchiveFromMeshRpc(archiveId, opts)
}
function ingestAuditExportArchiveMeshRpc (platform, rpc) {
return platform.deliveryReceipts.ingestAuditExportArchive(rpc)
}
module.exports = {
getAuditExportArchiveMeshLocalRow,
tryFetchAuditExportArchiveMeshRpc,
ingestAuditExportArchiveMeshRpc
}
@@ -0,0 +1,7 @@
'use strict'
function getAutomationDigestSnapshotMeshLocalRow (platform, snapshotId) {
return platform.deliveryReceipts.getAutomationDigestExportSnapshot(snapshotId)
}
module.exports = { getAutomationDigestSnapshotMeshLocalRow }
+17
View File
@@ -0,0 +1,17 @@
'use strict'
const { getAutomationDigestSnapshotMeshLocalRow } = require('./gossip-rpc-export-mesh-row-digest-mesh')
function tryFetchAutomationDigestSnapshotMeshRpc (platform, snapshotId, opts) {
return platform._tryFetchAutomationDigestSnapshotFromMeshRpc(snapshotId, opts)
}
function ingestAutomationDigestSnapshotMeshRpc (platform, rpc) {
return platform.deliveryReceipts.ingestAutomationDigestExportSnapshot(rpc)
}
module.exports = {
getAutomationDigestSnapshotMeshLocalRow,
tryFetchAutomationDigestSnapshotMeshRpc,
ingestAutomationDigestSnapshotMeshRpc
}
+64
View File
@@ -0,0 +1,64 @@
'use strict'
const EXPORT_MESH_TRACK_PHASE_START = 931
const EXPORT_MESH_TRACK_PHASE_END = 955
const EXPORT_MESH_MODULE_LINE_LIMIT = 100
const EXPORT_MESH_TRACK_COMPLETE_VERSION = '0.8.922'
const EXPORT_MESH_BARREL_API_FROZEN = true
const EXPORT_MESH_EXPECTED_MODULE_COUNT = 98
/** Phases 931954 regression chain (Phase 955 closure). */
function listExportMeshTrackRegressionPhases () {
const out = []
for (let p = EXPORT_MESH_TRACK_PHASE_START; p < EXPORT_MESH_TRACK_PHASE_END; p++) out.push(p)
return out
}
function isExportMeshModuleFilename (name) {
return name.startsWith('gossip-rpc-export-mesh') && name.endsWith('.js')
}
function listExportMeshModulePathsFromDir (platformDir) {
const fs = require('bare-fs')
return fs.readdirSync(platformDir).filter(isExportMeshModuleFilename).sort()
}
/** Audit line counts for gossip-rpc-export-mesh*.js modules (Phase 955). */
function auditExportMeshModuleLineCounts (platformDir) {
const fs = require('bare-fs')
const path = require('bare-path')
const paths = listExportMeshModulePathsFromDir(platformDir)
return paths.map((rel) => {
const lines = fs.readFileSync(path.join(platformDir, rel), 'utf8').split('\n').length
return { path: rel, lines, ok: lines <= EXPORT_MESH_MODULE_LINE_LIMIT }
})
}
function assertExportMeshModuleLineCounts (platformDir) {
const rows = auditExportMeshModuleLineCounts(platformDir)
if (rows.length !== EXPORT_MESH_EXPECTED_MODULE_COUNT) {
throw new Error(`expected ${EXPORT_MESH_EXPECTED_MODULE_COUNT} export mesh modules got ${rows.length}`)
}
const bad = rows.filter((r) => !r.ok)
if (bad.length) {
throw new Error(`export mesh modules over ${EXPORT_MESH_MODULE_LINE_LIMIT} lines: ${bad.map((r) => r.path).join(', ')}`)
}
return {
count: rows.length,
maxLines: Math.max(...rows.map((r) => r.lines))
}
}
module.exports = {
EXPORT_MESH_TRACK_PHASE_START,
EXPORT_MESH_TRACK_PHASE_END,
EXPORT_MESH_MODULE_LINE_LIMIT,
EXPORT_MESH_TRACK_COMPLETE_VERSION,
EXPORT_MESH_BARREL_API_FROZEN,
EXPORT_MESH_EXPECTED_MODULE_COUNT,
listExportMeshTrackRegressionPhases,
isExportMeshModuleFilename,
listExportMeshModulePathsFromDir,
auditExportMeshModuleLineCounts,
assertExportMeshModuleLineCounts
}
@@ -0,0 +1,5 @@
'use strict'
const isValidAuditExportArchiveMeshRow = (r) => Boolean(r?.entries?.length)
module.exports = { isValidAuditExportArchiveMeshRow }
@@ -0,0 +1,7 @@
'use strict'
const { formatAutomationDigestSnapshotMeshRow } = require('./gossip-rpc-export-mesh-format-digest-local')
const isValidAutomationDigestSnapshotMeshRow = (r) => Boolean(r?.body?.length)
module.exports = { isValidAutomationDigestSnapshotMeshRow, formatAutomationDigestSnapshotMeshRow }
+13
View File
@@ -0,0 +1,13 @@
'use strict'
const { isValidAuditExportArchiveMeshRow } = require('./gossip-rpc-export-mesh-validators-audit')
const {
isValidAutomationDigestSnapshotMeshRow,
formatAutomationDigestSnapshotMeshRow
} = require('./gossip-rpc-export-mesh-validators-digest')
module.exports = {
isValidAuditExportArchiveMeshRow,
isValidAutomationDigestSnapshotMeshRow,
formatAutomationDigestSnapshotMeshRow
}

Some files were not shown because too many files have changed in this diff Show More