@emeryld/rrroutes-export 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tools/finalized-leaves-viewer.html +50 -111
package/package.json
CHANGED
|
@@ -555,9 +555,6 @@
|
|
|
555
555
|
<button id="tabChangelog" class="field-chip" type="button" aria-pressed="false">
|
|
556
556
|
Changelog
|
|
557
557
|
</button>
|
|
558
|
-
<button id="tabChangelogSource" class="field-chip" type="button" aria-pressed="false">
|
|
559
|
-
Changelog / By Source
|
|
560
|
-
</button>
|
|
561
558
|
</div>
|
|
562
559
|
</div>
|
|
563
560
|
</div>
|
|
@@ -694,35 +691,6 @@
|
|
|
694
691
|
},
|
|
695
692
|
]
|
|
696
693
|
|
|
697
|
-
const CHANGELOG_SOURCE_FIELDS = [
|
|
698
|
-
{
|
|
699
|
-
id: 'sourceObject',
|
|
700
|
-
label: 'source object',
|
|
701
|
-
get: (item) => [item.sourceId, item.displayName],
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
id: 'eventType',
|
|
705
|
-
label: 'event type',
|
|
706
|
-
get: (item) => item.events.map((event) => event.type),
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
id: 'impactedRoutes',
|
|
710
|
-
label: 'impacted routes',
|
|
711
|
-
get: (item) =>
|
|
712
|
-
item.events.flatMap((event) => (Array.isArray(event.impactedRoutes) ? event.impactedRoutes : [])),
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
id: 'schemaDiff',
|
|
716
|
-
label: 'schema diff',
|
|
717
|
-
get: (item) =>
|
|
718
|
-
item.events.flatMap((event) =>
|
|
719
|
-
Array.isArray(event.schemaDiff)
|
|
720
|
-
? event.schemaDiff.map((delta) => JSON.stringify(delta))
|
|
721
|
-
: [],
|
|
722
|
-
),
|
|
723
|
-
},
|
|
724
|
-
]
|
|
725
|
-
|
|
726
694
|
const SCHEMA_SECTIONS = ['params', 'query', 'body', 'output']
|
|
727
695
|
const SCHEMA_FIELD_IDS = new Set(SCHEMA_SECTIONS)
|
|
728
696
|
const SOURCE_FIELD_IDS = new Set(['sourceDefinition', 'sourceSchemas'])
|
|
@@ -759,7 +727,6 @@
|
|
|
759
727
|
const VIEW_IDS = {
|
|
760
728
|
leaves: 'leaves',
|
|
761
729
|
changelog: 'changelog',
|
|
762
|
-
changelogSource: 'changelogSource',
|
|
763
730
|
}
|
|
764
731
|
|
|
765
732
|
const VIEWER_MODE = {
|
|
@@ -792,10 +759,6 @@
|
|
|
792
759
|
fieldDefs: CHANGELOG_TIMELINE_FIELDS,
|
|
793
760
|
defaultSelected: new Set(CHANGELOG_TIMELINE_FIELDS.map((field) => field.id)),
|
|
794
761
|
},
|
|
795
|
-
[VIEW_IDS.changelogSource]: {
|
|
796
|
-
fieldDefs: CHANGELOG_SOURCE_FIELDS,
|
|
797
|
-
defaultSelected: new Set(CHANGELOG_SOURCE_FIELDS.map((field) => field.id)),
|
|
798
|
-
},
|
|
799
762
|
}
|
|
800
763
|
|
|
801
764
|
const state = {
|
|
@@ -809,7 +772,6 @@
|
|
|
809
772
|
selectedFieldIdsByTab: {
|
|
810
773
|
[VIEW_IDS.leaves]: new Set(TAB_CONFIG[VIEW_IDS.leaves].defaultSelected),
|
|
811
774
|
[VIEW_IDS.changelog]: new Set(TAB_CONFIG[VIEW_IDS.changelog].defaultSelected),
|
|
812
|
-
[VIEW_IDS.changelogSource]: new Set(TAB_CONFIG[VIEW_IDS.changelogSource].defaultSelected),
|
|
813
775
|
},
|
|
814
776
|
}
|
|
815
777
|
|
|
@@ -833,7 +795,6 @@
|
|
|
833
795
|
const controlsEl = document.querySelector('.controls')
|
|
834
796
|
const tabLeavesBtn = document.getElementById('tabLeaves')
|
|
835
797
|
const tabChangelogBtn = document.getElementById('tabChangelog')
|
|
836
|
-
const tabChangelogSourceBtn = document.getElementById('tabChangelogSource')
|
|
837
798
|
|
|
838
799
|
const URL_PARAM_KEY = 'filters'
|
|
839
800
|
let isHydratingFromUrl = false
|
|
@@ -1456,6 +1417,13 @@
|
|
|
1456
1417
|
}
|
|
1457
1418
|
content.appendChild(overview)
|
|
1458
1419
|
|
|
1420
|
+
const fullConfig = el('div', 'section')
|
|
1421
|
+
fullConfig.appendChild(el('h3', '', 'Configuration (full)'))
|
|
1422
|
+
const cfgJson = el('pre', 'mono')
|
|
1423
|
+
cfgJson.textContent = JSON.stringify(cfg, null, 2)
|
|
1424
|
+
fullConfig.appendChild(cfgJson)
|
|
1425
|
+
content.appendChild(fullConfig)
|
|
1426
|
+
|
|
1459
1427
|
const files = el('div', 'section')
|
|
1460
1428
|
if (Array.isArray(cfg.bodyFiles) && cfg.bodyFiles.length > 0) {
|
|
1461
1429
|
files.appendChild(el('h3', '', 'Body Files'))
|
|
@@ -1487,6 +1455,10 @@
|
|
|
1487
1455
|
const commitBySha = new Map(
|
|
1488
1456
|
(state.changelogPayload?.commits || []).map((commit) => [commit.sha, commit]),
|
|
1489
1457
|
)
|
|
1458
|
+
const commitOrder = new Map(
|
|
1459
|
+
(state.changelogPayload?.commits || []).map((commit, index) => [commit.sha, index]),
|
|
1460
|
+
)
|
|
1461
|
+
const routeHistoryNewestFirst = sortEventsNewestFirst(routeHistory, commitBySha, commitOrder)
|
|
1490
1462
|
const routeChangelogSection = el('div', 'section')
|
|
1491
1463
|
const routeChangelogDetails = el('details')
|
|
1492
1464
|
const routeChangelogSummary = el(
|
|
@@ -1500,7 +1472,7 @@
|
|
|
1500
1472
|
routeChangelogDetails.appendChild(routeChangelogSummary)
|
|
1501
1473
|
|
|
1502
1474
|
const routeChangelogBody = el('div', 'leaf-content')
|
|
1503
|
-
|
|
1475
|
+
routeHistoryNewestFirst.forEach((event) => {
|
|
1504
1476
|
routeChangelogBody.appendChild(renderEventCard(event, commitBySha))
|
|
1505
1477
|
})
|
|
1506
1478
|
routeChangelogDetails.appendChild(routeChangelogBody)
|
|
@@ -1655,6 +1627,31 @@
|
|
|
1655
1627
|
return row
|
|
1656
1628
|
}
|
|
1657
1629
|
|
|
1630
|
+
function commitTimestamp(commit) {
|
|
1631
|
+
if (!commit?.authorDate) return Number.NEGATIVE_INFINITY
|
|
1632
|
+
const parsed = Date.parse(commit.authorDate)
|
|
1633
|
+
return Number.isNaN(parsed) ? Number.NEGATIVE_INFINITY : parsed
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
function compareEventsNewestFirst(a, b, commitBySha, commitOrder) {
|
|
1637
|
+
const commitA = commitBySha.get(a?.commitSha)
|
|
1638
|
+
const commitB = commitBySha.get(b?.commitSha)
|
|
1639
|
+
const timeDelta = commitTimestamp(commitB) - commitTimestamp(commitA)
|
|
1640
|
+
if (timeDelta !== 0) return timeDelta
|
|
1641
|
+
|
|
1642
|
+
const indexA = commitOrder.get(a?.commitSha) ?? -1
|
|
1643
|
+
const indexB = commitOrder.get(b?.commitSha) ?? -1
|
|
1644
|
+
if (indexA !== indexB) return indexB - indexA
|
|
1645
|
+
|
|
1646
|
+
return String(b?.commitSha || '').localeCompare(String(a?.commitSha || ''))
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
function sortEventsNewestFirst(events, commitBySha, commitOrder) {
|
|
1650
|
+
return [...(events || [])].sort((a, b) =>
|
|
1651
|
+
compareEventsNewestFirst(a, b, commitBySha, commitOrder),
|
|
1652
|
+
)
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1658
1655
|
function buildChronologicalEvents(payload) {
|
|
1659
1656
|
if (!payload) return []
|
|
1660
1657
|
const commitBySha = new Map((payload.commits || []).map((commit) => [commit.sha, commit]))
|
|
@@ -1669,6 +1666,7 @@
|
|
|
1669
1666
|
routeKey,
|
|
1670
1667
|
event,
|
|
1671
1668
|
commit: commitBySha.get(event.commitSha),
|
|
1669
|
+
commitSort: commitTimestamp(commitBySha.get(event.commitSha)),
|
|
1672
1670
|
commitIndex: commitOrder.get(event.commitSha) ?? -1,
|
|
1673
1671
|
eventIndex: sequence++,
|
|
1674
1672
|
})
|
|
@@ -1683,6 +1681,7 @@
|
|
|
1683
1681
|
displayName: event.displayName || sourceObjectId,
|
|
1684
1682
|
event,
|
|
1685
1683
|
commit: commitBySha.get(event.commitSha),
|
|
1684
|
+
commitSort: commitTimestamp(commitBySha.get(event.commitSha)),
|
|
1686
1685
|
commitIndex: commitOrder.get(event.commitSha) ?? -1,
|
|
1687
1686
|
eventIndex: sequence++,
|
|
1688
1687
|
})
|
|
@@ -1690,6 +1689,7 @@
|
|
|
1690
1689
|
})
|
|
1691
1690
|
|
|
1692
1691
|
rows.sort((a, b) => {
|
|
1692
|
+
if (a.commitSort !== b.commitSort) return b.commitSort - a.commitSort
|
|
1693
1693
|
if (a.commitIndex !== b.commitIndex) return b.commitIndex - a.commitIndex
|
|
1694
1694
|
return b.eventIndex - a.eventIndex
|
|
1695
1695
|
})
|
|
@@ -1703,36 +1703,6 @@
|
|
|
1703
1703
|
if (tabId === VIEW_IDS.changelog) {
|
|
1704
1704
|
return buildChronologicalEvents(payload)
|
|
1705
1705
|
}
|
|
1706
|
-
if (tabId === VIEW_IDS.changelogSource) {
|
|
1707
|
-
const commitOrder = new Map((payload.commits || []).map((commit, index) => [commit.sha, index]))
|
|
1708
|
-
const sortEventsNewestFirst = (events) =>
|
|
1709
|
-
[...(events || [])].sort((a, b) => {
|
|
1710
|
-
const aIndex = commitOrder.get(a?.commitSha) ?? -1
|
|
1711
|
-
const bIndex = commitOrder.get(b?.commitSha) ?? -1
|
|
1712
|
-
if (aIndex !== bIndex) return bIndex - aIndex
|
|
1713
|
-
return String(b?.commitSha || '').localeCompare(String(a?.commitSha || ''))
|
|
1714
|
-
})
|
|
1715
|
-
|
|
1716
|
-
return Object.entries(payload.bySourceObject || {})
|
|
1717
|
-
.map(([sourceId, events]) => {
|
|
1718
|
-
const sortedEvents = sortEventsNewestFirst(events)
|
|
1719
|
-
const latestCommitIndex = sortedEvents.length
|
|
1720
|
-
? commitOrder.get(sortedEvents[0]?.commitSha) ?? -1
|
|
1721
|
-
: -1
|
|
1722
|
-
return {
|
|
1723
|
-
sourceId,
|
|
1724
|
-
events: sortedEvents,
|
|
1725
|
-
displayName: sortedEvents[0]?.displayName || sourceId,
|
|
1726
|
-
latestCommitIndex,
|
|
1727
|
-
}
|
|
1728
|
-
})
|
|
1729
|
-
.sort((a, b) => {
|
|
1730
|
-
if (a.latestCommitIndex !== b.latestCommitIndex) {
|
|
1731
|
-
return b.latestCommitIndex - a.latestCommitIndex
|
|
1732
|
-
}
|
|
1733
|
-
return a.displayName.localeCompare(b.displayName)
|
|
1734
|
-
})
|
|
1735
|
-
}
|
|
1736
1706
|
return []
|
|
1737
1707
|
}
|
|
1738
1708
|
|
|
@@ -1758,10 +1728,8 @@
|
|
|
1758
1728
|
function renderTabButtons() {
|
|
1759
1729
|
setPressed(tabLeavesBtn, state.activeTab === VIEW_IDS.leaves)
|
|
1760
1730
|
setPressed(tabChangelogBtn, state.activeTab === VIEW_IDS.changelog)
|
|
1761
|
-
setPressed(tabChangelogSourceBtn, state.activeTab === VIEW_IDS.changelogSource)
|
|
1762
1731
|
tabLeavesBtn.style.display = state.availableTabs.has(VIEW_IDS.leaves) ? '' : 'none'
|
|
1763
1732
|
tabChangelogBtn.style.display = state.availableTabs.has(VIEW_IDS.changelog) ? '' : 'none'
|
|
1764
|
-
tabChangelogSourceBtn.style.display = state.availableTabs.has(VIEW_IDS.changelogSource) ? '' : 'none'
|
|
1765
1733
|
const isLeavesTab = state.activeTab === VIEW_IDS.leaves
|
|
1766
1734
|
coreFieldsBtn.style.display = isLeavesTab ? '' : 'none'
|
|
1767
1735
|
schemasOnlyFieldsBtn.style.display = isLeavesTab ? '' : 'none'
|
|
@@ -1797,10 +1765,7 @@
|
|
|
1797
1765
|
const fieldDefs = currentFieldDefs()
|
|
1798
1766
|
const items = changelogItemsByTab(state.activeTab)
|
|
1799
1767
|
const filtered = items.filter((item) => matchesGenericItem(item, fieldDefs, engine, selectedIds))
|
|
1800
|
-
statusEl.textContent =
|
|
1801
|
-
state.activeTab === VIEW_IDS.changelog
|
|
1802
|
-
? `${filtered.length} / ${items.length} changelog events matched.`
|
|
1803
|
-
: `${filtered.length} / ${items.length} source changelog groups matched.`
|
|
1768
|
+
statusEl.textContent = `${filtered.length} / ${items.length} changelog events matched.`
|
|
1804
1769
|
const commitBySha = new Map(
|
|
1805
1770
|
(state.changelogPayload?.commits || []).map((commit) => [commit.sha, commit]),
|
|
1806
1771
|
)
|
|
@@ -1808,25 +1773,11 @@
|
|
|
1808
1773
|
renderCollection(
|
|
1809
1774
|
filtered,
|
|
1810
1775
|
(item) => {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
item.
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
return renderChangelogEventLines(item.event, commitBySha, contextLabel)
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
const lines = el('div', 'changelog-lines')
|
|
1820
|
-
;(item.events || []).forEach((event) => {
|
|
1821
|
-
lines.appendChild(
|
|
1822
|
-
renderChangelogEventLines(
|
|
1823
|
-
event,
|
|
1824
|
-
commitBySha,
|
|
1825
|
-
`Source: ${item.displayName || item.sourceId}`,
|
|
1826
|
-
),
|
|
1827
|
-
)
|
|
1828
|
-
})
|
|
1829
|
-
return lines
|
|
1776
|
+
const contextLabel =
|
|
1777
|
+
item.eventKind === 'route'
|
|
1778
|
+
? `Route: ${item.routeKey}`
|
|
1779
|
+
: `Source: ${item.displayName || item.sourceObjectId}`
|
|
1780
|
+
return renderChangelogEventLines(item.event, commitBySha, contextLabel)
|
|
1830
1781
|
},
|
|
1831
1782
|
'No matches.',
|
|
1832
1783
|
)
|
|
@@ -1835,16 +1786,9 @@
|
|
|
1835
1786
|
filtered,
|
|
1836
1787
|
(item) => {
|
|
1837
1788
|
const details = el('details', 'leaf')
|
|
1838
|
-
const title =
|
|
1839
|
-
state.activeTab === VIEW_IDS.changelog
|
|
1840
|
-
? `${item.eventKind === 'route' ? `Route: ${item.routeKey}` : `Source: ${item.displayName || item.sourceObjectId}`} (${item.event.type})`
|
|
1841
|
-
: `${item.displayName} (${item.events.length})`
|
|
1789
|
+
const title = `${item.eventKind === 'route' ? `Route: ${item.routeKey}` : `Source: ${item.displayName || item.sourceObjectId}`} (${item.event.type})`
|
|
1842
1790
|
details.appendChild(el('summary', '', title))
|
|
1843
|
-
|
|
1844
|
-
details.appendChild(renderEventCard(item.event, commitBySha))
|
|
1845
|
-
} else {
|
|
1846
|
-
item.events.forEach((event) => details.appendChild(renderEventCard(event, commitBySha)))
|
|
1847
|
-
}
|
|
1791
|
+
details.appendChild(renderEventCard(item.event, commitBySha))
|
|
1848
1792
|
return details
|
|
1849
1793
|
},
|
|
1850
1794
|
'No matches.',
|
|
@@ -2040,8 +1984,7 @@
|
|
|
2040
1984
|
isHydratingFromUrl = true
|
|
2041
1985
|
if (
|
|
2042
1986
|
parsed.activeTab === VIEW_IDS.leaves ||
|
|
2043
|
-
parsed.activeTab === VIEW_IDS.changelog
|
|
2044
|
-
parsed.activeTab === VIEW_IDS.changelogSource
|
|
1987
|
+
parsed.activeTab === VIEW_IDS.changelog
|
|
2045
1988
|
) {
|
|
2046
1989
|
state.activeTab = parsed.activeTab
|
|
2047
1990
|
}
|
|
@@ -2118,15 +2061,12 @@
|
|
|
2118
2061
|
}
|
|
2119
2062
|
if (state.changelogPayload) {
|
|
2120
2063
|
state.availableTabs.add(VIEW_IDS.changelog)
|
|
2121
|
-
state.availableTabs.add(VIEW_IDS.changelogSource)
|
|
2122
2064
|
}
|
|
2123
2065
|
|
|
2124
2066
|
if (!state.availableTabs.has(state.activeTab)) {
|
|
2125
2067
|
state.activeTab = state.availableTabs.has(VIEW_IDS.leaves)
|
|
2126
2068
|
? VIEW_IDS.leaves
|
|
2127
|
-
:
|
|
2128
|
-
? VIEW_IDS.changelog
|
|
2129
|
-
: VIEW_IDS.changelogSource
|
|
2069
|
+
: VIEW_IDS.changelog
|
|
2130
2070
|
}
|
|
2131
2071
|
|
|
2132
2072
|
if (state.leavesPayload && state.changelogPayload) {
|
|
@@ -2186,7 +2126,6 @@
|
|
|
2186
2126
|
|
|
2187
2127
|
tabLeavesBtn.addEventListener('click', () => setActiveTab(VIEW_IDS.leaves))
|
|
2188
2128
|
tabChangelogBtn.addEventListener('click', () => setActiveTab(VIEW_IDS.changelog))
|
|
2189
|
-
tabChangelogSourceBtn.addEventListener('click', () => setActiveTab(VIEW_IDS.changelogSource))
|
|
2190
2129
|
|
|
2191
2130
|
selectAllFieldsBtn.addEventListener('click', () =>
|
|
2192
2131
|
setFieldSelection(new Set(currentFieldDefs().map((field) => field.id))),
|