const { IndexEncoder: e, c: n, b4a: t } = require("hyperdb/runtime"),
{ version: o, getEncoding: r, setVersion: c } = require("./messages.js"),
l = { schema: o, db: 3 },
d = require("../../../../../lib/hyperdb/local/local.js"),
s = new e([], { prefix: 0 })
function u(e) {
return []
}
const i = r("@local/stats")
function a(e, n, t) {
c(e)
const o = { start: 0, end: t.byteLength, buffer: t }
return i.decode(o)
}
function f(e) {
return {}
}
const y = {
name: "@local/stats",
id: 0,
version: 0,
encodeKey: (e) => s.encode([]),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
s.encodeRange({
gt: e ? u(e) : null,
lt: n ? u(n) : null,
gte: t ? u(t) : null,
lte: o ? u(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (i.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), i.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: a,
reconstructKey: f,
indexes: [],
decodedVersion: 0,
},
g = new e([], { prefix: 1 })
function p(e) {
return []
}
const b = r("@local/migration-status")
function m(e, n, t) {
c(e)
const o = { start: 0, end: t.byteLength, buffer: t }
return b.decode(o)
}
function K(e) {
return {}
}
const x = {
name: "@local/migrations",
id: 1,
version: 0,
encodeKey: (e) => g.encode([]),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
g.encodeRange({
gt: e ? p(e) : null,
lt: n ? p(n) : null,
gte: t ? p(t) : null,
lte: o ? p(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (b.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), b.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: m,
reconstructKey: K,
indexes: [],
decodedVersion: 0,
},
v = new e([], { prefix: 2 })
function h(e) {
return []
}
const R = r("@local/room-migration-stats")
function U(e, n, t) {
c(e)
const o = { start: 0, end: t.byteLength, buffer: t }
return R.decode(o)
}
function w(e) {
return {}
}
const F = {
name: "@local/room-migration-stats",
id: 2,
version: 0,
encodeKey: (e) => v.encode([]),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
v.encodeRange({
gt: e ? h(e) : null,
lt: n ? h(n) : null,
gte: t ? h(t) : null,
lte: o ? h(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (R.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), R.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: U,
reconstructKey: w,
indexes: [],
decodedVersion: 0,
},
V = new e([e.BUFFER], { prefix: 3 })
function k(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const B = r("@local/room-migration/hyperdb#3"),
E = d.roomMigrationsTrigger
function I(e, n, t) {
const o = V.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = B.decode(r)
return ((l.roomKey = o[0]), l)
}
function T(e) {
return { roomKey: V.decode(e)[0] }
}
const L = {
name: "@local/room-migrations",
id: 3,
version: 0,
encodeKey(e) {
const n = [e.roomKey]
return V.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
V.encodeRange({
gt: e ? k(e) : null,
lt: n ? k(n) : null,
gte: t ? k(t) : null,
lte: o ? k(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (B.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), B.encode(r, o), r.buffer)
},
trigger: E,
reconstruct: I,
reconstructKey: T,
indexes: [],
decodedVersion: 0,
},
N = new e([e.UINT, e.BUFFER], { prefix: 4 })
function D(e) {
const n = [],
t = e.priority
if (void 0 === t) return n
n.push(t)
const o = e.roomKey
return (void 0 === o || n.push(o), n)
}
const P = {
name: "@local/room-migrations-by-priority",
version: 0,
id: 4,
encodeKey: (e) => N.encode(D(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
N.encodeRange({
gt: e ? D(e) : null,
lt: n ? D(n) : null,
gte: t ? D(t) : null,
lte: o ? D(o) : null,
}),
encodeValue: (e) => P.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [N.encode([e.priority, e.roomKey])],
reconstruct: (e, n) => n,
offset: L.indexes.length,
collection: L,
}
L.indexes.push(P)
const A = new e([], { prefix: 5 })
function M(e) {
return []
}
const O = r("@local/identity-record")
function q(e, n, t) {
c(e)
const o = { start: 0, end: t.byteLength, buffer: t }
return O.decode(o)
}
function C(e) {
return {}
}
const G = {
name: "@local/identity",
id: 5,
version: 0,
encodeKey: (e) => A.encode([]),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
A.encodeRange({
gt: e ? M(e) : null,
lt: n ? M(n) : null,
gte: t ? M(t) : null,
lte: o ? M(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (O.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), O.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: q,
reconstructKey: C,
indexes: [],
decodedVersion: 0,
},
S = new e([e.BUFFER], { prefix: 6 })
function j(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const W = r("@local/room/hyperdb#6"),
z = d.roomsTrigger
function H(e, n, t) {
const o = S.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = W.decode(r)
return ((l.roomKey = o[0]), (Q.decodedVersion = l.version), l)
}
function J(e) {
return { roomKey: S.decode(e)[0] }
}
const Q = {
name: "@local/rooms",
id: 6,
version: 3,
encodeKey(e) {
const n = [e.roomKey]
return S.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
S.encodeRange({
gt: e ? j(e) : null,
lt: n ? j(n) : null,
gte: t ? j(t) : null,
lte: o ? j(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (
(o.version = n),
W.preencode(r, o),
(r.buffer = t.allocUnsafe(r.end)),
W.encode(r, o),
r.buffer
)
},
trigger: z,
reconstruct: H,
reconstructKey: J,
indexes: [],
decodedVersion: 0,
},
X = new e([e.BUFFER], { prefix: 7 })
function Y(e) {
const n = e.discoveryKey
return void 0 === n ? [] : [n]
}
const Z = {
name: "@local/rooms-by-discovery-key",
version: 0,
id: 7,
encodeKey: (e) => X.encode(Y(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
X.encodeRange({
gt: e ? Y(e) : null,
lt: n ? Y(n) : null,
gte: t ? Y(t) : null,
lte: o ? Y(o) : null,
}),
encodeValue: (e) => Z.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [X.encode([e.discoveryKey])],
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(Z)
const $ = new e([e.UINT, e.BUFFER], { prefix: 8 }),
_ = d.roomsByTimestampMap
function ee(e) {
const n = e.timestamp
return void 0 === n ? [] : [n]
}
const ne = {
name: "@local/rooms-by-timestamp",
version: 0,
id: 8,
encodeKey: (e) => $.encode(ee(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
$.encodeRange({
gt: e ? ee(e) : null,
lt: n ? ee(n) : null,
gte: t ? ee(t) : null,
lte: o ? ee(o) : null,
}),
encodeValue: (e) => ne.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = _(e, n),
o = new Array(t.length)
for (let n = 0; n < t.length; n++) {
const r = t[n]
o[n] = $.encode([r.timestamp, e.roomKey])
}
return o
},
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(ne)
const te = new e([e.UINT, e.UINT, e.BUFFER], { prefix: 9 }),
oe = d.roomsByTypeAndTimestampMap
function re(e) {
const n = [],
t = e.type
if (void 0 === t) return n
n.push(t)
const o = e.timestamp
return (void 0 === o || n.push(o), n)
}
const ce = {
name: "@local/rooms-by-type-and-timestamp",
version: 0,
id: 9,
encodeKey: (e) => te.encode(re(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
te.encodeRange({
gt: e ? re(e) : null,
lt: n ? re(n) : null,
gte: t ? re(t) : null,
lte: o ? re(o) : null,
}),
encodeValue: (e) => ce.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = oe(e, n),
o = new Array(t.length)
for (let n = 0; n < t.length; n++) {
const r = t[n]
o[n] = te.encode([r.type, r.timestamp, e.roomKey])
}
return o
},
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(ce)
const le = new e([e.BUFFER], { prefix: 10 })
function de(e) {
const n = e.capabilities?.wakeupTopic
return void 0 === n ? [] : [n]
}
const se = {
name: "@local/rooms-by-wakeup-topic",
version: 0,
id: 10,
encodeKey: (e) => le.encode(de(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
le.encodeRange({
gt: e ? de(e) : null,
lt: n ? de(n) : null,
gte: t ? de(t) : null,
lte: o ? de(o) : null,
}),
encodeValue: (e) => se.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [le.encode([e.capabilities.wakeupTopic])],
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(se)
const ue = new e([e.BUFFER], { prefix: 11 })
function ie(e) {
const n = e.capabilities?.mailboxKeyPair?.publicKey
return void 0 === n ? [] : [n]
}
const ae = {
name: "@local/rooms-by-mailbox",
version: 0,
id: 11,
encodeKey: (e) => ue.encode(ie(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
ue.encodeRange({
gt: e ? ie(e) : null,
lt: n ? ie(n) : null,
gte: t ? ie(t) : null,
lte: o ? ie(o) : null,
}),
encodeValue: (e) => ae.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [ue.encode([e.capabilities.mailboxKeyPair.publicKey])],
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(ae)
const fe = new e([e.BUFFER], { prefix: 12 })
function ye(e) {
const n = e.capabilities?.discoveryKeyPair?.publicKey
return void 0 === n ? [] : [n]
}
const ge = {
name: "@local/rooms-by-discovery",
version: 0,
id: 12,
encodeKey: (e) => fe.encode(ye(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
fe.encodeRange({
gt: e ? ye(e) : null,
lt: n ? ye(n) : null,
gte: t ? ye(t) : null,
lte: o ? ye(o) : null,
}),
encodeValue: (e) => ge.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [fe.encode([e.capabilities.discoveryKeyPair.publicKey])],
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(ge)
const pe = new e([e.BUFFER], { prefix: 13 })
function be(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const me = r("@local/room-preferences/hyperdb#13")
function Ke(e, n, t) {
const o = pe.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = me.decode(r)
return ((l.roomKey = o[0]), l)
}
function xe(e) {
return { roomKey: pe.decode(e)[0] }
}
const ve = {
name: "@local/room-preferences",
id: 13,
version: 0,
encodeKey(e) {
const n = [e.roomKey]
return pe.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
pe.encodeRange({
gt: e ? be(e) : null,
lt: n ? be(n) : null,
gte: t ? be(t) : null,
lte: o ? be(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (me.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), me.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Ke,
reconstructKey: xe,
indexes: [],
decodedVersion: 0,
},
he = new e([e.BUFFER], { prefix: 14 })
function Re(e) {
const n = e.mailbox
return void 0 === n ? [] : [n]
}
const Ue = r("@local/writer/hyperdb#14")
function we(e, n, t) {
const o = he.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = Ue.decode(r)
return ((l.mailbox = o[0]), l)
}
function Fe(e) {
return { mailbox: he.decode(e)[0] }
}
const Ve = {
name: "@local/writers",
id: 14,
version: 0,
encodeKey(e) {
const n = [e.mailbox]
return he.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
he.encodeRange({
gt: e ? Re(e) : null,
lt: n ? Re(n) : null,
gte: t ? Re(t) : null,
lte: o ? Re(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (Ue.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), Ue.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: we,
reconstructKey: Fe,
indexes: [],
decodedVersion: 0,
},
ke = new e([e.BUFFER], { prefix: 15 }),
Be = d.writersByWakeupTopicMap
function Ee(e) {
const n = e.wakeupTopic
return void 0 === n ? [] : [n]
}
const Ie = {
name: "@local/writers-by-wakeup-topic",
version: 0,
id: 15,
encodeKey: (e) => ke.encode(Ee(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
ke.encodeRange({
gt: e ? Ee(e) : null,
lt: n ? Ee(n) : null,
gte: t ? Ee(t) : null,
lte: o ? Ee(o) : null,
}),
encodeValue: (e) => Ie.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = Be(e, n),
o = new Array(t.length)
for (let e = 0; e < t.length; e++) {
const n = t[e]
o[e] = ke.encode([n.wakeupTopic])
}
return o
},
reconstruct: (e, n) => n,
offset: Ve.indexes.length,
collection: Ve,
}
Ve.indexes.push(Ie)
const Te = new e([e.BUFFER], { prefix: 16 }),
Le = d.writersByRoomKeyMap
function Ne(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const De = {
name: "@local/writers-by-room-key",
version: 0,
id: 16,
encodeKey: (e) => Te.encode(Ne(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Te.encodeRange({
gt: e ? Ne(e) : null,
lt: n ? Ne(n) : null,
gte: t ? Ne(t) : null,
lte: o ? Ne(o) : null,
}),
encodeValue: (e) => De.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = Le(e, n),
o = new Array(t.length)
for (let e = 0; e < t.length; e++) {
const n = t[e]
o[e] = Te.encode([n.roomKey])
}
return o
},
reconstruct: (e, n) => n,
offset: Ve.indexes.length,
collection: Ve,
}
Ve.indexes.push(De)
const Pe = new e([e.BUFFER], { prefix: 17 })
function Ae(e) {
const n = e.key
return void 0 === n ? [] : [n]
}
const Me = r("@local/member/hyperdb#17")
function Oe(e, n, t) {
const o = Pe.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = Me.decode(r)
return ((l.key = o[0]), l)
}
function qe(e) {
return { key: Pe.decode(e)[0] }
}
const Ce = {
name: "@local/members",
id: 17,
version: 0,
encodeKey(e) {
const n = [e.key]
return Pe.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Pe.encodeRange({
gt: e ? Ae(e) : null,
lt: n ? Ae(n) : null,
gte: t ? Ae(t) : null,
lte: o ? Ae(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (Me.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), Me.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Oe,
reconstructKey: qe,
indexes: [],
decodedVersion: 0,
},
Ge = new e([e.BUFFER], { prefix: 18 })
function Se(e) {
const n = e.device?.key
return void 0 === n ? [] : [n]
}
const je = r("@local/device/hyperdb#18")
function We(e, n, t) {
const o = Ge.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = je.decode(r)
return ((l.device.key = o[0]), l)
}
function ze(e) {
return { device: { key: Ge.decode(e)[0] } }
}
const He = {
name: "@local/devices",
id: 18,
version: 0,
encodeKey(e) {
const n = [e.device.key]
return Ge.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Ge.encodeRange({
gt: e ? Se(e) : null,
lt: n ? Se(n) : null,
gte: t ? Se(t) : null,
lte: o ? Se(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (je.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), je.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: We,
reconstructKey: ze,
indexes: [],
decodedVersion: 0,
},
Je = new e([e.BUFFER], { prefix: 19 })
function Qe(e) {
const n = e.memberKey
return void 0 === n ? [] : [n]
}
const Xe = r("@keet-private-id/contact/hyperdb#19")
function Ye(e, n, t) {
const o = Je.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = Xe.decode(r)
return ((l.memberKey = o[0]), l)
}
function Ze(e) {
return { memberKey: Je.decode(e)[0] }
}
const $e = {
name: "@local/contacts",
id: 19,
version: 0,
encodeKey(e) {
const n = [e.memberKey]
return Je.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Je.encodeRange({
gt: e ? Qe(e) : null,
lt: n ? Qe(n) : null,
gte: t ? Qe(t) : null,
lte: o ? Qe(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (Xe.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), Xe.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Ye,
reconstructKey: Ze,
indexes: [],
decodedVersion: 0,
},
_e = new e([e.BUFFER], { prefix: 20 }),
en = d.blockedContactsMap
function nn(e) {
const n = e.memberKey
return void 0 === n ? [] : [n]
}
const tn = {
name: "@local/blocked-contacts",
version: 0,
id: 20,
encodeKey: (e) => _e.encode(nn(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
_e.encodeRange({
gt: e ? nn(e) : null,
lt: n ? nn(n) : null,
gte: t ? nn(t) : null,
lte: o ? nn(o) : null,
}),
encodeValue: (e) => tn.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = en(e, n),
o = new Array(t.length)
for (let e = 0; e < t.length; e++) {
const n = t[e]
o[e] = _e.encode([n.memberKey])
}
return o
},
reconstruct: (e, n) => n,
offset: $e.indexes.length,
collection: $e,
}
$e.indexes.push(tn)
const on = new e([e.UINT, e.UINT, e.UINT, e.BUFFER], { prefix: 21 })
function rn(e) {
const n = [],
t = e.priority
if (void 0 === t) return n
n.push(t)
const o = e.timestamp
if (void 0 === o) return n
n.push(o)
const r = e.type
if (void 0 === r) return n
n.push(r)
const c = e.discoveryKey
return (void 0 === c || n.push(c), n)
}
const cn = r("@local/task/hyperdb#21")
function ln(e, n, t) {
const o = on.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = cn.decode(r)
return ((l.priority = o[0]), (l.timestamp = o[1]), (l.type = o[2]), (l.discoveryKey = o[3]), l)
}
function dn(e) {
const n = on.decode(e)
return { priority: n[0], timestamp: n[1], type: n[2], discoveryKey: n[3] }
}
const sn = {
name: "@local/tasks",
id: 21,
version: 0,
encodeKey(e) {
const n = [e.priority, e.timestamp, e.type, e.discoveryKey]
return on.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
on.encodeRange({
gt: e ? rn(e) : null,
lt: n ? rn(n) : null,
gte: t ? rn(t) : null,
lte: o ? rn(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (cn.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), cn.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: ln,
reconstructKey: dn,
indexes: [],
decodedVersion: 0,
},
un = new e([e.UINT, e.BUFFER], { prefix: 22 })
function an(e) {
const n = [],
t = e.type
if (void 0 === t) return n
n.push(t)
const o = e.discoveryKey
return (void 0 === o || n.push(o), n)
}
const fn = {
name: "@local/tasks-by-type",
version: 0,
id: 22,
encodeKey: (e) => un.encode(an(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
un.encodeRange({
gt: e ? an(e) : null,
lt: n ? an(n) : null,
gte: t ? an(t) : null,
lte: o ? an(o) : null,
}),
encodeValue: (e) => fn.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [un.encode([e.type, e.discoveryKey])],
reconstruct: (e, n) => n,
offset: sn.indexes.length,
collection: sn,
}
sn.indexes.push(fn)
const yn = new e([e.BUFFER, e.UINT], { prefix: 23 })
function gn(e) {
const n = [],
t = e.file?.pointer?.externalBlob?.key
if (void 0 === t) return n
n.push(t)
const o = e.file?.pointer?.externalBlob?.blob?.blockOffset
return (void 0 === o || n.push(o), n)
}
const pn = r("@local/file/hyperdb#23")
function bn(e, n, t) {
const o = yn.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = pn.decode(r)
return (
(l.file.pointer.externalBlob.key = o[0]),
(l.file.pointer.externalBlob.blob.blockOffset = o[1]),
l
)
}
function mn(e) {
return { file: { pointer: { externalBlob: { blob: { blockOffset: yn.decode(e)[1] } } } } }
}
const Kn = {
name: "@local/blob-files",
id: 23,
version: 0,
encodeKey(e) {
const n = [e.file.pointer.externalBlob.key, e.file.pointer.externalBlob.blob.blockOffset]
return yn.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
yn.encodeRange({
gt: e ? gn(e) : null,
lt: n ? gn(n) : null,
gte: t ? gn(t) : null,
lte: o ? gn(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (pn.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), pn.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: bn,
reconstructKey: mn,
indexes: [],
decodedVersion: 0,
},
xn = new e([e.BUFFER, e.STRING, e.UINT], { prefix: 24 })
function vn(e) {
const n = [],
t = e.file?.pointer?.externalDrive?.key
if (void 0 === t) return n
n.push(t)
const o = e.file?.pointer?.externalDrive?.path
if (void 0 === o) return n
n.push(o)
const r = e.file?.pointer?.externalDrive?.version
return (void 0 === r || n.push(r), n)
}
const hn = r("@local/file/hyperdb#24")
function Rn(e, n, t) {
const o = xn.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = hn.decode(r)
return (
(l.file.pointer.externalDrive.key = o[0]),
(l.file.pointer.externalDrive.path = o[1]),
(l.file.pointer.externalDrive.version = o[2]),
l
)
}
function Un(e) {
return { file: { pointer: { externalDrive: { version: xn.decode(e)[2] } } } }
}
const wn = {
name: "@local/drive-files",
id: 24,
version: 0,
encodeKey(e) {
const n = [
e.file.pointer.externalDrive.key,
e.file.pointer.externalDrive.path,
e.file.pointer.externalDrive.version,
]
return xn.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
xn.encodeRange({
gt: e ? vn(e) : null,
lt: n ? vn(n) : null,
gte: t ? vn(t) : null,
lte: o ? vn(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (hn.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), hn.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Rn,
reconstructKey: Un,
indexes: [],
decodedVersion: 0,
},
Fn = new e([e.BUFFER, e.BUFFER, e.UINT], { prefix: 25 })
function Vn(e) {
const n = [],
t = e.roomKey
if (void 0 === t) return n
n.push(t)
const o = e.file?.pointer?.externalBlob?.key
if (void 0 === o) return n
n.push(o)
const r = e.file?.pointer?.externalBlob?.blob?.blockOffset
return (void 0 === r || n.push(r), n)
}
const kn = {
name: "@local/blob-files-by-room",
version: 0,
id: 25,
encodeKey: (e) => Fn.encode(Vn(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Fn.encodeRange({
gt: e ? Vn(e) : null,
lt: n ? Vn(n) : null,
gte: t ? Vn(t) : null,
lte: o ? Vn(o) : null,
}),
encodeValue: (e) => kn.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [
Fn.encode([
e.roomKey,
e.file.pointer.externalBlob.key,
e.file.pointer.externalBlob.blob.blockOffset,
]),
],
reconstruct: (e, n) => n,
offset: Kn.indexes.length,
collection: Kn,
}
Kn.indexes.push(kn)
const Bn = new e([e.BUFFER, e.BUFFER, e.STRING, e.UINT], { prefix: 26 })
function En(e) {
const n = [],
t = e.roomKey
if (void 0 === t) return n
n.push(t)
const o = e.file?.pointer?.externalDrive?.key
if (void 0 === o) return n
n.push(o)
const r = e.file?.pointer?.externalDrive?.path
if (void 0 === r) return n
n.push(r)
const c = e.file?.pointer?.externalDrive?.version
return (void 0 === c || n.push(c), n)
}
const In = {
name: "@local/drive-files-by-room",
version: 0,
id: 26,
encodeKey: (e) => Bn.encode(En(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Bn.encodeRange({
gt: e ? En(e) : null,
lt: n ? En(n) : null,
gte: t ? En(t) : null,
lte: o ? En(o) : null,
}),
encodeValue: (e) => In.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [
Bn.encode([
e.roomKey,
e.file.pointer.externalDrive.key,
e.file.pointer.externalDrive.path,
e.file.pointer.externalDrive.version,
]),
],
reconstruct: (e, n) => n,
offset: wn.indexes.length,
collection: wn,
}
wn.indexes.push(In)
const Tn = new e([e.BUFFER], { prefix: 27 })
function Ln(e) {
const n = e.discoveryPublicKey
return void 0 === n ? [] : [n]
}
const Nn = r("@local/background-sync-room/hyperdb#27")
function Dn(e, n, t) {
const o = Tn.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = Nn.decode(r)
return ((l.discoveryPublicKey = o[0]), l)
}
function Pn(e) {
return { discoveryPublicKey: Tn.decode(e)[0] }
}
const An = {
name: "@local/background-sync",
id: 27,
version: 0,
encodeKey(e) {
const n = [e.discoveryPublicKey]
return Tn.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Tn.encodeRange({
gt: e ? Ln(e) : null,
lt: n ? Ln(n) : null,
gte: t ? Ln(t) : null,
lte: o ? Ln(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (Nn.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), Nn.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Dn,
reconstructKey: Pn,
indexes: [],
decodedVersion: 0,
},
Mn = new e([e.UINT, e.BUFFER], { prefix: 28 }),
On = d.dirtyByTimestampMap
function qn(e) {
const n = e.timestamp
return void 0 === n ? [] : [n]
}
const Cn = {
name: "@local/background-sync-by-dirty",
version: 0,
id: 28,
encodeKey: (e) => Mn.encode(qn(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Mn.encodeRange({
gt: e ? qn(e) : null,
lt: n ? qn(n) : null,
gte: t ? qn(t) : null,
lte: o ? qn(o) : null,
}),
encodeValue: (e) => Cn.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = On(e, n),
o = new Array(t.length)
for (let n = 0; n < t.length; n++) {
const r = t[n]
o[n] = Mn.encode([r.timestamp, e.discoveryPublicKey])
}
return o
},
reconstruct: (e, n) => n,
offset: An.indexes.length,
collection: An,
}
An.indexes.push(Cn)
const Gn = new e([e.BUFFER, e.BUFFER], { prefix: 29 })
function Sn(e) {
const n = [],
t = e.key
if (void 0 === t) return n
n.push(t)
const o = e.responsePublicKey
return (void 0 === o || n.push(o), n)
}
const jn = r("@local/writer-append/hyperdb#29")
function Wn(e, n, t) {
const o = Gn.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = jn.decode(r)
return ((l.key = o[0]), (l.responsePublicKey = o[1]), l)
}
function zn(e) {
const n = Gn.decode(e)
return { key: n[0], responsePublicKey: n[1] }
}
const Hn = {
name: "@local/writer-appends",
id: 29,
version: 0,
encodeKey(e) {
const n = [e.key, e.responsePublicKey]
return Gn.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Gn.encodeRange({
gt: e ? Sn(e) : null,
lt: n ? Sn(n) : null,
gte: t ? Sn(t) : null,
lte: o ? Sn(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (jn.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), jn.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Wn,
reconstructKey: zn,
indexes: [],
decodedVersion: 0,
},
Jn = new e([e.BUFFER], { prefix: 30 })
function Qn(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const Xn = r("@local/room-metadata/hyperdb#30")
function Yn(e, n, t) {
const o = Jn.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = Xn.decode(r)
return ((l.roomKey = o[0]), l)
}
function Zn(e) {
return { roomKey: Jn.decode(e)[0] }
}
const $n = {
name: "@local/room-metadata",
id: 30,
version: 0,
encodeKey(e) {
const n = [e.roomKey]
return Jn.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
Jn.encodeRange({
gt: e ? Qn(e) : null,
lt: n ? Qn(n) : null,
gte: t ? Qn(t) : null,
lte: o ? Qn(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (Xn.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), Xn.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Yn,
reconstructKey: Zn,
indexes: [],
decodedVersion: 0,
},
_n = new e([], { prefix: 31 })
function et(e) {
return []
}
const nt = r("@local/debug")
function tt(e, n, t) {
c(e)
const o = { start: 0, end: t.byteLength, buffer: t }
return nt.decode(o)
}
function ot(e) {
return {}
}
const rt = {
name: "@local/debug",
id: 31,
version: 0,
encodeKey: (e) => _n.encode([]),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
_n.encodeRange({
gt: e ? et(e) : null,
lt: n ? et(n) : null,
gte: t ? et(t) : null,
lte: o ? et(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (nt.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), nt.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: tt,
reconstructKey: ot,
indexes: [],
decodedVersion: 0,
},
ct = new e([e.BUFFER, e.BUFFER], { prefix: 32 }),
lt = d.roomsByContactMap
function dt(e) {
const n = e.contact
return void 0 === n ? [] : [n]
}
const st = {
name: "@local/rooms-by-contact",
version: 1,
id: 32,
encodeKey: (e) => ct.encode(dt(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
ct.encodeRange({
gt: e ? dt(e) : null,
lt: n ? dt(n) : null,
gte: t ? dt(t) : null,
lte: o ? dt(o) : null,
}),
encodeValue: (e) => st.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = lt(e, n),
o = new Array(t.length)
for (let n = 0; n < t.length; n++) {
const r = t[n]
o[n] = ct.encode([r.contact, e.roomKey])
}
return o
},
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(st)
const ut = new e([e.BUFFER], { prefix: 33 })
function it(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const at = r("@local/unread/hyperdb#33")
function ft(e, n, t) {
const o = ut.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = at.decode(r)
return ((l.roomKey = o[0]), l)
}
function yt(e) {
return { roomKey: ut.decode(e)[0] }
}
const gt = {
name: "@local/unreads",
id: 33,
version: 0,
encodeKey(e) {
const n = [e.roomKey]
return ut.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
ut.encodeRange({
gt: e ? it(e) : null,
lt: n ? it(n) : null,
gte: t ? it(t) : null,
lte: o ? it(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (at.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), at.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: ft,
reconstructKey: yt,
indexes: [],
decodedVersion: 0,
},
pt = new e([], { prefix: 34 })
function bt(e) {
return []
}
const mt = r("@local/hyperdht-record")
function Kt(e, n, t) {
c(e)
const o = { start: 0, end: t.byteLength, buffer: t }
return mt.decode(o)
}
function xt(e) {
return {}
}
const vt = {
name: "@local/hyperdht",
id: 34,
version: 0,
encodeKey: (e) => pt.encode([]),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
pt.encodeRange({
gt: e ? bt(e) : null,
lt: n ? bt(n) : null,
gte: t ? bt(t) : null,
lte: o ? bt(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (mt.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), mt.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: Kt,
reconstructKey: xt,
indexes: [],
decodedVersion: 0,
},
ht = new e([e.UINT], { prefix: 35 })
function Rt(e) {
const n = e.timestamp
return void 0 === n ? [] : [n]
}
const Ut = r("@local/error-record/hyperdb#35")
function wt(e, n, t) {
const o = ht.decode(n)
c(e)
const r = { start: 0, end: t.byteLength, buffer: t },
l = Ut.decode(r)
return ((l.timestamp = o[0]), l)
}
function Ft(e) {
return { timestamp: ht.decode(e)[0] }
}
const Vt = {
name: "@local/errors",
id: 35,
version: 0,
encodeKey(e) {
const n = [e.timestamp]
return ht.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
ht.encodeRange({
gt: e ? Rt(e) : null,
lt: n ? Rt(n) : null,
gte: t ? Rt(t) : null,
lte: o ? Rt(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 0, buffer: null }
return (Ut.preencode(r, o), (r.buffer = t.allocUnsafe(r.end)), Ut.encode(r, o), r.buffer)
},
trigger: null,
reconstruct: wt,
reconstructKey: Ft,
indexes: [],
decodedVersion: 0,
},
kt = new e([e.STRING, e.UINT], { prefix: 36 })
function Bt(e) {
const n = [],
t = e.code
if (void 0 === t) return n
n.push(t)
const o = e.timestamp
return (void 0 === o || n.push(o), n)
}
const Et = {
name: "@local/errors-by-code",
version: 0,
id: 36,
encodeKey: (e) => kt.encode(Bt(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
kt.encodeRange({
gt: e ? Bt(e) : null,
lt: n ? Bt(n) : null,
gte: t ? Bt(t) : null,
lte: o ? Bt(o) : null,
}),
encodeValue: (e) => Et.collection.encodeKey(e),
encodeIndexKeys: (e, n) => [kt.encode([e.code, e.timestamp])],
reconstruct: (e, n) => n,
offset: Vt.indexes.length,
collection: Vt,
}
Vt.indexes.push(Et)
const It = new e([e.BUFFER], { prefix: 37 })
function Tt(e) {
const n = e.roomKey
return void 0 === n ? [] : [n]
}
const Lt = r("@local/file-stats/hyperdb#37")
function Nt(e, t, o) {
const r = It.decode(t)
c(e)
const l = { start: 0, end: o.byteLength, buffer: o },
d = n.uint.decode(l)
if (0 !== d) throw new Error("Unknown collection type: " + d)
Pt.decodedVersion = n.uint.decode(l)
const s = Lt.decode(l)
return ((s.roomKey = r[0]), s)
}
function Dt(e) {
return { roomKey: It.decode(e)[0] }
}
const Pt = {
name: "@local/file-stats",
id: 37,
version: 2,
encodeKey(e) {
const n = [e.roomKey]
return It.encode(n)
},
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
It.encodeRange({
gt: e ? Tt(e) : null,
lt: n ? Tt(n) : null,
gte: t ? Tt(t) : null,
lte: o ? Tt(o) : null,
}),
encodeValue(e, n, o) {
c(e)
const r = { start: 0, end: 2, buffer: null }
return (
Lt.preencode(r, o),
(r.buffer = t.allocUnsafe(r.end)),
(r.buffer[r.start++] = 0),
(r.buffer[r.start++] = n),
Lt.encode(r, o),
r.buffer
)
},
trigger: null,
reconstruct: Nt,
reconstructKey: Dt,
indexes: [],
decodedVersion: 0,
},
At = new e([e.UINT, e.BUFFER], { prefix: 38 }),
Mt = d.roomsByFavoriteAndTimestampMap
function Ot(e) {
const n = e.timestamp
return void 0 === n ? [] : [n]
}
const qt = {
name: "@local/rooms-by-favorite-and-timestamp",
version: 3,
id: 38,
encodeKey: (e) => At.encode(Ot(e)),
encodeKeyRange: ({ gt: e, lt: n, gte: t, lte: o } = {}) =>
At.encodeRange({
gt: e ? Ot(e) : null,
lt: n ? Ot(n) : null,
gte: t ? Ot(t) : null,
lte: o ? Ot(o) : null,
}),
encodeValue: (e) => qt.collection.encodeKey(e),
encodeIndexKeys(e, n) {
const t = Mt(e, n),
o = new Array(t.length)
for (let n = 0; n < t.length; n++) {
const r = t[n]
o[n] = At.encode([r.timestamp, e.roomKey])
}
return o
},
reconstruct: (e, n) => n,
offset: Q.indexes.length,
collection: Q,
}
Q.indexes.push(qt)
const Ct = [y, x, F, L, G, Q, ve, Ve, Ce, He, $e, sn, Kn, wn, An, Hn, $n, rt, gt, vt, Vt, Pt],
Gt = [P, Z, ne, ce, se, ae, ge, Ie, De, tn, fn, kn, In, Cn, st, Et, qt]
function St(e) {
switch (e) {
case "@local/stats":
return y
case "@local/migrations":
return x
case "@local/room-migration-stats":
return F
case "@local/room-migrations":
return L
case "@local/identity":
return G
case "@local/rooms":
return Q
case "@local/room-preferences":
return ve
case "@local/writers":
return Ve
case "@local/members":
return Ce
case "@local/devices":
return He
case "@local/contacts":
return $e
case "@local/tasks":
return sn
case "@local/blob-files":
return Kn
case "@local/drive-files":
return wn
case "@local/background-sync":
return An
case "@local/writer-appends":
return Hn
case "@local/room-metadata":
return $n
case "@local/debug":
return rt
case "@local/unreads":
return gt
case "@local/hyperdht":
return vt
case "@local/errors":
return Vt
case "@local/file-stats":
return Pt
default:
return null
}
}
function jt(e) {
switch (e) {
case "@local/room-migrations-by-priority":
return P
case "@local/rooms-by-discovery-key":
return Z
case "@local/rooms-by-timestamp":
return ne
case "@local/rooms-by-type-and-timestamp":
return ce
case "@local/rooms-by-wakeup-topic":
return se
case "@local/rooms-by-mailbox":
return ae
case "@local/rooms-by-discovery":
return ge
case "@local/writers-by-wakeup-topic":
return Ie
case "@local/writers-by-room-key":
return De
case "@local/blocked-contacts":
return tn
case "@local/tasks-by-type":
return fn
case "@local/blob-files-by-room":
return kn
case "@local/drive-files-by-room":
return In
case "@local/background-sync-by-dirty":
return Cn
case "@local/rooms-by-contact":
return st
case "@local/errors-by-code":
return Et
case "@local/rooms-by-favorite-and-timestamp":
return qt
default:
return null
}
}
module.exports = {
versions: l,
collections: Ct,
indexes: Gt,
resolveCollection: St,
resolveIndex: jt,
}