@qvac/core 0.3.3 → 0.4.0
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/README.md +19 -17
- package/dist-lib/lib/abort-controller-node.d.ts +4 -0
- package/dist-lib/lib/abort-controller-node.js +1 -0
- package/dist-lib/lib/api/agents.d.ts +3 -3
- package/dist-lib/lib/api/agents.js +31 -20
- package/dist-lib/lib/api/approval-rules.d.ts +2 -2
- package/dist-lib/lib/api/approval-rules.js +2 -2
- package/dist-lib/lib/api/attachments.d.ts +2 -2
- package/dist-lib/lib/api/attachments.js +14 -25
- package/dist-lib/lib/api/chat-groups.d.ts +2 -2
- package/dist-lib/lib/api/chat-groups.js +9 -9
- package/dist-lib/lib/api/chat.d.ts +4 -2
- package/dist-lib/lib/api/chat.js +18 -18
- package/dist-lib/lib/api/chunks.d.ts +2 -2
- package/dist-lib/lib/api/chunks.js +27 -36
- package/dist-lib/lib/api/current-mesh.d.ts +7 -15
- package/dist-lib/lib/api/current-mesh.js +7 -22
- package/dist-lib/lib/api/devices.d.ts +4 -3
- package/dist-lib/lib/api/devices.js +18 -18
- package/dist-lib/lib/api/execution.d.ts +2 -2
- package/dist-lib/lib/api/execution.js +6 -6
- package/dist-lib/lib/api/files.d.ts +2 -2
- package/dist-lib/lib/api/files.js +4 -4
- package/dist-lib/lib/api/index.d.ts +12 -11
- package/dist-lib/lib/api/index.js +15 -13
- package/dist-lib/lib/api/inference-calls.d.ts +1 -1
- package/dist-lib/lib/api/inference-calls.js +2 -2
- package/dist-lib/lib/api/knowledge.d.ts +2 -2
- package/dist-lib/lib/api/knowledge.js +22 -11
- package/dist-lib/lib/api/local-files.d.ts +3 -0
- package/dist-lib/lib/api/local-files.js +23 -0
- package/dist-lib/lib/api/members.d.ts +6 -2
- package/dist-lib/lib/api/members.js +24 -17
- package/dist-lib/lib/api/mesh.d.ts +4 -5
- package/dist-lib/lib/api/mesh.js +7 -9
- package/dist-lib/lib/api/notifications.d.ts +2 -13
- package/dist-lib/lib/api/notifications.js +20 -52
- package/dist-lib/lib/api/rag.d.ts +2 -2
- package/dist-lib/lib/api/rag.js +4 -4
- package/dist-lib/lib/api/range.d.ts +11 -0
- package/dist-lib/lib/api/range.js +10 -0
- package/dist-lib/lib/api/sync.d.ts +2 -2
- package/dist-lib/lib/api/sync.js +3 -3
- package/dist-lib/lib/api/tool-activity.d.ts +2 -2
- package/dist-lib/lib/api/tool-activity.js +11 -10
- package/dist-lib/lib/api/tool-configs.d.ts +2 -2
- package/dist-lib/lib/api/tool-configs.js +6 -7
- package/dist-lib/lib/api/upload-frames.d.ts +9 -0
- package/dist-lib/lib/api/upload-frames.js +17 -0
- package/dist-lib/lib/api/watchable.d.ts +1 -6
- package/dist-lib/lib/api/watchable.js +4 -13
- package/dist-lib/lib/assistant/history.d.ts +3 -3
- package/dist-lib/lib/assistant-client.js +3 -2
- package/dist-lib/lib/assistant-tree.js +1 -1
- package/dist-lib/lib/assistant.d.ts +16 -14
- package/dist-lib/lib/assistant.js +166 -137
- package/dist-lib/lib/collabora/convert.js +1 -1
- package/dist-lib/lib/core/agent.d.ts +5 -7
- package/dist-lib/lib/core/agent.js +26 -6
- package/dist-lib/lib/core/archived-mesh.js +1 -0
- package/dist-lib/lib/core/chat-order.d.ts +20 -0
- package/dist-lib/lib/core/chat-order.js +96 -0
- package/dist-lib/lib/core/chat.d.ts +0 -5
- package/dist-lib/lib/core/chat.js +1 -3
- package/dist-lib/lib/core/chunk.d.ts +7 -14
- package/dist-lib/lib/core/chunk.js +17 -35
- package/dist-lib/lib/core/contract/agents.js +8 -0
- package/dist-lib/lib/core/contract/compute.d.ts +1 -1
- package/dist-lib/lib/core/contract/compute.js +1 -0
- package/dist-lib/lib/core/contract/joined-meshes.js +4 -3
- package/dist-lib/lib/core/contract/members.js +4 -3
- package/dist-lib/lib/core/contract/writers.js +5 -4
- package/dist-lib/lib/core/departures.js +5 -4
- package/dist-lib/lib/core/device-invites.js +2 -1
- package/dist-lib/lib/core/files/attachments.d.ts +8 -1
- package/dist-lib/lib/core/files/index.d.ts +4 -4
- package/dist-lib/lib/core/files/index.js +18 -8
- package/dist-lib/lib/core/files/local-index.d.ts +16 -0
- package/dist-lib/lib/core/files/local-index.js +38 -0
- package/dist-lib/lib/core/files/processing/document.js +2 -1
- package/dist-lib/lib/core/files/processing/ownership.js +6 -3
- package/dist-lib/lib/core/files/records/chunks.js +1 -0
- package/dist-lib/lib/core/files/records/reclaim.js +1 -0
- package/dist-lib/lib/core/files/records/routing.js +2 -1
- package/dist-lib/lib/core/files/store/blob.d.ts +1 -1
- package/dist-lib/lib/core/files/store/blob.js +6 -3
- package/dist-lib/lib/core/files/store/index.d.ts +1 -1
- package/dist-lib/lib/core/files/store/reference.js +4 -3
- package/dist-lib/lib/core/files/store/server.d.ts +8 -4
- package/dist-lib/lib/core/files/store/server.js +16 -12
- package/dist-lib/lib/core/files/store/sweep.js +2 -1
- package/dist-lib/lib/core/files/upload.d.ts +1 -1
- package/dist-lib/lib/core/hosted-agents.js +1 -1
- package/dist-lib/lib/core/image/cache-sweep.d.ts +1 -0
- package/dist-lib/lib/core/image/cache-sweep.js +7 -3
- package/dist-lib/lib/core/local/files.d.ts +24 -0
- package/dist-lib/lib/core/local/files.js +154 -0
- package/dist-lib/lib/core/local/index.d.ts +21 -5
- package/dist-lib/lib/core/local/index.js +75 -45
- package/dist-lib/lib/core/membership.d.ts +4 -1
- package/dist-lib/lib/core/membership.js +17 -2
- package/dist-lib/lib/core/mesh.d.ts +5 -0
- package/dist-lib/lib/core/mesh.js +11 -5
- package/dist-lib/lib/core/migrations/agent-indexes.d.ts +2 -0
- package/dist-lib/lib/core/migrations/agent-indexes.js +30 -0
- package/dist-lib/lib/core/migrations/file-index.d.ts +2 -0
- package/dist-lib/lib/core/migrations/file-index.js +27 -0
- package/dist-lib/lib/core/migrations/index.js +3 -1
- package/dist-lib/lib/core/notification.js +5 -5
- package/dist-lib/lib/core/range.d.ts +18 -0
- package/dist-lib/lib/core/range.js +17 -0
- package/dist-lib/lib/core/sync/index.js +39 -32
- package/dist-lib/lib/core/sync-status.js +3 -2
- package/dist-lib/lib/core/tool-activity.d.ts +2 -5
- package/dist-lib/lib/core/tool-activity.js +4 -7
- package/dist-lib/lib/core.d.ts +48 -29
- package/dist-lib/lib/core.js +465 -359
- package/dist-lib/lib/knowledge-search.d.ts +2 -2
- package/dist-lib/lib/kv-cache.js +1 -1
- package/dist-lib/lib/log.js +2 -3
- package/dist-lib/lib/mesh-scoped-engine.d.ts +8 -1
- package/dist-lib/lib/mesh-scoped-engine.js +62 -15
- package/dist-lib/lib/model-download.d.ts +14 -5
- package/dist-lib/lib/model-download.js +25 -17
- package/dist-lib/lib/oauth/token-exchange-core.js +1 -1
- package/dist-lib/lib/run-transcript.d.ts +2 -2
- package/dist-lib/lib/run-transcript.js +3 -2
- package/dist-lib/lib/task.d.ts +1 -0
- package/dist-lib/lib/task.js +3 -2
- package/dist-lib/schema/build.js +4 -10
- package/dist-lib/schema/engine.js +261 -91
- package/dist-lib/schema/helpers.d.ts +4 -0
- package/dist-lib/schema/helpers.js +20 -0
- package/dist-lib/schema/local.d.ts +1 -1
- package/dist-lib/schema/local.js +70 -2
- package/dist-lib/schema/qvac.js +30 -0
- package/dist-lib/spec/bind.js +20 -3
- package/dist-lib/spec/calls.js +19 -15
- package/dist-lib/spec/capabilities.d.ts +42 -34
- package/dist-lib/spec/hrpc/hrpc.json +82 -30
- package/dist-lib/spec/hrpc/index.js +106 -57
- package/dist-lib/spec/hrpc/messages.js +5420 -5019
- package/dist-lib/spec/hyperschema/index.js +5424 -5023
- package/dist-lib/spec/hyperschema/schema.json +3202 -2666
- package/dist-lib/spec/hyperschema/types.d.ts +455 -319
- package/dist-lib/spec/local/hyperdb/db.json +119 -1
- package/dist-lib/spec/local/hyperdb/index.js +414 -2
- package/dist-lib/spec/local/hyperdb/messages.js +505 -124
- package/dist-lib/spec/local/hyperschema/index.js +203 -5
- package/dist-lib/spec/local/hyperschema/schema.json +136 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +32 -1
- package/dist-lib/spec/mesh/hyperdb/db.json +55 -3
- package/dist-lib/spec/mesh/hyperdb/index.js +119 -3
- package/dist-lib/spec/mesh/hyperdb/messages.js +244 -172
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +7 -1
- package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +74 -2
- package/dist-lib/spec/mesh/hyperschema/index.js +74 -2
- package/dist-lib/spec/mesh/hyperschema/schema.json +27 -1
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +9 -1
- package/package.json +10 -6
- package/tui/app.mjs +376 -151
- package/tui/boot.mjs +2 -1
- package/tui/lib/busy-words.mjs +2 -1
- package/tui/lib/knowledge-command.mjs +11 -10
- package/tui/lib/knowledge-import.mjs +7 -5
- package/tui/lib/render.mjs +4 -3
- package/tui/lib/usage.mjs +2 -1
- package/tui/main.mjs +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 6,
|
|
3
3
|
"offset": 0,
|
|
4
4
|
"schema": [
|
|
5
5
|
{
|
|
@@ -241,6 +241,124 @@
|
|
|
241
241
|
"meshKey"
|
|
242
242
|
],
|
|
243
243
|
"trigger": null
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "chat-order",
|
|
247
|
+
"namespace": "local",
|
|
248
|
+
"id": 16,
|
|
249
|
+
"type": 1,
|
|
250
|
+
"version": 6,
|
|
251
|
+
"versionField": null,
|
|
252
|
+
"indexes": [
|
|
253
|
+
"@local/chat-order-by-key"
|
|
254
|
+
],
|
|
255
|
+
"schema": "@local/chat-order",
|
|
256
|
+
"derived": false,
|
|
257
|
+
"key": [
|
|
258
|
+
"meshKey",
|
|
259
|
+
"chatId"
|
|
260
|
+
],
|
|
261
|
+
"trigger": null
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "chat-order-by-key",
|
|
265
|
+
"namespace": "local",
|
|
266
|
+
"id": 17,
|
|
267
|
+
"type": 2,
|
|
268
|
+
"version": 6,
|
|
269
|
+
"collection": "@local/chat-order",
|
|
270
|
+
"unique": false,
|
|
271
|
+
"deprecated": false,
|
|
272
|
+
"key": [
|
|
273
|
+
"meshKey",
|
|
274
|
+
"sortKey",
|
|
275
|
+
"chatId"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "files",
|
|
280
|
+
"namespace": "local",
|
|
281
|
+
"id": 18,
|
|
282
|
+
"type": 1,
|
|
283
|
+
"version": 6,
|
|
284
|
+
"versionField": null,
|
|
285
|
+
"indexes": [
|
|
286
|
+
"@local/files-by-blob",
|
|
287
|
+
"@local/reclaimable-files-by-last-accessed",
|
|
288
|
+
"@local/live-files"
|
|
289
|
+
],
|
|
290
|
+
"schema": "@local/file",
|
|
291
|
+
"derived": false,
|
|
292
|
+
"key": [
|
|
293
|
+
"meshKey",
|
|
294
|
+
"coreKey",
|
|
295
|
+
"blockOffset"
|
|
296
|
+
],
|
|
297
|
+
"trigger": null
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "files-by-blob",
|
|
301
|
+
"namespace": "local",
|
|
302
|
+
"id": 19,
|
|
303
|
+
"type": 2,
|
|
304
|
+
"version": 6,
|
|
305
|
+
"collection": "@local/files",
|
|
306
|
+
"unique": false,
|
|
307
|
+
"deprecated": false,
|
|
308
|
+
"key": [
|
|
309
|
+
"coreKey",
|
|
310
|
+
"blockOffset"
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"name": "reclaimable-files-by-last-accessed",
|
|
315
|
+
"namespace": "local",
|
|
316
|
+
"id": 20,
|
|
317
|
+
"type": 2,
|
|
318
|
+
"version": 6,
|
|
319
|
+
"collection": "@local/files",
|
|
320
|
+
"unique": false,
|
|
321
|
+
"deprecated": false,
|
|
322
|
+
"key": {
|
|
323
|
+
"type": {
|
|
324
|
+
"fields": [
|
|
325
|
+
{
|
|
326
|
+
"name": "lastAccessed",
|
|
327
|
+
"type": "uint"
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
"map": "reclaimableFilesMap"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "live-files",
|
|
336
|
+
"namespace": "local",
|
|
337
|
+
"id": 21,
|
|
338
|
+
"type": 2,
|
|
339
|
+
"version": 6,
|
|
340
|
+
"collection": "@local/files",
|
|
341
|
+
"unique": false,
|
|
342
|
+
"deprecated": false,
|
|
343
|
+
"key": {
|
|
344
|
+
"type": {
|
|
345
|
+
"fields": [
|
|
346
|
+
{
|
|
347
|
+
"name": "meshKey",
|
|
348
|
+
"type": "fixed32"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"name": "coreKey",
|
|
352
|
+
"type": "fixed32"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "blockOffset",
|
|
356
|
+
"type": "uint"
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
"map": "liveFilesMap"
|
|
361
|
+
}
|
|
244
362
|
}
|
|
245
363
|
]
|
|
246
364
|
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
import { IndexEncoder, c, b4a } from 'hyperdb/runtime'
|
|
5
5
|
import { version, getEncoding, setVersion } from './messages.js'
|
|
6
6
|
|
|
7
|
-
const versions = { schema: version, db:
|
|
7
|
+
const versions = { schema: version, db: 6 }
|
|
8
|
+
|
|
9
|
+
import * as helpers0 from '../../../schema/helpers.js'
|
|
8
10
|
|
|
9
11
|
// '@local/config' collection key
|
|
10
12
|
const collection0_key = new IndexEncoder([
|
|
@@ -1078,6 +1080,404 @@ const collection15 = {
|
|
|
1078
1080
|
decodedVersion: 0
|
|
1079
1081
|
}
|
|
1080
1082
|
|
|
1083
|
+
// '@local/chat-order' collection key
|
|
1084
|
+
const collection16_key = new IndexEncoder([
|
|
1085
|
+
IndexEncoder.BUFFER,
|
|
1086
|
+
IndexEncoder.STRING
|
|
1087
|
+
], { prefix: 16 })
|
|
1088
|
+
|
|
1089
|
+
function collection16_indexify (record) {
|
|
1090
|
+
const arr = []
|
|
1091
|
+
|
|
1092
|
+
const a0 = record.meshKey
|
|
1093
|
+
if (a0 === undefined) return arr
|
|
1094
|
+
arr.push(a0)
|
|
1095
|
+
|
|
1096
|
+
const a1 = record.chatId
|
|
1097
|
+
if (a1 === undefined) return arr
|
|
1098
|
+
arr.push(a1)
|
|
1099
|
+
|
|
1100
|
+
return arr
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// '@local/chat-order' value encoding
|
|
1104
|
+
const collection16_enc = getEncoding('@local/chat-order/hyperdb#16')
|
|
1105
|
+
|
|
1106
|
+
// '@local/chat-order' reconstruction function
|
|
1107
|
+
function collection16_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
1108
|
+
const key = collection16_key.decode(keyBuf)
|
|
1109
|
+
setVersion(schemaVersion)
|
|
1110
|
+
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
1111
|
+
const type = c.uint.decode(state)
|
|
1112
|
+
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
1113
|
+
collection16.decodedVersion = c.uint.decode(state)
|
|
1114
|
+
const record = collection16_enc.decode(state)
|
|
1115
|
+
record.meshKey = key[0]
|
|
1116
|
+
record.chatId = key[1]
|
|
1117
|
+
return record
|
|
1118
|
+
}
|
|
1119
|
+
// '@local/chat-order' key reconstruction function
|
|
1120
|
+
function collection16_reconstruct_key (keyBuf) {
|
|
1121
|
+
const key = collection16_key.decode(keyBuf)
|
|
1122
|
+
return {
|
|
1123
|
+
meshKey: key[0],
|
|
1124
|
+
chatId: key[1]
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// '@local/chat-order'
|
|
1129
|
+
const collection16 = {
|
|
1130
|
+
name: '@local/chat-order',
|
|
1131
|
+
id: 16,
|
|
1132
|
+
version: 6,
|
|
1133
|
+
encodeKey (record) {
|
|
1134
|
+
const key = [record.meshKey, record.chatId]
|
|
1135
|
+
return collection16_key.encode(key)
|
|
1136
|
+
},
|
|
1137
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
1138
|
+
return collection16_key.encodeRange({
|
|
1139
|
+
gt: gt ? collection16_indexify(gt) : null,
|
|
1140
|
+
lt: lt ? collection16_indexify(lt) : null,
|
|
1141
|
+
gte: gte ? collection16_indexify(gte) : null,
|
|
1142
|
+
lte: lte ? collection16_indexify(lte) : null
|
|
1143
|
+
})
|
|
1144
|
+
},
|
|
1145
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
1146
|
+
setVersion(schemaVersion)
|
|
1147
|
+
const state = { start: 0, end: 2, buffer: null }
|
|
1148
|
+
collection16_enc.preencode(state, record)
|
|
1149
|
+
state.buffer = b4a.allocUnsafe(state.end)
|
|
1150
|
+
state.buffer[state.start++] = 0
|
|
1151
|
+
state.buffer[state.start++] = collectionVersion
|
|
1152
|
+
collection16_enc.encode(state, record)
|
|
1153
|
+
return state.buffer
|
|
1154
|
+
},
|
|
1155
|
+
trigger: null,
|
|
1156
|
+
reconstruct: collection16_reconstruct,
|
|
1157
|
+
reconstructKey: collection16_reconstruct_key,
|
|
1158
|
+
indexes: [],
|
|
1159
|
+
decodedVersion: 0
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// '@local/chat-order-by-key' collection key
|
|
1163
|
+
const index17_key = new IndexEncoder([
|
|
1164
|
+
IndexEncoder.BUFFER,
|
|
1165
|
+
IndexEncoder.BUFFER,
|
|
1166
|
+
IndexEncoder.STRING,
|
|
1167
|
+
IndexEncoder.BUFFER,
|
|
1168
|
+
IndexEncoder.STRING
|
|
1169
|
+
], { prefix: 17 })
|
|
1170
|
+
|
|
1171
|
+
function index17_indexify (record) {
|
|
1172
|
+
const arr = []
|
|
1173
|
+
|
|
1174
|
+
const a0 = record.meshKey
|
|
1175
|
+
if (a0 === undefined) return arr
|
|
1176
|
+
arr.push(a0)
|
|
1177
|
+
|
|
1178
|
+
const a1 = record.sortKey
|
|
1179
|
+
if (a1 === undefined) return arr
|
|
1180
|
+
arr.push(a1)
|
|
1181
|
+
|
|
1182
|
+
const a2 = record.chatId
|
|
1183
|
+
if (a2 === undefined) return arr
|
|
1184
|
+
arr.push(a2)
|
|
1185
|
+
|
|
1186
|
+
const a3 = record.meshKey
|
|
1187
|
+
if (a3 === undefined) return arr
|
|
1188
|
+
arr.push(a3)
|
|
1189
|
+
|
|
1190
|
+
const a4 = record.chatId
|
|
1191
|
+
if (a4 === undefined) return arr
|
|
1192
|
+
arr.push(a4)
|
|
1193
|
+
|
|
1194
|
+
return arr
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// '@local/chat-order-by-key'
|
|
1198
|
+
const index17 = {
|
|
1199
|
+
name: '@local/chat-order-by-key',
|
|
1200
|
+
version: 6,
|
|
1201
|
+
id: 17,
|
|
1202
|
+
encodeKey (record) {
|
|
1203
|
+
return index17_key.encode(index17_indexify(record))
|
|
1204
|
+
},
|
|
1205
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
1206
|
+
return index17_key.encodeRange({
|
|
1207
|
+
gt: gt ? index17_indexify(gt) : null,
|
|
1208
|
+
lt: lt ? index17_indexify(lt) : null,
|
|
1209
|
+
gte: gte ? index17_indexify(gte) : null,
|
|
1210
|
+
lte: lte ? index17_indexify(lte) : null
|
|
1211
|
+
})
|
|
1212
|
+
},
|
|
1213
|
+
encodeValue: (record) => index17.collection.encodeKey(record),
|
|
1214
|
+
encodeIndexKeys (record, context) {
|
|
1215
|
+
return [index17_key.encode([record.meshKey, record.sortKey, record.chatId, record.meshKey, record.chatId])]
|
|
1216
|
+
},
|
|
1217
|
+
reconstruct: (keyBuf, valueBuf) => valueBuf,
|
|
1218
|
+
offset: collection16.indexes.length,
|
|
1219
|
+
collection: collection16
|
|
1220
|
+
}
|
|
1221
|
+
collection16.indexes.push(index17)
|
|
1222
|
+
|
|
1223
|
+
// '@local/files' collection key
|
|
1224
|
+
const collection18_key = new IndexEncoder([
|
|
1225
|
+
IndexEncoder.BUFFER,
|
|
1226
|
+
IndexEncoder.BUFFER,
|
|
1227
|
+
IndexEncoder.UINT
|
|
1228
|
+
], { prefix: 18 })
|
|
1229
|
+
|
|
1230
|
+
function collection18_indexify (record) {
|
|
1231
|
+
const arr = []
|
|
1232
|
+
|
|
1233
|
+
const a0 = record.meshKey
|
|
1234
|
+
if (a0 === undefined) return arr
|
|
1235
|
+
arr.push(a0)
|
|
1236
|
+
|
|
1237
|
+
const a1 = record.coreKey
|
|
1238
|
+
if (a1 === undefined) return arr
|
|
1239
|
+
arr.push(a1)
|
|
1240
|
+
|
|
1241
|
+
const a2 = record.blockOffset
|
|
1242
|
+
if (a2 === undefined) return arr
|
|
1243
|
+
arr.push(a2)
|
|
1244
|
+
|
|
1245
|
+
return arr
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// '@local/files' value encoding
|
|
1249
|
+
const collection18_enc = getEncoding('@local/file/hyperdb#18')
|
|
1250
|
+
|
|
1251
|
+
// '@local/files' reconstruction function
|
|
1252
|
+
function collection18_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
1253
|
+
const key = collection18_key.decode(keyBuf)
|
|
1254
|
+
setVersion(schemaVersion)
|
|
1255
|
+
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
1256
|
+
const type = c.uint.decode(state)
|
|
1257
|
+
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
1258
|
+
collection18.decodedVersion = c.uint.decode(state)
|
|
1259
|
+
const record = collection18_enc.decode(state)
|
|
1260
|
+
record.meshKey = key[0]
|
|
1261
|
+
record.coreKey = key[1]
|
|
1262
|
+
record.blockOffset = key[2]
|
|
1263
|
+
return record
|
|
1264
|
+
}
|
|
1265
|
+
// '@local/files' key reconstruction function
|
|
1266
|
+
function collection18_reconstruct_key (keyBuf) {
|
|
1267
|
+
const key = collection18_key.decode(keyBuf)
|
|
1268
|
+
return {
|
|
1269
|
+
meshKey: key[0],
|
|
1270
|
+
coreKey: key[1],
|
|
1271
|
+
blockOffset: key[2]
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
// '@local/files'
|
|
1276
|
+
const collection18 = {
|
|
1277
|
+
name: '@local/files',
|
|
1278
|
+
id: 18,
|
|
1279
|
+
version: 6,
|
|
1280
|
+
encodeKey (record) {
|
|
1281
|
+
const key = [record.meshKey, record.coreKey, record.blockOffset]
|
|
1282
|
+
return collection18_key.encode(key)
|
|
1283
|
+
},
|
|
1284
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
1285
|
+
return collection18_key.encodeRange({
|
|
1286
|
+
gt: gt ? collection18_indexify(gt) : null,
|
|
1287
|
+
lt: lt ? collection18_indexify(lt) : null,
|
|
1288
|
+
gte: gte ? collection18_indexify(gte) : null,
|
|
1289
|
+
lte: lte ? collection18_indexify(lte) : null
|
|
1290
|
+
})
|
|
1291
|
+
},
|
|
1292
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
1293
|
+
setVersion(schemaVersion)
|
|
1294
|
+
const state = { start: 0, end: 2, buffer: null }
|
|
1295
|
+
collection18_enc.preencode(state, record)
|
|
1296
|
+
state.buffer = b4a.allocUnsafe(state.end)
|
|
1297
|
+
state.buffer[state.start++] = 0
|
|
1298
|
+
state.buffer[state.start++] = collectionVersion
|
|
1299
|
+
collection18_enc.encode(state, record)
|
|
1300
|
+
return state.buffer
|
|
1301
|
+
},
|
|
1302
|
+
trigger: null,
|
|
1303
|
+
reconstruct: collection18_reconstruct,
|
|
1304
|
+
reconstructKey: collection18_reconstruct_key,
|
|
1305
|
+
indexes: [],
|
|
1306
|
+
decodedVersion: 0
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
// '@local/files-by-blob' collection key
|
|
1310
|
+
const index19_key = new IndexEncoder([
|
|
1311
|
+
IndexEncoder.BUFFER,
|
|
1312
|
+
IndexEncoder.UINT,
|
|
1313
|
+
IndexEncoder.BUFFER,
|
|
1314
|
+
IndexEncoder.BUFFER,
|
|
1315
|
+
IndexEncoder.UINT
|
|
1316
|
+
], { prefix: 19 })
|
|
1317
|
+
|
|
1318
|
+
function index19_indexify (record) {
|
|
1319
|
+
const arr = []
|
|
1320
|
+
|
|
1321
|
+
const a0 = record.coreKey
|
|
1322
|
+
if (a0 === undefined) return arr
|
|
1323
|
+
arr.push(a0)
|
|
1324
|
+
|
|
1325
|
+
const a1 = record.blockOffset
|
|
1326
|
+
if (a1 === undefined) return arr
|
|
1327
|
+
arr.push(a1)
|
|
1328
|
+
|
|
1329
|
+
const a2 = record.meshKey
|
|
1330
|
+
if (a2 === undefined) return arr
|
|
1331
|
+
arr.push(a2)
|
|
1332
|
+
|
|
1333
|
+
const a3 = record.coreKey
|
|
1334
|
+
if (a3 === undefined) return arr
|
|
1335
|
+
arr.push(a3)
|
|
1336
|
+
|
|
1337
|
+
const a4 = record.blockOffset
|
|
1338
|
+
if (a4 === undefined) return arr
|
|
1339
|
+
arr.push(a4)
|
|
1340
|
+
|
|
1341
|
+
return arr
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
// '@local/files-by-blob'
|
|
1345
|
+
const index19 = {
|
|
1346
|
+
name: '@local/files-by-blob',
|
|
1347
|
+
version: 6,
|
|
1348
|
+
id: 19,
|
|
1349
|
+
encodeKey (record) {
|
|
1350
|
+
return index19_key.encode(index19_indexify(record))
|
|
1351
|
+
},
|
|
1352
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
1353
|
+
return index19_key.encodeRange({
|
|
1354
|
+
gt: gt ? index19_indexify(gt) : null,
|
|
1355
|
+
lt: lt ? index19_indexify(lt) : null,
|
|
1356
|
+
gte: gte ? index19_indexify(gte) : null,
|
|
1357
|
+
lte: lte ? index19_indexify(lte) : null
|
|
1358
|
+
})
|
|
1359
|
+
},
|
|
1360
|
+
encodeValue: (record) => index19.collection.encodeKey(record),
|
|
1361
|
+
encodeIndexKeys (record, context) {
|
|
1362
|
+
return [index19_key.encode([record.coreKey, record.blockOffset, record.meshKey, record.coreKey, record.blockOffset])]
|
|
1363
|
+
},
|
|
1364
|
+
reconstruct: (keyBuf, valueBuf) => valueBuf,
|
|
1365
|
+
offset: collection18.indexes.length,
|
|
1366
|
+
collection: collection18
|
|
1367
|
+
}
|
|
1368
|
+
collection18.indexes.push(index19)
|
|
1369
|
+
|
|
1370
|
+
// '@local/reclaimable-files-by-last-accessed' collection key
|
|
1371
|
+
const index20_key = new IndexEncoder([
|
|
1372
|
+
IndexEncoder.UINT,
|
|
1373
|
+
IndexEncoder.BUFFER,
|
|
1374
|
+
IndexEncoder.BUFFER,
|
|
1375
|
+
IndexEncoder.UINT
|
|
1376
|
+
], { prefix: 20 })
|
|
1377
|
+
|
|
1378
|
+
// '@local/reclaimable-files-by-last-accessed' has the following schema defined key map
|
|
1379
|
+
const index20_map = helpers0.reclaimableFilesMap
|
|
1380
|
+
|
|
1381
|
+
function index20_indexify (record) {
|
|
1382
|
+
const a = record.lastAccessed
|
|
1383
|
+
return a === undefined ? [] : [a]
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
// '@local/reclaimable-files-by-last-accessed'
|
|
1387
|
+
const index20 = {
|
|
1388
|
+
name: '@local/reclaimable-files-by-last-accessed',
|
|
1389
|
+
version: 6,
|
|
1390
|
+
id: 20,
|
|
1391
|
+
encodeKey (record) {
|
|
1392
|
+
return index20_key.encode(index20_indexify(record))
|
|
1393
|
+
},
|
|
1394
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
1395
|
+
return index20_key.encodeRange({
|
|
1396
|
+
gt: gt ? index20_indexify(gt) : null,
|
|
1397
|
+
lt: lt ? index20_indexify(lt) : null,
|
|
1398
|
+
gte: gte ? index20_indexify(gte) : null,
|
|
1399
|
+
lte: lte ? index20_indexify(lte) : null
|
|
1400
|
+
})
|
|
1401
|
+
},
|
|
1402
|
+
encodeValue: (record) => index20.collection.encodeKey(record),
|
|
1403
|
+
encodeIndexKeys (record, context) {
|
|
1404
|
+
const mapped = index20_map(record, context)
|
|
1405
|
+
const keys = new Array(mapped.length)
|
|
1406
|
+
for (let i = 0; i < mapped.length; i++) {
|
|
1407
|
+
const mappedRecord = mapped[i]
|
|
1408
|
+
keys[i] = index20_key.encode([mappedRecord.lastAccessed, record.meshKey, record.coreKey, record.blockOffset])
|
|
1409
|
+
}
|
|
1410
|
+
return keys
|
|
1411
|
+
},
|
|
1412
|
+
reconstruct: (keyBuf, valueBuf) => valueBuf,
|
|
1413
|
+
offset: collection18.indexes.length,
|
|
1414
|
+
collection: collection18
|
|
1415
|
+
}
|
|
1416
|
+
collection18.indexes.push(index20)
|
|
1417
|
+
|
|
1418
|
+
// '@local/live-files' collection key
|
|
1419
|
+
const index21_key = new IndexEncoder([
|
|
1420
|
+
IndexEncoder.BUFFER,
|
|
1421
|
+
IndexEncoder.BUFFER,
|
|
1422
|
+
IndexEncoder.UINT,
|
|
1423
|
+
IndexEncoder.BUFFER,
|
|
1424
|
+
IndexEncoder.BUFFER,
|
|
1425
|
+
IndexEncoder.UINT
|
|
1426
|
+
], { prefix: 21 })
|
|
1427
|
+
|
|
1428
|
+
// '@local/live-files' has the following schema defined key map
|
|
1429
|
+
const index21_map = helpers0.liveFilesMap
|
|
1430
|
+
|
|
1431
|
+
function index21_indexify (record) {
|
|
1432
|
+
const arr = []
|
|
1433
|
+
|
|
1434
|
+
const a0 = record.meshKey
|
|
1435
|
+
if (a0 === undefined) return arr
|
|
1436
|
+
arr.push(a0)
|
|
1437
|
+
|
|
1438
|
+
const a1 = record.coreKey
|
|
1439
|
+
if (a1 === undefined) return arr
|
|
1440
|
+
arr.push(a1)
|
|
1441
|
+
|
|
1442
|
+
const a2 = record.blockOffset
|
|
1443
|
+
if (a2 === undefined) return arr
|
|
1444
|
+
arr.push(a2)
|
|
1445
|
+
|
|
1446
|
+
return arr
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
// '@local/live-files'
|
|
1450
|
+
const index21 = {
|
|
1451
|
+
name: '@local/live-files',
|
|
1452
|
+
version: 6,
|
|
1453
|
+
id: 21,
|
|
1454
|
+
encodeKey (record) {
|
|
1455
|
+
return index21_key.encode(index21_indexify(record))
|
|
1456
|
+
},
|
|
1457
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
1458
|
+
return index21_key.encodeRange({
|
|
1459
|
+
gt: gt ? index21_indexify(gt) : null,
|
|
1460
|
+
lt: lt ? index21_indexify(lt) : null,
|
|
1461
|
+
gte: gte ? index21_indexify(gte) : null,
|
|
1462
|
+
lte: lte ? index21_indexify(lte) : null
|
|
1463
|
+
})
|
|
1464
|
+
},
|
|
1465
|
+
encodeValue: (record) => index21.collection.encodeKey(record),
|
|
1466
|
+
encodeIndexKeys (record, context) {
|
|
1467
|
+
const mapped = index21_map(record, context)
|
|
1468
|
+
const keys = new Array(mapped.length)
|
|
1469
|
+
for (let i = 0; i < mapped.length; i++) {
|
|
1470
|
+
const mappedRecord = mapped[i]
|
|
1471
|
+
keys[i] = index21_key.encode([mappedRecord.meshKey, mappedRecord.coreKey, mappedRecord.blockOffset, record.meshKey, record.coreKey, record.blockOffset])
|
|
1472
|
+
}
|
|
1473
|
+
return keys
|
|
1474
|
+
},
|
|
1475
|
+
reconstruct: (keyBuf, valueBuf) => valueBuf,
|
|
1476
|
+
offset: collection18.indexes.length,
|
|
1477
|
+
collection: collection18
|
|
1478
|
+
}
|
|
1479
|
+
collection18.indexes.push(index21)
|
|
1480
|
+
|
|
1081
1481
|
const collections = [
|
|
1082
1482
|
collection0,
|
|
1083
1483
|
collection1,
|
|
@@ -1094,10 +1494,16 @@ const collections = [
|
|
|
1094
1494
|
collection12,
|
|
1095
1495
|
collection13,
|
|
1096
1496
|
collection14,
|
|
1097
|
-
collection15
|
|
1497
|
+
collection15,
|
|
1498
|
+
collection16,
|
|
1499
|
+
collection18
|
|
1098
1500
|
]
|
|
1099
1501
|
|
|
1100
1502
|
const indexes = [
|
|
1503
|
+
index17,
|
|
1504
|
+
index19,
|
|
1505
|
+
index20,
|
|
1506
|
+
index21
|
|
1101
1507
|
]
|
|
1102
1508
|
|
|
1103
1509
|
export default { versions, collections, indexes, resolveCollection, resolveIndex }
|
|
@@ -1120,12 +1526,18 @@ function resolveCollection (name) {
|
|
|
1120
1526
|
case '@local/mesh-membership': return collection13
|
|
1121
1527
|
case '@local/member-proof': return collection14
|
|
1122
1528
|
case '@local/account-recovery': return collection15
|
|
1529
|
+
case '@local/chat-order': return collection16
|
|
1530
|
+
case '@local/files': return collection18
|
|
1123
1531
|
default: return null
|
|
1124
1532
|
}
|
|
1125
1533
|
}
|
|
1126
1534
|
|
|
1127
1535
|
function resolveIndex (name) {
|
|
1128
1536
|
switch (name) {
|
|
1537
|
+
case '@local/chat-order-by-key': return index17
|
|
1538
|
+
case '@local/files-by-blob': return index19
|
|
1539
|
+
case '@local/reclaimable-files-by-last-accessed': return index20
|
|
1540
|
+
case '@local/live-files': return index21
|
|
1129
1541
|
default: return null
|
|
1130
1542
|
}
|
|
1131
1543
|
}
|