@tinyshed/tinystore 0.1.0 → 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/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/dist/wire/protocol.js
CHANGED
|
@@ -97,6 +97,7 @@ export const methods = {
|
|
|
97
97
|
'metrics.delete': 0x060c,
|
|
98
98
|
'metrics.flush': 0x060d,
|
|
99
99
|
'metrics.instruments': 0x060e,
|
|
100
|
+
'metrics.ingestPrometheus': 0x060f,
|
|
100
101
|
'records.open': 0x0501,
|
|
101
102
|
'records.append': 0x0502,
|
|
102
103
|
'records.list': 0x0503,
|
|
@@ -1570,75 +1571,121 @@ export const ConfigOpen = message('config.Open', {
|
|
|
1570
1571
|
},
|
|
1571
1572
|
});
|
|
1572
1573
|
/**
|
|
1573
|
-
*
|
|
1574
|
+
* Where a value came from: its kind, and only the fields that kind names.
|
|
1574
1575
|
*/
|
|
1575
|
-
export const
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
/**
|
|
1581
|
-
|
|
1576
|
+
export const ConfigOrigin = message('config.Origin', {
|
|
1577
|
+
/** declaration, layer, file, env or change */
|
|
1578
|
+
kind: [1, str],
|
|
1579
|
+
/** a layer's place in the list, the declaration 1 */
|
|
1580
|
+
place: [2, uint],
|
|
1581
|
+
/** a file's path */
|
|
1582
|
+
path: [3, str],
|
|
1583
|
+
/** an env's variable */
|
|
1584
|
+
variable: [4, str],
|
|
1585
|
+
/** the .env file that set the variable */
|
|
1586
|
+
dotenv: [5, str],
|
|
1587
|
+
/** the file a NAME_FILE variable named */
|
|
1588
|
+
file: [6, str],
|
|
1589
|
+
/** a change's version */
|
|
1590
|
+
version: [7, int],
|
|
1591
|
+
/** when a change was made */
|
|
1592
|
+
at: [8, int],
|
|
1582
1593
|
}, {
|
|
1583
1594
|
write(w, v) {
|
|
1584
1595
|
const head = w.openMap();
|
|
1585
1596
|
let n = 0;
|
|
1586
|
-
if (v.
|
|
1597
|
+
if (v.kind !== undefined) {
|
|
1587
1598
|
w.field(1);
|
|
1588
|
-
w.str(v.
|
|
1599
|
+
w.str(v.kind);
|
|
1589
1600
|
n++;
|
|
1590
1601
|
}
|
|
1591
|
-
if (v.
|
|
1602
|
+
if (v.place !== undefined) {
|
|
1592
1603
|
w.field(2);
|
|
1593
|
-
w.
|
|
1604
|
+
w.uint(v.place);
|
|
1594
1605
|
n++;
|
|
1595
1606
|
}
|
|
1596
|
-
if (v.
|
|
1607
|
+
if (v.path !== undefined) {
|
|
1597
1608
|
w.field(3);
|
|
1598
|
-
w.str(v.
|
|
1609
|
+
w.str(v.path);
|
|
1599
1610
|
n++;
|
|
1600
1611
|
}
|
|
1601
|
-
if (v.
|
|
1612
|
+
if (v.variable !== undefined) {
|
|
1602
1613
|
w.field(4);
|
|
1603
|
-
w.
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1614
|
+
w.str(v.variable);
|
|
1615
|
+
n++;
|
|
1616
|
+
}
|
|
1617
|
+
if (v.dotenv !== undefined) {
|
|
1618
|
+
w.field(5);
|
|
1619
|
+
w.str(v.dotenv);
|
|
1620
|
+
n++;
|
|
1621
|
+
}
|
|
1622
|
+
if (v.file !== undefined) {
|
|
1623
|
+
w.field(6);
|
|
1624
|
+
w.str(v.file);
|
|
1625
|
+
n++;
|
|
1626
|
+
}
|
|
1627
|
+
if (v.version !== undefined) {
|
|
1628
|
+
w.field(7);
|
|
1629
|
+
w.int(v.version);
|
|
1630
|
+
n++;
|
|
1631
|
+
}
|
|
1632
|
+
if (v.at !== undefined) {
|
|
1633
|
+
w.field(8);
|
|
1634
|
+
w.int(v.at);
|
|
1607
1635
|
n++;
|
|
1608
1636
|
}
|
|
1609
1637
|
w.closeMap(head, n);
|
|
1610
1638
|
},
|
|
1611
1639
|
read(r) {
|
|
1640
|
+
let $kind;
|
|
1641
|
+
let $place;
|
|
1612
1642
|
let $path;
|
|
1613
|
-
let $
|
|
1614
|
-
let $
|
|
1615
|
-
let $
|
|
1643
|
+
let $variable;
|
|
1644
|
+
let $dotenv;
|
|
1645
|
+
let $file;
|
|
1646
|
+
let $version;
|
|
1647
|
+
let $at;
|
|
1616
1648
|
for (let n = r.message(); n > 0; n--) {
|
|
1617
1649
|
switch (r.field()) {
|
|
1618
1650
|
case 1:
|
|
1619
|
-
$
|
|
1651
|
+
$kind = r.str();
|
|
1620
1652
|
break;
|
|
1621
1653
|
case 2:
|
|
1622
|
-
$
|
|
1654
|
+
$place = r.uint();
|
|
1623
1655
|
break;
|
|
1624
1656
|
case 3:
|
|
1625
|
-
$
|
|
1657
|
+
$path = r.str();
|
|
1626
1658
|
break;
|
|
1627
|
-
case 4:
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1659
|
+
case 4:
|
|
1660
|
+
$variable = r.str();
|
|
1661
|
+
break;
|
|
1662
|
+
case 5:
|
|
1663
|
+
$dotenv = r.str();
|
|
1664
|
+
break;
|
|
1665
|
+
case 6:
|
|
1666
|
+
$file = r.str();
|
|
1667
|
+
break;
|
|
1668
|
+
case 7:
|
|
1669
|
+
$version = r.int();
|
|
1670
|
+
break;
|
|
1671
|
+
case 8:
|
|
1672
|
+
$at = r.int();
|
|
1634
1673
|
break;
|
|
1635
|
-
}
|
|
1636
1674
|
default:
|
|
1637
1675
|
r.skip();
|
|
1638
1676
|
}
|
|
1639
1677
|
}
|
|
1640
1678
|
r.leave();
|
|
1641
|
-
return {
|
|
1679
|
+
return {
|
|
1680
|
+
kind: $kind,
|
|
1681
|
+
place: $place,
|
|
1682
|
+
path: $path,
|
|
1683
|
+
variable: $variable,
|
|
1684
|
+
dotenv: $dotenv,
|
|
1685
|
+
file: $file,
|
|
1686
|
+
version: $version,
|
|
1687
|
+
at: $at,
|
|
1688
|
+
};
|
|
1642
1689
|
},
|
|
1643
1690
|
});
|
|
1644
1691
|
/**
|
|
@@ -2038,6 +2085,8 @@ export const StoreOptions = message('store.Options', {
|
|
|
2038
2085
|
selfMetrics: [13, bool],
|
|
2039
2086
|
/** with selfMetrics, leaves out the machine it runs on: its process's memory and processor, the system's */
|
|
2040
2087
|
withoutSystem: [14, bool],
|
|
2088
|
+
/** the metrics series the store holds at most; 100,000 when absent */
|
|
2089
|
+
maxSeries: [15, uint],
|
|
2041
2090
|
}, {
|
|
2042
2091
|
write(w, v) {
|
|
2043
2092
|
const head = w.openMap();
|
|
@@ -2121,6 +2170,11 @@ export const StoreOptions = message('store.Options', {
|
|
|
2121
2170
|
w.bool(v.withoutSystem);
|
|
2122
2171
|
n++;
|
|
2123
2172
|
}
|
|
2173
|
+
if (v.maxSeries !== undefined) {
|
|
2174
|
+
w.field(15);
|
|
2175
|
+
w.uint(v.maxSeries);
|
|
2176
|
+
n++;
|
|
2177
|
+
}
|
|
2124
2178
|
w.closeMap(head, n);
|
|
2125
2179
|
},
|
|
2126
2180
|
read(r) {
|
|
@@ -2138,6 +2192,7 @@ export const StoreOptions = message('store.Options', {
|
|
|
2138
2192
|
let $insecure;
|
|
2139
2193
|
let $selfMetrics;
|
|
2140
2194
|
let $withoutSystem;
|
|
2195
|
+
let $maxSeries;
|
|
2141
2196
|
for (let n = r.message(); n > 0; n--) {
|
|
2142
2197
|
switch (r.field()) {
|
|
2143
2198
|
case 1:
|
|
@@ -2200,6 +2255,9 @@ export const StoreOptions = message('store.Options', {
|
|
|
2200
2255
|
case 14:
|
|
2201
2256
|
$withoutSystem = r.bool();
|
|
2202
2257
|
break;
|
|
2258
|
+
case 15:
|
|
2259
|
+
$maxSeries = r.uint();
|
|
2260
|
+
break;
|
|
2203
2261
|
default:
|
|
2204
2262
|
r.skip();
|
|
2205
2263
|
}
|
|
@@ -2220,6 +2278,7 @@ export const StoreOptions = message('store.Options', {
|
|
|
2220
2278
|
insecure: $insecure,
|
|
2221
2279
|
selfMetrics: $selfMetrics,
|
|
2222
2280
|
withoutSystem: $withoutSystem,
|
|
2281
|
+
maxSeries: $maxSeries,
|
|
2223
2282
|
};
|
|
2224
2283
|
},
|
|
2225
2284
|
});
|
|
@@ -5956,7 +6015,7 @@ export const MetricsAggregates = message('metrics.Aggregates', {
|
|
|
5956
6015
|
},
|
|
5957
6016
|
});
|
|
5958
6017
|
export const MetricsExceeds = message('metrics.Exceeds', {
|
|
5959
|
-
/** series, bytes read
|
|
6018
|
+
/** series, bytes read, samples decoded or answer */
|
|
5960
6019
|
limit: [1, str],
|
|
5961
6020
|
wanted: [2, uint],
|
|
5962
6021
|
bound: [3, uint],
|
|
@@ -6136,6 +6195,71 @@ export const MetricsIngest = message('metrics.Ingest', {
|
|
|
6136
6195
|
return { series: $series };
|
|
6137
6196
|
},
|
|
6138
6197
|
});
|
|
6198
|
+
/**
|
|
6199
|
+
* A text an exporter serves, in Prometheus' format or OpenMetrics', whose
|
|
6200
|
+
* series the store writes every one or none, each with labels beside its own.
|
|
6201
|
+
*/
|
|
6202
|
+
export const MetricsExposition = message('metrics.Exposition', {
|
|
6203
|
+
/** UTF-8, read a line at a time, so that an error names its line */
|
|
6204
|
+
text: [1, bin],
|
|
6205
|
+
labels: [2, names(str)],
|
|
6206
|
+
/** of a sample the text gives no time; now unless given */
|
|
6207
|
+
at: [3, int],
|
|
6208
|
+
/** how long each name of the text keeps its samples */
|
|
6209
|
+
keep: [4, uint],
|
|
6210
|
+
}, {
|
|
6211
|
+
write(w, v) {
|
|
6212
|
+
const head = w.openMap();
|
|
6213
|
+
let n = 0;
|
|
6214
|
+
if (v.text !== undefined) {
|
|
6215
|
+
w.field(1);
|
|
6216
|
+
w.bin(v.text);
|
|
6217
|
+
n++;
|
|
6218
|
+
}
|
|
6219
|
+
if (v.labels !== undefined) {
|
|
6220
|
+
w.field(2);
|
|
6221
|
+
writeNames(w, v.labels, str.write);
|
|
6222
|
+
n++;
|
|
6223
|
+
}
|
|
6224
|
+
if (v.at !== undefined) {
|
|
6225
|
+
w.field(3);
|
|
6226
|
+
w.int(v.at);
|
|
6227
|
+
n++;
|
|
6228
|
+
}
|
|
6229
|
+
if (v.keep !== undefined) {
|
|
6230
|
+
w.field(4);
|
|
6231
|
+
w.uint(v.keep);
|
|
6232
|
+
n++;
|
|
6233
|
+
}
|
|
6234
|
+
w.closeMap(head, n);
|
|
6235
|
+
},
|
|
6236
|
+
read(r) {
|
|
6237
|
+
let $text;
|
|
6238
|
+
let $labels;
|
|
6239
|
+
let $at;
|
|
6240
|
+
let $keep;
|
|
6241
|
+
for (let n = r.message(); n > 0; n--) {
|
|
6242
|
+
switch (r.field()) {
|
|
6243
|
+
case 1:
|
|
6244
|
+
$text = r.bytes();
|
|
6245
|
+
break;
|
|
6246
|
+
case 2:
|
|
6247
|
+
$labels = readNames(r, str.read);
|
|
6248
|
+
break;
|
|
6249
|
+
case 3:
|
|
6250
|
+
$at = r.int();
|
|
6251
|
+
break;
|
|
6252
|
+
case 4:
|
|
6253
|
+
$keep = r.uint();
|
|
6254
|
+
break;
|
|
6255
|
+
default:
|
|
6256
|
+
r.skip();
|
|
6257
|
+
}
|
|
6258
|
+
}
|
|
6259
|
+
r.leave();
|
|
6260
|
+
return { text: $text, labels: $labels, at: $at, keep: $keep };
|
|
6261
|
+
},
|
|
6262
|
+
});
|
|
6139
6263
|
/**
|
|
6140
6264
|
* A page of names, of a name's labels or of a label's values.
|
|
6141
6265
|
*/
|
|
@@ -9651,11 +9775,16 @@ export const SqlOpen = message('sql.Open', {
|
|
|
9651
9775
|
},
|
|
9652
9776
|
});
|
|
9653
9777
|
/**
|
|
9654
|
-
* A statement's text and the values of its ?s, in order.
|
|
9778
|
+
* A statement's text and the values of its ?s, in order. In a batch it may
|
|
9779
|
+
* be a call of jobs on a queue kept in the database's file instead, jobs.add
|
|
9780
|
+
* with its request in body and no text, which commits with the batch's rows.
|
|
9655
9781
|
*/
|
|
9656
9782
|
export const SqlText = message('sql.Text', {
|
|
9657
9783
|
text: [1, str],
|
|
9658
9784
|
values: [2, list(sqlValue)],
|
|
9785
|
+
/** in a batch, jobs.add: the call in body */
|
|
9786
|
+
method: [3, uint],
|
|
9787
|
+
body: [4, bin],
|
|
9659
9788
|
}, {
|
|
9660
9789
|
write(w, v) {
|
|
9661
9790
|
const head = w.openMap();
|
|
@@ -9673,11 +9802,23 @@ export const SqlText = message('sql.Text', {
|
|
|
9673
9802
|
}
|
|
9674
9803
|
n++;
|
|
9675
9804
|
}
|
|
9805
|
+
if (v.method !== undefined) {
|
|
9806
|
+
w.field(3);
|
|
9807
|
+
w.uint(v.method);
|
|
9808
|
+
n++;
|
|
9809
|
+
}
|
|
9810
|
+
if (v.body !== undefined) {
|
|
9811
|
+
w.field(4);
|
|
9812
|
+
w.bin(v.body);
|
|
9813
|
+
n++;
|
|
9814
|
+
}
|
|
9676
9815
|
w.closeMap(head, n);
|
|
9677
9816
|
},
|
|
9678
9817
|
read(r) {
|
|
9679
9818
|
let $text;
|
|
9680
9819
|
let $values;
|
|
9820
|
+
let $method;
|
|
9821
|
+
let $body;
|
|
9681
9822
|
for (let n = r.message(); n > 0; n--) {
|
|
9682
9823
|
switch (r.field()) {
|
|
9683
9824
|
case 1:
|
|
@@ -9692,12 +9833,18 @@ export const SqlText = message('sql.Text', {
|
|
|
9692
9833
|
$values = items0;
|
|
9693
9834
|
break;
|
|
9694
9835
|
}
|
|
9836
|
+
case 3:
|
|
9837
|
+
$method = r.uint();
|
|
9838
|
+
break;
|
|
9839
|
+
case 4:
|
|
9840
|
+
$body = r.bytes();
|
|
9841
|
+
break;
|
|
9695
9842
|
default:
|
|
9696
9843
|
r.skip();
|
|
9697
9844
|
}
|
|
9698
9845
|
}
|
|
9699
9846
|
r.leave();
|
|
9700
|
-
return { text: $text, values: $values };
|
|
9847
|
+
return { text: $text, values: $values, method: $method, body: $body };
|
|
9701
9848
|
},
|
|
9702
9849
|
});
|
|
9703
9850
|
/**
|
|
@@ -10095,7 +10242,8 @@ export const SqlDone = message('sql.Done', {
|
|
|
10095
10242
|
},
|
|
10096
10243
|
});
|
|
10097
10244
|
/**
|
|
10098
|
-
*
|
|
10245
|
+
* Writes known before they run, written as one in a shared commit: its
|
|
10246
|
+
* statements, and the adds of a queue kept in the database's file.
|
|
10099
10247
|
*/
|
|
10100
10248
|
export const SqlBatch = message('sql.Batch', {
|
|
10101
10249
|
handle: [1, uint],
|
|
@@ -10144,6 +10292,10 @@ export const SqlBatch = message('sql.Batch', {
|
|
|
10144
10292
|
return { handle: $handle, statements: $statements };
|
|
10145
10293
|
},
|
|
10146
10294
|
});
|
|
10295
|
+
/**
|
|
10296
|
+
* What each write of a batch did, in their order: a job's add changed one
|
|
10297
|
+
* job, or none when its id was taken.
|
|
10298
|
+
*/
|
|
10147
10299
|
export const SqlBatched = message('sql.Batched', {
|
|
10148
10300
|
done: [1, list(SqlDone)],
|
|
10149
10301
|
}, {
|
|
@@ -10432,95 +10584,45 @@ export const ChannelsBatch = message('channels.Batch', {
|
|
|
10432
10584
|
},
|
|
10433
10585
|
});
|
|
10434
10586
|
/**
|
|
10435
|
-
* A
|
|
10436
|
-
* value came from.
|
|
10587
|
+
* A value a setting was given, and where it came from.
|
|
10437
10588
|
*/
|
|
10438
|
-
export const
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
value: [3, str],
|
|
10443
|
-
lines: [4, list(ConfigLine)],
|
|
10444
|
-
/** what was read and not used, each with why */
|
|
10445
|
-
notes: [5, list(str)],
|
|
10589
|
+
export const ConfigGiven = message('config.Given', {
|
|
10590
|
+
/** as JSON, a span spelled, a secret as *** */
|
|
10591
|
+
value: [1, str],
|
|
10592
|
+
from: [2, ConfigOrigin],
|
|
10446
10593
|
}, {
|
|
10447
10594
|
write(w, v) {
|
|
10448
10595
|
const head = w.openMap();
|
|
10449
10596
|
let n = 0;
|
|
10450
|
-
if (v.handle !== undefined) {
|
|
10451
|
-
w.field(1);
|
|
10452
|
-
w.uint(v.handle);
|
|
10453
|
-
n++;
|
|
10454
|
-
}
|
|
10455
|
-
if (v.version !== undefined) {
|
|
10456
|
-
w.field(2);
|
|
10457
|
-
w.int(v.version);
|
|
10458
|
-
n++;
|
|
10459
|
-
}
|
|
10460
10597
|
if (v.value !== undefined) {
|
|
10461
|
-
w.field(
|
|
10598
|
+
w.field(1);
|
|
10462
10599
|
w.str(v.value);
|
|
10463
10600
|
n++;
|
|
10464
10601
|
}
|
|
10465
|
-
if (v.
|
|
10466
|
-
w.field(
|
|
10467
|
-
|
|
10468
|
-
for (const item0 of v.lines) {
|
|
10469
|
-
ConfigLine.write(w, item0);
|
|
10470
|
-
}
|
|
10471
|
-
n++;
|
|
10472
|
-
}
|
|
10473
|
-
if (v.notes !== undefined) {
|
|
10474
|
-
w.field(5);
|
|
10475
|
-
w.array(v.notes.length);
|
|
10476
|
-
for (const item0 of v.notes) {
|
|
10477
|
-
w.str(item0);
|
|
10478
|
-
}
|
|
10602
|
+
if (v.from !== undefined) {
|
|
10603
|
+
w.field(2);
|
|
10604
|
+
ConfigOrigin.write(w, v.from);
|
|
10479
10605
|
n++;
|
|
10480
10606
|
}
|
|
10481
10607
|
w.closeMap(head, n);
|
|
10482
10608
|
},
|
|
10483
10609
|
read(r) {
|
|
10484
|
-
let $handle;
|
|
10485
|
-
let $version;
|
|
10486
10610
|
let $value;
|
|
10487
|
-
let $
|
|
10488
|
-
let $notes;
|
|
10611
|
+
let $from;
|
|
10489
10612
|
for (let n = r.message(); n > 0; n--) {
|
|
10490
10613
|
switch (r.field()) {
|
|
10491
10614
|
case 1:
|
|
10492
|
-
$handle = r.uint();
|
|
10493
|
-
break;
|
|
10494
|
-
case 2:
|
|
10495
|
-
$version = r.int();
|
|
10496
|
-
break;
|
|
10497
|
-
case 3:
|
|
10498
10615
|
$value = r.str();
|
|
10499
10616
|
break;
|
|
10500
|
-
case
|
|
10501
|
-
|
|
10502
|
-
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
10503
|
-
items0.push(ConfigLine.read(r));
|
|
10504
|
-
}
|
|
10505
|
-
r.leave();
|
|
10506
|
-
$lines = items0;
|
|
10507
|
-
break;
|
|
10508
|
-
}
|
|
10509
|
-
case 5: {
|
|
10510
|
-
const items0 = [];
|
|
10511
|
-
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
10512
|
-
items0.push(r.str());
|
|
10513
|
-
}
|
|
10514
|
-
r.leave();
|
|
10515
|
-
$notes = items0;
|
|
10617
|
+
case 2:
|
|
10618
|
+
$from = ConfigOrigin.read(r);
|
|
10516
10619
|
break;
|
|
10517
|
-
}
|
|
10518
10620
|
default:
|
|
10519
10621
|
r.skip();
|
|
10520
10622
|
}
|
|
10521
10623
|
}
|
|
10522
10624
|
r.leave();
|
|
10523
|
-
return {
|
|
10625
|
+
return { value: $value, from: $from };
|
|
10524
10626
|
},
|
|
10525
10627
|
});
|
|
10526
10628
|
/**
|
|
@@ -10844,3 +10946,187 @@ export const SearchSetMany = message('search.SetMany', {
|
|
|
10844
10946
|
return { handle: $handle, documents: $documents };
|
|
10845
10947
|
},
|
|
10846
10948
|
});
|
|
10949
|
+
/**
|
|
10950
|
+
* A setting's line of explain.
|
|
10951
|
+
*/
|
|
10952
|
+
export const ConfigLine = message('config.Line', {
|
|
10953
|
+
path: [1, str],
|
|
10954
|
+
/** as JSON, a span spelled, a secret as *** */
|
|
10955
|
+
value: [2, str],
|
|
10956
|
+
from: [3, str],
|
|
10957
|
+
/** the values it went over, newest first */
|
|
10958
|
+
over: [4, list(str)],
|
|
10959
|
+
/** every value it was given, newest first: its own, then the ones it went over */
|
|
10960
|
+
given: [5, list(ConfigGiven)],
|
|
10961
|
+
}, {
|
|
10962
|
+
write(w, v) {
|
|
10963
|
+
const head = w.openMap();
|
|
10964
|
+
let n = 0;
|
|
10965
|
+
if (v.path !== undefined) {
|
|
10966
|
+
w.field(1);
|
|
10967
|
+
w.str(v.path);
|
|
10968
|
+
n++;
|
|
10969
|
+
}
|
|
10970
|
+
if (v.value !== undefined) {
|
|
10971
|
+
w.field(2);
|
|
10972
|
+
w.str(v.value);
|
|
10973
|
+
n++;
|
|
10974
|
+
}
|
|
10975
|
+
if (v.from !== undefined) {
|
|
10976
|
+
w.field(3);
|
|
10977
|
+
w.str(v.from);
|
|
10978
|
+
n++;
|
|
10979
|
+
}
|
|
10980
|
+
if (v.over !== undefined) {
|
|
10981
|
+
w.field(4);
|
|
10982
|
+
w.array(v.over.length);
|
|
10983
|
+
for (const item0 of v.over) {
|
|
10984
|
+
w.str(item0);
|
|
10985
|
+
}
|
|
10986
|
+
n++;
|
|
10987
|
+
}
|
|
10988
|
+
if (v.given !== undefined) {
|
|
10989
|
+
w.field(5);
|
|
10990
|
+
w.array(v.given.length);
|
|
10991
|
+
for (const item0 of v.given) {
|
|
10992
|
+
ConfigGiven.write(w, item0);
|
|
10993
|
+
}
|
|
10994
|
+
n++;
|
|
10995
|
+
}
|
|
10996
|
+
w.closeMap(head, n);
|
|
10997
|
+
},
|
|
10998
|
+
read(r) {
|
|
10999
|
+
let $path;
|
|
11000
|
+
let $value;
|
|
11001
|
+
let $from;
|
|
11002
|
+
let $over;
|
|
11003
|
+
let $given;
|
|
11004
|
+
for (let n = r.message(); n > 0; n--) {
|
|
11005
|
+
switch (r.field()) {
|
|
11006
|
+
case 1:
|
|
11007
|
+
$path = r.str();
|
|
11008
|
+
break;
|
|
11009
|
+
case 2:
|
|
11010
|
+
$value = r.str();
|
|
11011
|
+
break;
|
|
11012
|
+
case 3:
|
|
11013
|
+
$from = r.str();
|
|
11014
|
+
break;
|
|
11015
|
+
case 4: {
|
|
11016
|
+
const items0 = [];
|
|
11017
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11018
|
+
items0.push(r.str());
|
|
11019
|
+
}
|
|
11020
|
+
r.leave();
|
|
11021
|
+
$over = items0;
|
|
11022
|
+
break;
|
|
11023
|
+
}
|
|
11024
|
+
case 5: {
|
|
11025
|
+
const items0 = [];
|
|
11026
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11027
|
+
items0.push(ConfigGiven.read(r));
|
|
11028
|
+
}
|
|
11029
|
+
r.leave();
|
|
11030
|
+
$given = items0;
|
|
11031
|
+
break;
|
|
11032
|
+
}
|
|
11033
|
+
default:
|
|
11034
|
+
r.skip();
|
|
11035
|
+
}
|
|
11036
|
+
}
|
|
11037
|
+
r.leave();
|
|
11038
|
+
return { path: $path, value: $value, from: $from, over: $over, given: $given };
|
|
11039
|
+
},
|
|
11040
|
+
});
|
|
11041
|
+
/**
|
|
11042
|
+
* A config's value at a version of its changes, and where each setting's
|
|
11043
|
+
* value came from.
|
|
11044
|
+
*/
|
|
11045
|
+
export const ConfigValue = message('config.Value', {
|
|
11046
|
+
handle: [1, uint],
|
|
11047
|
+
version: [2, int],
|
|
11048
|
+
/** the settings, each span its milliseconds, each secret its text */
|
|
11049
|
+
value: [3, str],
|
|
11050
|
+
lines: [4, list(ConfigLine)],
|
|
11051
|
+
/** what was read and not used, each with why */
|
|
11052
|
+
notes: [5, list(str)],
|
|
11053
|
+
}, {
|
|
11054
|
+
write(w, v) {
|
|
11055
|
+
const head = w.openMap();
|
|
11056
|
+
let n = 0;
|
|
11057
|
+
if (v.handle !== undefined) {
|
|
11058
|
+
w.field(1);
|
|
11059
|
+
w.uint(v.handle);
|
|
11060
|
+
n++;
|
|
11061
|
+
}
|
|
11062
|
+
if (v.version !== undefined) {
|
|
11063
|
+
w.field(2);
|
|
11064
|
+
w.int(v.version);
|
|
11065
|
+
n++;
|
|
11066
|
+
}
|
|
11067
|
+
if (v.value !== undefined) {
|
|
11068
|
+
w.field(3);
|
|
11069
|
+
w.str(v.value);
|
|
11070
|
+
n++;
|
|
11071
|
+
}
|
|
11072
|
+
if (v.lines !== undefined) {
|
|
11073
|
+
w.field(4);
|
|
11074
|
+
w.array(v.lines.length);
|
|
11075
|
+
for (const item0 of v.lines) {
|
|
11076
|
+
ConfigLine.write(w, item0);
|
|
11077
|
+
}
|
|
11078
|
+
n++;
|
|
11079
|
+
}
|
|
11080
|
+
if (v.notes !== undefined) {
|
|
11081
|
+
w.field(5);
|
|
11082
|
+
w.array(v.notes.length);
|
|
11083
|
+
for (const item0 of v.notes) {
|
|
11084
|
+
w.str(item0);
|
|
11085
|
+
}
|
|
11086
|
+
n++;
|
|
11087
|
+
}
|
|
11088
|
+
w.closeMap(head, n);
|
|
11089
|
+
},
|
|
11090
|
+
read(r) {
|
|
11091
|
+
let $handle;
|
|
11092
|
+
let $version;
|
|
11093
|
+
let $value;
|
|
11094
|
+
let $lines;
|
|
11095
|
+
let $notes;
|
|
11096
|
+
for (let n = r.message(); n > 0; n--) {
|
|
11097
|
+
switch (r.field()) {
|
|
11098
|
+
case 1:
|
|
11099
|
+
$handle = r.uint();
|
|
11100
|
+
break;
|
|
11101
|
+
case 2:
|
|
11102
|
+
$version = r.int();
|
|
11103
|
+
break;
|
|
11104
|
+
case 3:
|
|
11105
|
+
$value = r.str();
|
|
11106
|
+
break;
|
|
11107
|
+
case 4: {
|
|
11108
|
+
const items0 = [];
|
|
11109
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11110
|
+
items0.push(ConfigLine.read(r));
|
|
11111
|
+
}
|
|
11112
|
+
r.leave();
|
|
11113
|
+
$lines = items0;
|
|
11114
|
+
break;
|
|
11115
|
+
}
|
|
11116
|
+
case 5: {
|
|
11117
|
+
const items0 = [];
|
|
11118
|
+
for (let i0 = r.array(); i0 > 0; i0--) {
|
|
11119
|
+
items0.push(r.str());
|
|
11120
|
+
}
|
|
11121
|
+
r.leave();
|
|
11122
|
+
$notes = items0;
|
|
11123
|
+
break;
|
|
11124
|
+
}
|
|
11125
|
+
default:
|
|
11126
|
+
r.skip();
|
|
11127
|
+
}
|
|
11128
|
+
}
|
|
11129
|
+
r.leave();
|
|
11130
|
+
return { handle: $handle, version: $version, value: $value, lines: $lines, notes: $notes };
|
|
11131
|
+
},
|
|
11132
|
+
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinyshed/tinystore",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TinyStore for Bun and Node: kv, jobs, blobs, SQL, records and metrics in one directory, served by a sidecar",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://tinyshed.org/tinystore",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/tinyshed/tinystore.git",
|
|
@@ -30,12 +31,12 @@
|
|
|
30
31
|
"README.md"
|
|
31
32
|
],
|
|
32
33
|
"optionalDependencies": {
|
|
33
|
-
"@tinyshed/tinystore-linux-x64": "0.1.
|
|
34
|
-
"@tinyshed/tinystore-linux-arm64": "0.1.
|
|
35
|
-
"@tinyshed/tinystore-linux-x64-musl": "0.1.
|
|
36
|
-
"@tinyshed/tinystore-linux-arm64-musl": "0.1.
|
|
37
|
-
"@tinyshed/tinystore-darwin-arm64": "0.1.
|
|
38
|
-
"@tinyshed/tinystore-darwin-x64": "0.1.
|
|
39
|
-
"@tinyshed/tinystore-win32-x64": "0.1.
|
|
34
|
+
"@tinyshed/tinystore-linux-x64": "0.1.1",
|
|
35
|
+
"@tinyshed/tinystore-linux-arm64": "0.1.1",
|
|
36
|
+
"@tinyshed/tinystore-linux-x64-musl": "0.1.1",
|
|
37
|
+
"@tinyshed/tinystore-linux-arm64-musl": "0.1.1",
|
|
38
|
+
"@tinyshed/tinystore-darwin-arm64": "0.1.1",
|
|
39
|
+
"@tinyshed/tinystore-darwin-x64": "0.1.1",
|
|
40
|
+
"@tinyshed/tinystore-win32-x64": "0.1.1"
|
|
40
41
|
}
|
|
41
42
|
}
|