autopass 3.4.0 → 3.4.1
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 +1 -1
- package/spec/db/db.json +30 -16
- package/spec/db/index.js +91 -120
- package/spec/db/messages.js +95 -88
- package/spec/hyperdispatch/dispatch.json +1 -1
- package/spec/hyperdispatch/index.js +8 -8
- package/spec/hyperdispatch/messages.js +68 -68
- package/spec/schema/index.js +68 -68
- package/spec/schema/schema.json +57 -57
package/package.json
CHANGED
package/spec/db/db.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 0,
|
|
3
3
|
"offset": 0,
|
|
4
4
|
"schema": [
|
|
5
5
|
{
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
"namespace": "autopass",
|
|
8
8
|
"id": 0,
|
|
9
9
|
"type": 1,
|
|
10
|
-
"version":
|
|
10
|
+
"version": 0,
|
|
11
11
|
"versionField": null,
|
|
12
12
|
"indexes": [],
|
|
13
13
|
"schema": "@autopass/records",
|
|
14
14
|
"derived": false,
|
|
15
|
-
"key": [
|
|
15
|
+
"key": [
|
|
16
|
+
"key"
|
|
17
|
+
],
|
|
16
18
|
"trigger": null
|
|
17
19
|
},
|
|
18
20
|
{
|
|
@@ -20,12 +22,14 @@
|
|
|
20
22
|
"namespace": "autopass",
|
|
21
23
|
"id": 1,
|
|
22
24
|
"type": 1,
|
|
23
|
-
"version":
|
|
25
|
+
"version": 0,
|
|
24
26
|
"versionField": null,
|
|
25
27
|
"indexes": [],
|
|
26
28
|
"schema": "@autopass/invite",
|
|
27
29
|
"derived": false,
|
|
28
|
-
"key": [
|
|
30
|
+
"key": [
|
|
31
|
+
"id"
|
|
32
|
+
],
|
|
29
33
|
"trigger": null
|
|
30
34
|
},
|
|
31
35
|
{
|
|
@@ -33,12 +37,14 @@
|
|
|
33
37
|
"namespace": "autopass",
|
|
34
38
|
"id": 2,
|
|
35
39
|
"type": 1,
|
|
36
|
-
"version":
|
|
40
|
+
"version": 0,
|
|
37
41
|
"versionField": null,
|
|
38
42
|
"indexes": [],
|
|
39
43
|
"schema": "@autopass/mirrors",
|
|
40
44
|
"derived": false,
|
|
41
|
-
"key": [
|
|
45
|
+
"key": [
|
|
46
|
+
"key"
|
|
47
|
+
],
|
|
42
48
|
"trigger": null
|
|
43
49
|
},
|
|
44
50
|
{
|
|
@@ -46,12 +52,14 @@
|
|
|
46
52
|
"namespace": "autopass",
|
|
47
53
|
"id": 3,
|
|
48
54
|
"type": 1,
|
|
49
|
-
"version":
|
|
55
|
+
"version": 0,
|
|
50
56
|
"versionField": null,
|
|
51
57
|
"indexes": [],
|
|
52
58
|
"schema": "@autopass/writer",
|
|
53
59
|
"derived": false,
|
|
54
|
-
"key": [
|
|
60
|
+
"key": [
|
|
61
|
+
"key"
|
|
62
|
+
],
|
|
55
63
|
"trigger": null
|
|
56
64
|
},
|
|
57
65
|
{
|
|
@@ -59,12 +67,14 @@
|
|
|
59
67
|
"namespace": "autopass",
|
|
60
68
|
"id": 4,
|
|
61
69
|
"type": 1,
|
|
62
|
-
"version":
|
|
70
|
+
"version": 0,
|
|
63
71
|
"versionField": null,
|
|
64
72
|
"indexes": [],
|
|
65
73
|
"schema": "@autopass/delete",
|
|
66
74
|
"derived": false,
|
|
67
|
-
"key": [
|
|
75
|
+
"key": [
|
|
76
|
+
"key"
|
|
77
|
+
],
|
|
68
78
|
"trigger": null
|
|
69
79
|
},
|
|
70
80
|
{
|
|
@@ -72,12 +82,14 @@
|
|
|
72
82
|
"namespace": "autopass",
|
|
73
83
|
"id": 5,
|
|
74
84
|
"type": 1,
|
|
75
|
-
"version":
|
|
85
|
+
"version": 0,
|
|
76
86
|
"versionField": null,
|
|
77
87
|
"indexes": [],
|
|
78
88
|
"schema": "@autopass/del-invite",
|
|
79
89
|
"derived": false,
|
|
80
|
-
"key": [
|
|
90
|
+
"key": [
|
|
91
|
+
"id"
|
|
92
|
+
],
|
|
81
93
|
"trigger": null
|
|
82
94
|
},
|
|
83
95
|
{
|
|
@@ -85,13 +97,15 @@
|
|
|
85
97
|
"namespace": "autopass",
|
|
86
98
|
"id": 6,
|
|
87
99
|
"type": 1,
|
|
88
|
-
"version":
|
|
100
|
+
"version": 0,
|
|
89
101
|
"versionField": null,
|
|
90
102
|
"indexes": [],
|
|
91
103
|
"schema": "@autopass/del-mirror",
|
|
92
104
|
"derived": false,
|
|
93
|
-
"key": [
|
|
105
|
+
"key": [
|
|
106
|
+
"key"
|
|
107
|
+
],
|
|
94
108
|
"trigger": null
|
|
95
109
|
}
|
|
96
110
|
]
|
|
97
|
-
}
|
|
111
|
+
}
|
package/spec/db/index.js
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
const { IndexEncoder, c, b4a } = require('hyperdb/runtime')
|
|
5
5
|
const { version, getEncoding, setVersion } = require('./messages.js')
|
|
6
6
|
|
|
7
|
-
const versions = { schema: version, db:
|
|
7
|
+
const versions = { schema: version, db: 0 }
|
|
8
8
|
|
|
9
9
|
// '@autopass/records' collection key
|
|
10
|
-
const collection0_key = new IndexEncoder([
|
|
10
|
+
const collection0_key = new IndexEncoder([
|
|
11
|
+
IndexEncoder.STRING
|
|
12
|
+
], { prefix: 0 })
|
|
11
13
|
|
|
12
|
-
function collection0_indexify(record) {
|
|
14
|
+
function collection0_indexify (record) {
|
|
13
15
|
const a = record.key
|
|
14
16
|
return a === undefined ? [] : [a]
|
|
15
17
|
}
|
|
@@ -18,19 +20,16 @@ function collection0_indexify(record) {
|
|
|
18
20
|
const collection0_enc = getEncoding('@autopass/records/hyperdb#0')
|
|
19
21
|
|
|
20
22
|
// '@autopass/records' reconstruction function
|
|
21
|
-
function collection0_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
23
|
+
function collection0_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
22
24
|
const key = collection0_key.decode(keyBuf)
|
|
23
25
|
setVersion(schemaVersion)
|
|
24
26
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
25
|
-
const type = c.uint.decode(state)
|
|
26
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
27
|
-
collection0.decodedVersion = c.uint.decode(state)
|
|
28
27
|
const record = collection0_enc.decode(state)
|
|
29
28
|
record.key = key[0]
|
|
30
29
|
return record
|
|
31
30
|
}
|
|
32
31
|
// '@autopass/records' key reconstruction function
|
|
33
|
-
function collection0_reconstruct_key(keyBuf) {
|
|
32
|
+
function collection0_reconstruct_key (keyBuf) {
|
|
34
33
|
const key = collection0_key.decode(keyBuf)
|
|
35
34
|
return {
|
|
36
35
|
key: key[0]
|
|
@@ -41,12 +40,12 @@ function collection0_reconstruct_key(keyBuf) {
|
|
|
41
40
|
const collection0 = {
|
|
42
41
|
name: '@autopass/records',
|
|
43
42
|
id: 0,
|
|
44
|
-
version:
|
|
45
|
-
encodeKey(record) {
|
|
43
|
+
version: 0,
|
|
44
|
+
encodeKey (record) {
|
|
46
45
|
const key = [record.key]
|
|
47
46
|
return collection0_key.encode(key)
|
|
48
47
|
},
|
|
49
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
48
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
50
49
|
return collection0_key.encodeRange({
|
|
51
50
|
gt: gt ? collection0_indexify(gt) : null,
|
|
52
51
|
lt: lt ? collection0_indexify(lt) : null,
|
|
@@ -54,13 +53,11 @@ const collection0 = {
|
|
|
54
53
|
lte: lte ? collection0_indexify(lte) : null
|
|
55
54
|
})
|
|
56
55
|
},
|
|
57
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
56
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
58
57
|
setVersion(schemaVersion)
|
|
59
|
-
const state = { start: 0, end:
|
|
58
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
60
59
|
collection0_enc.preencode(state, record)
|
|
61
60
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
62
|
-
state.buffer[state.start++] = 0
|
|
63
|
-
state.buffer[state.start++] = collectionVersion
|
|
64
61
|
collection0_enc.encode(state, record)
|
|
65
62
|
return state.buffer
|
|
66
63
|
},
|
|
@@ -72,9 +69,11 @@ const collection0 = {
|
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
// '@autopass/invite' collection key
|
|
75
|
-
const collection1_key = new IndexEncoder([
|
|
72
|
+
const collection1_key = new IndexEncoder([
|
|
73
|
+
IndexEncoder.BUFFER
|
|
74
|
+
], { prefix: 1 })
|
|
76
75
|
|
|
77
|
-
function collection1_indexify(record) {
|
|
76
|
+
function collection1_indexify (record) {
|
|
78
77
|
const a = record.id
|
|
79
78
|
return a === undefined ? [] : [a]
|
|
80
79
|
}
|
|
@@ -83,19 +82,16 @@ function collection1_indexify(record) {
|
|
|
83
82
|
const collection1_enc = getEncoding('@autopass/invite/hyperdb#1')
|
|
84
83
|
|
|
85
84
|
// '@autopass/invite' reconstruction function
|
|
86
|
-
function collection1_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
85
|
+
function collection1_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
87
86
|
const key = collection1_key.decode(keyBuf)
|
|
88
87
|
setVersion(schemaVersion)
|
|
89
88
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
90
|
-
const type = c.uint.decode(state)
|
|
91
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
92
|
-
collection1.decodedVersion = c.uint.decode(state)
|
|
93
89
|
const record = collection1_enc.decode(state)
|
|
94
90
|
record.id = key[0]
|
|
95
91
|
return record
|
|
96
92
|
}
|
|
97
93
|
// '@autopass/invite' key reconstruction function
|
|
98
|
-
function collection1_reconstruct_key(keyBuf) {
|
|
94
|
+
function collection1_reconstruct_key (keyBuf) {
|
|
99
95
|
const key = collection1_key.decode(keyBuf)
|
|
100
96
|
return {
|
|
101
97
|
id: key[0]
|
|
@@ -106,12 +102,12 @@ function collection1_reconstruct_key(keyBuf) {
|
|
|
106
102
|
const collection1 = {
|
|
107
103
|
name: '@autopass/invite',
|
|
108
104
|
id: 1,
|
|
109
|
-
version:
|
|
110
|
-
encodeKey(record) {
|
|
105
|
+
version: 0,
|
|
106
|
+
encodeKey (record) {
|
|
111
107
|
const key = [record.id]
|
|
112
108
|
return collection1_key.encode(key)
|
|
113
109
|
},
|
|
114
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
110
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
115
111
|
return collection1_key.encodeRange({
|
|
116
112
|
gt: gt ? collection1_indexify(gt) : null,
|
|
117
113
|
lt: lt ? collection1_indexify(lt) : null,
|
|
@@ -119,13 +115,11 @@ const collection1 = {
|
|
|
119
115
|
lte: lte ? collection1_indexify(lte) : null
|
|
120
116
|
})
|
|
121
117
|
},
|
|
122
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
118
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
123
119
|
setVersion(schemaVersion)
|
|
124
|
-
const state = { start: 0, end:
|
|
120
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
125
121
|
collection1_enc.preencode(state, record)
|
|
126
122
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
127
|
-
state.buffer[state.start++] = 0
|
|
128
|
-
state.buffer[state.start++] = collectionVersion
|
|
129
123
|
collection1_enc.encode(state, record)
|
|
130
124
|
return state.buffer
|
|
131
125
|
},
|
|
@@ -137,9 +131,11 @@ const collection1 = {
|
|
|
137
131
|
}
|
|
138
132
|
|
|
139
133
|
// '@autopass/mirrors' collection key
|
|
140
|
-
const collection2_key = new IndexEncoder([
|
|
134
|
+
const collection2_key = new IndexEncoder([
|
|
135
|
+
IndexEncoder.BUFFER
|
|
136
|
+
], { prefix: 2 })
|
|
141
137
|
|
|
142
|
-
function collection2_indexify(record) {
|
|
138
|
+
function collection2_indexify (record) {
|
|
143
139
|
const a = record.key
|
|
144
140
|
return a === undefined ? [] : [a]
|
|
145
141
|
}
|
|
@@ -148,19 +144,16 @@ function collection2_indexify(record) {
|
|
|
148
144
|
const collection2_enc = getEncoding('@autopass/mirrors/hyperdb#2')
|
|
149
145
|
|
|
150
146
|
// '@autopass/mirrors' reconstruction function
|
|
151
|
-
function collection2_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
147
|
+
function collection2_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
152
148
|
const key = collection2_key.decode(keyBuf)
|
|
153
149
|
setVersion(schemaVersion)
|
|
154
150
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
155
|
-
const type = c.uint.decode(state)
|
|
156
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
157
|
-
collection2.decodedVersion = c.uint.decode(state)
|
|
158
151
|
const record = collection2_enc.decode(state)
|
|
159
152
|
record.key = key[0]
|
|
160
153
|
return record
|
|
161
154
|
}
|
|
162
155
|
// '@autopass/mirrors' key reconstruction function
|
|
163
|
-
function collection2_reconstruct_key(keyBuf) {
|
|
156
|
+
function collection2_reconstruct_key (keyBuf) {
|
|
164
157
|
const key = collection2_key.decode(keyBuf)
|
|
165
158
|
return {
|
|
166
159
|
key: key[0]
|
|
@@ -171,12 +164,12 @@ function collection2_reconstruct_key(keyBuf) {
|
|
|
171
164
|
const collection2 = {
|
|
172
165
|
name: '@autopass/mirrors',
|
|
173
166
|
id: 2,
|
|
174
|
-
version:
|
|
175
|
-
encodeKey(record) {
|
|
167
|
+
version: 0,
|
|
168
|
+
encodeKey (record) {
|
|
176
169
|
const key = [record.key]
|
|
177
170
|
return collection2_key.encode(key)
|
|
178
171
|
},
|
|
179
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
172
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
180
173
|
return collection2_key.encodeRange({
|
|
181
174
|
gt: gt ? collection2_indexify(gt) : null,
|
|
182
175
|
lt: lt ? collection2_indexify(lt) : null,
|
|
@@ -184,13 +177,11 @@ const collection2 = {
|
|
|
184
177
|
lte: lte ? collection2_indexify(lte) : null
|
|
185
178
|
})
|
|
186
179
|
},
|
|
187
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
180
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
188
181
|
setVersion(schemaVersion)
|
|
189
|
-
const state = { start: 0, end:
|
|
182
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
190
183
|
collection2_enc.preencode(state, record)
|
|
191
184
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
192
|
-
state.buffer[state.start++] = 0
|
|
193
|
-
state.buffer[state.start++] = collectionVersion
|
|
194
185
|
collection2_enc.encode(state, record)
|
|
195
186
|
return state.buffer
|
|
196
187
|
},
|
|
@@ -202,9 +193,11 @@ const collection2 = {
|
|
|
202
193
|
}
|
|
203
194
|
|
|
204
195
|
// '@autopass/writer' collection key
|
|
205
|
-
const collection3_key = new IndexEncoder([
|
|
196
|
+
const collection3_key = new IndexEncoder([
|
|
197
|
+
IndexEncoder.BUFFER
|
|
198
|
+
], { prefix: 3 })
|
|
206
199
|
|
|
207
|
-
function collection3_indexify(record) {
|
|
200
|
+
function collection3_indexify (record) {
|
|
208
201
|
const a = record.key
|
|
209
202
|
return a === undefined ? [] : [a]
|
|
210
203
|
}
|
|
@@ -213,19 +206,16 @@ function collection3_indexify(record) {
|
|
|
213
206
|
const collection3_enc = getEncoding('@autopass/writer/hyperdb#3')
|
|
214
207
|
|
|
215
208
|
// '@autopass/writer' reconstruction function
|
|
216
|
-
function collection3_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
209
|
+
function collection3_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
217
210
|
const key = collection3_key.decode(keyBuf)
|
|
218
211
|
setVersion(schemaVersion)
|
|
219
212
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
220
|
-
const type = c.uint.decode(state)
|
|
221
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
222
|
-
collection3.decodedVersion = c.uint.decode(state)
|
|
223
213
|
const record = collection3_enc.decode(state)
|
|
224
214
|
record.key = key[0]
|
|
225
215
|
return record
|
|
226
216
|
}
|
|
227
217
|
// '@autopass/writer' key reconstruction function
|
|
228
|
-
function collection3_reconstruct_key(keyBuf) {
|
|
218
|
+
function collection3_reconstruct_key (keyBuf) {
|
|
229
219
|
const key = collection3_key.decode(keyBuf)
|
|
230
220
|
return {
|
|
231
221
|
key: key[0]
|
|
@@ -236,12 +226,12 @@ function collection3_reconstruct_key(keyBuf) {
|
|
|
236
226
|
const collection3 = {
|
|
237
227
|
name: '@autopass/writer',
|
|
238
228
|
id: 3,
|
|
239
|
-
version:
|
|
240
|
-
encodeKey(record) {
|
|
229
|
+
version: 0,
|
|
230
|
+
encodeKey (record) {
|
|
241
231
|
const key = [record.key]
|
|
242
232
|
return collection3_key.encode(key)
|
|
243
233
|
},
|
|
244
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
234
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
245
235
|
return collection3_key.encodeRange({
|
|
246
236
|
gt: gt ? collection3_indexify(gt) : null,
|
|
247
237
|
lt: lt ? collection3_indexify(lt) : null,
|
|
@@ -249,13 +239,11 @@ const collection3 = {
|
|
|
249
239
|
lte: lte ? collection3_indexify(lte) : null
|
|
250
240
|
})
|
|
251
241
|
},
|
|
252
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
242
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
253
243
|
setVersion(schemaVersion)
|
|
254
|
-
const state = { start: 0, end:
|
|
244
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
255
245
|
collection3_enc.preencode(state, record)
|
|
256
246
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
257
|
-
state.buffer[state.start++] = 0
|
|
258
|
-
state.buffer[state.start++] = collectionVersion
|
|
259
247
|
collection3_enc.encode(state, record)
|
|
260
248
|
return state.buffer
|
|
261
249
|
},
|
|
@@ -267,9 +255,11 @@ const collection3 = {
|
|
|
267
255
|
}
|
|
268
256
|
|
|
269
257
|
// '@autopass/delete' collection key
|
|
270
|
-
const collection4_key = new IndexEncoder([
|
|
258
|
+
const collection4_key = new IndexEncoder([
|
|
259
|
+
IndexEncoder.STRING
|
|
260
|
+
], { prefix: 4 })
|
|
271
261
|
|
|
272
|
-
function collection4_indexify(record) {
|
|
262
|
+
function collection4_indexify (record) {
|
|
273
263
|
const a = record.key
|
|
274
264
|
return a === undefined ? [] : [a]
|
|
275
265
|
}
|
|
@@ -278,19 +268,16 @@ function collection4_indexify(record) {
|
|
|
278
268
|
const collection4_enc = getEncoding('@autopass/delete/hyperdb#4')
|
|
279
269
|
|
|
280
270
|
// '@autopass/delete' reconstruction function
|
|
281
|
-
function collection4_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
271
|
+
function collection4_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
282
272
|
const key = collection4_key.decode(keyBuf)
|
|
283
273
|
setVersion(schemaVersion)
|
|
284
274
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
285
|
-
const type = c.uint.decode(state)
|
|
286
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
287
|
-
collection4.decodedVersion = c.uint.decode(state)
|
|
288
275
|
const record = collection4_enc.decode(state)
|
|
289
276
|
record.key = key[0]
|
|
290
277
|
return record
|
|
291
278
|
}
|
|
292
279
|
// '@autopass/delete' key reconstruction function
|
|
293
|
-
function collection4_reconstruct_key(keyBuf) {
|
|
280
|
+
function collection4_reconstruct_key (keyBuf) {
|
|
294
281
|
const key = collection4_key.decode(keyBuf)
|
|
295
282
|
return {
|
|
296
283
|
key: key[0]
|
|
@@ -301,12 +288,12 @@ function collection4_reconstruct_key(keyBuf) {
|
|
|
301
288
|
const collection4 = {
|
|
302
289
|
name: '@autopass/delete',
|
|
303
290
|
id: 4,
|
|
304
|
-
version:
|
|
305
|
-
encodeKey(record) {
|
|
291
|
+
version: 0,
|
|
292
|
+
encodeKey (record) {
|
|
306
293
|
const key = [record.key]
|
|
307
294
|
return collection4_key.encode(key)
|
|
308
295
|
},
|
|
309
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
296
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
310
297
|
return collection4_key.encodeRange({
|
|
311
298
|
gt: gt ? collection4_indexify(gt) : null,
|
|
312
299
|
lt: lt ? collection4_indexify(lt) : null,
|
|
@@ -314,13 +301,11 @@ const collection4 = {
|
|
|
314
301
|
lte: lte ? collection4_indexify(lte) : null
|
|
315
302
|
})
|
|
316
303
|
},
|
|
317
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
304
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
318
305
|
setVersion(schemaVersion)
|
|
319
|
-
const state = { start: 0, end:
|
|
306
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
320
307
|
collection4_enc.preencode(state, record)
|
|
321
308
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
322
|
-
state.buffer[state.start++] = 0
|
|
323
|
-
state.buffer[state.start++] = collectionVersion
|
|
324
309
|
collection4_enc.encode(state, record)
|
|
325
310
|
return state.buffer
|
|
326
311
|
},
|
|
@@ -332,9 +317,11 @@ const collection4 = {
|
|
|
332
317
|
}
|
|
333
318
|
|
|
334
319
|
// '@autopass/del-invite' collection key
|
|
335
|
-
const collection5_key = new IndexEncoder([
|
|
320
|
+
const collection5_key = new IndexEncoder([
|
|
321
|
+
IndexEncoder.BUFFER
|
|
322
|
+
], { prefix: 5 })
|
|
336
323
|
|
|
337
|
-
function collection5_indexify(record) {
|
|
324
|
+
function collection5_indexify (record) {
|
|
338
325
|
const a = record.id
|
|
339
326
|
return a === undefined ? [] : [a]
|
|
340
327
|
}
|
|
@@ -343,19 +330,16 @@ function collection5_indexify(record) {
|
|
|
343
330
|
const collection5_enc = getEncoding('@autopass/del-invite/hyperdb#5')
|
|
344
331
|
|
|
345
332
|
// '@autopass/del-invite' reconstruction function
|
|
346
|
-
function collection5_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
333
|
+
function collection5_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
347
334
|
const key = collection5_key.decode(keyBuf)
|
|
348
335
|
setVersion(schemaVersion)
|
|
349
336
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
350
|
-
const type = c.uint.decode(state)
|
|
351
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
352
|
-
collection5.decodedVersion = c.uint.decode(state)
|
|
353
337
|
const record = collection5_enc.decode(state)
|
|
354
338
|
record.id = key[0]
|
|
355
339
|
return record
|
|
356
340
|
}
|
|
357
341
|
// '@autopass/del-invite' key reconstruction function
|
|
358
|
-
function collection5_reconstruct_key(keyBuf) {
|
|
342
|
+
function collection5_reconstruct_key (keyBuf) {
|
|
359
343
|
const key = collection5_key.decode(keyBuf)
|
|
360
344
|
return {
|
|
361
345
|
id: key[0]
|
|
@@ -366,12 +350,12 @@ function collection5_reconstruct_key(keyBuf) {
|
|
|
366
350
|
const collection5 = {
|
|
367
351
|
name: '@autopass/del-invite',
|
|
368
352
|
id: 5,
|
|
369
|
-
version:
|
|
370
|
-
encodeKey(record) {
|
|
353
|
+
version: 0,
|
|
354
|
+
encodeKey (record) {
|
|
371
355
|
const key = [record.id]
|
|
372
356
|
return collection5_key.encode(key)
|
|
373
357
|
},
|
|
374
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
358
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
375
359
|
return collection5_key.encodeRange({
|
|
376
360
|
gt: gt ? collection5_indexify(gt) : null,
|
|
377
361
|
lt: lt ? collection5_indexify(lt) : null,
|
|
@@ -379,13 +363,11 @@ const collection5 = {
|
|
|
379
363
|
lte: lte ? collection5_indexify(lte) : null
|
|
380
364
|
})
|
|
381
365
|
},
|
|
382
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
366
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
383
367
|
setVersion(schemaVersion)
|
|
384
|
-
const state = { start: 0, end:
|
|
368
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
385
369
|
collection5_enc.preencode(state, record)
|
|
386
370
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
387
|
-
state.buffer[state.start++] = 0
|
|
388
|
-
state.buffer[state.start++] = collectionVersion
|
|
389
371
|
collection5_enc.encode(state, record)
|
|
390
372
|
return state.buffer
|
|
391
373
|
},
|
|
@@ -397,9 +379,11 @@ const collection5 = {
|
|
|
397
379
|
}
|
|
398
380
|
|
|
399
381
|
// '@autopass/del-mirror' collection key
|
|
400
|
-
const collection6_key = new IndexEncoder([
|
|
382
|
+
const collection6_key = new IndexEncoder([
|
|
383
|
+
IndexEncoder.BUFFER
|
|
384
|
+
], { prefix: 6 })
|
|
401
385
|
|
|
402
|
-
function collection6_indexify(record) {
|
|
386
|
+
function collection6_indexify (record) {
|
|
403
387
|
const a = record.key
|
|
404
388
|
return a === undefined ? [] : [a]
|
|
405
389
|
}
|
|
@@ -408,19 +392,16 @@ function collection6_indexify(record) {
|
|
|
408
392
|
const collection6_enc = getEncoding('@autopass/del-mirror/hyperdb#6')
|
|
409
393
|
|
|
410
394
|
// '@autopass/del-mirror' reconstruction function
|
|
411
|
-
function collection6_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
395
|
+
function collection6_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
412
396
|
const key = collection6_key.decode(keyBuf)
|
|
413
397
|
setVersion(schemaVersion)
|
|
414
398
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
415
|
-
const type = c.uint.decode(state)
|
|
416
|
-
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
417
|
-
collection6.decodedVersion = c.uint.decode(state)
|
|
418
399
|
const record = collection6_enc.decode(state)
|
|
419
400
|
record.key = key[0]
|
|
420
401
|
return record
|
|
421
402
|
}
|
|
422
403
|
// '@autopass/del-mirror' key reconstruction function
|
|
423
|
-
function collection6_reconstruct_key(keyBuf) {
|
|
404
|
+
function collection6_reconstruct_key (keyBuf) {
|
|
424
405
|
const key = collection6_key.decode(keyBuf)
|
|
425
406
|
return {
|
|
426
407
|
key: key[0]
|
|
@@ -431,12 +412,12 @@ function collection6_reconstruct_key(keyBuf) {
|
|
|
431
412
|
const collection6 = {
|
|
432
413
|
name: '@autopass/del-mirror',
|
|
433
414
|
id: 6,
|
|
434
|
-
version:
|
|
435
|
-
encodeKey(record) {
|
|
415
|
+
version: 0,
|
|
416
|
+
encodeKey (record) {
|
|
436
417
|
const key = [record.key]
|
|
437
418
|
return collection6_key.encode(key)
|
|
438
419
|
},
|
|
439
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
420
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
440
421
|
return collection6_key.encodeRange({
|
|
441
422
|
gt: gt ? collection6_indexify(gt) : null,
|
|
442
423
|
lt: lt ? collection6_indexify(lt) : null,
|
|
@@ -444,13 +425,11 @@ const collection6 = {
|
|
|
444
425
|
lte: lte ? collection6_indexify(lte) : null
|
|
445
426
|
})
|
|
446
427
|
},
|
|
447
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
428
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
448
429
|
setVersion(schemaVersion)
|
|
449
|
-
const state = { start: 0, end:
|
|
430
|
+
const state = { start: 0, end: 0, buffer: null }
|
|
450
431
|
collection6_enc.preencode(state, record)
|
|
451
432
|
state.buffer = b4a.allocUnsafe(state.end)
|
|
452
|
-
state.buffer[state.start++] = 0
|
|
453
|
-
state.buffer[state.start++] = collectionVersion
|
|
454
433
|
collection6_enc.encode(state, record)
|
|
455
434
|
return state.buffer
|
|
456
435
|
},
|
|
@@ -471,34 +450,26 @@ const collections = [
|
|
|
471
450
|
collection6
|
|
472
451
|
]
|
|
473
452
|
|
|
474
|
-
const indexes = [
|
|
453
|
+
const indexes = [
|
|
454
|
+
]
|
|
475
455
|
|
|
476
456
|
module.exports = { versions, collections, indexes, resolveCollection, resolveIndex }
|
|
477
457
|
|
|
478
|
-
function resolveCollection(name) {
|
|
458
|
+
function resolveCollection (name) {
|
|
479
459
|
switch (name) {
|
|
480
|
-
case '@autopass/records':
|
|
481
|
-
|
|
482
|
-
case '@autopass/
|
|
483
|
-
|
|
484
|
-
case '@autopass/
|
|
485
|
-
|
|
486
|
-
case '@autopass/
|
|
487
|
-
|
|
488
|
-
case '@autopass/delete':
|
|
489
|
-
return collection4
|
|
490
|
-
case '@autopass/del-invite':
|
|
491
|
-
return collection5
|
|
492
|
-
case '@autopass/del-mirror':
|
|
493
|
-
return collection6
|
|
494
|
-
default:
|
|
495
|
-
return null
|
|
460
|
+
case '@autopass/records': return collection0
|
|
461
|
+
case '@autopass/invite': return collection1
|
|
462
|
+
case '@autopass/mirrors': return collection2
|
|
463
|
+
case '@autopass/writer': return collection3
|
|
464
|
+
case '@autopass/delete': return collection4
|
|
465
|
+
case '@autopass/del-invite': return collection5
|
|
466
|
+
case '@autopass/del-mirror': return collection6
|
|
467
|
+
default: return null
|
|
496
468
|
}
|
|
497
469
|
}
|
|
498
470
|
|
|
499
|
-
function resolveIndex(name) {
|
|
471
|
+
function resolveIndex (name) {
|
|
500
472
|
switch (name) {
|
|
501
|
-
default:
|
|
502
|
-
return null
|
|
473
|
+
default: return null
|
|
503
474
|
}
|
|
504
475
|
}
|