@tinyshed/tinystore 0.1.0 → 0.2.0-rc.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.
Files changed (71) hide show
  1. package/dist/blobs.d.ts +1 -1
  2. package/dist/blobs.js +13 -5
  3. package/dist/cancel.d.ts +16 -2
  4. package/dist/cancel.js +36 -2
  5. package/dist/channels.js +20 -6
  6. package/dist/config.d.ts +49 -1
  7. package/dist/config.js +86 -7
  8. package/dist/connection.d.ts +52 -10
  9. package/dist/connection.js +305 -73
  10. package/dist/handles.d.ts +10 -1
  11. package/dist/handles.js +27 -4
  12. package/dist/index.d.ts +5 -5
  13. package/dist/jobs.d.ts +35 -1
  14. package/dist/jobs.js +46 -0
  15. package/dist/logger.d.ts +22 -10
  16. package/dist/logger.js +118 -28
  17. package/dist/metrics.d.ts +24 -1
  18. package/dist/metrics.js +24 -1
  19. package/dist/query.js +33 -9
  20. package/dist/records.d.ts +48 -7
  21. package/dist/records.js +22 -3
  22. package/dist/runtime/addon.js +3 -2
  23. package/dist/runtime/bun.js +33 -12
  24. package/dist/runtime/node.js +30 -8
  25. package/dist/runtime/pipe.d.ts +2 -0
  26. package/dist/runtime/pipe.js +45 -20
  27. package/dist/runtime/shared.d.ts +28 -4
  28. package/dist/runtime/shared.js +125 -13
  29. package/dist/runtime.d.ts +28 -6
  30. package/dist/session.d.ts +9 -5
  31. package/dist/session.js +113 -31
  32. package/dist/sql.d.ts +18 -5
  33. package/dist/sql.js +44 -11
  34. package/dist/store.d.ts +25 -11
  35. package/dist/store.js +67 -9
  36. package/dist/time.d.ts +2 -0
  37. package/dist/wire/codec.d.ts +5 -0
  38. package/dist/wire/codec.js +10 -0
  39. package/dist/wire/frame.d.ts +2 -0
  40. package/dist/wire/frame.js +4 -0
  41. package/dist/wire/msgpack.d.ts +7 -3
  42. package/dist/wire/msgpack.js +11 -4
  43. package/dist/wire/protocol.d.ts +280 -36
  44. package/dist/wire/protocol.js +510 -102
  45. package/package.json +9 -8
  46. package/src/blobs.ts +13 -5
  47. package/src/cancel.ts +44 -2
  48. package/src/channels.ts +21 -6
  49. package/src/config.ts +138 -12
  50. package/src/connection.ts +377 -77
  51. package/src/handles.ts +32 -4
  52. package/src/index.ts +6 -1
  53. package/src/jobs.ts +66 -0
  54. package/src/logger.ts +158 -40
  55. package/src/metrics.ts +53 -2
  56. package/src/query.ts +33 -13
  57. package/src/records.ts +73 -10
  58. package/src/runtime/addon.ts +3 -2
  59. package/src/runtime/bun.ts +44 -9
  60. package/src/runtime/node.ts +30 -5
  61. package/src/runtime/pipe.ts +49 -19
  62. package/src/runtime/shared.ts +137 -16
  63. package/src/runtime.ts +31 -6
  64. package/src/session.ts +129 -30
  65. package/src/sql.ts +48 -14
  66. package/src/store.ts +81 -14
  67. package/src/time.ts +3 -0
  68. package/src/wire/codec.ts +11 -0
  69. package/src/wire/frame.ts +5 -0
  70. package/src/wire/msgpack.ts +11 -4
  71. package/src/wire/protocol.ts +532 -104
@@ -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
- * A setting's line of explain.
1718
+ * Where a value came from: its kind, and only the fields that kind names.
1718
1719
  */
