@tinyshed/tinystore 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2399,36 +2399,29 @@ export declare const SearchQuery: import("./codec.ts").Message<{
2399
2399
  readonly offset: readonly [7, import("./codec.ts").Codec<number, number>];
2400
2400
  /** 10 when absent; offset and limit together 1000 at most */
2401
2401
  readonly limit: readonly [8, import("./codec.ts").Codec<number, number>];
2402
- }>;
2403
- /**
2404
- * A hit: a document and its value, or a table's row, a value a column of
2405
- * the answer's columns, as sql.Rows holds one.
2406
- */
2407
- export declare const SearchHit: import("./codec.ts").Message<{
2408
- readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2409
- /** null for a table's row */
2410
- readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2411
- readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2412
- readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2413
- }>;
2414
- export declare const SearchFound: import("./codec.ts").Message<{
2415
- readonly hits: readonly [1, import("./codec.ts").Codec<Read<{
2416
- readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2417
- /** null for a table's row */
2418
- readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2419
- readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2420
- readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2421
- }>[], readonly import("./codec.ts").Written<{
2422
- readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2423
- /** null for a table's row */
2424
- readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2425
- readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2426
- readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2427
- }>[]>];
2428
- /** the text the search read in fact, when a word was read as another */
2429
- readonly corrected: readonly [2, import("./codec.ts").Codec<string, string>];
2430
- /** the columns of a table's index's rows */
2431
- readonly columns: readonly [3, import("./codec.ts").Codec<string[], readonly string[]>];
2402
+ /** the last word read as the start of a word too, as a search box types */
2403
+ readonly prefix: readonly [9, import("./codec.ts").Codec<boolean, boolean>];
2404
+ /** every word read so, a document holding a word for each first; in place of prefix */
2405
+ readonly prefixEvery: readonly [10, import("./codec.ts").Codec<boolean, boolean>];
2406
+ /** utf8, utf16 or chars: each hit says where it matched, counted in that unit */
2407
+ readonly matches: readonly [11, import("./codec.ts").Codec<string, string>];
2408
+ }>;
2409
+ /**
2410
+ * Where a search's word matched a hit: a range of a field's text, or of a
2411
+ * string of a field that holds a list, counted in the unit the query asked:
2412
+ * bytes of UTF-8, units of UTF-16 or code points. The whole word for a word
2413
+ * found as written, by its stem or once corrected; the letters typed for a
2414
+ * word a prefix began.
2415
+ */
2416
+ export declare const SearchMatch: import("./codec.ts").Message<{
2417
+ /** the field's path or the table's column; empty for a document that is its own text */
2418
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2419
+ /** the string's place in a field that holds a list */
2420
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2421
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2422
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2423
+ /** the query's word, as its text wrote it */
2424
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2432
2425
  }>;
2433
2426
  /**
2434
2427
  * Where an index stands: ready, rebuilding and how far, or failed and why.
@@ -2789,9 +2782,12 @@ export declare const SearchOpen: import("./codec.ts").Message<{
2789
2782
  readonly key: readonly [13, import("./codec.ts").Codec<string, string>];
2790
2783
  /** the column of each row's vector, a blob of little-endian floats */
2791
2784
  readonly vectorColumn: readonly [14, import("./codec.ts").Codec<string, string>];
2785
+ /** the keyboard layouts its readers type with: ru and en, or none */
2786
+ readonly layouts: readonly [15, import("./codec.ts").Codec<string[], readonly string[]>];
2792
2787
  }>;
2793
2788
  /**
2794
- * Documents set in one commit, all of them or none: 1,000 and 16 MiB at most.
2789
+ * Documents set in one commit, all of them or none: 1,000 at most, and no more
2790
+ * than one request body holds, 2 MiB from every SDK.
2795
2791
  */
2796
2792
  export declare const SearchSetMany: import("./codec.ts").Message<{
2797
2793
  readonly handle: readonly [1, import("./codec.ts").Codec<number, number>];
@@ -2807,6 +2803,94 @@ export declare const SearchSetMany: import("./codec.ts").Message<{
2807
2803
  readonly noVector: readonly [4, import("./codec.ts").Codec<boolean, boolean>];
2808
2804
  }>[]>];
2809
2805
  }>;
