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