1719
- export const ConfigLine = message(
1720
- 'config.Line',
1720
+ export const ConfigOrigin = message(
1721
+ 'config.Origin',
1721
1722
  {
1722
- path: [1, str],
1723
- /** as JSON, a span spelled, a secret as *** */
1724
- value: [2, str],
1725
- from: [3, str],
1726
- /** the values it went over, newest first */
1727
- over: [4, list(str)],
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.path !== undefined) {
1744
+ if (v.kind !== undefined) {
1734
1745
  w.field(1)
1735
- w.str(v.path)
1746
+ w.str(v.kind)
1736
1747
  n++
1737
1748
  }
1738
- if (v.value !== undefined) {
1749
+ if (v.place !== undefined) {
1739
1750
  w.field(2)
1740
- w.str(v.value)
1751
+ w.uint(v.place)
1741
1752
  n++
1742
1753
  }
1743
- if (v.from !== undefined) {
1754
+ if (v.path !== undefined) {
1744
1755
  w.field(3)
1745
- w.str(v.from)
1756
+ w.str(v.path)
1746
1757
  n++
1747
1758
  }
1748
- if (v.over !== undefined) {
1759
+ if (v.variable !== undefined) {
1749
1760
  w.field(4)
1750
- w.array(v.over.length)
1751
- for (const item0 of v.over) {
1752
- w.str(item0)
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 $value: string | undefined
1761
- let $from: string | undefined
1762
- let $over: string[] | undefined
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
- $path = r.str()
1798
+ $kind = r.str()
1767
1799
  break
1768
1800
  case 2:
1769
- $value = r.str()
1801
+ $place = r.uint()
1770
1802
  break
1771
1803
  case 3:
1772
- $from = r.str()
1804
+ $path = r.str()
1773
1805
  break
1774
- case 4: {
1775
- const items0: string[] = []
1776
- for (let i0 = r.array(); i0 > 0; i0--) {
1777
- items0.push(r.str())
1778
- }
1779
- r.leave()
1780
- $over = items0
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 { path: $path, value: $value, from: $from, over: $over }
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
  },
@@ -2721,6 +2780,8 @@ export const JobsQueueOpen = message(
2721
2780
  maxWaiting: [9, uint],
2722
2781
  /** a database's handle: the queue lives in its file; jobs.db when absent */
2723
2782
  database: [10, uint],
2783
+ /** each group's starts, beside the queue's rate */
2784
+ groupRate: [11, JobsRate],
2724
2785
  },
2725
2786
  {
2726
2787
  write(w, v) {
@@ -2776,6 +2837,11 @@ export const JobsQueueOpen = message(
2776
2837
  w.uint(v.database)
2777
2838
  n++
2778
2839
  }
2840
+ if (v.groupRate !== undefined) {
2841
+ w.field(11)
2842
+ JobsRate.write(w, v.groupRate)
2843
+ n++
2844
+ }
2779
2845
  w.closeMap(head, n)
2780
2846
  },
2781
2847
  read(r) {
@@ -2789,6 +2855,7 @@ export const JobsQueueOpen = message(
2789
2855
  let $keep: number | undefined
2790
2856
  let $maxWaiting: number | undefined
2791
2857
  let $database: number | undefined
2858
+ let $groupRate: Read<typeof JobsRate.fields> | undefined
2792
2859
  for (let n = r.message(); n > 0; n--) {
2793
2860
  switch (r.field()) {
2794
2861
  case 1:
@@ -2821,6 +2888,9 @@ export const JobsQueueOpen = message(
2821
2888
  case 10:
2822
2889
  $database = r.uint()
2823
2890
  break
2891
+ case 11:
2892
+ $groupRate = JobsRate.read(r)
2893
+ break
2824
2894
  default:
2825
2895
  r.skip()
2826
2896
  }
@@ -2837,6 +2907,7 @@ export const JobsQueueOpen = message(
2837
2907
  keep: $keep,
2838
2908
  maxWaiting: $maxWaiting,
2839
2909
  database: $database,
2910
+ groupRate: $groupRate,
2840
2911
  }
2841
2912
  },
2842
2913
  },
@@ -6076,6 +6147,10 @@ export const MetricsAggregateAsked = message(
6076
6147
  without: [5, list(str)],
6077
6148
  /** a timer's percentile also gives a point between its bounds */
6078
6149
  estimate: [6, bool],
6150
+ /** day, week or month: buckets of a calendar in timeZone, in place of every */
6151
+ calendar: [7, str],
6152
+ /** an IANA name, UTC among them, which calendar takes */
6153
+ timeZone: [8, str],
6079
6154
  },
6080
6155
  {
6081
6156
  write(w, v) {
@@ -6117,6 +6192,16 @@ export const MetricsAggregateAsked = message(
6117
6192
  w.bool(v.estimate)
6118
6193
  n++
6119
6194
  }
6195
+ if (v.calendar !== undefined) {
6196
+ w.field(7)
6197
+ w.str(v.calendar)
6198
+ n++
6199
+ }
6200
+ if (v.timeZone !== undefined) {
6201
+ w.field(8)
6202
+ w.str(v.timeZone)
6203
+ n++
6204
+ }
6120
6205
  w.closeMap(head, n)
6121
6206
  },
6122
6207
  read(r) {
@@ -6126,6 +6211,8 @@ export const MetricsAggregateAsked = message(
6126
6211
  let $by: string[] | undefined
6127
6212
  let $without: string[] | undefined
6128
6213
  let $estimate: boolean | undefined
6214
+ let $calendar: string | undefined
6215
+ let $timeZone: string | undefined
6129
6216
  for (let n = r.message(); n > 0; n--) {
6130
6217
  switch (r.field()) {
6131
6218
  case 1:
@@ -6158,6 +6245,12 @@ export const MetricsAggregateAsked = message(
6158
6245
  case 6:
6159
6246
  $estimate = r.bool()
6160
6247
  break
6248
+ case 7:
6249
+ $calendar = r.str()
6250
+ break
6251
+ case 8:
6252
+ $timeZone = r.str()
6253
+ break
6161
6254
  default:
6162
6255
  r.skip()
6163
6256
  }
@@ -6170,6 +6263,8 @@ export const MetricsAggregateAsked = message(
6170
6263
  by: $by,
6171
6264
  without: $without,
6172
6265
  estimate: $estimate,
6266
+ calendar: $calendar,
6267
+ timeZone: $timeZone,
6173
6268
  }
6174
6269
  },
6175
6270
  },
@@ -6427,7 +6522,7 @@ export const MetricsAggregates = message(
6427
6522
  export const MetricsExceeds = message(
6428
6523
  'metrics.Exceeds',
6429
6524
  {
6430
- /** series, bytes read or samples decoded */
6525
+ /** series, bytes read, samples decoded or answer */
6431
6526
  limit: [1, str],
6432
6527
  wanted: [2, uint],
6433
6528
  bound: [3, uint],
@@ -6620,6 +6715,76 @@ export const MetricsIngest = message(
6620
6715
  },
6621
6716
  )
6622
6717
 
6718
+ /**
6719
+ * A text an exporter serves, in Prometheus' format or OpenMetrics', whose
6720
+ * series the store writes every one or none, each with labels beside its own.
6721
+ */
6722
+ export const MetricsExposition = message(
6723
+ 'metrics.Exposition',
6724
+ {
6725
+ /** UTF-8, read a line at a time, so that an error names its line */
6726
+ text: [1, bin],
6727
+ labels: [2, names(str)],
6728
+ /** of a sample the text gives no time; now unless given */
6729
+ at: [3, int],
6730
+ /** how long each name of the text keeps its samples */
6731
+ keep: [4, uint],
6732
+ },
6733
+ {
6734
+ write(w, v) {
6735
+ const head = w.openMap()
6736
+ let n = 0
6737
+ if (v.text !== undefined) {
6738
+ w.field(1)
6739
+ w.bin(v.text)
6740
+ n++
6741
+ }
6742
+ if (v.labels !== undefined) {
6743
+ w.field(2)
6744
+ writeNames(w, v.labels, str.write)
6745
+ n++
6746
+ }
6747
+ if (v.at !== undefined) {
6748
+ w.field(3)
6749
+ w.int(v.at)
6750
+ n++
6751
+ }
6752
+ if (v.keep !== undefined) {
6753
+ w.field(4)
6754
+ w.uint(v.keep)
6755
+ n++
6756
+ }
6757
+ w.closeMap(head, n)
6758
+ },
6759
+ read(r) {
6760
+ let $text: Uint8Array | undefined
6761
+ let $labels: Record<string, string> | undefined
6762
+ let $at: number | undefined
6763
+ let $keep: number | undefined
6764
+ for (let n = r.message(); n > 0; n--) {
6765
+ switch (r.field()) {
6766
+ case 1:
6767
+ $text = r.bytes()
6768
+ break
6769
+ case 2:
6770
+ $labels = readNames(r, str.read)
6771
+ break
6772
+ case 3:
6773
+ $at = r.int()
6774
+ break
6775
+ case 4:
6776
+ $keep = r.uint()
6777
+ break
6778
+ default:
6779
+ r.skip()
6780
+ }
6781
+ }
6782
+ r.leave()
6783
+ return { text: $text, labels: $labels, at: $at, keep: $keep }
6784
+ },
6785
+ },
6786
+ )
6787
+
6623
6788
  /**
6624
6789
  * A page of names, of a name's labels or of a label's values.
6625
6790
  */
@@ -7850,6 +8015,8 @@ export const RecordsNewEvent = message(
7850
8015
  traceId: [7, bin],
7851
8016
  /** 8 bytes */
7852
8017
  spanId: [8, bin],
8018
+ /** 1 to 128 bytes: an event of an id its stream holds is written as nothing */
8019
+ id: [9, str],
7853
8020
  },
7854
8021
  {
7855
8022
  write(w, v) {
@@ -7895,6 +8062,11 @@ export const RecordsNewEvent = message(
7895
8062
  w.bin(v.spanId)
7896
8063
  n++
7897
8064
  }
8065
+ if (v.id !== undefined) {
8066
+ w.field(9)
8067
+ w.str(v.id)
8068
+ n++
8069
+ }
7898
8070
  w.closeMap(head, n)
7899
8071
  },
7900
8072
  read(r) {
@@ -7906,6 +8078,7 @@ export const RecordsNewEvent = message(
7906
8078
  let $context: string | undefined
7907
8079
  let $traceId: Uint8Array | undefined
7908
8080
  let $spanId: Uint8Array | undefined
8081
+ let $id: string | undefined
7909
8082
  for (let n = r.message(); n > 0; n--) {
7910
8083
  switch (r.field()) {
7911
8084
  case 1:
@@ -7932,6 +8105,9 @@ export const RecordsNewEvent = message(
7932
8105
  case 8:
7933
8106
  $spanId = r.bytes()
7934
8107
  break
8108
+ case 9:
8109
+ $id = r.str()
8110
+ break
7935
8111
  default:
7936
8112
  r.skip()
7937
8113
  }
@@ -7946,6 +8122,7 @@ export const RecordsNewEvent = message(
7946
8122
  context: $context,
7947
8123
  traceId: $traceId,
7948
8124
  spanId: $spanId,
8125
+ id: $id,
7949
8126
  }
7950
8127
  },
7951
8128
  },
@@ -8006,6 +8183,44 @@ export const RecordsAppend = message(
8006
8183
  },
8007
8184
  )
8008
8185
 
8186
+ /**
8187
+ * What an append wrote: none of an event whose id its stream held, or an
8188
+ * earlier event of the append held.
8189
+ */
8190
+ export const RecordsAppended = message(
8191
+ 'records.Appended',
8192
+ {
8193
+ /** the events written as nothing */
8194
+ held: [1, uint],
8195
+ },
8196
+ {
8197
+ write(w, v) {
8198
+ const head = w.openMap()
8199
+ let n = 0
8200
+ if (v.held !== undefined) {
8201
+ w.field(1)
8202
+ w.uint(v.held)
8203
+ n++
8204
+ }
8205
+ w.closeMap(head, n)
8206
+ },
8207
+ read(r) {
8208
+ let $held: number | undefined
8209
+ for (let n = r.message(); n > 0; n--) {
8210
+ switch (r.field()) {
8211
+ case 1:
8212
+ $held = r.uint()
8213
+ break
8214
+ default:
8215
+ r.skip()
8216
+ }
8217
+ }
8218
+ r.leave()
8219
+ return { held: $held }
8220
+ },
8221
+ },
8222
+ )
8223
+
8009
8224
  /**
8010
8225
  * An event as a read gives it.
8011
8226
  */
@@ -8022,6 +8237,7 @@ export const RecordsEvent = message(
8022
8237
  context: [7, str],
8023
8238
  traceId: [8, bin],
8024
8239
  spanId: [9, bin],
8240
+ id: [10, str],
8025
8241
  },
8026
8242
  {
8027
8243
  write(w, v) {
@@ -8072,6 +8288,11 @@ export const RecordsEvent = message(
8072
8288
  w.bin(v.spanId)
8073
8289
  n++
8074
8290
  }
8291
+ if (v.id !== undefined) {
8292
+ w.field(10)
8293
+ w.str(v.id)
8294
+ n++
8295
+ }
8075
8296
  w.closeMap(head, n)
8076
8297
  },
8077
8298
  read(r) {
@@ -8084,6 +8305,7 @@ export const RecordsEvent = message(
8084
8305
  let $context: string | undefined
8085
8306
  let $traceId: Uint8Array | undefined
8086
8307
  let $spanId: Uint8Array | undefined
8308
+ let $id: string | undefined
8087
8309
  for (let n = r.message(); n > 0; n--) {
8088
8310
  switch (r.field()) {
8089
8311
  case 1:
@@ -8113,6 +8335,9 @@ export const RecordsEvent = message(
8113
8335
  case 9:
8114
8336
  $spanId = r.bytes()
8115
8337
  break
8338
+ case 10:
8339
+ $id = r.str()
8340
+ break
8116
8341
  default:
8117
8342
  r.skip()
8118
8343
  }
@@ -8128,6 +8353,7 @@ export const RecordsEvent = message(
8128
8353
  context: $context,
8129
8354
  traceId: $traceId,
8130
8355
  spanId: $spanId,
8356
+ id: $id,
8131
8357
  }
8132
8358
  },
8133
8359
  },
@@ -8555,6 +8781,10 @@ export const RecordsAggregateAsked = message(
8555
8781
  by: [3, list(str)],
8556
8782
  stats: [4, list(str)],
8557
8783
  distinct: [5, list(str)],
8784
+ /** day, week or month: rows of a calendar in timeZone, in place of every */
8785
+ calendar: [6, str],
8786
+ /** an IANA name, UTC among them, which calendar takes */
8787
+ timeZone: [7, str],
8558
8788
  },
8559
8789
  {
8560
8790
  write(w, v) {
@@ -8594,6 +8824,16 @@ export const RecordsAggregateAsked = message(
8594
8824
  }
8595
8825
  n++
8596
8826
  }
8827
+ if (v.calendar !== undefined) {
8828
+ w.field(6)
8829
+ w.str(v.calendar)
8830
+ n++
8831
+ }
8832
+ if (v.timeZone !== undefined) {
8833
+ w.field(7)
8834
+ w.str(v.timeZone)
8835
+ n++
8836
+ }
8597
8837
  w.closeMap(head, n)
8598
8838
  },
8599
8839
  read(r) {
@@ -8602,6 +8842,8 @@ export const RecordsAggregateAsked = message(
8602
8842
  let $by: string[] | undefined
8603
8843
  let $stats: string[] | undefined
8604
8844
  let $distinct: string[] | undefined
8845
+ let $calendar: string | undefined
8846
+ let $timeZone: string | undefined
8605
8847
  for (let n = r.message(); n > 0; n--) {
8606
8848
  switch (r.field()) {
8607
8849
  case 1:
@@ -8637,12 +8879,26 @@ export const RecordsAggregateAsked = message(
8637
8879
  $distinct = items0
8638
8880
  break
8639
8881
  }
8882
+ case 6:
8883
+ $calendar = r.str()
8884
+ break
8885
+ case 7:
8886
+ $timeZone = r.str()
8887
+ break
8640
8888
  default:
8641
8889
  r.skip()
8642
8890
  }
8643
8891
  }
8644
8892
  r.leave()
8645
- return { query: $query, every: $every, by: $by, stats: $stats, distinct: $distinct }
8893
+ return {
8894
+ query: $query,
8895
+ every: $every,
8896
+ by: $by,
8897
+ stats: $stats,
8898
+ distinct: $distinct,
8899
+ calendar: $calendar,
8900
+ timeZone: $timeZone,
8901
+ }
8646
8902
  },
8647
8903
  },
8648
8904
  )
@@ -10430,13 +10686,18 @@ export const SqlOpen = message(
10430
10686
  )
10431
10687
 
10432
10688
  /**
10433
- * A statement's text and the values of its ?s, in order.
10689
+ * A statement's text and the values of its ?s, in order. In a batch it may
10690
+ * be a call of jobs on a queue kept in the database's file instead, jobs.add
10691
+ * with its request in body and no text, which commits with the batch's rows.
10434
10692
  */
10435
10693
  export const SqlText = message(
10436
10694
  'sql.Text',
10437
10695
  {
10438
10696
  text: [1, str],
10439
10697
  values: [2, list(sqlValue)],
10698
+ /** in a batch, jobs.add: the call in body */
10699
+ method: [3, uint],
10700
+ body: [4, bin],
10440
10701
  },
10441
10702
  {
10442
10703
  write(w, v) {
@@ -10455,11 +10716,23 @@ export const SqlText = message(
10455
10716
  }
10456
10717
  n++
10457
10718
  }
10719
+ if (v.method !== undefined) {
10720
+ w.field(3)
10721
+ w.uint(v.method)
10722
+ n++
10723
+ }
10724
+ if (v.body !== undefined) {
10725
+ w.field(4)
10726
+ w.bin(v.body)
10727
+ n++
10728
+ }
10458
10729
  w.closeMap(head, n)
10459
10730
  },
10460
10731
  read(r) {
10461
10732
  let $text: string | undefined
10462
10733
  let $values: (SqlValue | boolean)[] | undefined
10734
+ let $method: number | undefined
10735
+ let $body: Uint8Array | undefined
10463
10736
  for (let n = r.message(); n > 0; n--) {
10464
10737
  switch (r.field()) {
10465
10738
  case 1:
@@ -10474,12 +10747,18 @@ export const SqlText = message(
10474
10747
  $values = items0
10475
10748
  break
10476
10749
  }
10750
+ case 3:
10751
+ $method = r.uint()
10752
+ break
10753
+ case 4:
10754
+ $body = r.bytes()
10755
+ break
10477
10756
  default:
10478
10757
  r.skip()
10479
10758
  }
10480
10759
  }
10481
10760
  r.leave()
10482
- return { text: $text, values: $values }
10761
+ return { text: $text, values: $values, method: $method, body: $body }
10483
10762
  },
10484
10763
  },
10485
10764
  )
@@ -10909,7 +11188,8 @@ export const SqlDone = message(
10909
11188
  )
10910
11189
 
10911
11190
  /**
10912
- * Statements known before they run, written as one in a shared commit.
11191
+ * Writes known before they run, written as one in a shared commit: its
11192
+ * statements, and the adds of a queue kept in the database's file.
10913
11193
  */
10914
11194
  export const SqlBatch = message(
10915
11195
  'sql.Batch',
@@ -10963,6 +11243,10 @@ export const SqlBatch = message(
10963
11243
  },
10964
11244
  )
10965
11245
 
11246
+ /**
11247
+ * What each write of a batch did, in their order: a job's add changed one
11248
+ * job, or none when its id was taken.
11249
+ */
10966
11250
  export const SqlBatched = message(
10967
11251
  'sql.Batched',
10968
11252
  {
@@ -11276,98 +11560,48 @@ export const ChannelsBatch = message(
11276
11560
  )
11277
11561
 
11278
11562
  /**
11279
- * A config's value at a version of its changes, and where each setting's
11280
- * value came from.
11563
+ * A value a setting was given, and where it came from.
11281
11564
  */
11282
- export const ConfigValue = message(
11283
- 'config.Value',
11565
+ export const ConfigGiven = message(
11566
+ 'config.Given',
11284
11567
  {
11285
- handle: [1, uint],
11286
- version: [2, int],
11287
- /** the settings, each span its milliseconds, each secret its text */
11288
- value: [3, str],
11289
- lines: [4, list(ConfigLine)],
11290
- /** what was read and not used, each with why */
11291
- notes: [5, list(str)],
11568
+ /** as JSON, a span spelled, a secret as *** */
11569
+ value: [1, str],
11570
+ from: [2, ConfigOrigin],
11292
11571
  },
11293
11572
  {
11294
11573
  write(w, v) {
11295
11574
  const head = w.openMap()
11296
11575
  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
11576
  if (v.value !== undefined) {
11308
- w.field(3)
11577
+ w.field(1)
11309
11578
  w.str(v.value)
11310
11579
  n++
11311
11580
  }
11312
- if (v.lines !== undefined) {
11313
- w.field(4)
11314
- w.array(v.lines.length)
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
- }
11581
+ if (v.from !== undefined) {
11582
+ w.field(2)
11583
+ ConfigOrigin.write(w, v.from)
11326
11584
  n++
11327
11585
  }
11328
11586
  w.closeMap(head, n)
11329
11587
  },
11330
11588
  read(r) {
11331
- let $handle: number | undefined
11332
- let $version: number | undefined
11333
11589
  let $value: string | undefined
11334
- let $lines: Read<typeof ConfigLine.fields>[] | undefined
11335
- let $notes: string[] | undefined
11590
+ let $from: Read<typeof ConfigOrigin.fields> | undefined
11336
11591
  for (let n = r.message(); n > 0; n--) {
11337
11592
  switch (r.field()) {
11338
11593
  case 1:
11339
- $handle = r.uint()
11340
- break
11341
- case 2:
11342
- $version = r.int()
11343
- break
11344
- case 3:
11345
11594
  $value = r.str()
11346
11595
  break
11347
- case 4: {
11348
- const items0: Read<typeof ConfigLine.fields>[] = []
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
11596
+ case 2:
11597
+ $from = ConfigOrigin.read(r)
11363
11598
  break
11364
- }
11365
11599
  default:
11366
11600
  r.skip()
11367
11601
  }
11368
11602
  }
11369
11603
  r.leave()
11370
- return { handle: $handle, version: $version, value: $value, lines: $lines, notes: $notes }
11604
+ return { value: $value, from: $from }
11371
11605
  },
11372
11606
  },
11373
11607
  )
@@ -11707,3 +11941,197 @@ export const SearchSetMany = message(
11707
11941
  },
11708
11942
  },
11709
11943
  )
11944
+
11945
+ /**
11946
+ * A setting's line of explain.
11947
+ */
11948
+ export const ConfigLine = message(
11949
+ 'config.Line',
11950
+ {
11951
+ path: [1, str],
11952
+ /** as JSON, a span spelled, a secret as *** */
11953
+ value: [2, str],
11954
+ from: [3, str],
11955
+ /** the values it went over, newest first */
11956
+ over: [4, list(str)],
11957
+ /** every value it was given, newest first: its own, then the ones it went over */
11958
+ given: [5, list(ConfigGiven)],
11959
+ },
11960
+ {
11961
+ write(w, v) {
11962
+ const head = w.openMap()
11963
+ let n = 0
11964
+ if (v.path !== undefined) {
11965
+ w.field(1)
11966
+ w.str(v.path)
11967
+ n++
11968
+ }
11969
+ if (v.value !== undefined) {
11970
+ w.field(2)
11971
+ w.str(v.value)
11972
+ n++
11973
+ }
11974
+ if (v.from !== undefined) {
11975
+ w.field(3)
11976
+ w.str(v.from)
11977
+ n++
11978
+ }
11979
+ if (v.over !== undefined) {
11980
+ w.field(4)
11981
+ w.array(v.over.length)
11982
+ for (const item0 of v.over) {
11983
+ w.str(item0)
11984
+ }
11985
+ n++
11986
+ }
11987
+ if (v.given !== undefined) {
11988
+ w.field(5)
11989
+ w.array(v.given.length)
11990
+ for (const item0 of v.given) {
11991
+ ConfigGiven.write(w, item0)
11992
+ }
11993
+ n++
11994
+ }
11995
+ w.closeMap(head, n)
11996
+ },
11997
+ read(r) {
11998
+ let $path: string | undefined
11999
+ let $value: string | undefined
12000
+ let $from: string | undefined
12001
+ let $over: string[] | undefined
12002
+ let $given: Read<typeof ConfigGiven.fields>[] | undefined
12003
+ for (let n = r.message(); n > 0; n--) {
12004
+ switch (r.field()) {
12005
+ case 1:
12006
+ $path = r.str()
12007
+ break
12008
+ case 2:
12009
+ $value = r.str()
12010
+ break
12011
+ case 3:
12012
+ $from = r.str()
12013
+ break
12014
+ case 4: {
12015
+ const items0: string[] = []
12016
+ for (let i0 = r.array(); i0 > 0; i0--) {
12017
+ items0.push(r.str())
12018
+ }
12019
+ r.leave()
12020
+ $over = items0
12021
+ break
12022
+ }
12023
+ case 5: {
12024
+ const items0: Read<typeof ConfigGiven.fields>[] = []
12025
+ for (let i0 = r.array(); i0 > 0; i0--) {
12026
+ items0.push(ConfigGiven.read(r))
12027
+ }
12028
+ r.leave()
12029
+ $given = items0
12030
+ break
12031
+ }
12032
+ default:
12033
+ r.skip()
12034
+ }
12035
+ }
12036
+ r.leave()
12037
+ return { path: $path, value: $value, from: $from, over: $over, given: $given }
12038
+ },
12039
+ },
12040
+ )
12041
+
12042
+ /**
12043
+ * A config's value at a version of its changes, and where each setting's
12044
+ * value came from.
12045
+ */
12046
+ export const ConfigValue = message(
12047
+ 'config.Value',
12048
+ {
12049
+ handle: [1, uint],
12050
+ version: [2, int],
12051
+ /** the settings, each span its milliseconds, each secret its text */
12052
+ value: [3, str],
12053
+ lines: [4, list(ConfigLine)],
12054
+ /** what was read and not used, each with why */
12055
+ notes: [5, list(str)],
12056
+ },
12057
+ {
12058
+ write(w, v) {
12059
+ const head = w.openMap()
12060
+ let n = 0
12061
+ if (v.handle !== undefined) {
12062
+ w.field(1)
12063
+ w.uint(v.handle)
12064
+ n++
12065
+ }
12066
+ if (v.version !== undefined) {
12067
+ w.field(2)
12068
+ w.int(v.version)
12069
+ n++
12070
+ }
12071
+ if (v.value !== undefined) {
12072
+ w.field(3)
12073
+ w.str(v.value)
12074
+ n++
12075
+ }
12076
+ if (v.lines !== undefined) {
12077
+ w.field(4)
12078
+ w.array(v.lines.length)
12079
+ for (const item0 of v.lines) {
12080
+ ConfigLine.write(w, item0)
12081
+ }
12082
+ n++
12083
+ }
12084
+ if (v.notes !== undefined) {
12085
+ w.field(5)
12086
+ w.array(v.notes.length)
12087
+ for (const item0 of v.notes) {
12088
+ w.str(item0)
12089
+ }
12090
+ n++
12091
+ }
12092
+ w.closeMap(head, n)
12093
+ },
12094
+ read(r) {
12095
+ let $handle: number | undefined
12096
+ let $version: number | undefined
12097
+ let $value: string | undefined
12098
+ let $lines: Read<typeof ConfigLine.fields>[] | undefined
12099
+ let $notes: string[] | undefined
12100
+ for (let n = r.message(); n > 0; n--) {
12101
+ switch (r.field()) {
12102
+ case 1:
12103
+ $handle = r.uint()
12104
+ break
12105
+ case 2:
12106
+ $version = r.int()
12107
+ break
12108
+ case 3:
12109
+ $value = r.str()
12110
+ break
12111
+ case 4: {
12112
+ const items0: Read<typeof ConfigLine.fields>[] = []
12113
+ for (let i0 = r.array(); i0 > 0; i0--) {
12114
+ items0.push(ConfigLine.read(r))
12115
+ }
12116
+ r.leave()
12117
+ $lines = items0
12118
+ break
12119
+ }
12120
+ case 5: {
12121
+ const items0: string[] = []
12122
+ for (let i0 = r.array(); i0 > 0; i0--) {
12123
+ items0.push(r.str())
12124
+ }
12125
+ r.leave()
12126
+ $notes = items0
12127
+ break
12128
+ }
12129
+ default:
12130
+ r.skip()
12131
+ }
12132
+ }
12133
+ r.leave()
12134
+ return { handle: $handle, version: $version, value: $value, lines: $lines, notes: $notes }
12135
+ },
12136
+ },
12137
+ )