@emeryld/rrroutes-export 1.0.12 → 1.0.13
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
|
@@ -1350,22 +1350,103 @@
|
|
|
1350
1350
|
const view = el('div')
|
|
1351
1351
|
resultsEl.appendChild(view)
|
|
1352
1352
|
|
|
1353
|
+
const formatCommitDateTime = (value) => {
|
|
1354
|
+
if (!value) return null
|
|
1355
|
+
const parsed = new Date(value)
|
|
1356
|
+
if (Number.isNaN(parsed.getTime())) return String(value)
|
|
1357
|
+
return parsed.toLocaleString()
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
const formatRouteSchemaEntry = (entry) => {
|
|
1361
|
+
if (!entry || typeof entry !== 'object') return 'n/a'
|
|
1362
|
+
const parts = [
|
|
1363
|
+
`type=${entry.type}`,
|
|
1364
|
+
`nullable=${Boolean(entry.nullable)}`,
|
|
1365
|
+
`optional=${Boolean(entry.optional)}`,
|
|
1366
|
+
]
|
|
1367
|
+
if ('literal' in entry) {
|
|
1368
|
+
parts.push(`literal=${JSON.stringify(entry.literal)}`)
|
|
1369
|
+
}
|
|
1370
|
+
return parts.join(', ')
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
const formatSchemaDiffLine = (delta) => {
|
|
1374
|
+
if (!delta || typeof delta !== 'object') return null
|
|
1375
|
+
|
|
1376
|
+
// Source-object schema diff shape: { section, path, op, before?, after? }
|
|
1377
|
+
if ('section' in delta) {
|
|
1378
|
+
const location = `${delta.section}.${delta.path}`
|
|
1379
|
+
if (delta.op === 'added') {
|
|
1380
|
+
return `added ${location}: ${JSON.stringify(delta.after || [])}`
|
|
1381
|
+
}
|
|
1382
|
+
if (delta.op === 'removed') {
|
|
1383
|
+
return `removed ${location}: ${JSON.stringify(delta.before || [])}`
|
|
1384
|
+
}
|
|
1385
|
+
return `changed ${location}: ${JSON.stringify(delta.before || [])} -> ${JSON.stringify(
|
|
1386
|
+
delta.after || [],
|
|
1387
|
+
)}`
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// Route schema diff shape: { path, op, before?, after? }
|
|
1391
|
+
if ('path' in delta) {
|
|
1392
|
+
if (delta.op === 'added') {
|
|
1393
|
+
return `added ${delta.path}: ${formatRouteSchemaEntry(delta.after)}`
|
|
1394
|
+
}
|
|
1395
|
+
if (delta.op === 'removed') {
|
|
1396
|
+
return `removed ${delta.path}: ${formatRouteSchemaEntry(delta.before)}`
|
|
1397
|
+
}
|
|
1398
|
+
return `changed ${delta.path}: ${formatRouteSchemaEntry(
|
|
1399
|
+
delta.before,
|
|
1400
|
+
)} -> ${formatRouteSchemaEntry(delta.after)}`
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
return null
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
const formatCfgDiffLine = (diff) => {
|
|
1407
|
+
if (!diff || typeof diff !== 'object') return null
|
|
1408
|
+
return `${diff.field}: ${JSON.stringify(diff.before)} -> ${JSON.stringify(diff.after)}`
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1353
1411
|
const renderEventDetails = (event) => {
|
|
1354
1412
|
const card = el('div', 'leaf-content')
|
|
1355
1413
|
const commit = commitBySha.get(event.commitSha)
|
|
1414
|
+
const commitDateTime = formatCommitDateTime(commit?.authorDate)
|
|
1415
|
+
const commitMeta = [
|
|
1416
|
+
event.commitSha.slice(0, 12),
|
|
1417
|
+
commitDateTime,
|
|
1418
|
+
commit?.authorName || null,
|
|
1419
|
+
commit?.subject || null,
|
|
1420
|
+
]
|
|
1421
|
+
.filter(Boolean)
|
|
1422
|
+
.join(' - ')
|
|
1356
1423
|
card.appendChild(
|
|
1357
1424
|
el(
|
|
1358
1425
|
'div',
|
|
1359
1426
|
'meta',
|
|
1360
|
-
|
|
1427
|
+
commitMeta,
|
|
1361
1428
|
),
|
|
1362
1429
|
)
|
|
1363
1430
|
card.appendChild(el('div', 'mono', event.type))
|
|
1364
1431
|
if (Array.isArray(event.schemaDiff) && event.schemaDiff.length > 0) {
|
|
1365
1432
|
card.appendChild(el('div', 'meta', `schema changes: ${event.schemaDiff.length}`))
|
|
1433
|
+
const schemaChanges = el('div')
|
|
1434
|
+
event.schemaDiff.forEach((delta) => {
|
|
1435
|
+
const line = formatSchemaDiffLine(delta)
|
|
1436
|
+
if (!line) return
|
|
1437
|
+
schemaChanges.appendChild(el('div', 'meta', line))
|
|
1438
|
+
})
|
|
1439
|
+
card.appendChild(schemaChanges)
|
|
1366
1440
|
}
|
|
1367
1441
|
if (Array.isArray(event.cfgDiff) && event.cfgDiff.length > 0) {
|
|
1368
1442
|
card.appendChild(el('div', 'meta', `cfg changes: ${event.cfgDiff.length}`))
|
|
1443
|
+
const cfgChanges = el('div')
|
|
1444
|
+
event.cfgDiff.forEach((diff) => {
|
|
1445
|
+
const line = formatCfgDiffLine(diff)
|
|
1446
|
+
if (!line) return
|
|
1447
|
+
cfgChanges.appendChild(el('div', 'meta', line))
|
|
1448
|
+
})
|
|
1449
|
+
card.appendChild(cfgChanges)
|
|
1369
1450
|
}
|
|
1370
1451
|
if (Array.isArray(event.impactedRoutes) && event.impactedRoutes.length > 0) {
|
|
1371
1452
|
card.appendChild(
|