feat(schema): HyperDB v11 message.hubMirrorJson for rich hub mirrors

Optional hubMirrorJson on message rows (flag bit 8) so structured
announcement hub card metadata survives HyperDB encode/decode.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 23:25:37 -04:00
co-authored by Cursor
parent 4b6414f348
commit 53f082b729
3 changed files with 20 additions and 7 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{
"version": 10,
"version": 11,
"offset": 0,
"schema": [
{
+13 -5
View File
@@ -6,7 +6,7 @@
const { c } = require('hyperschema/runtime')
const VERSION = 10
const VERSION = 11
// eslint-disable-next-line no-unused-vars
let version = VERSION
@@ -157,12 +157,14 @@ const encoding3 = {
if (m.editedAt) c.uint.preencode(state, m.editedAt)
if (version >= 9 && m.replyToId) c.string.preencode(state, m.replyToId)
if (version >= 10 && m.stickerNamesJson) c.string.preencode(state, m.stickerNamesJson)
if (version >= 11 && m.hubMirrorJson) c.string.preencode(state, m.hubMirrorJson)
},
encode(state, m) {
const flags =
(m.editedAt ? 1 : 0) |
((version >= 9 && m.replyToId) ? 2 : 0) |
((version >= 10 && m.stickerNamesJson) ? 4 : 0)
((version >= 10 && m.stickerNamesJson) ? 4 : 0) |
((version >= 11 && m.hubMirrorJson) ? 8 : 0)
c.string.encode(state, m.id)
c.string.encode(state, m.channelId)
@@ -175,6 +177,7 @@ const encoding3 = {
if (m.editedAt) c.uint.encode(state, m.editedAt)
if (version >= 9 && m.replyToId) c.string.encode(state, m.replyToId)
if (version >= 10 && m.stickerNamesJson) c.string.encode(state, m.stickerNamesJson)
if (version >= 11 && m.hubMirrorJson) c.string.encode(state, m.hubMirrorJson)
},
decode(state) {
const r0 = c.string.decode(state)
@@ -194,7 +197,8 @@ const encoding3 = {
createdAt: r5,
editedAt: (flags & 1) !== 0 ? c.uint.decode(state) : 0,
replyToId: (version >= 9 && (flags & 2) !== 0) ? c.string.decode(state) : null,
stickerNamesJson: (version >= 10 && (flags & 4) !== 0) ? c.string.decode(state) : null
stickerNamesJson: (version >= 10 && (flags & 4) !== 0) ? c.string.decode(state) : null,
hubMirrorJson: (version >= 11 && (flags & 8) !== 0) ? c.string.decode(state) : null
}
}
}
@@ -889,12 +893,14 @@ const encoding22 = {
if (m.editedAt) c.uint.preencode(state, m.editedAt)
if (version >= 9 && m.replyToId) c.string.preencode(state, m.replyToId)
if (version >= 10 && m.stickerNamesJson) c.string.preencode(state, m.stickerNamesJson)
if (version >= 11 && m.hubMirrorJson) c.string.preencode(state, m.hubMirrorJson)
},
encode(state, m) {
const flags =
(m.editedAt ? 1 : 0) |
((version >= 9 && m.replyToId) ? 2 : 0) |
((version >= 10 && m.stickerNamesJson) ? 4 : 0)
((version >= 10 && m.stickerNamesJson) ? 4 : 0) |
((version >= 11 && m.hubMirrorJson) ? 8 : 0)
c.string.encode(state, m.guildId)
c.string.encode(state, m.authorId)
@@ -905,6 +911,7 @@ const encoding22 = {
if (m.editedAt) c.uint.encode(state, m.editedAt)
if (version >= 9 && m.replyToId) c.string.encode(state, m.replyToId)
if (version >= 10 && m.stickerNamesJson) c.string.encode(state, m.stickerNamesJson)
if (version >= 11 && m.hubMirrorJson) c.string.encode(state, m.hubMirrorJson)
},
decode(state) {
const r2 = c.string.decode(state)
@@ -922,7 +929,8 @@ const encoding22 = {
createdAt: r5,
editedAt: (flags & 1) !== 0 ? c.uint.decode(state) : 0,
replyToId: (version >= 9 && (flags & 2) !== 0) ? c.string.decode(state) : null,
stickerNamesJson: (version >= 10 && (flags & 4) !== 0) ? c.string.decode(state) : null
stickerNamesJson: (version >= 10 && (flags & 4) !== 0) ? c.string.decode(state) : null,
hubMirrorJson: (version >= 11 && (flags & 8) !== 0) ? c.string.decode(state) : null
}
}
}
+6 -1
View File
@@ -1,5 +1,5 @@
{
"version": 10,
"version": 11,
"schema": [
{
"name": "user",
@@ -201,6 +201,11 @@
"name": "stickerNamesJson",
"type": "string",
"version": 10
},
{
"name": "hubMirrorJson",
"type": "string",
"version": 11
}
]
},