2806
+ /**
2807
+ * A hit: a document and its value, or a table's row, a value a column of
2808
+ * the answer's columns, as sql.Rows holds one, and where the search's words
2809
+ * matched it when the query asked.
2810
+ */
2811
+ export declare const SearchHit: import("./codec.ts").Message<{
2812
+ readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2813
+ /** null for a table's row */
2814
+ readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2815
+ readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2816
+ readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2817
+ readonly matches: readonly [5, import("./codec.ts").Codec<Read<{
2818
+ /** the field's path or the table's column; empty for a document that is its own text */
2819
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2820
+ /** the string's place in a field that holds a list */
2821
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2822
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2823
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2824
+ /** the query's word, as its text wrote it */
2825
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2826
+ }>[], readonly import("./codec.ts").Written<{
2827
+ /** the field's path or the table's column; empty for a document that is its own text */
2828
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2829
+ /** the string's place in a field that holds a list */
2830
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2831
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2832
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2833
+ /** the query's word, as its text wrote it */
2834
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2835
+ }>[]>];
2836
+ }>;
2837
+ export declare const SearchFound: import("./codec.ts").Message<{
2838
+ readonly hits: readonly [1, import("./codec.ts").Codec<Read<{
2839
+ readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2840
+ /** null for a table's row */
2841
+ readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2842
+ readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2843
+ readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2844
+ readonly matches: readonly [5, import("./codec.ts").Codec<Read<{
2845
+ /** the field's path or the table's column; empty for a document that is its own text */
2846
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2847
+ /** the string's place in a field that holds a list */
2848
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2849
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2850
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2851
+ /** the query's word, as its text wrote it */
2852
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2853
+ }>[], readonly import("./codec.ts").Written<{
2854
+ /** the field's path or the table's column; empty for a document that is its own text */
2855
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2856
+ /** the string's place in a field that holds a list */
2857
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2858
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2859
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2860
+ /** the query's word, as its text wrote it */
2861
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2862
+ }>[]>];
2863
+ }>[], readonly import("./codec.ts").Written<{
2864
+ readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2865
+ /** null for a table's row */
2866
+ readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2867
+ readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2868
+ readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2869
+ readonly matches: readonly [5, import("./codec.ts").Codec<Read<{
2870
+ /** the field's path or the table's column; empty for a document that is its own text */
2871
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2872
+ /** the string's place in a field that holds a list */
2873
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2874
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2875
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2876
+ /** the query's word, as its text wrote it */
2877
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2878
+ }>[], readonly import("./codec.ts").Written<{
2879
+ /** the field's path or the table's column; empty for a document that is its own text */
2880
+ readonly field: readonly [1, import("./codec.ts").Codec<string, string>];
2881
+ /** the string's place in a field that holds a list */
2882
+ readonly item: readonly [2, import("./codec.ts").Codec<number, number>];
2883
+ readonly start: readonly [3, import("./codec.ts").Codec<number, number>];
2884
+ readonly end: readonly [4, import("./codec.ts").Codec<number, number>];
2885
+ /** the query's word, as its text wrote it */
2886
+ readonly word: readonly [5, import("./codec.ts").Codec<string, string>];
2887
+ }>[]>];
2888
+ }>[]>];
2889
+ /** the text the search read in fact, when a word was read as another */
2890
+ readonly corrected: readonly [2, import("./codec.ts").Codec<string, string>];
2891
+ /** the columns of a table's index's rows */
2892
+ readonly columns: readonly [3, import("./codec.ts").Codec<string[], readonly string[]>];
2893
+ }>;
2810
2894
  /**
2811
2895
  * A setting's line of explain.
2812
2896
  */
