gip-remote 1.2.2 → 1.2.4
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/index.d.ts +47 -7
- package/index.js +110 -38
- package/lib/drive.js +19 -10
- package/lib/git.js +32 -1
- package/package.json +1 -1
- package/schema/hyperdb/db.json +36 -8
- package/schema/hyperdb/index.js +144 -64
- package/schema/hyperdb/messages.js +129 -19
- package/schema/hyperschema/index.js +63 -7
- package/schema/hyperschema/schema.json +57 -1
package/schema/hyperdb/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: 3 }
|
|
8
8
|
|
|
9
9
|
// '@gip/repos' 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.name
|
|
14
16
|
return a === undefined ? [] : [a]
|
|
15
17
|
}
|
|
@@ -18,7 +20,7 @@ function collection0_indexify(record) {
|
|
|
18
20
|
const collection0_enc = getEncoding('@gip/repos/hyperdb#0')
|
|
19
21
|
|
|
20
22
|
// '@gip/repos' 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 }
|
|
@@ -30,7 +32,7 @@ function collection0_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
|
30
32
|
return record
|
|
31
33
|
}
|
|
32
34
|
// '@gip/repos' key reconstruction function
|
|
33
|
-
function collection0_reconstruct_key(keyBuf) {
|
|
35
|
+
function collection0_reconstruct_key (keyBuf) {
|
|
34
36
|
const key = collection0_key.decode(keyBuf)
|
|
35
37
|
return {
|
|
36
38
|
name: key[0]
|
|
@@ -42,11 +44,11 @@ const collection0 = {
|
|
|
42
44
|
name: '@gip/repos',
|
|
43
45
|
id: 0,
|
|
44
46
|
version: 1,
|
|
45
|
-
encodeKey(record) {
|
|
47
|
+
encodeKey (record) {
|
|
46
48
|
const key = [record.name]
|
|
47
49
|
return collection0_key.encode(key)
|
|
48
50
|
},
|
|
49
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
51
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
50
52
|
return collection0_key.encodeRange({
|
|
51
53
|
gt: gt ? collection0_indexify(gt) : null,
|
|
52
54
|
lt: lt ? collection0_indexify(lt) : null,
|
|
@@ -54,7 +56,7 @@ const collection0 = {
|
|
|
54
56
|
lte: lte ? collection0_indexify(lte) : null
|
|
55
57
|
})
|
|
56
58
|
},
|
|
57
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
59
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
58
60
|
setVersion(schemaVersion)
|
|
59
61
|
const state = { start: 0, end: 2, buffer: null }
|
|
60
62
|
collection0_enc.preencode(state, record)
|
|
@@ -72,9 +74,11 @@ const collection0 = {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
// '@gip/branches' collection key
|
|
75
|
-
const collection1_key = new IndexEncoder([
|
|
77
|
+
const collection1_key = new IndexEncoder([
|
|
78
|
+
IndexEncoder.STRING
|
|
79
|
+
], { prefix: 1 })
|
|
76
80
|
|
|
77
|
-
function collection1_indexify(record) {
|
|
81
|
+
function collection1_indexify (record) {
|
|
78
82
|
const a = record.name
|
|
79
83
|
return a === undefined ? [] : [a]
|
|
80
84
|
}
|
|
@@ -83,7 +87,7 @@ function collection1_indexify(record) {
|
|
|
83
87
|
const collection1_enc = getEncoding('@gip/branches/hyperdb#1')
|
|
84
88
|
|
|
85
89
|
// '@gip/branches' reconstruction function
|
|
86
|
-
function collection1_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
90
|
+
function collection1_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
87
91
|
const key = collection1_key.decode(keyBuf)
|
|
88
92
|
setVersion(schemaVersion)
|
|
89
93
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
@@ -95,7 +99,7 @@ function collection1_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
|
95
99
|
return record
|
|
96
100
|
}
|
|
97
101
|
// '@gip/branches' key reconstruction function
|
|
98
|
-
function collection1_reconstruct_key(keyBuf) {
|
|
102
|
+
function collection1_reconstruct_key (keyBuf) {
|
|
99
103
|
const key = collection1_key.decode(keyBuf)
|
|
100
104
|
return {
|
|
101
105
|
name: key[0]
|
|
@@ -107,11 +111,11 @@ const collection1 = {
|
|
|
107
111
|
name: '@gip/branches',
|
|
108
112
|
id: 1,
|
|
109
113
|
version: 1,
|
|
110
|
-
encodeKey(record) {
|
|
114
|
+
encodeKey (record) {
|
|
111
115
|
const key = [record.name]
|
|
112
116
|
return collection1_key.encode(key)
|
|
113
117
|
},
|
|
114
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
118
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
115
119
|
return collection1_key.encodeRange({
|
|
116
120
|
gt: gt ? collection1_indexify(gt) : null,
|
|
117
121
|
lt: lt ? collection1_indexify(lt) : null,
|
|
@@ -119,7 +123,7 @@ const collection1 = {
|
|
|
119
123
|
lte: lte ? collection1_indexify(lte) : null
|
|
120
124
|
})
|
|
121
125
|
},
|
|
122
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
126
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
123
127
|
setVersion(schemaVersion)
|
|
124
128
|
const state = { start: 0, end: 2, buffer: null }
|
|
125
129
|
collection1_enc.preencode(state, record)
|
|
@@ -137,9 +141,12 @@ const collection1 = {
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
// '@gip/files' collection key
|
|
140
|
-
const collection2_key = new IndexEncoder([
|
|
144
|
+
const collection2_key = new IndexEncoder([
|
|
145
|
+
IndexEncoder.STRING,
|
|
146
|
+
IndexEncoder.STRING
|
|
147
|
+
], { prefix: 2 })
|
|
141
148
|
|
|
142
|
-
function collection2_indexify(record) {
|
|
149
|
+
function collection2_indexify (record) {
|
|
143
150
|
const arr = []
|
|
144
151
|
|
|
145
152
|
const a0 = record.branch
|
|
@@ -157,7 +164,7 @@ function collection2_indexify(record) {
|
|
|
157
164
|
const collection2_enc = getEncoding('@gip/files/hyperdb#2')
|
|
158
165
|
|
|
159
166
|
// '@gip/files' reconstruction function
|
|
160
|
-
function collection2_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
167
|
+
function collection2_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
161
168
|
const key = collection2_key.decode(keyBuf)
|
|
162
169
|
setVersion(schemaVersion)
|
|
163
170
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
@@ -170,7 +177,7 @@ function collection2_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
|
170
177
|
return record
|
|
171
178
|
}
|
|
172
179
|
// '@gip/files' key reconstruction function
|
|
173
|
-
function collection2_reconstruct_key(keyBuf) {
|
|
180
|
+
function collection2_reconstruct_key (keyBuf) {
|
|
174
181
|
const key = collection2_key.decode(keyBuf)
|
|
175
182
|
return {
|
|
176
183
|
branch: key[0],
|
|
@@ -183,11 +190,11 @@ const collection2 = {
|
|
|
183
190
|
name: '@gip/files',
|
|
184
191
|
id: 2,
|
|
185
192
|
version: 1,
|
|
186
|
-
encodeKey(record) {
|
|
193
|
+
encodeKey (record) {
|
|
187
194
|
const key = [record.branch, record.path]
|
|
188
195
|
return collection2_key.encode(key)
|
|
189
196
|
},
|
|
190
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
197
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
191
198
|
return collection2_key.encodeRange({
|
|
192
199
|
gt: gt ? collection2_indexify(gt) : null,
|
|
193
200
|
lt: lt ? collection2_indexify(lt) : null,
|
|
@@ -195,7 +202,7 @@ const collection2 = {
|
|
|
195
202
|
lte: lte ? collection2_indexify(lte) : null
|
|
196
203
|
})
|
|
197
204
|
},
|
|
198
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
205
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
199
206
|
setVersion(schemaVersion)
|
|
200
207
|
const state = { start: 0, end: 2, buffer: null }
|
|
201
208
|
collection2_enc.preencode(state, record)
|
|
@@ -213,9 +220,11 @@ const collection2 = {
|
|
|
213
220
|
}
|
|
214
221
|
|
|
215
222
|
// '@gip/objects' collection key
|
|
216
|
-
const collection3_key = new IndexEncoder([
|
|
223
|
+
const collection3_key = new IndexEncoder([
|
|
224
|
+
IndexEncoder.STRING
|
|
225
|
+
], { prefix: 3 })
|
|
217
226
|
|
|
218
|
-
function collection3_indexify(record) {
|
|
227
|
+
function collection3_indexify (record) {
|
|
219
228
|
const a = record.oid
|
|
220
229
|
return a === undefined ? [] : [a]
|
|
221
230
|
}
|
|
@@ -224,7 +233,7 @@ function collection3_indexify(record) {
|
|
|
224
233
|
const collection3_enc = getEncoding('@gip/objects/hyperdb#3')
|
|
225
234
|
|
|
226
235
|
// '@gip/objects' reconstruction function
|
|
227
|
-
function collection3_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
236
|
+
function collection3_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
228
237
|
const key = collection3_key.decode(keyBuf)
|
|
229
238
|
setVersion(schemaVersion)
|
|
230
239
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
@@ -236,7 +245,7 @@ function collection3_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
|
236
245
|
return record
|
|
237
246
|
}
|
|
238
247
|
// '@gip/objects' key reconstruction function
|
|
239
|
-
function collection3_reconstruct_key(keyBuf) {
|
|
248
|
+
function collection3_reconstruct_key (keyBuf) {
|
|
240
249
|
const key = collection3_key.decode(keyBuf)
|
|
241
250
|
return {
|
|
242
251
|
oid: key[0]
|
|
@@ -248,11 +257,11 @@ const collection3 = {
|
|
|
248
257
|
name: '@gip/objects',
|
|
249
258
|
id: 3,
|
|
250
259
|
version: 1,
|
|
251
|
-
encodeKey(record) {
|
|
260
|
+
encodeKey (record) {
|
|
252
261
|
const key = [record.oid]
|
|
253
262
|
return collection3_key.encode(key)
|
|
254
263
|
},
|
|
255
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
264
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
256
265
|
return collection3_key.encodeRange({
|
|
257
266
|
gt: gt ? collection3_indexify(gt) : null,
|
|
258
267
|
lt: lt ? collection3_indexify(lt) : null,
|
|
@@ -260,7 +269,7 @@ const collection3 = {
|
|
|
260
269
|
lte: lte ? collection3_indexify(lte) : null
|
|
261
270
|
})
|
|
262
271
|
},
|
|
263
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
272
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
264
273
|
setVersion(schemaVersion)
|
|
265
274
|
const state = { start: 0, end: 2, buffer: null }
|
|
266
275
|
collection3_enc.preencode(state, record)
|
|
@@ -278,12 +287,13 @@ const collection3 = {
|
|
|
278
287
|
}
|
|
279
288
|
|
|
280
289
|
// '@gip/files-by-branch' collection key
|
|
281
|
-
const index4_key = new IndexEncoder(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
290
|
+
const index4_key = new IndexEncoder([
|
|
291
|
+
IndexEncoder.STRING,
|
|
292
|
+
IndexEncoder.STRING,
|
|
293
|
+
IndexEncoder.STRING
|
|
294
|
+
], { prefix: 4 })
|
|
285
295
|
|
|
286
|
-
function index4_indexify(record) {
|
|
296
|
+
function index4_indexify (record) {
|
|
287
297
|
const arr = []
|
|
288
298
|
|
|
289
299
|
const a0 = record.branch
|
|
@@ -306,10 +316,10 @@ const index4 = {
|
|
|
306
316
|
name: '@gip/files-by-branch',
|
|
307
317
|
version: 1,
|
|
308
318
|
id: 4,
|
|
309
|
-
encodeKey(record) {
|
|
319
|
+
encodeKey (record) {
|
|
310
320
|
return index4_key.encode(index4_indexify(record))
|
|
311
321
|
},
|
|
312
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
322
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
313
323
|
return index4_key.encodeRange({
|
|
314
324
|
gt: gt ? index4_indexify(gt) : null,
|
|
315
325
|
lt: lt ? index4_indexify(lt) : null,
|
|
@@ -318,7 +328,7 @@ const index4 = {
|
|
|
318
328
|
})
|
|
319
329
|
},
|
|
320
330
|
encodeValue: (record) => index4.collection.encodeKey(record),
|
|
321
|
-
encodeIndexKeys(record, context) {
|
|
331
|
+
encodeIndexKeys (record, context) {
|
|
322
332
|
return [index4_key.encode([record.branch, record.branch, record.path])]
|
|
323
333
|
},
|
|
324
334
|
reconstruct: (keyBuf, valueBuf) => valueBuf,
|
|
@@ -328,9 +338,10 @@ const index4 = {
|
|
|
328
338
|
collection2.indexes.push(index4)
|
|
329
339
|
|
|
330
340
|
// '@gip/head' collection key
|
|
331
|
-
const collection5_key = new IndexEncoder([
|
|
341
|
+
const collection5_key = new IndexEncoder([
|
|
342
|
+
], { prefix: 5 })
|
|
332
343
|
|
|
333
|
-
function collection5_indexify(record) {
|
|
344
|
+
function collection5_indexify (record) {
|
|
334
345
|
return []
|
|
335
346
|
}
|
|
336
347
|
|
|
@@ -338,7 +349,7 @@ function collection5_indexify(record) {
|
|
|
338
349
|
const collection5_enc = getEncoding('@gip/head')
|
|
339
350
|
|
|
340
351
|
// '@gip/head' reconstruction function
|
|
341
|
-
function collection5_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
352
|
+
function collection5_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
342
353
|
setVersion(schemaVersion)
|
|
343
354
|
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
344
355
|
const type = c.uint.decode(state)
|
|
@@ -348,7 +359,7 @@ function collection5_reconstruct(schemaVersion, keyBuf, valueBuf) {
|
|
|
348
359
|
return record
|
|
349
360
|
}
|
|
350
361
|
// '@gip/head' key reconstruction function
|
|
351
|
-
function collection5_reconstruct_key(keyBuf) {
|
|
362
|
+
function collection5_reconstruct_key (keyBuf) {
|
|
352
363
|
return {}
|
|
353
364
|
}
|
|
354
365
|
|
|
@@ -357,11 +368,11 @@ const collection5 = {
|
|
|
357
368
|
name: '@gip/head',
|
|
358
369
|
id: 5,
|
|
359
370
|
version: 2,
|
|
360
|
-
encodeKey(record) {
|
|
371
|
+
encodeKey (record) {
|
|
361
372
|
const key = []
|
|
362
373
|
return collection5_key.encode(key)
|
|
363
374
|
},
|
|
364
|
-
encodeKeyRange({ gt, lt, gte, lte } = {}) {
|
|
375
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
365
376
|
return collection5_key.encodeRange({
|
|
366
377
|
gt: gt ? collection5_indexify(gt) : null,
|
|
367
378
|
lt: lt ? collection5_indexify(lt) : null,
|
|
@@ -369,7 +380,7 @@ const collection5 = {
|
|
|
369
380
|
lte: lte ? collection5_indexify(lte) : null
|
|
370
381
|
})
|
|
371
382
|
},
|
|
372
|
-
encodeValue(schemaVersion, collectionVersion, record) {
|
|
383
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
373
384
|
setVersion(schemaVersion)
|
|
374
385
|
const state = { start: 0, end: 2, buffer: null }
|
|
375
386
|
collection5_enc.preencode(state, record)
|
|
@@ -386,34 +397,103 @@ const collection5 = {
|
|
|
386
397
|
decodedVersion: 0
|
|
387
398
|
}
|
|
388
399
|
|
|
389
|
-
|
|
400
|
+
// '@gip/tags' collection key
|
|
401
|
+
const collection6_key = new IndexEncoder([
|
|
402
|
+
IndexEncoder.STRING
|
|
403
|
+
], { prefix: 6 })
|
|
390
404
|
|
|
391
|
-
|
|
405
|
+
function collection6_indexify (record) {
|
|
406
|
+
const a = record.name
|
|
407
|
+
return a === undefined ? [] : [a]
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// '@gip/tags' value encoding
|
|
411
|
+
const collection6_enc = getEncoding('@gip/tags/hyperdb#6')
|
|
412
|
+
|
|
413
|
+
// '@gip/tags' reconstruction function
|
|
414
|
+
function collection6_reconstruct (schemaVersion, keyBuf, valueBuf) {
|
|
415
|
+
const key = collection6_key.decode(keyBuf)
|
|
416
|
+
setVersion(schemaVersion)
|
|
417
|
+
const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
|
|
418
|
+
const type = c.uint.decode(state)
|
|
419
|
+
if (type !== 0) throw new Error('Unknown collection type: ' + type)
|
|
420
|
+
collection6.decodedVersion = c.uint.decode(state)
|
|
421
|
+
const record = collection6_enc.decode(state)
|
|
422
|
+
record.name = key[0]
|
|
423
|
+
return record
|
|
424
|
+
}
|
|
425
|
+
// '@gip/tags' key reconstruction function
|
|
426
|
+
function collection6_reconstruct_key (keyBuf) {
|
|
427
|
+
const key = collection6_key.decode(keyBuf)
|
|
428
|
+
return {
|
|
429
|
+
name: key[0]
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// '@gip/tags'
|
|
434
|
+
const collection6 = {
|
|
435
|
+
name: '@gip/tags',
|
|
436
|
+
id: 6,
|
|
437
|
+
version: 3,
|
|
438
|
+
encodeKey (record) {
|
|
439
|
+
const key = [record.name]
|
|
440
|
+
return collection6_key.encode(key)
|
|
441
|
+
},
|
|
442
|
+
encodeKeyRange ({ gt, lt, gte, lte } = {}) {
|
|
443
|
+
return collection6_key.encodeRange({
|
|
444
|
+
gt: gt ? collection6_indexify(gt) : null,
|
|
445
|
+
lt: lt ? collection6_indexify(lt) : null,
|
|
446
|
+
gte: gte ? collection6_indexify(gte) : null,
|
|
447
|
+
lte: lte ? collection6_indexify(lte) : null
|
|
448
|
+
})
|
|
449
|
+
},
|
|
450
|
+
encodeValue (schemaVersion, collectionVersion, record) {
|
|
451
|
+
setVersion(schemaVersion)
|
|
452
|
+
const state = { start: 0, end: 2, buffer: null }
|
|
453
|
+
collection6_enc.preencode(state, record)
|
|
454
|
+
state.buffer = b4a.allocUnsafe(state.end)
|
|
455
|
+
state.buffer[state.start++] = 0
|
|
456
|
+
state.buffer[state.start++] = collectionVersion
|
|
457
|
+
collection6_enc.encode(state, record)
|
|
458
|
+
return state.buffer
|
|
459
|
+
},
|
|
460
|
+
trigger: null,
|
|
461
|
+
reconstruct: collection6_reconstruct,
|
|
462
|
+
reconstructKey: collection6_reconstruct_key,
|
|
463
|
+
indexes: [],
|
|
464
|
+
decodedVersion: 0
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const collections = [
|
|
468
|
+
collection0,
|
|
469
|
+
collection1,
|
|
470
|
+
collection2,
|
|
471
|
+
collection3,
|
|
472
|
+
collection5,
|
|
473
|
+
collection6
|
|
474
|
+
]
|
|
475
|
+
|
|
476
|
+
const indexes = [
|
|
477
|
+
index4
|
|
478
|
+
]
|
|
392
479
|
|
|
393
480
|
module.exports = { versions, collections, indexes, resolveCollection, resolveIndex }
|
|
394
481
|
|
|
395
|
-
function resolveCollection(name) {
|
|
482
|
+
function resolveCollection (name) {
|
|
396
483
|
switch (name) {
|
|
397
|
-
case '@gip/repos':
|
|
398
|
-
|
|
399
|
-
case '@gip/
|
|
400
|
-
|
|
401
|
-
case '@gip/
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
return collection3
|
|
405
|
-
case '@gip/head':
|
|
406
|
-
return collection5
|
|
407
|
-
default:
|
|
408
|
-
return null
|
|
484
|
+
case '@gip/repos': return collection0
|
|
485
|
+
case '@gip/branches': return collection1
|
|
486
|
+
case '@gip/files': return collection2
|
|
487
|
+
case '@gip/objects': return collection3
|
|
488
|
+
case '@gip/head': return collection5
|
|
489
|
+
case '@gip/tags': return collection6
|
|
490
|
+
default: return null
|
|
409
491
|
}
|
|
410
492
|
}
|
|
411
493
|
|
|
412
|
-
function resolveIndex(name) {
|
|
494
|
+
function resolveIndex (name) {
|
|
413
495
|
switch (name) {
|
|
414
|
-
case '@gip/files-by-branch':
|
|
415
|
-
|
|
416
|
-
default:
|
|
417
|
-
return null
|
|
496
|
+
case '@gip/files-by-branch': return index4
|
|
497
|
+
default: return null
|
|
418
498
|
}
|
|
419
499
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 3
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
/* eslint-disable quotes */
|
|
5
5
|
/* eslint-disable space-before-function-paren */
|
|
6
6
|
|
|
7
7
|
const { c } = require('hyperschema/runtime')
|
|
8
8
|
|
|
9
|
-
const VERSION =
|
|
9
|
+
const VERSION = 3
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line no-unused-vars
|
|
12
12
|
let version = VERSION
|
|
@@ -151,10 +151,10 @@ const encoding3_enum = {
|
|
|
151
151
|
|
|
152
152
|
// @gip/object-type enum
|
|
153
153
|
const encoding3 = {
|
|
154
|
-
preencode(state, m) {
|
|
154
|
+
preencode (state, m) {
|
|
155
155
|
state.end++ // max enum is 4 so always one byte
|
|
156
156
|
},
|
|
157
|
-
encode(state, m) {
|
|
157
|
+
encode (state, m) {
|
|
158
158
|
switch (m) {
|
|
159
159
|
case 'blob':
|
|
160
160
|
c.uint.encode(state, 1)
|
|
@@ -172,7 +172,7 @@ const encoding3 = {
|
|
|
172
172
|
throw new Error('Unknown enum')
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
|
-
decode(state) {
|
|
175
|
+
decode (state) {
|
|
176
176
|
switch (c.uint.decode(state)) {
|
|
177
177
|
case 1:
|
|
178
178
|
return 'blob'
|
|
@@ -182,8 +182,7 @@ const encoding3 = {
|
|
|
182
182
|
return 'commit'
|
|
183
183
|
case 4:
|
|
184
184
|
return 'tag'
|
|
185
|
-
default:
|
|
186
|
-
return null
|
|
185
|
+
default: return null
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
}
|
|
@@ -234,8 +233,63 @@ const encoding5 = {
|
|
|
234
233
|
}
|
|
235
234
|
}
|
|
236
235
|
|
|
237
|
-
// @gip/
|
|
236
|
+
// @gip/tags.objects
|
|
237
|
+
const encoding6_7 = encoding1_6
|
|
238
|
+
|
|
239
|
+
// @gip/tags
|
|
238
240
|
const encoding6 = {
|
|
241
|
+
preencode(state, m) {
|
|
242
|
+
c.string.preencode(state, m.name)
|
|
243
|
+
c.string.preencode(state, m.oid)
|
|
244
|
+
c.string.preencode(state, m.commitOid)
|
|
245
|
+
c.string.preencode(state, m.treeOid)
|
|
246
|
+
state.end++ // flags are fixed size
|
|
247
|
+
|
|
248
|
+
if (version >= 3 && m.tagger) c.string.preencode(state, m.tagger)
|
|
249
|
+
if (version >= 3 && m.message) c.string.preencode(state, m.message)
|
|
250
|
+
if (version >= 3 && m.timestamp) c.uint.preencode(state, m.timestamp)
|
|
251
|
+
if (version >= 3 && m.objects) encoding6_7.preencode(state, m.objects)
|
|
252
|
+
},
|
|
253
|
+
encode(state, m) {
|
|
254
|
+
const flags =
|
|
255
|
+
((version >= 3 && m.tagger) ? 1 : 0) |
|
|
256
|
+
((version >= 3 && m.message) ? 2 : 0) |
|
|
257
|
+
((version >= 3 && m.timestamp) ? 4 : 0) |
|
|
258
|
+
((version >= 3 && m.objects) ? 8 : 0)
|
|
259
|
+
|
|
260
|
+
c.string.encode(state, m.name)
|
|
261
|
+
c.string.encode(state, m.oid)
|
|
262
|
+
c.string.encode(state, m.commitOid)
|
|
263
|
+
c.string.encode(state, m.treeOid)
|
|
264
|
+
c.uint8.encode(state, flags)
|
|
265
|
+
|
|
266
|
+
if (version >= 3 && m.tagger) c.string.encode(state, m.tagger)
|
|
267
|
+
if (version >= 3 && m.message) c.string.encode(state, m.message)
|
|
268
|
+
if (version >= 3 && m.timestamp) c.uint.encode(state, m.timestamp)
|
|
269
|
+
if (version >= 3 && m.objects) encoding6_7.encode(state, m.objects)
|
|
270
|
+
},
|
|
271
|
+
decode(state) {
|
|
272
|
+
const r0 = c.string.decode(state)
|
|
273
|
+
const r1 = c.string.decode(state)
|
|
274
|
+
const r2 = c.string.decode(state)
|
|
275
|
+
const r3 = c.string.decode(state)
|
|
276
|
+
const flags = c.uint8.decode(state)
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
name: r0,
|
|
280
|
+
oid: r1,
|
|
281
|
+
commitOid: r2,
|
|
282
|
+
treeOid: r3,
|
|
283
|
+
tagger: (version >= 3 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
284
|
+
message: (version >= 3 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
285
|
+
timestamp: (version >= 3 && (flags & 4) !== 0) ? c.uint.decode(state) : 0,
|
|
286
|
+
objects: (version >= 3 && (flags & 8) !== 0) ? encoding6_7.decode(state) : null
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// @gip/repos/hyperdb#0
|
|
292
|
+
const encoding7 = {
|
|
239
293
|
preencode(state, m) {
|
|
240
294
|
c.buffer.preencode(state, m.key)
|
|
241
295
|
state.end++ // flags are fixed size
|
|
@@ -266,10 +320,10 @@ const encoding6 = {
|
|
|
266
320
|
}
|
|
267
321
|
|
|
268
322
|
// @gip/branches/hyperdb#1.objects
|
|
269
|
-
const
|
|
323
|
+
const encoding8_6 = encoding1_6
|
|
270
324
|
|
|
271
325
|
// @gip/branches/hyperdb#1
|
|
272
|
-
const
|
|
326
|
+
const encoding8 = {
|
|
273
327
|
preencode(state, m) {
|
|
274
328
|
c.string.preencode(state, m.commitOid)
|
|
275
329
|
c.string.preencode(state, m.treeOid)
|
|
@@ -278,7 +332,7 @@ const encoding7 = {
|
|
|
278
332
|
if (m.author) c.string.preencode(state, m.author)
|
|
279
333
|
if (m.message) c.string.preencode(state, m.message)
|
|
280
334
|
if (m.timestamp) c.uint.preencode(state, m.timestamp)
|
|
281
|
-
if (m.objects)
|
|
335
|
+
if (m.objects) encoding8_6.preencode(state, m.objects)
|
|
282
336
|
},
|
|
283
337
|
encode(state, m) {
|
|
284
338
|
const flags =
|
|
@@ -291,7 +345,7 @@ const encoding7 = {
|
|
|
291
345
|
if (m.author) c.string.encode(state, m.author)
|
|
292
346
|
if (m.message) c.string.encode(state, m.message)
|
|
293
347
|
if (m.timestamp) c.uint.encode(state, m.timestamp)
|
|
294
|
-
if (m.objects)
|
|
348
|
+
if (m.objects) encoding8_6.encode(state, m.objects)
|
|
295
349
|
},
|
|
296
350
|
decode(state) {
|
|
297
351
|
const r1 = c.string.decode(state)
|
|
@@ -305,13 +359,13 @@ const encoding7 = {
|
|
|
305
359
|
author: (flags & 1) !== 0 ? c.string.decode(state) : null,
|
|
306
360
|
message: (flags & 2) !== 0 ? c.string.decode(state) : null,
|
|
307
361
|
timestamp: (flags & 4) !== 0 ? c.uint.decode(state) : 0,
|
|
308
|
-
objects: (flags & 8) !== 0 ?
|
|
362
|
+
objects: (flags & 8) !== 0 ? encoding8_6.decode(state) : null
|
|
309
363
|
}
|
|
310
364
|
}
|
|
311
365
|
}
|
|
312
366
|
|
|
313
367
|
// @gip/files/hyperdb#2
|
|
314
|
-
const
|
|
368
|
+
const encoding9 = {
|
|
315
369
|
preencode(state, m) {
|
|
316
370
|
c.string.preencode(state, m.oid)
|
|
317
371
|
c.string.preencode(state, m.mode)
|
|
@@ -354,7 +408,7 @@ const encoding8 = {
|
|
|
354
408
|
}
|
|
355
409
|
|
|
356
410
|
// @gip/objects/hyperdb#3
|
|
357
|
-
const
|
|
411
|
+
const encoding10 = {
|
|
358
412
|
preencode(state, m) {
|
|
359
413
|
encoding3.preencode(state, m.type)
|
|
360
414
|
c.uint.preencode(state, m.size)
|
|
@@ -379,6 +433,58 @@ const encoding9 = {
|
|
|
379
433
|
}
|
|
380
434
|
}
|
|
381
435
|
|
|
436
|
+
// @gip/tags/hyperdb#6.objects
|
|
437
|
+
const encoding11_7 = encoding1_6
|
|
438
|
+
|
|
439
|
+
// @gip/tags/hyperdb#6
|
|
440
|
+
const encoding11 = {
|
|
441
|
+
preencode(state, m) {
|
|
442
|
+
c.string.preencode(state, m.oid)
|
|
443
|
+
c.string.preencode(state, m.commitOid)
|
|
444
|
+
c.string.preencode(state, m.treeOid)
|
|
445
|
+
state.end++ // flags are fixed size
|
|
446
|
+
|
|
447
|
+
if (version >= 3 && m.tagger) c.string.preencode(state, m.tagger)
|
|
448
|
+
if (version >= 3 && m.message) c.string.preencode(state, m.message)
|
|
449
|
+
if (version >= 3 && m.timestamp) c.uint.preencode(state, m.timestamp)
|
|
450
|
+
if (version >= 3 && m.objects) encoding11_7.preencode(state, m.objects)
|
|
451
|
+
},
|
|
452
|
+
encode(state, m) {
|
|
453
|
+
const flags =
|
|
454
|
+
((version >= 3 && m.tagger) ? 1 : 0) |
|
|
455
|
+
((version >= 3 && m.message) ? 2 : 0) |
|
|
456
|
+
((version >= 3 && m.timestamp) ? 4 : 0) |
|
|
457
|
+
((version >= 3 && m.objects) ? 8 : 0)
|
|
458
|
+
|
|
459
|
+
c.string.encode(state, m.oid)
|
|
460
|
+
c.string.encode(state, m.commitOid)
|
|
461
|
+
c.string.encode(state, m.treeOid)
|
|
462
|
+
c.uint8.encode(state, flags)
|
|
463
|
+
|
|
464
|
+
if (version >= 3 && m.tagger) c.string.encode(state, m.tagger)
|
|
465
|
+
if (version >= 3 && m.message) c.string.encode(state, m.message)
|
|
466
|
+
if (version >= 3 && m.timestamp) c.uint.encode(state, m.timestamp)
|
|
467
|
+
if (version >= 3 && m.objects) encoding11_7.encode(state, m.objects)
|
|
468
|
+
},
|
|
469
|
+
decode(state) {
|
|
470
|
+
const r1 = c.string.decode(state)
|
|
471
|
+
const r2 = c.string.decode(state)
|
|
472
|
+
const r3 = c.string.decode(state)
|
|
473
|
+
const flags = c.uint8.decode(state)
|
|
474
|
+
|
|
475
|
+
return {
|
|
476
|
+
name: null,
|
|
477
|
+
oid: r1,
|
|
478
|
+
commitOid: r2,
|
|
479
|
+
treeOid: r3,
|
|
480
|
+
tagger: (version >= 3 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
481
|
+
message: (version >= 3 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
482
|
+
timestamp: (version >= 3 && (flags & 4) !== 0) ? c.uint.decode(state) : 0,
|
|
483
|
+
objects: (version >= 3 && (flags & 8) !== 0) ? encoding11_7.decode(state) : null
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
382
488
|
function setVersion(v) {
|
|
383
489
|
version = v
|
|
384
490
|
}
|
|
@@ -416,14 +522,18 @@ function getEncoding(name) {
|
|
|
416
522
|
return encoding4
|
|
417
523
|
case '@gip/head':
|
|
418
524
|
return encoding5
|
|
419
|
-
case '@gip/
|
|
525
|
+
case '@gip/tags':
|
|
420
526
|
return encoding6
|
|
421
|
-
case '@gip/
|
|
527
|
+
case '@gip/repos/hyperdb#0':
|
|
422
528
|
return encoding7
|
|
423
|
-
case '@gip/
|
|
529
|
+
case '@gip/branches/hyperdb#1':
|
|
424
530
|
return encoding8
|
|
425
|
-
case '@gip/
|
|
531
|
+
case '@gip/files/hyperdb#2':
|
|
426
532
|
return encoding9
|
|
533
|
+
case '@gip/objects/hyperdb#3':
|
|
534
|
+
return encoding10
|
|
535
|
+
case '@gip/tags/hyperdb#6':
|
|
536
|
+
return encoding11
|
|
427
537
|
default:
|
|
428
538
|
throw new Error('Encoder not found ' + name)
|
|
429
539
|
}
|