@tinyshed/tinystore 0.4.1 → 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.
@@ -2401,36 +2401,27 @@ export declare const SearchQuery: import("./codec.ts").Message<{
2401
2401
  readonly limit: readonly [8, import("./codec.ts").Codec<number, number>];
2402
2402
  /** the last word read as the start of a word too, as a search box types */
2403
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>];
2404
2408
  }>;
2405
2409
  /**
2406
- * A hit: a document and its value, or a table's row, a value a column of
2407
- * the answer's columns, as sql.Rows holds one.
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.
2408
2415
  */
2409
- export declare const SearchHit: import("./codec.ts").Message<{
2410
- readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2411
- /** null for a table's row */
2412
- readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2413
- readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2414
- readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2415
- }>;
2416
- export declare const SearchFound: import("./codec.ts").Message<{
2417
- readonly hits: readonly [1, import("./codec.ts").Codec<Read<{
2418
- readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2419
- /** null for a table's row */
2420
- readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2421
- readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2422
- readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2423
- }>[], readonly import("./codec.ts").Written<{
2424
- readonly id: readonly [1, import("./codec.ts").Codec<string, string>];
2425
- /** null for a table's row */
2426
- readonly value: readonly [2, import("./codec.ts").Codec<string, string>];
2427
- readonly score: readonly [3, import("./codec.ts").Codec<number, number>];
2428
- readonly row: readonly [4, import("./codec.ts").Codec<(boolean | SqlValue)[], readonly import("./codec.ts").SqlArg[]>];
2429
- }>[]>];
2430
- /** the text the search read in fact, when a word was read as another */
2431
- readonly corrected: readonly [2, import("./codec.ts").Codec<string, string>];
2432
- /** the columns of a table's index's rows */
2433
- readonly columns: readonly [3, import("./codec.ts").Codec<string[], readonly string[]>];
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>];
2434
2425
  }>;
2435
2426
  /**
2436
2427
  * Where an index stands: ready, rebuilding and how far, or failed and why.
@@ -2791,9 +2782,12 @@ export declare const SearchOpen: import("./codec.ts").Message<{
2791
2782
  readonly key: readonly [13, import("./codec.ts").Codec<string, string>];
2792
2783
  /** the column of each row's vector, a blob of little-endian floats */
2793
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[]>];
2794
2787
  }>;
2795
2788
  /**
2796
- * 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.
2797
2791
  */
2798
2792
  export declare const SearchSetMany: import("./codec.ts").Message<{
2799
2793
  readonly handle: readonly [1, import("./codec.ts").Codec<number, number>];
@@ -2809,6 +2803,94 @@ export declare const SearchSetMany: import("./codec.ts").Message<{
2809
2803
  readonly noVector: readonly [4, import("./codec.ts").Codec<boolean, boolean>];
2810
2804
  }>[]>];
2811
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
+ }>;
2812
2894
  /**
2813
2895
  * A setting's line of explain.
2814
2896
  */