@@ -9488,6 +9488,12 @@ export const SearchQuery = message('search.Query', {
9488
9488
  offset: [7, uint],
9489
9489
  /** 10 when absent; offset and limit together 1000 at most */
9490
9490
  limit: [8, uint],
9491
+ /** the last word read as the start of a word too, as a search box types */
9492
+ prefix: [9, bool],
9493
+ /** every word read so, a document holding a word for each first; in place of prefix */
9494
+ prefixEvery: [10, bool],
9495
+ /** utf8, utf16 or chars: each hit says where it matched, counted in that unit */
9496
+ matches: [11, str],
9491
9497
  }, {
9492
9498
  write(w, v) {
9493
9499
  const head = w.openMap();
@@ -9532,6 +9538,21 @@ export const SearchQuery = message('search.Query', {
9532
9538
  w.uint(v.limit);
9533
9539
  n++;
9534
9540
  }
9541
+ if (v.prefix !== undefined) {
9542
+ w.field(9);
9543
+ w.bool(v.prefix);
9544
+ n++;
9545
+ }
9546
+ if (v.prefixEvery !== undefined) {
9547
+ w.field(10);
9548
+ w.bool(v.prefixEvery);
9549
+ n++;
9550
+ }
9551
+ if (v.matches !== undefined) {
9552
+ w.field(11);
9553
+ w.str(v.matches);
9554
+ n++;
9555
+ }
9535
9556
  w.closeMap(head, n);
9536
9557
  },
9537
9558
  read(r) {
@@ -9543,6 +9564,9 @@ export const SearchQuery = message('search.Query', {
9543
9564
  let $where;
9544
9565
  let $offset;
9545
9566
  let $limit;
9567
+ let $prefix;
9568
+ let $prefixEvery;
9569
+ let $matches;
9546
9570
  for (let n = r.message(); n > 0; n--) {
9547
9571
  switch (r.field()) {
9548
9572
  case 1:
@@ -9569,6 +9593,15 @@ export const SearchQuery = message('search.Query', {
9569
9593
  case 8:
9570
9594
  $limit = r.uint();
9571
9595
  break;
9596
+ case 9:
9597
+ $prefix = r.bool();
9598
+ break;
9599
+ case 10:
9600
+ $prefixEvery = r.bool();
9601
+ break;
9602
+ case 11:
9603
+ $matches = r.str();
9604
+ break;
9572
9605
  default:
9573
9606
  r.skip();
9574
9607
  }
@@ -9583,147 +9616,88 @@ export const SearchQuery = message('search.Query', {
9583
9616
  where: $where,
9584
9617
  offset: $offset,
9585
9618
  limit: $limit,
9619
+ prefix: $prefix,
9620
+ prefixEvery: $prefixEvery,
9621
+ matches: $matches,
9586
9622
  };
9587
9623
  },
9588
9624
  });
9589
9625
  /**
9590
- * A hit: a document and its value, or a table's row, a value a column of
9591
- * the answer's columns, as sql.Rows holds one.
9626
+ * Where a search's word matched a hit: a range of a field's text, or of a
9627
+ * string of a field that holds a list, counted in the unit the query asked:
9628
+ * bytes of UTF-8, units of UTF-16 or code points. The whole word for a word
9629
+ * found as written, by its stem or once corrected; the letters typed for a
9630
+ * word a prefix began.
9592
9631
  */
9593
- export const SearchHit = message('search.Hit', {
9594
- id: [1, str],
9595
- /** null for a table's row */
9596
- value: [2, str],
9597
- score: [3, float],
9598
- row: [4, list(sqlValue)],
9632
+ export const SearchMatch = message('search.Match', {
9633
+ /** the field's path or the table's column; empty for a document that is its own text */
9634
+ field: [1, str],
9635
+ /** the string's place in a field that holds a list */
9636
+ item: [2, uint],
9637
+ start: [3, uint],
9638
+ end: [4, uint],
9639
+ /** the query's word, as its text wrote it */
9640
+ word: [5, str],
9599
9641
  }, {
9600
9642
  write(w, v) {
9601
9643
  const head = w.openMap();
9602
9644
  let n = 0;
9603
- if (v.id !== undefined) {
9645
+ if (v.field !== undefined) {
9604
9646
  w.field(1);
9605
- w.str(v.id);
9647
+ w.str(v.field);
9606
9648
  n++;
9607
9649
  }
9608
- if (v.value !== undefined) {
9650
+ if (v.item !== undefined) {
9609
9651
  w.field(2);
9610
- w.str(v.value);
9652
+ w.uint(v.item);
9611
9653
  n++;
9612
9654
  }
9613
- if (v.score !== undefined) {
9655
+ if (v.start !== undefined) {
9614
9656
  w.field(3);
9615
- w.float(v.score);
9657
+ w.uint(v.start);
9616
9658
  n++;
9617
9659
  }
9618
- if (v.row !== undefined) {
9660
+ if (v.end !== undefined) {
9619
9661
  w.field(4);
9620
- w.array(v.row.length);
9621
- for (const item0 of v.row) {
9622
- sqlValue.write(w, item0);
9623
- }
9662
+ w.uint(v.end);
9663
+ n++;
9664
+ }
9665
+ if (v.word !== undefined) {
9666
+ w.field(5);
9667
+ w.str(v.word);
9624
9668
  n++;
9625
9669
  }
9626
9670
  w.closeMap(head, n);
9627
9671
  },
9628
9672
  read(r) {
9629
- let $id;
9630
- let $value;
9631
- let $score;
9632
- let $row;
9673
+ let $field;
9674
+ let $item;
9675
+ let $start;
9676
+ let $end;
9677
+ let $word;
9633
9678
  for (let n = r.message(); n > 0; n--) {
9634
9679
  switch (r.field()) {
9635
9680
  case 1:
9636
- $id = r.str();
9681
+ $field = r.str();
9637
9682
  break;
9638
9683
  case 2:
9639
- $value = r.str();
9684
+ $item = r.uint();
9640
9685
  break;
9641
9686
  case 3:
9642
- $score = r.float();
9643
- break;
9644
- case 4: {
9645
- const items0 = [];
9646
- for (let i0 = r.array(); i0 > 0; i0--) {
9647
- items0.push(sqlValue.read(r));
9648
- }
9649
- r.leave();
9650
- $row = items0;
9651
- break;
9652
- }
9653
- default:
9654
- r.skip();
9655
- }
9656
- }
9657
- r.leave();
9658
- return { id: $id, value: $value, score: $score, row: $row };
9659
- },
9660
- });
9661
- export const SearchFound = message('search.Found', {
9662
- hits: [1, list(SearchHit)],
9663
- /** the text the search read in fact, when a word was read as another */
9664
- corrected: [2, str],
9665
- /** the columns of a table's index's rows */
9666
- columns: [3, list(str)],
9667
- }, {
9668
- write(w, v) {
9669
- const head = w.openMap();
9670
- let n = 0;
9671
- if (v.hits !== undefined) {
9672
- w.field(1);
9673
- w.array(v.hits.length);
9674
- for (const item0 of v.hits) {
9675
- SearchHit.write(w, item0);
9676
- }
9677
- n++;
9678
- }
9679
- if (v.corrected !== undefined) {
9680
- w.field(2);
9681
- w.str(v.corrected);
9682
- n++;
9683
- }
9684
- if (v.columns !== undefined) {
9685
- w.field(3);
9686
- w.array(v.columns.length);
9687
- for (const item0 of v.columns) {
9688
- w.str(item0);
9689
- }
9690
- n++;
9691
- }
9692
- w.closeMap(head, n);
9693
- },
9694
- read(r) {
9695
- let $hits;
9696
- let $corrected;
9697
- let $columns;
9698
- for (let n = r.message(); n > 0; n--) {
9699
- switch (r.field()) {
9700
- case 1: {
9701
- const items0 = [];
9702
- for (let i0 = r.array(); i0 > 0; i0--) {
9703
- items0.push(SearchHit.read(r));
9704
- }
9705
- r.leave();
9706
- $hits = items0;
9687
+ $start = r.uint();
9707
9688
  break;
9708
- }
9709
- case 2:
9710
- $corrected = r.str();
9689
+ case 4:
9690
+ $end = r.uint();
9711
9691
  break;
9712
- case 3: {
9713
- const items0 = [];
9714
- for (let i0 = r.array(); i0 > 0; i0--) {
9715
- items0.push(r.str());
9716
- }
9717
- r.leave();
9718
- $columns = items0;
9692
+ case 5:
9693
+ $word = r.str();
9719
9694
  break;
9720
- }
9721
9695
  default:
9722
9696
  r.skip();
9723
9697
  }
9724
9698
  }
9725
9699
  r.leave();
9726
- return { hits: $hits, corrected: $corrected, columns: $columns };
9700
+ return { field: $field, item: $item, start: $start, end: $end, word: $word };
9727
9701
  },
9728
9702
  });
9729
9703
  /**
@@ -11077,6 +11051,8 @@ export const SearchOpen = message('search.Open', {
11077
11051
  key: [13, str],
11078
11052
  /** the column of each row's vector, a blob of little-endian floats */
11079
11053
  vectorColumn: [14, str],
11054
+ /** the keyboard layouts its readers type with: ru and en, or none */
11055
+ layouts: [15, list(str)],
11080
11056
  }, {
11081
11057
  write(w, v) {
11082
11058
  const head = w.openMap();
@@ -11157,6 +11133,14 @@ export const SearchOpen = message('search.Open', {
11157
11133
  w.str(v.vectorColumn);
11158
11134
  n++;
11159
11135
  }
11136
+ if (v.layouts !== undefined) {
11137
+ w.field(15);
11138
+ w.array(v.layouts.length);
11139
+ for (const item0 of v.layouts) {
11140
+ w.str(item0);
11141
+ }
11142
+ n++;
11143
+ }
11160
11144
  w.closeMap(head, n);
11161
11145
  },
11162
11146
  read(r) {
@@ -11174,6 +11158,7 @@ export const SearchOpen = message('search.Open', {
11174
11158
  let $table;
11175
11159
  let $key;
11176
11160
  let $vectorColumn;
11161
+ let $layouts;
11177
11162
  for (let n = r.message(); n > 0; n--) {
11178
11163
  switch (r.field()) {
11179
11164
  case 1:
@@ -11230,6 +11215,15 @@ export const SearchOpen = message('search.Open', {
11230
11215
  case 14:
11231
11216
  $vectorColumn = r.str();
11232
11217
  break;
11218
+ case 15: {
11219
+ const items0 = [];
11220
+ for (let i0 = r.array(); i0 > 0; i0--) {
11221
+ items0.push(r.str());
11222
+ }
11223
+ r.leave();
11224
+ $layouts = items0;
11225
+ break;
11226
+ }
11233
11227
  default:
11234
11228
  r.skip();
11235
11229
  }
@@ -11250,11 +11244,13 @@ export const SearchOpen = message('search.Open', {
11250
11244
  table: $table,
11251
11245
  key: $key,
11252
11246
  vectorColumn: $vectorColumn,
11247
+ layouts: $layouts,
11253
11248
  };
11254
11249
  },
11255
11250
  });
11256
11251
  /**
11257
- * Documents set in one commit, all of them or none: 1,000 and 16 MiB at most.
11252
+ * Documents set in one commit, all of them or none: 1,000 at most, and no more
11253
+ * than one request body holds, 2 MiB from every SDK.
11258
11254
  */
11259
11255
  export const SearchSetMany = message('search.SetMany', {
11260
11256
  handle: [1, uint],
@@ -11303,6 +11299,166 @@ export const SearchSetMany = message('search.SetMany', {
11303
11299
  return { handle: $handle, documents: $documents };
11304
11300
  },
11305
11301
  });
11302
+ /**
11303
+ * A hit: a document and its value, or a table's row, a value a column of
11304
+ * the answer's columns, as sql.Rows holds one, and where the search's words
11305
+ * matched it when the query asked.
11306
+ */
11307
+ export const SearchHit = message('search.Hit', {
11308
+ id: [1, str],
11309
+ /** null for a table's row */
11310
+ value: [2, str],
11311
+ score: [3, float],
11312
+ row: [4, list(sqlValue)],
11313
+ matches: [5, list(SearchMatch)],
11314
+ }, {
11315
+ write(w, v) {
11316
+ const head = w.openMap();
11317
+ let n = 0;
11318
+ if (v.id !== undefined) {
11319
+ w.field(1);
11320
+ w.str(v.id);
11321
+ n++;
11322
+ }
11323
+ if (v.value !== undefined) {
11324
+ w.field(2);
11325
+ w.str(v.value);
11326
+ n++;
11327
+ }
11328
+ if (v.score !== undefined) {
11329
+ w.field(3);
11330
+ w.float(v.score);
11331
+ n++;
11332
+ }
11333
+ if (v.row !== undefined) {
11334
+ w.field(4);
11335
+ w.array(v.row.length);
11336
+ for (const item0 of v.row) {
11337
+ sqlValue.write(w, item0);
11338
+ }
11339
+ n++;
11340
+ }
11341
+ if (v.matches !== undefined) {
11342
+ w.field(5);
11343
+ w.array(v.matches.length);
11344
+ for (const item0 of v.matches) {
11345
+ SearchMatch.write(w, item0);
11346
+ }
11347
+ n++;
11348
+ }
11349
+ w.closeMap(head, n);
11350
+ },
11351
+ read(r) {
11352
+ let $id;
11353
+ let $value;
11354
+ let $score;
11355
+ let $row;
11356
+ let $matches;
11357
+ for (let n = r.message(); n > 0; n--) {
11358
+ switch (r.field()) {
11359
+ case 1:
11360
+ $id = r.str();
11361
+ break;
11362
+ case 2:
11363
+ $value = r.str();
11364
+ break;
11365
+ case 3:
11366
+ $score = r.float();
11367
+ break;
11368
+ case 4: {
11369
+ const items0 = [];
11370
+ for (let i0 = r.array(); i0 > 0; i0--) {
11371
+ items0.push(sqlValue.read(r));
11372
+ }
11373
+ r.leave();
11374
+ $row = items0;
11375
+ break;
11376
+ }
11377
+ case 5: {
11378
+ const items0 = [];
11379
+ for (let i0 = r.array(); i0 > 0; i0--) {
11380
+ items0.push(SearchMatch.read(r));
11381
+ }
11382
+ r.leave();
11383
+ $matches = items0;
11384
+ break;
11385
+ }
11386
+ default:
11387
+ r.skip();
11388
+ }
11389
+ }
11390
+ r.leave();
11391
+ return { id: $id, value: $value, score: $score, row: $row, matches: $matches };
11392
+ },
11393
+ });
11394
+ export const SearchFound = message('search.Found', {
11395
+ hits: [1, list(SearchHit)],
11396
+ /** the text the search read in fact, when a word was read as another */
11397
+ corrected: [2, str],
11398
+ /** the columns of a table's index's rows */
11399
+ columns: [3, list(str)],
11400
+ }, {
11401
+ write(w, v) {
11402
+ const head = w.openMap();
11403
+ let n = 0;
11404
+ if (v.hits !== undefined) {
11405
+ w.field(1);
11406
+ w.array(v.hits.length);
11407
+ for (const item0 of v.hits) {
11408
+ SearchHit.write(w, item0);
11409
+ }
11410
+ n++;
11411
+ }
11412
+ if (v.corrected !== undefined) {
11413
+ w.field(2);
11414
+ w.str(v.corrected);
11415
+ n++;
11416
+ }
11417
+ if (v.columns !== undefined) {
11418
+ w.field(3);
11419
+ w.array(v.columns.length);
11420
+ for (const item0 of v.columns) {
11421
+ w.str(item0);
11422
+ }
11423
+ n++;
11424
+ }
11425
+ w.closeMap(head, n);
11426
+ },
11427
+ read(r) {
11428
+ let $hits;
11429
+ let $corrected;
11430
+ let $columns;
11431
+ for (let n = r.message(); n > 0; n--) {
11432
+ switch (r.field()) {
11433
+ case 1: {
11434
+ const items0 = [];
11435
+ for (let i0 = r.array(); i0 > 0; i0--) {
11436
+ items0.push(SearchHit.read(r));
11437
+ }
11438
+ r.leave();
11439
+ $hits = items0;
11440
+ break;
11441
+ }
11442
+ case 2:
11443
+ $corrected = r.str();
11444
+ break;
11445
+ case 3: {
11446
+ const items0 = [];
11447
+ for (let i0 = r.array(); i0 > 0; i0--) {
11448
+ items0.push(r.str());
11449
+ }
11450
+ r.leave();
11451
+ $columns = items0;
11452
+ break;
11453
+ }
11454
+ default:
11455
+ r.skip();
11456
+ }
11457
+ }
11458
+ r.leave();
11459
+ return { hits: $hits, corrected: $corrected, columns: $columns };
11460
+ },
11461
+ });
11306
11462
  /**
11307
11463
  * A setting's line of explain.
11308
11464
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinyshed/tinystore",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
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
6
  "homepage": "https://tinyshed.org/tinystore",
@@ -31,12 +31,12 @@
31
31
  "README.md"
32
32
  ],
33
33
  "optionalDependencies": {
34
- "@tinyshed/tinystore-linux-x64": "0.4.0",
35
- "@tinyshed/tinystore-linux-arm64": "0.4.0",
36
- "@tinyshed/tinystore-linux-x64-musl": "0.4.0",
37
- "@tinyshed/tinystore-linux-arm64-musl": "0.4.0",
38
- "@tinyshed/tinystore-darwin-arm64": "0.4.0",
39
- "@tinyshed/tinystore-darwin-x64": "0.4.0",
40
- "@tinyshed/tinystore-win32-x64": "0.4.0"
34
+ "@tinyshed/tinystore-linux-x64": "0.5.0",
35
+ "@tinyshed/tinystore-linux-arm64": "0.5.0",
36
+ "@tinyshed/tinystore-linux-x64-musl": "0.5.0",
37
+ "@tinyshed/tinystore-linux-arm64-musl": "0.5.0",
38
+ "@tinyshed/tinystore-darwin-arm64": "0.5.0",
39
+ "@tinyshed/tinystore-darwin-x64": "0.5.0",
40
+ "@tinyshed/tinystore-win32-x64": "0.5.0"
41
41
  }
42
42
  }