@peerbit/indexer-tests 1.1.20 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/indexer-tests",
3
- "version": "1.1.20",
3
+ "version": "2.0.0",
4
4
  "description": "Tests document store index engines",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -55,14 +55,14 @@
55
55
  "author": "dao.xyz",
56
56
  "license": "MIT",
57
57
  "dependencies": {
58
- "@dao-xyz/borsh": "^5.2.3",
58
+ "@dao-xyz/borsh": "^6.0.0",
59
59
  "libsodium-wrappers": "^0.7.15",
60
60
  "uint8arrays": "^5.1.0",
61
61
  "benchmark": "^2.1.4",
62
62
  "uuid": "^10.0.0",
63
- "@peerbit/indexer-interface": "2.0.14",
64
- "@peerbit/crypto": "2.3.13",
65
- "@peerbit/time": "2.2.0"
63
+ "@peerbit/indexer-interface": "2.1.0",
64
+ "@peerbit/time": "2.3.0",
65
+ "@peerbit/crypto": "2.4.0"
66
66
  },
67
67
  "scripts": {
68
68
  "clean": "aegir clean",
package/src/benchmarks.ts CHANGED
@@ -97,7 +97,6 @@ const stringBenchmark = async (
97
97
  });
98
98
  })
99
99
  .add("string count no-matches - " + type, async () => {
100
- const out = Math.random() > 0.5 ? true : false;
101
100
  await stringIndexPreFilled.store.count({
102
101
  query: new StringMatch({ key: "string", value: uuid() }),
103
102
  });
package/src/tests.ts CHANGED
@@ -33,11 +33,7 @@ import {
33
33
  id,
34
34
  toId,
35
35
  } from "@peerbit/indexer-interface";
36
- import {
37
- /* delay, */
38
- delay,
39
- waitForResolved,
40
- } from "@peerbit/time";
36
+ import { waitForResolved } from "@peerbit/time";
41
37
  import { expect } from "chai";
42
38
  import sodium from "libsodium-wrappers";
43
39
  import { equals } from "uint8arrays";
@@ -333,6 +329,7 @@ export const tests = (
333
329
  };
334
330
 
335
331
  describe("string", () => {
332
+ @variant("SimpleDocument")
336
333
  class SimpleDocument {
337
334
  @field({ type: "string" })
338
335
  id: string;
@@ -425,6 +422,7 @@ export const tests = (
425
422
  });
426
423
 
427
424
  describe("bytes", () => {
425
+ @variant("DocumentUint8arrayId")
428
426
  class DocumentUint8arrayId {
429
427
  @field({ type: Uint8Array })
430
428
  id: Uint8Array;
@@ -449,6 +447,7 @@ export const tests = (
449
447
  await testIndex(store, doc);
450
448
  });
451
449
 
450
+ @variant("DocumentFixedUint8arrayId")
452
451
  class DocumentFixedUint8arrayId {
453
452
  @field({ type: fixedArray("u8", 32) })
454
453
  id: Uint8Array;
@@ -475,6 +474,7 @@ export const tests = (
475
474
  });
476
475
 
477
476
  describe("number", () => {
477
+ @variant("DocumentNumberId")
478
478
  class DocumentNumberId {
479
479
  @field({ type: "u32" })
480
480
  id: number;
@@ -502,6 +502,7 @@ export const tests = (
502
502
  });
503
503
 
504
504
  describe("bigint", () => {
505
+ @variant("DocumentBigintId")
505
506
  class DocumentBigintId {
506
507
  @field({ type: "u64" })
507
508
  id: bigint;
@@ -529,6 +530,7 @@ export const tests = (
529
530
  });
530
531
 
531
532
  describe("by decorator", () => {
533
+ @variant("DocumentWithDecoratedId")
532
534
  class DocumentWithDecoratedId {
533
535
  @id({ type: "string" })
534
536
  xyz: string;
@@ -876,6 +878,7 @@ export const tests = (
876
878
 
877
879
  describe("array", () => {
878
880
  describe("uint8arrays", () => {
881
+ @variant("Uint8arraysVec")
879
882
  class Uint8arraysVec {
880
883
  @field({ type: Uint8Array })
881
884
  id: Uint8Array;
@@ -915,6 +918,7 @@ export const tests = (
915
918
  });
916
919
 
917
920
  describe("documents", () => {
921
+ @variant("DocumentsVec")
918
922
  class DocumentsVec {
919
923
  @field({ type: Uint8Array })
920
924
  id: Uint8Array;
@@ -931,6 +935,7 @@ export const tests = (
931
935
  }
932
936
  }
933
937
 
938
+ @variant("DocumentWithProperty")
934
939
  class DocumentWithProperty {
935
940
  @field({ type: "string" })
936
941
  property: string;
@@ -940,6 +945,7 @@ export const tests = (
940
945
  }
941
946
  }
942
947
 
948
+ @variant("DocumentsVecWithPropertyDocument")
943
949
  class DocumentsVecWithPropertyDocument {
944
950
  @field({ type: Uint8Array })
945
951
  id: Uint8Array;
@@ -1380,6 +1386,7 @@ export const tests = (
1380
1386
  });
1381
1387
 
1382
1388
  describe("simple value", () => {
1389
+ @variant("ArrayDocument")
1383
1390
  class ArrayDocument {
1384
1391
  @field({ type: Uint8Array })
1385
1392
  id: Uint8Array;
@@ -2010,6 +2017,7 @@ export const tests = (
2010
2017
 
2011
2018
  describe("nested", () => {
2012
2019
  describe("one level", () => {
2020
+ @variant("NestedOneLevel")
2013
2021
  class Nested {
2014
2022
  @field({ type: "u64" })
2015
2023
  number: bigint;
@@ -2134,6 +2142,7 @@ export const tests = (
2134
2142
  });
2135
2143
 
2136
2144
  describe("one level flat constructor", () => {
2145
+ @variant("NestedOneLevelFlatConstructor")
2137
2146
  class Nested {
2138
2147
  @field({ type: "bool" })
2139
2148
  bool: boolean;
@@ -2201,6 +2210,7 @@ export const tests = (
2201
2210
  });
2202
2211
 
2203
2212
  describe("2-level-variants", () => {
2213
+ @variant("L1_2Level")
2204
2214
  class L1 {
2205
2215
  @field({ type: option("u64") })
2206
2216
  number?: bigint;
@@ -2210,6 +2220,7 @@ export const tests = (
2210
2220
  }
2211
2221
  }
2212
2222
 
2223
+ @variant("L0_2Level")
2213
2224
  class L0 {
2214
2225
  @field({ type: option(L1) })
2215
2226
  nestedAgain?: L1;
@@ -2271,6 +2282,7 @@ export const tests = (
2271
2282
  });
2272
2283
 
2273
2284
  describe("3-level-variants", () => {
2285
+ @variant("L2_3Level")
2274
2286
  class L2 {
2275
2287
  @field({ type: option("u64") })
2276
2288
  number?: bigint;
@@ -2280,6 +2292,7 @@ export const tests = (
2280
2292
  }
2281
2293
  }
2282
2294
 
2295
+ @variant("L1_3Level")
2283
2296
  class L1 {
2284
2297
  @field({ type: option(L2) })
2285
2298
  nestedAgainAgain?: L2;
@@ -2289,6 +2302,7 @@ export const tests = (
2289
2302
  }
2290
2303
  }
2291
2304
 
2305
+ @variant("L0_3Level")
2292
2306
  class L0 {
2293
2307
  @field({ type: option(L1) })
2294
2308
  nestedAgain?: L1;
@@ -2549,6 +2563,7 @@ export const tests = (
2549
2563
  }
2550
2564
  }
2551
2565
 
2566
+ @variant("NestedNonArray")
2552
2567
  class Nested {
2553
2568
  @field({ type: option(Base) })
2554
2569
  nestedAgain?: Base;
@@ -2781,6 +2796,7 @@ export const tests = (
2781
2796
  });
2782
2797
 
2783
2798
  describe("nested-string-array", () => {
2799
+ @variant("NestedStringArray")
2784
2800
  class Nested {
2785
2801
  @field({ type: vec("string") })
2786
2802
  arr: string[];
@@ -2844,6 +2860,7 @@ export const tests = (
2844
2860
  });
2845
2861
 
2846
2862
  describe("nested multiple fields", () => {
2863
+ @variant("NestedMultipleFieldsDocument")
2847
2864
  class NestedMultipleFieldsDocument {
2848
2865
  @field({ type: "string" })
2849
2866
  a: string;
@@ -3089,6 +3106,7 @@ export const tests = (
3089
3106
  });
3090
3107
 
3091
3108
  describe("nested", () => {
3109
+ @variant("MultifieldNested_ShapeNested")
3092
3110
  class MultifieldNested {
3093
3111
  @field({ type: "bool" })
3094
3112
  bool: boolean;
@@ -3106,6 +3124,7 @@ export const tests = (
3106
3124
  }
3107
3125
  }
3108
3126
 
3127
+ @variant("NestedBoolQueryDocument_ShapeNested")
3109
3128
  class NestedBoolQueryDocument {
3110
3129
  @id({ type: "string" })
3111
3130
  id: string;
@@ -3258,6 +3277,7 @@ export const tests = (
3258
3277
  }
3259
3278
  }
3260
3279
 
3280
+ @variant("NestedBoolQueryDocument_ShapeNestedPoly")
3261
3281
  class NestedBoolQueryDocument {
3262
3282
  @id({ type: "string" })
3263
3283
  id: string;
@@ -3371,6 +3391,7 @@ export const tests = (
3371
3391
  });
3372
3392
 
3373
3393
  describe("nested-array", () => {
3394
+ @variant("MultifieldNested_ShapeNestedArray")
3374
3395
  class MultifieldNested {
3375
3396
  @field({ type: "bool" })
3376
3397
  bool: boolean;
@@ -3388,6 +3409,7 @@ export const tests = (
3388
3409
  }
3389
3410
  }
3390
3411
 
3412
+ @variant("NestedBoolQueryDocument_ShapeNestedArray")
3391
3413
  class NestedBoolQueryDocument {
3392
3414
  @id({ type: "string" })
3393
3415
  id: string;
@@ -3785,6 +3807,7 @@ export const tests = (
3785
3807
  });
3786
3808
 
3787
3809
  describe("nested-nested-invariant", () => {
3810
+ @variant("V0_nested_nested_invariant")
3788
3811
  class V0 {
3789
3812
  @field({ type: "u64" })
3790
3813
  number: bigint;
@@ -3794,6 +3817,7 @@ export const tests = (
3794
3817
  }
3795
3818
  }
3796
3819
 
3820
+ @variant("NestedValue_nested_nested_invariant")
3797
3821
  class NestedValue {
3798
3822
  @field({ type: V0 })
3799
3823
  v0?: V0;
@@ -3803,6 +3827,7 @@ export const tests = (
3803
3827
  }
3804
3828
  }
3805
3829
 
3830
+ @variant("Document_nested_nested_invariant")
3806
3831
  class Document {
3807
3832
  @id({ type: "string" })
3808
3833
  id: string;
@@ -3842,6 +3867,7 @@ export const tests = (
3842
3867
  });
3843
3868
 
3844
3869
  describe("variant-nested-invariant", () => {
3870
+ @variant("V0_variant_nested_invariant")
3845
3871
  class V0 {
3846
3872
  @field({ type: "u64" })
3847
3873
  number: bigint;
@@ -3851,6 +3877,7 @@ export const tests = (
3851
3877
  }
3852
3878
  }
3853
3879
 
3880
+ @variant("NestedValue_variant_nested_invariant")
3854
3881
  class NestedValue {
3855
3882
  @field({ type: V0 })
3856
3883
  v0?: V0;
@@ -4084,6 +4111,7 @@ export const tests = (
4084
4111
  });
4085
4112
 
4086
4113
  describe("sum", () => {
4114
+ @variant("SummableDocument")
4087
4115
  class SummableDocument {
4088
4116
  @field({ type: "string" })
4089
4117
  id: string;
@@ -4188,6 +4216,7 @@ export const tests = (
4188
4216
  });
4189
4217
 
4190
4218
  describe("count", () => {
4219
+ @variant("NumberArrayDocument")
4191
4220
  class NumberArrayDocument {
4192
4221
  @field({ type: "string" })
4193
4222
  id: string;
@@ -4498,6 +4527,7 @@ export const tests = (
4498
4527
  });
4499
4528
 
4500
4529
  it("multi-scope insertion", async () => {
4530
+ @variant("AnotherDocument")
4501
4531
  class AnotherDocument {
4502
4532
  @id({ type: "string" })
4503
4533
  id: string;