@peerbit/indexer-tests 1.2.0 → 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/dist/src/tests.d.ts.map +1 -1
- package/dist/src/tests.js +374 -68
- package/dist/src/tests.js.map +1 -1
- package/package.json +1 -1
- package/src/tests.ts +34 -0
package/package.json
CHANGED
package/src/tests.ts
CHANGED
|
@@ -329,6 +329,7 @@ export const tests = (
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
describe("string", () => {
|
|
332
|
+
@variant("SimpleDocument")
|
|
332
333
|
class SimpleDocument {
|
|
333
334
|
@field({ type: "string" })
|
|
334
335
|
id: string;
|
|
@@ -421,6 +422,7 @@ export const tests = (
|
|
|
421
422
|
});
|
|
422
423
|
|
|
423
424
|
describe("bytes", () => {
|
|
425
|
+
@variant("DocumentUint8arrayId")
|
|
424
426
|
class DocumentUint8arrayId {
|
|
425
427
|
@field({ type: Uint8Array })
|
|
426
428
|
id: Uint8Array;
|
|
@@ -445,6 +447,7 @@ export const tests = (
|
|
|
445
447
|
await testIndex(store, doc);
|
|
446
448
|
});
|
|
447
449
|
|
|
450
|
+
@variant("DocumentFixedUint8arrayId")
|
|
448
451
|
class DocumentFixedUint8arrayId {
|
|
449
452
|
@field({ type: fixedArray("u8", 32) })
|
|
450
453
|
id: Uint8Array;
|
|
@@ -471,6 +474,7 @@ export const tests = (
|
|
|
471
474
|
});
|
|
472
475
|
|
|
473
476
|
describe("number", () => {
|
|
477
|
+
@variant("DocumentNumberId")
|
|
474
478
|
class DocumentNumberId {
|
|
475
479
|
@field({ type: "u32" })
|
|
476
480
|
id: number;
|
|
@@ -498,6 +502,7 @@ export const tests = (
|
|
|
498
502
|
});
|
|
499
503
|
|
|
500
504
|
describe("bigint", () => {
|
|
505
|
+
@variant("DocumentBigintId")
|
|
501
506
|
class DocumentBigintId {
|
|
502
507
|
@field({ type: "u64" })
|
|
503
508
|
id: bigint;
|
|
@@ -525,6 +530,7 @@ export const tests = (
|
|
|
525
530
|
});
|
|
526
531
|
|
|
527
532
|
describe("by decorator", () => {
|
|
533
|
+
@variant("DocumentWithDecoratedId")
|
|
528
534
|
class DocumentWithDecoratedId {
|
|
529
535
|
@id({ type: "string" })
|
|
530
536
|
xyz: string;
|
|
@@ -872,6 +878,7 @@ export const tests = (
|
|
|
872
878
|
|
|
873
879
|
describe("array", () => {
|
|
874
880
|
describe("uint8arrays", () => {
|
|
881
|
+
@variant("Uint8arraysVec")
|
|
875
882
|
class Uint8arraysVec {
|
|
876
883
|
@field({ type: Uint8Array })
|
|
877
884
|
id: Uint8Array;
|
|
@@ -911,6 +918,7 @@ export const tests = (
|
|
|
911
918
|
});
|
|
912
919
|
|
|
913
920
|
describe("documents", () => {
|
|
921
|
+
@variant("DocumentsVec")
|
|
914
922
|
class DocumentsVec {
|
|
915
923
|
@field({ type: Uint8Array })
|
|
916
924
|
id: Uint8Array;
|
|
@@ -927,6 +935,7 @@ export const tests = (
|
|
|
927
935
|
}
|
|
928
936
|
}
|
|
929
937
|
|
|
938
|
+
@variant("DocumentWithProperty")
|
|
930
939
|
class DocumentWithProperty {
|
|
931
940
|
@field({ type: "string" })
|
|
932
941
|
property: string;
|
|
@@ -936,6 +945,7 @@ export const tests = (
|
|
|
936
945
|
}
|
|
937
946
|
}
|
|
938
947
|
|
|
948
|
+
@variant("DocumentsVecWithPropertyDocument")
|
|
939
949
|
class DocumentsVecWithPropertyDocument {
|
|
940
950
|
@field({ type: Uint8Array })
|
|
941
951
|
id: Uint8Array;
|
|
@@ -1376,6 +1386,7 @@ export const tests = (
|
|
|
1376
1386
|
});
|
|
1377
1387
|
|
|
1378
1388
|
describe("simple value", () => {
|
|
1389
|
+
@variant("ArrayDocument")
|
|
1379
1390
|
class ArrayDocument {
|
|
1380
1391
|
@field({ type: Uint8Array })
|
|
1381
1392
|
id: Uint8Array;
|
|
@@ -2006,6 +2017,7 @@ export const tests = (
|
|
|
2006
2017
|
|
|
2007
2018
|
describe("nested", () => {
|
|
2008
2019
|
describe("one level", () => {
|
|
2020
|
+
@variant("NestedOneLevel")
|
|
2009
2021
|
class Nested {
|
|
2010
2022
|
@field({ type: "u64" })
|
|
2011
2023
|
number: bigint;
|
|
@@ -2130,6 +2142,7 @@ export const tests = (
|
|
|
2130
2142
|
});
|
|
2131
2143
|
|
|
2132
2144
|
describe("one level flat constructor", () => {
|
|
2145
|
+
@variant("NestedOneLevelFlatConstructor")
|
|
2133
2146
|
class Nested {
|
|
2134
2147
|
@field({ type: "bool" })
|
|
2135
2148
|
bool: boolean;
|
|
@@ -2197,6 +2210,7 @@ export const tests = (
|
|
|
2197
2210
|
});
|
|
2198
2211
|
|
|
2199
2212
|
describe("2-level-variants", () => {
|
|
2213
|
+
@variant("L1_2Level")
|
|
2200
2214
|
class L1 {
|
|
2201
2215
|
@field({ type: option("u64") })
|
|
2202
2216
|
number?: bigint;
|
|
@@ -2206,6 +2220,7 @@ export const tests = (
|
|
|
2206
2220
|
}
|
|
2207
2221
|
}
|
|
2208
2222
|
|
|
2223
|
+
@variant("L0_2Level")
|
|
2209
2224
|
class L0 {
|
|
2210
2225
|
@field({ type: option(L1) })
|
|
2211
2226
|
nestedAgain?: L1;
|
|
@@ -2267,6 +2282,7 @@ export const tests = (
|
|
|
2267
2282
|
});
|
|
2268
2283
|
|
|
2269
2284
|
describe("3-level-variants", () => {
|
|
2285
|
+
@variant("L2_3Level")
|
|
2270
2286
|
class L2 {
|
|
2271
2287
|
@field({ type: option("u64") })
|
|
2272
2288
|
number?: bigint;
|
|
@@ -2276,6 +2292,7 @@ export const tests = (
|
|
|
2276
2292
|
}
|
|
2277
2293
|
}
|
|
2278
2294
|
|
|
2295
|
+
@variant("L1_3Level")
|
|
2279
2296
|
class L1 {
|
|
2280
2297
|
@field({ type: option(L2) })
|
|
2281
2298
|
nestedAgainAgain?: L2;
|
|
@@ -2285,6 +2302,7 @@ export const tests = (
|
|
|
2285
2302
|
}
|
|
2286
2303
|
}
|
|
2287
2304
|
|
|
2305
|
+
@variant("L0_3Level")
|
|
2288
2306
|
class L0 {
|
|
2289
2307
|
@field({ type: option(L1) })
|
|
2290
2308
|
nestedAgain?: L1;
|
|
@@ -2545,6 +2563,7 @@ export const tests = (
|
|
|
2545
2563
|
}
|
|
2546
2564
|
}
|
|
2547
2565
|
|
|
2566
|
+
@variant("NestedNonArray")
|
|
2548
2567
|
class Nested {
|
|
2549
2568
|
@field({ type: option(Base) })
|
|
2550
2569
|
nestedAgain?: Base;
|
|
@@ -2777,6 +2796,7 @@ export const tests = (
|
|
|
2777
2796
|
});
|
|
2778
2797
|
|
|
2779
2798
|
describe("nested-string-array", () => {
|
|
2799
|
+
@variant("NestedStringArray")
|
|
2780
2800
|
class Nested {
|
|
2781
2801
|
@field({ type: vec("string") })
|
|
2782
2802
|
arr: string[];
|
|
@@ -2840,6 +2860,7 @@ export const tests = (
|
|
|
2840
2860
|
});
|
|
2841
2861
|
|
|
2842
2862
|
describe("nested multiple fields", () => {
|
|
2863
|
+
@variant("NestedMultipleFieldsDocument")
|
|
2843
2864
|
class NestedMultipleFieldsDocument {
|
|
2844
2865
|
@field({ type: "string" })
|
|
2845
2866
|
a: string;
|
|
@@ -3085,6 +3106,7 @@ export const tests = (
|
|
|
3085
3106
|
});
|
|
3086
3107
|
|
|
3087
3108
|
describe("nested", () => {
|
|
3109
|
+
@variant("MultifieldNested_ShapeNested")
|
|
3088
3110
|
class MultifieldNested {
|
|
3089
3111
|
@field({ type: "bool" })
|
|
3090
3112
|
bool: boolean;
|
|
@@ -3102,6 +3124,7 @@ export const tests = (
|
|
|
3102
3124
|
}
|
|
3103
3125
|
}
|
|
3104
3126
|
|
|
3127
|
+
@variant("NestedBoolQueryDocument_ShapeNested")
|
|
3105
3128
|
class NestedBoolQueryDocument {
|
|
3106
3129
|
@id({ type: "string" })
|
|
3107
3130
|
id: string;
|
|
@@ -3254,6 +3277,7 @@ export const tests = (
|
|
|
3254
3277
|
}
|
|
3255
3278
|
}
|
|
3256
3279
|
|
|
3280
|
+
@variant("NestedBoolQueryDocument_ShapeNestedPoly")
|
|
3257
3281
|
class NestedBoolQueryDocument {
|
|
3258
3282
|
@id({ type: "string" })
|
|
3259
3283
|
id: string;
|
|
@@ -3367,6 +3391,7 @@ export const tests = (
|
|
|
3367
3391
|
});
|
|
3368
3392
|
|
|
3369
3393
|
describe("nested-array", () => {
|
|
3394
|
+
@variant("MultifieldNested_ShapeNestedArray")
|
|
3370
3395
|
class MultifieldNested {
|
|
3371
3396
|
@field({ type: "bool" })
|
|
3372
3397
|
bool: boolean;
|
|
@@ -3384,6 +3409,7 @@ export const tests = (
|
|
|
3384
3409
|
}
|
|
3385
3410
|
}
|
|
3386
3411
|
|
|
3412
|
+
@variant("NestedBoolQueryDocument_ShapeNestedArray")
|
|
3387
3413
|
class NestedBoolQueryDocument {
|
|
3388
3414
|
@id({ type: "string" })
|
|
3389
3415
|
id: string;
|
|
@@ -3781,6 +3807,7 @@ export const tests = (
|
|
|
3781
3807
|
});
|
|
3782
3808
|
|
|
3783
3809
|
describe("nested-nested-invariant", () => {
|
|
3810
|
+
@variant("V0_nested_nested_invariant")
|
|
3784
3811
|
class V0 {
|
|
3785
3812
|
@field({ type: "u64" })
|
|
3786
3813
|
number: bigint;
|
|
@@ -3790,6 +3817,7 @@ export const tests = (
|
|
|
3790
3817
|
}
|
|
3791
3818
|
}
|
|
3792
3819
|
|
|
3820
|
+
@variant("NestedValue_nested_nested_invariant")
|
|
3793
3821
|
class NestedValue {
|
|
3794
3822
|
@field({ type: V0 })
|
|
3795
3823
|
v0?: V0;
|
|
@@ -3799,6 +3827,7 @@ export const tests = (
|
|
|
3799
3827
|
}
|
|
3800
3828
|
}
|
|
3801
3829
|
|
|
3830
|
+
@variant("Document_nested_nested_invariant")
|
|
3802
3831
|
class Document {
|
|
3803
3832
|
@id({ type: "string" })
|
|
3804
3833
|
id: string;
|
|
@@ -3838,6 +3867,7 @@ export const tests = (
|
|
|
3838
3867
|
});
|
|
3839
3868
|
|
|
3840
3869
|
describe("variant-nested-invariant", () => {
|
|
3870
|
+
@variant("V0_variant_nested_invariant")
|
|
3841
3871
|
class V0 {
|
|
3842
3872
|
@field({ type: "u64" })
|
|
3843
3873
|
number: bigint;
|
|
@@ -3847,6 +3877,7 @@ export const tests = (
|
|
|
3847
3877
|
}
|
|
3848
3878
|
}
|
|
3849
3879
|
|
|
3880
|
+
@variant("NestedValue_variant_nested_invariant")
|
|
3850
3881
|
class NestedValue {
|
|
3851
3882
|
@field({ type: V0 })
|
|
3852
3883
|
v0?: V0;
|
|
@@ -4080,6 +4111,7 @@ export const tests = (
|
|
|
4080
4111
|
});
|
|
4081
4112
|
|
|
4082
4113
|
describe("sum", () => {
|
|
4114
|
+
@variant("SummableDocument")
|
|
4083
4115
|
class SummableDocument {
|
|
4084
4116
|
@field({ type: "string" })
|
|
4085
4117
|
id: string;
|
|
@@ -4184,6 +4216,7 @@ export const tests = (
|
|
|
4184
4216
|
});
|
|
4185
4217
|
|
|
4186
4218
|
describe("count", () => {
|
|
4219
|
+
@variant("NumberArrayDocument")
|
|
4187
4220
|
class NumberArrayDocument {
|
|
4188
4221
|
@field({ type: "string" })
|
|
4189
4222
|
id: string;
|
|
@@ -4494,6 +4527,7 @@ export const tests = (
|
|
|
4494
4527
|
});
|
|
4495
4528
|
|
|
4496
4529
|
it("multi-scope insertion", async () => {
|
|
4530
|
+
@variant("AnotherDocument")
|
|
4497
4531
|
class AnotherDocument {
|
|
4498
4532
|
@id({ type: "string" })
|
|
4499
4533
|
id: string;
|