@@ -9490,6 +9490,10 @@ export const SearchQuery = message('search.Query', {
9490
9490
  limit: [8, uint],
9491
9491
  /** the last word read as the start of a word too, as a search box types */
9492
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],
9493
9497
  }, {
9494
9498
  write(w, v) {
9495
9499
  const head = w.openMap();
@@ -9539,6 +9543,16 @@ export const SearchQuery = message('search.Query', {
9539
9543
  w.bool(v.prefix);
9540
9544
  n++;
9541
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
+ }
9542
9556
  w.closeMap(head, n);
9543
9557
  },
9544
9558
  read(r) {
@@ -9551,6 +9565,8 @@ export const SearchQuery = message('search.Query', {
9551
9565
  let $offset;
9552
9566
  let $limit;
9553
9567
  let $prefix;
9568
+ let $prefixEvery;
9569
+ let $matches;
9554
9570
  for (let n = r.message(); n > 0; n--) {
9555
9571
  switch (r.field()) {
9556
9572
  case 1:
@@ -9580,6 +9596,12 @@ export const SearchQuery = message('search.Query', {
9580
9596
  case 9:
9581
9597
  $prefix = r.bool();
9582
9598
  break;
9599
+ case 10:
9600
+ $prefixEvery = r.bool();
9601
+ break;
9602
+ case 11:
9603
+ $matches = r.str();
9604
+ break;
9583
9605
  default:
9584
9606
  r.skip();
9585
9607
  }
@@ -9595,147 +9617,87 @@ export const SearchQuery = message('search.Query', {
9595
9617
  offset: $offset,
9596
9618
  limit: $limit,
9597
9619
  prefix: $prefix,
9620
+ prefixEvery: $prefixEvery,
9621
+ matches: $matches,
9598
9622
  };
9599
9623
  },
9600
9624
  });
9601
9625
  /**
9602
- * A hit: a document and its value, or a table's row, a value a column of
9603
- * 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.
9604
9631
  */
9605
- export const SearchHit = message('search.Hit', {
9606
- id: [1, str],
9607
- /** null for a table's row */
9608
- value: [2, str],
9609
- score: [3, float],
9610
- 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],
9611
9641
  }, {
9612
9642
  write(w, v) {
9613
9643
  const head = w.openMap();
9614
9644
  let n = 0;
9615
- if (v.id !== undefined) {
9645
+ if (v.field !== undefined) {
9616
9646
  w.field(1);
9617
- w.str(v.id);
9647
+ w.str(v.field);
9618
9648
  n++;
9619
9649
  }
9620
- if (v.value !== undefined) {
9650
+ if (v.item !== undefined) {
9621
9651
  w.field(2);
9622
- w.str(v.value);
9652
+ w.uint(v.item);
9623
9653
  n++;
9624
9654
  }
9625
- if (v.score !== undefined) {
9655
+ if (v.start !== undefined) {
9626
9656
  w.field(3);
9627
- w.float(v.score);
9657
+ w.uint(v.start);
9628
9658
  n++;
9629
9659
  }
9630
- if (v.row !== undefined) {
9660
+ if (v.end !== undefined) {
9631
9661
  w.field(4);
9632
- w.array(v.row.length);
9633
- for (const item0 of v.row) {
9634
- sqlValue.write(w, item0);
9635
- }
9662
+ w.uint(v.end);
9663
+ n++;
9664
+ }
9665
+ if (v.word !== undefined) {
9666
+ w.field(5);
9667
+ w.str(v.word);
9636
9668
  n++;
9637
9669
  }
9638
9670
  w.closeMap(head, n);
9639
9671
  },
9640
9672
  read(r) {
9641
- let $id;
9642
- let $value;
9643
- let $score;
9644
- let $row;
9673
+ let $field;
9674
+ let $item;
9675
+ let $start;
9676
+ let $end;
9677
+ let $word;
9645
9678
  for (let n = r.message(); n > 0; n--) {
9646
9679
  switch (r.field()) {
9647
9680
  case 1:
9648
- $id = r.str();
9681
+ $field = r.str();
9649
9682
  break;
9650
9683
  case 2:
9651
- $value = r.str();
9684
+ $item = r.uint();
9652
9685
  break;
9653
9686
  case 3:
9654
- $score = r.float();
9655
- break;
9656
- case 4: {
9657
- const items0 = [];
9658
- for (let i0 = r.array(); i0 > 0; i0--) {
9659
- items0.push(sqlValue.read(r));
9660
- }
9661
- r.leave();
9662
- $row = items0;
9663
- break;
9664
- }
9665
- default:
9666
- r.skip();
9667
- }
9668
- }
9669
- r.leave();
9670
- return { id: $id, value: $value, score: $score, row: $row };
9671
- },
9672
- });
9673
- export const SearchFound = message('search.Found', {
9674
- hits: [1, list(SearchHit)],
9675
- /** the text the search read in fact, when a word was read as another */
9676
- corrected: [2, str],
9677
- /** the columns of a table's index's rows */
9678
- columns: [3, list(str)],
9679
- }, {
9680
- write(w, v) {
9681
- const head = w.openMap();
9682
- let n = 0;
9683
- if (v.hits !== undefined) {
9684
- w.field(1);
9685
- w.array(v.hits.length);
9686
- for (const item0 of v.hits) {
9687
- SearchHit.write(w, item0);
9688
- }
9689
- n++;
9690
- }
9691
- if (v.corrected !== undefined) {
9692
- w.field(2);
9693
- w.str(v.corrected);
9694
- n++;
9695
- }
9696
- if (v.columns !== undefined) {
9697
- w.field(3);
9698
- w.array(v.columns.length);
9699
- for (const item0 of v.columns) {
9700
- w.str(item0);
9701
- }
9702
- n++;
9703
- }
9704
- w.closeMap(head, n);
9705
- },
9706
- read(r) {
9707
- let $hits;
9708
- let $corrected;
9709
- let $columns;
9710
- for (let n = r.message(); n > 0; n--) {
9711
- switch (r.field()) {
9712
- case 1: {
9713
- const items0 = [];
9714
- for (let i0 = r.array(); i0 > 0; i0--) {
9715
- items0.push(SearchHit.read(r));
9716
- }
9717
- r.leave();
9718
- $hits = items0;
9687
+ $start = r.uint();
9719
9688
  break;
9720
- }
9721
- case 2:
9722
- $corrected = r.str();
9689
+ case 4:
9690
+ $end = r.uint();
9723
9691
  break;
9724
- case 3: {
9725
- const items0 = [];
9726
- for (let i0 = r.array(); i0 > 0; i0--) {
9727
- items0.push(r.str());
9728
- }
9729
- r.leave();
9730
- $columns = items0;
9692
+ case 5:
9693
+ $word = r.str();
9731
9694
  break;
9732
- }
9733
9695
  default:
9734
9696
  r.skip();
9735
9697
  }
9736
9698
  }
9737
9699
  r.leave();
9738
- return { hits: $hits, corrected: $corrected, columns: $columns };
9700
+ return { field: $field, item: $item, start: $start, end: $end, word: $word };
9739
9701
  },
9740
9702
  });
9741
9703
  /**
@@ -11089,6 +11051,8 @@ export const SearchOpen = message('search.Open', {
11089
11051
  key: [13, str],
11090
11052
  /** the column of each row's vector, a blob of little-endian floats */
11091
11053
  vectorColumn: [14, str],
11054
+ /** the keyboard layouts its readers type with: ru and en, or none */
11055
+ layouts: [15, list(str)],
11092
11056
  }, {
11093
11057
  write(w, v) {
11094
11058
  const head = w.openMap();
@@ -11169,6 +11133,14 @@ export const SearchOpen = message('search.Open', {
11169
11133
  w.str(v.vectorColumn);
11170
11134
  n++;
11171
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
+ }
11172
11144
  w.closeMap(head, n);
11173
11145
  },
11174
11146
  read(r) {
@@ -11186,6 +11158,7 @@ export const SearchOpen = message('search.Open', {
11186
11158
  let $table;
11187
11159
  let $key;
11188
11160
  let $vectorColumn;
11161
+ let $layouts;
11189
11162
  for (let n = r.message(); n > 0; n--) {
11190
11163
  switch (r.field()) {
11191
11164
  case 1:
@@ -11242,6 +11215,15 @@ export const SearchOpen = message('search.Open', {
11242
11215
  case 14:
11243
11216
  $vectorColumn = r.str();
11244
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
+ }
11245
11227
  default:
11246
11228
  r.skip();
11247
11229
  }
@@ -11262,11 +11244,13 @@ export const SearchOpen = message('search.Open', {
11262
11244
  table: $table,
11263
11245
  key: $key,
11264
11246
  vectorColumn: $vectorColumn,
11247
+ layouts: $layouts,
11265
11248
  };
11266
11249
  },
11267
11250
  });
11268
11251
  /**
11269
- * 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.
11270
11254
  */
11271
11255
  export const SearchSetMany = message('search.SetMany', {
11272
11256
  handle: [1, uint],
@@ -11315,6 +11299,166 @@ export const SearchSetMany = message('search.SetMany', {
11315
11299
  return { handle: $handle, documents: $documents };
11316
11300
  },
11317
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
+ });
11318
11462
  /**
11319
11463
  * A setting's line of explain.
11320
11464
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinyshed/tinystore",
3
- "version": "0.4.1",
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.1",
35
- "@tinyshed/tinystore-linux-arm64": "0.4.1",
36
- "@tinyshed/tinystore-linux-x64-musl": "0.4.1",
37
- "@tinyshed/tinystore-linux-arm64-musl": "0.4.1",
38
- "@tinyshed/tinystore-darwin-arm64": "0.4.1",
39
- "@tinyshed/tinystore-darwin-x64": "0.4.1",
40
- "@tinyshed/tinystore-win32-x64": "0.4.1"
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
  }