@emeryld/rrroutes-export 1.0.16 → 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
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,7 +1666,8 @@
|
|
|
1669
1666
|
routeKey,
|
|
1670
1667
|
event,
|
|
1671
1668
|
commit: commitBySha.get(event.commitSha),
|
|
1672
|
-
|
|
1669
|
+
commitSort: commitTimestamp(commitBySha.get(event.commitSha)),
|
|
1670
|
+
commitIndex: commitOrder.get(event.commitSha) ?? -1,
|
|
1673
1671
|
eventIndex: sequence++,
|
|
1674
1672
|
})
|
|
1675
1673
|
})
|
|
@@ -1683,15 +1681,17 @@
|
|
|
1683
1681
|
displayName: event.displayName || sourceObjectId,
|
|
1684
1682
|
event,
|
|
1685
1683
|
commit: commitBySha.get(event.commitSha),
|
|
1686
|
-
|
|
1684
|
+
commitSort: commitTimestamp(commitBySha.get(event.commitSha)),
|
|
1685
|
+
commitIndex: commitOrder.get(event.commitSha) ?? -1,
|
|
1687
1686
|
eventIndex: sequence++,
|
|
1688
1687
|
})
|
|
1689
1688
|
})
|
|
1690
1689
|
})
|
|
1691
1690
|
|
|
1692
1691
|
rows.sort((a, b) => {
|
|
1693
|
-
if (a.
|
|
1694
|
-
|
|
1692
|
+
if (a.commitSort !== b.commitSort) return b.commitSort - a.commitSort
|
|
1693
|
+
if (a.commitIndex !== b.commitIndex) return b.commitIndex - a.commitIndex
|
|
1694
|
+
return b.eventIndex - a.eventIndex
|
|
1695
1695
|
})
|
|
1696
1696
|
|
|
1697
1697
|
return rows
|
|
@@ -1703,15 +1703,6 @@
|
|
|
1703
1703
|
if (tabId === VIEW_IDS.changelog) {
|
|
1704
1704
|
return buildChronologicalEvents(payload)
|
|
1705
1705
|
}
|
|
1706
|
-
if (tabId === VIEW_IDS.changelogSource) {
|
|
1707
|
-
return Object.entries(payload.bySourceObject || {})
|
|
1708
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
1709
|
-
.map(([sourceId, events]) => ({
|
|
1710
|
-
sourceId,
|
|
1711
|
-
events,
|
|
1712
|
-
displayName: events[0]?.displayName || sourceId,
|
|
1713
|
-
}))
|
|
1714
|
-
}
|
|
1715
1706
|
return []
|
|
1716
1707
|
}
|
|
1717
1708
|
|
|
@@ -1737,10 +1728,8 @@
|
|
|
1737
1728
|
function renderTabButtons() {
|
|
1738
1729
|
setPressed(tabLeavesBtn, state.activeTab === VIEW_IDS.leaves)
|
|
1739
1730
|
setPressed(tabChangelogBtn, state.activeTab === VIEW_IDS.changelog)
|
|
1740
|
-
setPressed(tabChangelogSourceBtn, state.activeTab === VIEW_IDS.changelogSource)
|
|
1741
1731
|
tabLeavesBtn.style.display = state.availableTabs.has(VIEW_IDS.leaves) ? '' : 'none'
|
|
1742
1732
|
tabChangelogBtn.style.display = state.availableTabs.has(VIEW_IDS.changelog) ? '' : 'none'
|
|
1743
|
-
tabChangelogSourceBtn.style.display = state.availableTabs.has(VIEW_IDS.changelogSource) ? '' : 'none'
|
|
1744
1733
|
const isLeavesTab = state.activeTab === VIEW_IDS.leaves
|
|
1745
1734
|
coreFieldsBtn.style.display = isLeavesTab ? '' : 'none'
|
|
1746
1735
|
schemasOnlyFieldsBtn.style.display = isLeavesTab ? '' : 'none'
|
|
@@ -1776,10 +1765,7 @@
|
|
|
1776
1765
|
const fieldDefs = currentFieldDefs()
|
|
1777
1766
|
const items = changelogItemsByTab(state.activeTab)
|
|
1778
1767
|
const filtered = items.filter((item) => matchesGenericItem(item, fieldDefs, engine, selectedIds))
|
|
1779
|
-
statusEl.textContent =
|
|
1780
|
-
state.activeTab === VIEW_IDS.changelog
|
|
1781
|
-
? `${filtered.length} / ${items.length} changelog events matched.`
|
|
1782
|
-
: `${filtered.length} / ${items.length} source changelog groups matched.`
|
|
1768
|
+
statusEl.textContent = `${filtered.length} / ${items.length} changelog events matched.`
|
|
1783
1769
|
const commitBySha = new Map(
|
|
1784
1770
|
(state.changelogPayload?.commits || []).map((commit) => [commit.sha, commit]),
|
|
1785
1771
|
)
|
|
@@ -1787,25 +1773,11 @@
|
|
|
1787
1773
|
renderCollection(
|
|
1788
1774
|
filtered,
|
|
1789
1775
|
(item) => {
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
item.
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
return renderChangelogEventLines(item.event, commitBySha, contextLabel)
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
const lines = el('div', 'changelog-lines')
|
|
1799
|
-
;(item.events || []).forEach((event) => {
|
|
1800
|
-
lines.appendChild(
|
|
1801
|
-
renderChangelogEventLines(
|
|
1802
|
-
event,
|
|
1803
|
-
commitBySha,
|
|
1804
|
-
`Source: ${item.displayName || item.sourceId}`,
|
|
1805
|
-
),
|
|
1806
|
-
)
|
|
1807
|
-
})
|
|
1808
|
-
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)
|
|
1809
1781
|
},
|
|
1810
1782
|
'No matches.',
|
|
1811
1783
|
)
|
|
@@ -1814,16 +1786,9 @@
|
|
|
1814
1786
|
filtered,
|
|
1815
1787
|
(item) => {
|
|
1816
1788
|
const details = el('details', 'leaf')
|
|
1817
|
-
const title =
|
|
1818
|
-
state.activeTab === VIEW_IDS.changelog
|
|
1819
|
-
? `${item.eventKind === 'route' ? `Route: ${item.routeKey}` : `Source: ${item.displayName || item.sourceObjectId}`} (${item.event.type})`
|
|
1820
|
-
: `${item.displayName} (${item.events.length})`
|
|
1789
|
+
const title = `${item.eventKind === 'route' ? `Route: ${item.routeKey}` : `Source: ${item.displayName || item.sourceObjectId}`} (${item.event.type})`
|
|
1821
1790
|
details.appendChild(el('summary', '', title))
|
|
1822
|
-
|
|
1823
|
-
details.appendChild(renderEventCard(item.event, commitBySha))
|
|
1824
|
-
} else {
|
|
1825
|
-
item.events.forEach((event) => details.appendChild(renderEventCard(event, commitBySha)))
|
|
1826
|
-
}
|
|
1791
|
+
details.appendChild(renderEventCard(item.event, commitBySha))
|
|
1827
1792
|
return details
|
|
1828
1793
|
},
|
|
1829
1794
|
'No matches.',
|
|
@@ -2019,8 +1984,7 @@
|
|
|
2019
1984
|
isHydratingFromUrl = true
|
|
2020
1985
|
if (
|
|
2021
1986
|
parsed.activeTab === VIEW_IDS.leaves ||
|
|
2022
|
-
parsed.activeTab === VIEW_IDS.changelog
|
|
2023
|
-
parsed.activeTab === VIEW_IDS.changelogSource
|
|
1987
|
+
parsed.activeTab === VIEW_IDS.changelog
|
|
2024
1988
|
) {
|
|
2025
1989
|
state.activeTab = parsed.activeTab
|
|
2026
1990
|
}
|
|
@@ -2075,7 +2039,6 @@
|
|
|
2075
2039
|
function applyLoadedPayload(payload) {
|
|
2076
2040
|
state.viewerMode = resolveViewerMode(payload)
|
|
2077
2041
|
applyViewerModeMeta()
|
|
2078
|
-
state.payload = payload
|
|
2079
2042
|
state.availableTabs = new Set()
|
|
2080
2043
|
state.leavesPayload = null
|
|
2081
2044
|
state.changelogPayload = null
|
|
@@ -2090,21 +2053,20 @@
|
|
|
2090
2053
|
state.leavesPayload = payload
|
|
2091
2054
|
}
|
|
2092
2055
|
|
|
2056
|
+
state.payload = state.leavesPayload || payload
|
|
2057
|
+
|
|
2093
2058
|
if (state.leavesPayload) {
|
|
2094
2059
|
state.availableTabs.add(VIEW_IDS.leaves)
|
|
2095
2060
|
state.leaves = state.leavesPayload.leaves || []
|
|
2096
2061
|
}
|
|
2097
2062
|
if (state.changelogPayload) {
|
|
2098
2063
|
state.availableTabs.add(VIEW_IDS.changelog)
|
|
2099
|
-
state.availableTabs.add(VIEW_IDS.changelogSource)
|
|
2100
2064
|
}
|
|
2101
2065
|
|
|
2102
2066
|
if (!state.availableTabs.has(state.activeTab)) {
|
|
2103
2067
|
state.activeTab = state.availableTabs.has(VIEW_IDS.leaves)
|
|
2104
2068
|
? VIEW_IDS.leaves
|
|
2105
|
-
:
|
|
2106
|
-
? VIEW_IDS.changelog
|
|
2107
|
-
: VIEW_IDS.changelogSource
|
|
2069
|
+
: VIEW_IDS.changelog
|
|
2108
2070
|
}
|
|
2109
2071
|
|
|
2110
2072
|
if (state.leavesPayload && state.changelogPayload) {
|
|
@@ -2164,7 +2126,6 @@
|
|
|
2164
2126
|
|
|
2165
2127
|
tabLeavesBtn.addEventListener('click', () => setActiveTab(VIEW_IDS.leaves))
|
|
2166
2128
|
tabChangelogBtn.addEventListener('click', () => setActiveTab(VIEW_IDS.changelog))
|
|
2167
|
-
tabChangelogSourceBtn.addEventListener('click', () => setActiveTab(VIEW_IDS.changelogSource))
|
|
2168
2129
|
|
|
2169
2130
|
selectAllFieldsBtn.addEventListener('click', () =>
|
|
2170
2131
|
setFieldSelection(new Set(currentFieldDefs().map((field) => field.id))),
|