OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-core-schemas / lib / reactions / messages.js

25 lines · javascript ref:
const e = require("compact-encoding"),
  { MemberId: t } = require("../members/messages"),
  o = e.array(t),
  n = e.array(e.string),
  c = {
    preencode(t, n) {
      ;(e.string.preencode(t, n.text), e.uint.preencode(t, n.count), o.preencode(t, n.latest))
    },
    encode(t, n) {
      ;(e.string.encode(t, n.text), e.uint.encode(t, n.count), o.encode(t, n.latest))
    },
    decode: (t) => ({ text: e.string.decode(t), count: e.uint.decode(t), latest: o.decode(t) }),
  },
  d = e.array(c),
  r = {
    preencode(t, o) {
      ;(e.uint.preencode(t, o.total), d.preencode(t, o.reactions))
    },
    encode(t, o) {
      ;(e.uint.encode(t, o.total), d.encode(t, o.reactions))
    },
    decode: (t) => ({ total: e.uint.decode(t), reactions: d.decode(t) }),
  }
module.exports = { ReactionsDigest: r, MemberReactions: n }