@tinyshed/tinystore 0.1.0-rc.7 → 0.1.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/README.md +2 -2
- package/dist/blobs.d.ts +1 -1
- package/dist/blobs.js +13 -5
- package/dist/cancel.d.ts +16 -2
- package/dist/cancel.js +36 -2
- package/dist/channels.js +20 -6
- package/dist/config.d.ts +49 -1
- package/dist/config.js +86 -7
- package/dist/connection.d.ts +52 -10
- package/dist/connection.js +305 -73
- package/dist/handles.d.ts +10 -1
- package/dist/handles.js +27 -4
- package/dist/index.d.ts +4 -4
- package/dist/jobs.d.ts +33 -1
- package/dist/jobs.js +45 -0
- package/dist/logger.d.ts +22 -10
- package/dist/logger.js +118 -28
- package/dist/metrics.d.ts +19 -0
- package/dist/metrics.js +22 -1
- package/dist/query.js +33 -9
- package/dist/records.d.ts +30 -2
- package/dist/records.js +8 -0
- package/dist/runtime/addon.js +3 -2
- package/dist/runtime/bun.js +33 -12
- package/dist/runtime/node.js +30 -8
- package/dist/runtime/pipe.d.ts +2 -0
- package/dist/runtime/pipe.js +45 -20
- package/dist/runtime/shared.d.ts +28 -4
- package/dist/runtime/shared.js +125 -13
- package/dist/runtime.d.ts +28 -6
- package/dist/session.d.ts +9 -5
- package/dist/session.js +113 -31
- package/dist/sql.d.ts +18 -5
- package/dist/sql.js +44 -11
- package/dist/store.d.ts +25 -11
- package/dist/store.js +67 -9
- package/dist/wire/codec.d.ts +5 -0
- package/dist/wire/codec.js +10 -0
- package/dist/wire/frame.d.ts +2 -0
- package/dist/wire/frame.js +4 -0
- package/dist/wire/msgpack.d.ts +7 -3
- package/dist/wire/msgpack.js +11 -4
- package/dist/wire/protocol.d.ts +246 -36
- package/dist/wire/protocol.js +387 -101
- package/package.json +9 -8
- package/src/blobs.ts +13 -5
- package/src/cancel.ts +44 -2
- package/src/channels.ts +21 -6
- package/src/config.ts +138 -12
- package/src/connection.ts +377 -77
- package/src/handles.ts +32 -4
- package/src/index.ts +5 -0
- package/src/jobs.ts +63 -0
- package/src/logger.ts +158 -40
- package/src/metrics.ts +46 -1
- package/src/query.ts +33 -13
- package/src/records.ts +40 -2
- package/src/runtime/addon.ts +3 -2
- package/src/runtime/bun.ts +44 -9
- package/src/runtime/node.ts +30 -5
- package/src/runtime/pipe.ts +49 -19
- package/src/runtime/shared.ts +137 -16
- package/src/runtime.ts +31 -6
- package/src/session.ts +129 -30
- package/src/sql.ts +48 -14
- package/src/store.ts +81 -14
- package/src/wire/codec.ts +11 -0
- package/src/wire/frame.ts +5 -0
- package/src/wire/msgpack.ts +11 -4
- package/src/wire/protocol.ts +404 -103
package/src/wire/protocol.ts
CHANGED
|
@@ -118,6 +118,7 @@ export const methods = {
|
|
|
118
118
|
'metrics.delete': 0x060c,
|
|
119
119
|
'metrics.flush': 0x060d,
|
|
120
120
|
'metrics.instruments': 0x060e,
|
|
121
|
+
'metrics.ingestPrometheus': 0x060f,
|
|
121
122
|
'records.open': 0x0501,
|
|
122
123
|
'records.append': 0x0502,
|
|
123
124
|
'records.list': 0x0503,
|
|
@@ -1714,78 +1715,124 @@ export const ConfigOpen = message(
|
|
|
1714
1715
|
)
|
|
1715
1716
|
|
|
1716
1717
|
/**
|
|
1717
|
-
*
|
|
1718
|
+
* Where a value came from: its kind, and only the fields that kind names.
|
|
1718
1719
|
*/
|
|
1719
|
-
export const
|
|
1720
|
-
'config.
|
|
1720
|
+
export const ConfigOrigin = message(
|
|
1721
|
+
'config.Origin',
|
|
1721
1722
|
{
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
/**
|
|
1727
|
-
|
|
1723
|
+
/** declaration, layer, file, env or change */
|
|
1724
|
+
kind: [1, str],
|
|
1725
|
+
/** a layer's place in the list, the declaration 1 */
|
|
1726
|
+
place: [2, uint],
|
|
1727
|
+
/** a file's path */
|
|
1728
|
+
path: [3, str],
|
|
1729
|
+
/** an env's variable */
|
|
1730
|
+
variable: [4, str],
|
|
1731
|
+
/** the .env file that set the variable */
|
|
1732
|
+
dotenv: [5, str],
|
|
1733
|
+
/** the file a NAME_FILE variable named */
|
|
1734
|
+
file: [6, str],
|
|
1735
|
+
/** a change's version */
|
|
1736
|
+
version: [7, int],
|
|
1737
|
+
/** when a change was made */
|
|
1738
|
+
at: [8, int],
|
|
1728
1739
|
},
|
|
1729
1740
|
{
|
|
1730
1741
|
write(w, v) {
|
|
1731
1742
|
const head = w.openMap()
|
|
1732
1743
|
let n = 0
|
|
1733
|
-
if (v.
|
|
1744
|
+
if (v.kind !== undefined) {
|
|
1734
1745
|
w.field(1)
|
|
1735
|
-
w.str(v.
|
|
1746
|
+
w.str(v.kind)
|
|
1736
1747
|
n++
|
|
1737
1748
|
}
|
|
1738
|
-
if (v.
|
|
1749
|
+
if (v.place !== undefined) {
|
|
1739
1750
|
w.field(2)
|
|
1740
|
-
w.
|
|
1751
|
+
w.uint(v.place)
|
|
1741
1752
|
n++
|
|
1742
1753
|
}
|
|
1743
|
-
if (v.
|
|
1754
|
+
if (v.path !== undefined) {
|
|
1744
1755
|
w.field(3)
|
|
1745
|
-
w.str(v.
|
|
1756
|
+
w.str(v.path)
|
|
1746
1757
|
n++
|
|
1747
1758
|
}
|
|
1748
|
-
if (v.
|
|
1759
|
+
if (v.variable !== undefined) {
|
|
1749
1760
|
w.field(4)
|
|
1750
|
-
w.
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1761
|
+
w.str(v.variable)
|
|
1762
|
+
n++
|
|
1763
|
+
}
|
|
1764
|
+
if (v.dotenv !== undefined) {
|
|
1765
|
+
w.field(5)
|
|
1766
|
+
w.str(v.dotenv)
|
|
1767
|
+
n++
|
|
1768
|
+
}
|
|
1769
|
+
if (v.file !== undefined) {
|
|
1770
|
+
w.field(6)
|
|
1771
|
+
w.str(v.file)
|
|
1772
|
+
n++
|
|
1773
|
+
}
|
|
1774
|
+
if (v.version !== undefined) {
|
|
1775
|
+
w.field(7)
|
|
1776
|
+
w.int(v.version)
|
|
1777
|
+
n++
|
|
1778
|
+
}
|
|
1779
|
+
if (v.at !== undefined) {
|
|
1780
|
+
w.field(8)
|
|
1781
|
+
w.int(v.at)
|
|
1754
1782
|
n++
|
|
1755
1783
|
}
|
|
1756
1784
|
w.closeMap(head, n)
|
|
1757
1785
|
},
|
|
1758
1786
|
read(r) {
|
|
1787
|
+
let $kind: string | undefined
|
|
1788
|
+
let $place: number | undefined
|
|
1759
1789
|
let $path: string | undefined
|
|
1760
|
-
let $
|
|
1761
|
-
let $
|
|
1762
|
-
let $
|
|
1790
|
+
let $variable: string | undefined
|
|
1791
|
+
let $dotenv: string | undefined
|
|
1792
|
+
let $file: string | undefined
|
|
1793
|
+
let $version: number | undefined
|
|
1794
|
+
let $at: number | undefined
|
|
1763
1795
|
for (let n = r.message(); n > 0; n--) {
|
|
1764
1796
|
switch (r.field()) {
|
|
1765
1797
|
case 1:
|
|
1766
|
-
$
|
|
1798
|
+
$kind = r.str()
|
|
1767
1799
|
break
|
|
1768
1800
|
case 2:
|
|
1769
|
-
$
|
|
1801
|
+
$place = r.uint()
|
|
1770
1802
|
break
|
|
1771
1803
|
case 3:
|
|
1772
|
-
$
|
|
1804
|
+
$path = r.str()
|
|
1773
1805
|
break
|
|
1774
|
-
case 4:
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1806
|
+
case 4:
|
|
1807
|
+
$variable = r.str()
|
|
1808
|
+
break
|
|
1809
|
+
case 5:
|
|
1810
|
+
$dotenv = r.str()
|
|
1811
|
+
break
|
|
1812
|
+
case 6:
|
|
1813
|
+
$file = r.str()
|
|
1814
|
+
break
|
|
1815
|
+
case 7:
|
|
1816
|
+
$version = r.int()
|
|
1817
|
+
break
|
|
1818
|
+
case 8:
|
|
1819
|
+
$at = r.int()
|
|
1781
1820
|
break
|
|
1782
|
-
}
|
|
1783
1821
|
default:
|
|
1784
1822
|
r.skip()
|
|
1785
1823
|
}
|
|
1786
1824
|
}
|
|
1787
1825
|
r.leave()
|
|
1788
|
-
return {
|
|
1826
|
+
return {
|
|
1827
|
+
kind: $kind,
|
|
1828
|
+
place: $place,
|
|
1829
|
+
path: $path,
|
|
1830
|
+
variable: $variable,
|
|
1831
|
+
dotenv: $dotenv,
|
|
1832
|
+
file: $file,
|
|
1833
|
+
version: $version,
|
|
1834
|
+
at: $at,
|
|
1835
|
+
}
|
|
1789
1836
|
},
|
|
1790
1837
|
},
|
|
1791
1838
|
)
|
|
@@ -2209,6 +2256,8 @@ export const StoreOptions = message(
|
|
|
2209
2256
|
selfMetrics: [13, bool],
|
|
2210
2257
|
/** with selfMetrics, leaves out the machine it runs on: its process's memory and processor, the system's */
|
|
2211
2258
|
withoutSystem: [14, bool],
|
|
2259
|
+
/** the metrics series the store holds at most; 100,000 when absent */
|
|
2260
|
+
maxSeries: [15, uint],
|
|
2212
2261
|
},
|
|
2213
2262
|
{
|
|
2214
2263
|
write(w, v) {
|
|
@@ -2293,6 +2342,11 @@ export const StoreOptions = message(
|
|
|
2293
2342
|
w.bool(v.withoutSystem)
|
|
2294
2343
|
n++
|
|
2295
2344
|
}
|
|
2345
|
+
if (v.maxSeries !== undefined) {
|
|
2346
|
+
w.field(15)
|
|
2347
|
+
w.uint(v.maxSeries)
|
|
2348
|
+
n++
|
|
2349
|
+
}
|
|
2296
2350
|
w.closeMap(head, n)
|
|
2297
2351
|
},
|
|
2298
2352
|
read(r) {
|
|
@@ -2310,6 +2364,7 @@ export const StoreOptions = message(
|
|
|
2310
2364
|
let $insecure: boolean | undefined
|
|
2311
2365
|
let $selfMetrics: boolean | undefined
|
|
2312
2366
|
let $withoutSystem: boolean | undefined
|
|
2367
|
+
let $maxSeries: number | undefined
|
|
2313
2368
|
for (let n = r.message(); n > 0; n--) {
|
|
2314
2369
|
switch (r.field()) {
|
|
2315
2370
|
case 1:
|
|
@@ -2372,6 +2427,9 @@ export const StoreOptions = message(
|
|
|
2372
2427
|
case 14:
|
|
2373
2428
|
$withoutSystem = r.bool()
|
|
2374
2429
|
break
|
|
2430
|
+
case 15:
|
|
2431
|
+
$maxSeries = r.uint()
|
|
2432
|
+
break
|
|
2375
2433
|
default:
|
|
2376
2434
|
r.skip()
|
|
2377
2435
|
}
|
|
@@ -2392,6 +2450,7 @@ export const StoreOptions = message(
|
|
|
2392
2450
|
insecure: $insecure,
|
|
2393
2451
|
selfMetrics: $selfMetrics,
|
|
2394
2452
|
withoutSystem: $withoutSystem,
|
|
2453
|
+
maxSeries: $maxSeries,
|
|
2395
2454
|
}
|
|
2396
2455
|
},
|
|
2397
2456
|
},
|
|
@@ -6427,7 +6486,7 @@ export const MetricsAggregates = message(
|
|
|
6427
6486
|
export const MetricsExceeds = message(
|
|
6428
6487
|
'metrics.Exceeds',
|
|
6429
6488
|
{
|
|
6430
|
-
/** series, bytes read
|
|
6489
|
+
/** series, bytes read, samples decoded or answer */
|
|
6431
6490
|
limit: [1, str],
|
|
6432
6491
|
wanted: [2, uint],
|
|
6433
6492
|
bound: [3, uint],
|
|
@@ -6620,6 +6679,76 @@ export const MetricsIngest = message(
|
|
|
6620
6679
|
},
|
|
6621
6680
|
)
|
|
6622
6681
|
|
|
6682
|
+
/**
|
|
6683
|
+
* A text an exporter serves, in Prometheus' format or OpenMetrics', whose
|
|
6684
|
+
* series the store writes every one or none, each with labels beside its own.
|
|
6685
|
+
*/
|
|
6686
|
+
export const MetricsExposition = message(
|
|
6687
|
+
'metrics.Exposition',
|
|
6688
|
+
{
|
|
6689
|
+
/** UTF-8, read a line at a time, so that an error names its line */
|
|
6690
|
+
text: [1, bin],
|
|
6691
|
+
labels: [2, names(str)],
|
|
6692
|
+
/** of a sample the text gives no time; now unless given */
|
|
6693
|
+
at: [3, int],
|
|
6694
|
+
/** how long each name of the text keeps its samples */
|
|
6695
|
+
keep: [4, uint],
|
|
6696
|
+
},
|
|
6697
|
+
{
|
|
6698
|
+
write(w, v) {
|
|
6699
|
+
const head = w.openMap()
|
|
6700
|
+
let n = 0
|
|
6701
|
+
if (v.text !== undefined) {
|
|
6702
|
+
w.field(1)
|
|
6703
|
+
w.bin(v.text)
|
|
6704
|
+
n++
|
|
6705
|
+
}
|
|
6706
|
+
if (v.labels !== undefined) {
|
|
6707
|
+
w.field(2)
|
|
6708
|
+
writeNames(w, v.labels, str.write)
|
|
6709
|
+
n++
|
|
6710
|
+
}
|
|
6711
|
+
if (v.at !== undefined) {
|
|
6712
|
+
w.field(3)
|
|
6713
|
+
w.int(v.at)
|
|
6714
|
+
n++
|
|
6715
|
+
}
|
|
6716
|
+
if (v.keep !== undefined) {
|
|
6717
|
+
w.field(4)
|
|
6718
|
+
w.uint(v.keep)
|
|
6719
|
+
n++
|
|
6720
|
+
}
|
|
6721
|
+
w.closeMap(head, n)
|
|
6722
|
+
},
|
|
6723
|
+
read(r) {
|
|
6724
|
+
let $text: Uint8Array | undefined
|
|
6725
|
+
let $labels: Record<string, string> | undefined
|
|
6726
|
+
let $at: number | undefined
|
|
6727
|
+
let $keep: number | undefined
|
|
6728
|
+
for (let n = r.message(); n > 0; n--) {
|
|
6729
|
+
switch (r.field()) {
|
|
6730
|
+
case 1:
|
|
6731
|
+
$text = r.bytes()
|
|
6732
|
+
break
|
|
6733
|
+
case 2:
|
|
6734
|
+
$labels = readNames(r, str.read)
|
|
6735
|
+
break
|
|
6736
|
+
case 3:
|
|
6737
|
+
$at = r.int()
|
|
6738
|
+
break
|
|
6739
|
+
case 4:
|
|
6740
|
+
$keep = r.uint()
|
|
6741
|
+
break
|
|
6742
|
+
default:
|
|
6743
|
+
r.skip()
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
r.leave()
|
|
6747
|
+
return { text: $text, labels: $labels, at: $at, keep: $keep }
|
|
6748
|
+
},
|
|
6749
|
+
},
|
|
6750
|
+
)
|
|
6751
|
+
|
|
6623
6752
|
/**
|
|
6624
6753
|
* A page of names, of a name's labels or of a label's values.
|
|
6625
6754
|
*/
|
|
@@ -10430,13 +10559,18 @@ export const SqlOpen = message(
|
|
|
10430
10559
|
)
|
|
10431
10560
|
|
|
10432
10561
|
/**
|
|
10433
|
-
* A statement's text and the values of its ?s, in order.
|
|
10562
|
+
* A statement's text and the values of its ?s, in order. In a batch it may
|
|
10563
|
+
* be a call of jobs on a queue kept in the database's file instead, jobs.add
|
|
10564
|
+
* with its request in body and no text, which commits with the batch's rows.
|
|
10434
10565
|
*/
|
|
10435
10566
|
export const SqlText = message(
|
|
10436
10567
|
'sql.Text',
|
|
10437
10568
|
{
|
|
10438
10569
|
text: [1, str],
|
|
10439
10570
|
values: [2, list(sqlValue)],
|
|
10571
|
+
/** in a batch, jobs.add: the call in body */
|
|
10572
|
+
method: [3, uint],
|
|
10573
|
+
body: [4, bin],
|
|
10440
10574
|
},
|
|
10441
10575
|
{
|
|
10442
10576
|
write(w, v) {
|
|
@@ -10455,11 +10589,23 @@ export const SqlText = message(
|
|
|
10455
10589
|
}
|
|
10456
10590
|
n++
|
|
10457
10591
|
}
|
|
10592
|
+
if (v.method !== undefined) {
|
|
10593
|
+
w.field(3)
|
|
10594
|
+
w.uint(v.method)
|
|
10595
|
+
n++
|
|
10596
|
+
}
|
|
10597
|
+
if (v.body !== undefined) {
|
|
10598
|
+
w.field(4)
|
|
10599
|
+
w.bin(v.body)
|
|
10600
|
+
n++
|
|
10601
|
+
}
|
|
10458
10602
|
w.closeMap(head, n)
|
|
10459
10603
|
},
|
|
10460
10604
|
read(r) {
|
|
10461
10605
|
let $text: string | undefined
|
|
10462
10606
|
let $values: (SqlValue | boolean)[] | undefined
|
|
10607
|
+
let $method: number | undefined
|
|
10608
|
+
let $body: Uint8Array | undefined
|
|
10463
10609
|
for (let n = r.message(); n > 0; n--) {
|
|
10464
10610
|
switch (r.field()) {
|
|
10465
10611
|
case 1:
|
|
@@ -10474,12 +10620,18 @@ export const SqlText = message(
|
|
|
10474
10620
|
$values = items0
|
|
10475
10621
|
break
|
|
10476
10622
|
}
|
|
10623
|
+
case 3:
|
|
10624
|
+
$method = r.uint()
|
|
10625
|
+
break
|
|
10626
|
+
case 4:
|
|
10627
|
+
$body = r.bytes()
|
|
10628
|
+
break
|
|
10477
10629
|
default:
|
|
10478
10630
|
r.skip()
|
|
10479
10631
|
}
|
|
10480
10632
|
}
|
|
10481
10633
|
r.leave()
|
|
10482
|
-
return { text: $text, values: $values }
|
|
10634
|
+
return { text: $text, values: $values, method: $method, body: $body }
|
|
10483
10635
|
},
|
|
10484
10636
|
},
|
|
10485
10637
|
)
|
|
@@ -10909,7 +11061,8 @@ export const SqlDone = message(
|
|
|
10909
11061
|
)
|
|
10910
11062
|
|
|
10911
11063
|
/**
|
|
10912
|
-
*
|
|
11064
|
+
* Writes known before they run, written as one in a shared commit: its
|
|
11065
|
+
* statements, and the adds of a queue kept in the database's file.
|
|
10913
11066
|
*/
|
|
10914
11067
|
export const SqlBatch = message(
|
|
10915
11068
|
'sql.Batch',
|
|
@@ -10963,6 +11116,10 @@ export const SqlBatch = message(
|
|
|
10963
11116
|
},
|
|
10964
11117
|
)
|
|
10965
11118
|
|
|
11119
|
+
/**
|
|
11120
|
+
* What each write of a batch did, in their order: a job's add changed one
|
|
11121
|
+
* job, or none when its id was taken.
|
|
11122
|
+
*/
|
|
10966
11123
|
export const SqlBatched = message(
|
|
10967
11124
|
'sql.Batched',
|
|
10968
11125
|
{
|
|
@@ -11276,98 +11433,48 @@ export const ChannelsBatch = message(
|
|
|
11276
11433
|
)
|
|
11277
11434
|
|
|
11278
11435
|
/**
|
|
11279
|
-
* A
|
|
11280
|
-
* value came from.
|
|
11436
|
+
* A value a setting was given, and where it came from.
|
|
11281
11437
|
*/
|
|
11282
|
-
export const
|
|
11283
|
-
'config.
|
|
11438
|
+
export const ConfigGiven = message(
|
|
11439
|
+
'config.Given',
|
|
11284
11440
|
{
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
value: [3, str],
|
|
11289
|
-
lines: [4, list(ConfigLine)],
|
|
11290
|
-
/** what was read and not used, each with why */
|
|
11291
|
-
notes: [5, list(str)],
|
|
11441
|
+
/** as JSON, a span spelled, a secret as *** */
|
|
11442
|
+
value: [1, str],
|
|
11443
|
+
from: [2, ConfigOrigin],
|
|
11292
11444
|
},
|
|
11293
11445
|
{
|
|
11294
11446
|
write(w, v) {
|
|
11295
11447
|
const head = w.openMap()
|
|
11296
11448
|
let n = 0
|
|
11297
|
-
if (v.handle !== undefined) {
|
|
11298
|
-
w.field(1)
|
|
11299
|
-
w.uint(v.handle)
|
|
11300
|
-
n++
|
|
11301
|
-
}
|
|
11302
|
-
if (v.version !== undefined) {
|
|
11303
|
-
w.field(2)
|
|
11304
|
-
w.int(v.version)
|
|
11305
|
-
n++
|
|
11306
|
-
}
|
|
11307
11449
|
if (v.value !== undefined) {
|
|
11308
|
-
w.field(
|
|
11450
|
+
w.field(1)
|
|
11309
11451
|
w.str(v.value)
|
|
11310
11452
|
n++
|
|
11311
11453
|
}
|
|
11312
|
-
if (v.
|
|
11313
|
-
w.field(
|
|
11314
|
-
|
|
11315
|
-
for (const item0 of v.lines) {
|
|
11316
|
-
ConfigLine.write(w, item0)
|
|
11317
|
-
}
|
|
11318
|
-
n++
|
|
11319
|
-
}
|
|
11320
|
-
if (v.notes !== undefined) {
|
|
11321
|
-
w.field(5)
|
|
11322
|
-
w.array(v.notes.length)
|
|
11323
|
-
for (const item0 of v.notes) {
|
|
11324
|
-
w.str(item0)
|
|
11325
|
-
}
|
|
11454
|
+
if (v.from !== undefined) {
|
|
11455
|
+
w.field(2)
|
|
11456
|
+
ConfigOrigin.write(w, v.from)
|
|
11326
11457
|
n++
|
|
11327
11458
|
}
|
|
11328
11459
|
w.closeMap(head, n)
|
|
11329
11460
|
},
|
|
11330
11461
|
read(r) {
|
|
11331
|
-
let $handle: number | undefined
|
|
11332
|
-
let $version: number | undefined
|
|
11333
11462
|
let $value: string | undefined
|
|
11334
|
-
let $
|
|
11335
|
-
let $notes: string[] | undefined
|
|
11463
|
+
let $from: Read<typeof ConfigOrigin.fields> | undefined
|
|
11336
11464
|
for (let n = r.message(); n > 0; n--) {
|
|
11337
11465
|
switch (r.field()) {
|
|
11338
11466
|
case 1:
|
|
11339
|
-
$handle = r.uint()
|
|
11340
|
-
break
|
|
11341
|
-
case 2:
|
|
11342
|
-
$version = r.int()
|
|
11343
|
-
break
|
|
11344
|
-
case 3:
|
|
11345
11467
|
$value = r.str()
|
|
11346
11468
|
break
|
|
11347
|
-
case
|
|
11348
|
-
|
|
11349
|
-
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11350
|
-
items0.push(ConfigLine.read(r))
|
|
11351
|
-
}
|
|
11352
|
-
r.leave()
|
|
11353
|
-
$lines = items0
|
|
11354
|
-
break
|
|
11355
|
-
}
|
|
11356
|
-
case 5: {
|
|
11357
|
-
const items0: string[] = []
|
|
11358
|
-
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11359
|
-
items0.push(r.str())
|
|
11360
|
-
}
|
|
11361
|
-
r.leave()
|
|
11362
|
-
$notes = items0
|
|
11469
|
+
case 2:
|
|
11470
|
+
$from = ConfigOrigin.read(r)
|
|
11363
11471
|
break
|
|
11364
|
-
}
|
|
11365
11472
|
default:
|
|
11366
11473
|
r.skip()
|
|
11367
11474
|
}
|
|
11368
11475
|
}
|
|
11369
11476
|
r.leave()
|
|
11370
|
-
return {
|
|
11477
|
+
return { value: $value, from: $from }
|
|
11371
11478
|
},
|
|
11372
11479
|
},
|
|
11373
11480
|
)
|
|
@@ -11707,3 +11814,197 @@ export const SearchSetMany = message(
|
|
|
11707
11814
|
},
|
|
11708
11815
|
},
|
|
11709
11816
|
)
|
|
11817
|
+
|
|
11818
|
+
/**
|
|
11819
|
+
* A setting's line of explain.
|
|
11820
|
+
*/
|
|
11821
|
+
export const ConfigLine = message(
|
|
11822
|
+
'config.Line',
|
|
11823
|
+
{
|
|
11824
|
+
path: [1, str],
|
|
11825
|
+
/** as JSON, a span spelled, a secret as *** */
|
|
11826
|
+
value: [2, str],
|
|
11827
|
+
from: [3, str],
|
|
11828
|
+
/** the values it went over, newest first */
|
|
11829
|
+
over: [4, list(str)],
|
|
11830
|
+
/** every value it was given, newest first: its own, then the ones it went over */
|
|
11831
|
+
given: [5, list(ConfigGiven)],
|
|
11832
|
+
},
|
|
11833
|
+
{
|
|
11834
|
+
write(w, v) {
|
|
11835
|
+
const head = w.openMap()
|
|
11836
|
+
let n = 0
|
|
11837
|
+
if (v.path !== undefined) {
|
|
11838
|
+
w.field(1)
|
|
11839
|
+
w.str(v.path)
|
|
11840
|
+
n++
|
|
11841
|
+
}
|
|
11842
|
+
if (v.value !== undefined) {
|
|
11843
|
+
w.field(2)
|
|
11844
|
+
w.str(v.value)
|
|
11845
|
+
n++
|
|
11846
|
+
}
|
|
11847
|
+
if (v.from !== undefined) {
|
|
11848
|
+
w.field(3)
|
|
11849
|
+
w.str(v.from)
|
|
11850
|
+
n++
|
|
11851
|
+
}
|
|
11852
|
+
if (v.over !== undefined) {
|
|
11853
|
+
w.field(4)
|
|
11854
|
+
w.array(v.over.length)
|
|
11855
|
+
for (const item0 of v.over) {
|
|
11856
|
+
w.str(item0)
|
|
11857
|
+
}
|
|
11858
|
+
n++
|
|
11859
|
+
}
|
|
11860
|
+
if (v.given !== undefined) {
|
|
11861
|
+
w.field(5)
|
|
11862
|
+
w.array(v.given.length)
|
|
11863
|
+
for (const item0 of v.given) {
|
|
11864
|
+
ConfigGiven.write(w, item0)
|
|
11865
|
+
}
|
|
11866
|
+
n++
|
|
11867
|
+
}
|
|
11868
|
+
w.closeMap(head, n)
|
|
11869
|
+
},
|
|
11870
|
+
read(r) {
|
|
11871
|
+
let $path: string | undefined
|
|
11872
|
+
let $value: string | undefined
|
|
11873
|
+
let $from: string | undefined
|
|
11874
|
+
let $over: string[] | undefined
|
|
11875
|
+
let $given: Read<typeof ConfigGiven.fields>[] | undefined
|
|
11876
|
+
for (let n = r.message(); n > 0; n--) {
|
|
11877
|
+
switch (r.field()) {
|
|
11878
|
+
case 1:
|
|
11879
|
+
$path = r.str()
|
|
11880
|
+
break
|
|
11881
|
+
case 2:
|
|
11882
|
+
$value = r.str()
|
|
11883
|
+
break
|
|
11884
|
+
case 3:
|
|
11885
|
+
$from = r.str()
|
|
11886
|
+
break
|
|
11887
|
+
case 4: {
|
|
11888
|
+
const items0: string[] = []
|
|
11889
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11890
|
+
items0.push(r.str())
|
|
11891
|
+
}
|
|
11892
|
+
r.leave()
|
|
11893
|
+
$over = items0
|
|
11894
|
+
break
|
|
11895
|
+
}
|
|
11896
|
+
case 5: {
|
|
11897
|
+
const items0: Read<typeof ConfigGiven.fields>[] = []
|
|
11898
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11899
|
+
items0.push(ConfigGiven.read(r))
|
|
11900
|
+
}
|
|
11901
|
+
r.leave()
|
|
11902
|
+
$given = items0
|
|
11903
|
+
break
|
|
11904
|
+
}
|
|
11905
|
+
default:
|
|
11906
|
+
r.skip()
|
|
11907
|
+
}
|
|
11908
|
+
}
|
|
11909
|
+
r.leave()
|
|
11910
|
+
return { path: $path, value: $value, from: $from, over: $over, given: $given }
|
|
11911
|
+
},
|
|
11912
|
+
},
|
|
11913
|
+
)
|
|
11914
|
+
|
|
11915
|
+
/**
|
|
11916
|
+
* A config's value at a version of its changes, and where each setting's
|
|
11917
|
+
* value came from.
|
|
11918
|
+
*/
|
|
11919
|
+
export const ConfigValue = message(
|
|
11920
|
+
'config.Value',
|
|
11921
|
+
{
|
|
11922
|
+
handle: [1, uint],
|
|
11923
|
+
version: [2, int],
|
|
11924
|
+
/** the settings, each span its milliseconds, each secret its text */
|
|
11925
|
+
value: [3, str],
|
|
11926
|
+
lines: [4, list(ConfigLine)],
|
|
11927
|
+
/** what was read and not used, each with why */
|
|
11928
|
+
notes: [5, list(str)],
|
|
11929
|
+
},
|
|
11930
|
+
{
|
|
11931
|
+
write(w, v) {
|
|
11932
|
+
const head = w.openMap()
|
|
11933
|
+
let n = 0
|
|
11934
|
+
if (v.handle !== undefined) {
|
|
11935
|
+
w.field(1)
|
|
11936
|
+
w.uint(v.handle)
|
|
11937
|
+
n++
|
|
11938
|
+
}
|
|
11939
|
+
if (v.version !== undefined) {
|
|
11940
|
+
w.field(2)
|
|
11941
|
+
w.int(v.version)
|
|
11942
|
+
n++
|
|
11943
|
+
}
|
|
11944
|
+
if (v.value !== undefined) {
|
|
11945
|
+
w.field(3)
|
|
11946
|
+
w.str(v.value)
|
|
11947
|
+
n++
|
|
11948
|
+
}
|
|
11949
|
+
if (v.lines !== undefined) {
|
|
11950
|
+
w.field(4)
|
|
11951
|
+
w.array(v.lines.length)
|
|
11952
|
+
for (const item0 of v.lines) {
|
|
11953
|
+
ConfigLine.write(w, item0)
|
|
11954
|
+
}
|
|
11955
|
+
n++
|
|
11956
|
+
}
|
|
11957
|
+
if (v.notes !== undefined) {
|
|
11958
|
+
w.field(5)
|
|
11959
|
+
w.array(v.notes.length)
|
|
11960
|
+
for (const item0 of v.notes) {
|
|
11961
|
+
w.str(item0)
|
|
11962
|
+
}
|
|
11963
|
+
n++
|
|
11964
|
+
}
|
|
11965
|
+
w.closeMap(head, n)
|
|
11966
|
+
},
|
|
11967
|
+
read(r) {
|
|
11968
|
+
let $handle: number | undefined
|
|
11969
|
+
let $version: number | undefined
|
|
11970
|
+
let $value: string | undefined
|
|
11971
|
+
let $lines: Read<typeof ConfigLine.fields>[] | undefined
|
|
11972
|
+
let $notes: string[] | undefined
|
|
11973
|
+
for (let n = r.message(); n > 0; n--) {
|
|
11974
|
+
switch (r.field()) {
|
|
11975
|
+
case 1:
|
|
11976
|
+
$handle = r.uint()
|
|
11977
|
+
break
|
|
11978
|
+
case 2:
|
|
11979
|
+
$version = r.int()
|
|
11980
|
+
break
|
|
11981
|
+
case 3:
|
|
11982
|
+
$value = r.str()
|
|
11983
|
+
break
|
|
11984
|
+
case 4: {
|
|
11985
|
+
const items0: Read<typeof ConfigLine.fields>[] = []
|
|
11986
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11987
|
+
items0.push(ConfigLine.read(r))
|
|
11988
|
+
}
|
|
11989
|
+
r.leave()
|
|
11990
|
+
$lines = items0
|
|
11991
|
+
break
|
|
11992
|
+
}
|
|
11993
|
+
case 5: {
|
|
11994
|
+
const items0: string[] = []
|
|
11995
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11996
|
+
items0.push(r.str())
|
|
11997
|
+
}
|
|
11998
|
+
r.leave()
|
|
11999
|
+
$notes = items0
|
|
12000
|
+
break
|
|
12001
|
+
}
|
|
12002
|
+
default:
|
|
12003
|
+
r.skip()
|
|
12004
|
+
}
|
|
12005
|
+
}
|
|
12006
|
+
r.leave()
|
|
12007
|
+
return { handle: $handle, version: $version, value: $value, lines: $lines, notes: $notes }
|
|
12008
|
+
},
|
|
12009
|
+
},
|
|
12010
|
+
)
|