refactor(platform): Phase 732 deliveryScope namespace and diagnostics mixin
Replace 173-line delivery import destructuring in index.js with deliveryScope.* references (~205 lines removed). Extract platform-diagnostics-mixin and platform-server-folders-imports; add manifest row 60 (PLATFORM_MIXIN_ASSIGNMENT_COUNT). No behavior changes. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -54,6 +54,8 @@ Application facade: one `PearcordPlatform` class that wires identity, database,
|
||||
|
||||
**Phase 723 (v0.8.699):** Dedicated slash registry & invoke audit export JSON — `slash-registry-json-mixin.js`, `slash-invoke-audit-json-mixin.js`, spans `slash-registry.json` / `slash-invoke-audit.json`, `getSlashInvokeAuditExportJsonExport`, `clearSlashInvokeAuditExportJsonExports`, deep links `openSlashRegistryJson` / `openSlashInvokeAuditJson`. Bundle: `npm run test:ci-phase723`.
|
||||
|
||||
**Phase 732 (v0.8.708):** `index.js` uses `deliveryScope.*` for delivery-receipts exports; `platform-diagnostics-mixin.js`, `platform-server-folders-imports.js`; 60 mixin manifest rows. Bundle: `npm run test:ci-phase732`.
|
||||
|
||||
**Phase 731 (v0.8.707):** `platform-pearcord-shared-imports.js`, `platform-index-local-imports.js`, named `platform-delivery-receipts-imports.js`, `platform-bootstrap.js`; gossip registry `ALL_GOSSIP_ALIGNMENT_ROWS`. Bundle: `npm run test:ci-phase731`.
|
||||
|
||||
**Phase 730 (v0.8.706):** `platform-mixin-assign-manifest.js` drives 59 prototype mixin assigns; `json-export-gossip-alignment-validate.js` + registry-backed smokes; `platform-ipc-contract.js`; digest-json per-entry gossip keys. Bundle: `npm run test:ci-phase730`.
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('bare-fs')
|
||||
const path = require('bare-path')
|
||||
|
||||
/** UI diagnostics JSONL writer (extracted from index.js, Phase 732). */
|
||||
const platformDiagnosticsMixin = {
|
||||
writeDiagnosticsJsonl (lines = [], meta = {}) {
|
||||
const file = path.join(this.storagePath, `diagnostics-ui-${Date.now()}.jsonl`)
|
||||
const logFile = path.join(this.storagePath, 'pearcord.log')
|
||||
const arr = Array.isArray(lines) ? lines : []
|
||||
const out = []
|
||||
if (meta && typeof meta === 'object' && Object.keys(meta).length) {
|
||||
out.push(
|
||||
JSON.stringify({
|
||||
type: 'diagnostics-meta',
|
||||
exportedAt: Date.now(),
|
||||
logFile,
|
||||
...meta
|
||||
})
|
||||
)
|
||||
}
|
||||
for (const line of arr) {
|
||||
out.push(typeof line === 'string' ? line : JSON.stringify(line))
|
||||
}
|
||||
const body = out.filter((s) => s && s.length).join('\n')
|
||||
const payload = body ? `${body}\n` : ''
|
||||
fs.writeFileSync(file, payload)
|
||||
const dataLines = arr.filter((s) => s && String(s).length).length
|
||||
return {
|
||||
file,
|
||||
lineCount: dataLines,
|
||||
metaLineCount: meta && Object.keys(meta).length ? 1 : 0,
|
||||
bytes: payload.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { platformDiagnosticsMixin }
|
||||
@@ -4,7 +4,7 @@
|
||||
* Ordered PearcordPlatform prototype mixin registration (Phase 730).
|
||||
* Preserves assign order from index.js / apply-platform-mixins (Phase 727).
|
||||
*/
|
||||
const PLATFORM_MIXIN_ASSIGNMENT_COUNT = 59
|
||||
const PLATFORM_MIXIN_ASSIGNMENT_COUNT = 60
|
||||
|
||||
const PLATFORM_MIXIN_ASSIGNMENTS = [
|
||||
{ module: './polls-scheduling', export: 'pollSchedulingMixin' },
|
||||
@@ -65,7 +65,8 @@ const PLATFORM_MIXIN_ASSIGNMENTS = [
|
||||
{ module: './slash-registry-json-mixin', export: 'slashRegistryJsonMixin' },
|
||||
{ module: './slash-invoke-audit-json-mixin', export: 'slashInvokeAuditJsonMixin' },
|
||||
{ module: './worker-release-json-mixin', export: 'workerReleaseJsonMixin' },
|
||||
{ module: './integration-manifest-json-mixin', export: 'integrationManifestJsonMixin' }
|
||||
{ module: './integration-manifest-json-mixin', export: 'integrationManifestJsonMixin' },
|
||||
{ module: './platform-diagnostics-mixin', export: 'platformDiagnosticsMixin' }
|
||||
]
|
||||
|
||||
if (PLATFORM_MIXIN_ASSIGNMENTS.length !== PLATFORM_MIXIN_ASSIGNMENT_COUNT) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
/** pearcord-server-folders bindings for PearcordPlatform (Phase 732). */
|
||||
const folders = require('pearcord-server-folders')
|
||||
|
||||
module.exports = {
|
||||
normalizeServerFolders: folders.normalizeServerFolders,
|
||||
buildServerRailLayout: folders.buildServerRailLayout,
|
||||
createServerFolderState: folders.createFolder,
|
||||
deleteServerFolderState: folders.deleteFolder,
|
||||
assignGuildToFolderState: folders.assignGuildToFolder,
|
||||
setFolderCollapsedState: folders.setFolderCollapsed,
|
||||
renameServerFolderState: folders.renameFolder,
|
||||
setServerFolderColorState: folders.setFolderColor,
|
||||
reorderServerFoldersState: folders.reorderFolders,
|
||||
FOLDER_COLORS: folders.FOLDER_COLORS
|
||||
}
|
||||
Reference in New Issue
Block a user