@mongodb-js/mql-typescript 0.2.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.
Files changed (48) hide show
  1. package/LICENSE +201 -0
  2. package/bin/runner.js +3 -0
  3. package/dist/.esm-wrapper.mjs +5 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +50 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/driverSchema/docs-crawler.d.ts +13 -0
  9. package/dist/driverSchema/docs-crawler.d.ts.map +1 -0
  10. package/dist/driverSchema/docs-crawler.js +151 -0
  11. package/dist/driverSchema/docs-crawler.js.map +1 -0
  12. package/dist/driverSchema/driver-schema-generator.d.ts +8 -0
  13. package/dist/driverSchema/driver-schema-generator.d.ts.map +1 -0
  14. package/dist/driverSchema/driver-schema-generator.js +98 -0
  15. package/dist/driverSchema/driver-schema-generator.js.map +1 -0
  16. package/dist/driverSchema/static-schemas.d.ts +9 -0
  17. package/dist/driverSchema/static-schemas.d.ts.map +1 -0
  18. package/dist/driverSchema/static-schemas.js +1633 -0
  19. package/dist/driverSchema/static-schemas.js.map +1 -0
  20. package/dist/generator.d.ts +20 -0
  21. package/dist/generator.d.ts.map +1 -0
  22. package/dist/generator.js +288 -0
  23. package/dist/generator.js.map +1 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +8 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/metaschema.d.ts +222 -0
  29. package/dist/metaschema.d.ts.map +1 -0
  30. package/dist/metaschema.js +203 -0
  31. package/dist/metaschema.js.map +1 -0
  32. package/dist/schema-generator.d.ts +15 -0
  33. package/dist/schema-generator.d.ts.map +1 -0
  34. package/dist/schema-generator.js +486 -0
  35. package/dist/schema-generator.js.map +1 -0
  36. package/dist/testGenerator/test-generator.d.ts +11 -0
  37. package/dist/testGenerator/test-generator.d.ts.map +1 -0
  38. package/dist/testGenerator/test-generator.js +211 -0
  39. package/dist/testGenerator/test-generator.js.map +1 -0
  40. package/dist/testGenerator/unsupported-aggregations.d.ts +11 -0
  41. package/dist/testGenerator/unsupported-aggregations.d.ts.map +1 -0
  42. package/dist/testGenerator/unsupported-aggregations.js +254 -0
  43. package/dist/testGenerator/unsupported-aggregations.js.map +1 -0
  44. package/dist/utils.d.ts +9 -0
  45. package/dist/utils.d.ts.map +1 -0
  46. package/dist/utils.js +28 -0
  47. package/dist/utils.js.map +1 -0
  48. package/package.json +89 -0
@@ -0,0 +1,1633 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStaticSchema = getStaticSchema;
4
+ const geoPolygonSchema = {
5
+ collectionName: 'places',
6
+ schema: {
7
+ loc: {
8
+ types: [
9
+ {
10
+ bsonType: 'Document',
11
+ fields: {
12
+ type: {
13
+ types: [{ bsonType: 'String' }],
14
+ },
15
+ coordinates: {
16
+ types: [
17
+ {
18
+ bsonType: 'Array',
19
+ types: [
20
+ {
21
+ bsonType: 'Array',
22
+ types: [
23
+ {
24
+ bsonType: 'Array',
25
+ types: [{ bsonType: 'Double' }],
26
+ },
27
+ ],
28
+ },
29
+ ],
30
+ },
31
+ ],
32
+ },
33
+ },
34
+ },
35
+ ],
36
+ },
37
+ },
38
+ };
39
+ const geoPointSchema = {
40
+ collectionName: 'places',
41
+ schema: {
42
+ location: {
43
+ types: [
44
+ {
45
+ bsonType: 'Document',
46
+ fields: {
47
+ type: {
48
+ types: [{ bsonType: 'String' }],
49
+ },
50
+ coordinates: {
51
+ types: [
52
+ {
53
+ bsonType: 'Array',
54
+ types: [
55
+ {
56
+ bsonType: 'Double',
57
+ },
58
+ ],
59
+ },
60
+ ],
61
+ },
62
+ },
63
+ },
64
+ ],
65
+ },
66
+ },
67
+ };
68
+ const inventorySchema = {
69
+ collectionName: 'inventory',
70
+ schema: {
71
+ price: {
72
+ types: [{ bsonType: 'Double' }],
73
+ },
74
+ qty: {
75
+ types: [{ bsonType: 'Int32' }, { bsonType: 'Undefined' }],
76
+ },
77
+ quantity: {
78
+ types: [{ bsonType: 'Int32' }, { bsonType: 'Undefined' }],
79
+ },
80
+ sale: {
81
+ types: [{ bsonType: 'Boolean' }],
82
+ },
83
+ tags: {
84
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
85
+ },
86
+ },
87
+ };
88
+ const mflixMoviesSchema = {
89
+ collectionName: 'movies',
90
+ schema: {
91
+ _id: {
92
+ types: [
93
+ {
94
+ bsonType: 'Document',
95
+ fields: { $oid: { types: [{ bsonType: 'String' }] } },
96
+ },
97
+ ],
98
+ },
99
+ title: { types: [{ bsonType: 'String' }] },
100
+ year: {
101
+ types: [
102
+ {
103
+ bsonType: 'Document',
104
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
105
+ },
106
+ ],
107
+ },
108
+ runtime: {
109
+ types: [
110
+ {
111
+ bsonType: 'Document',
112
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
113
+ },
114
+ ],
115
+ },
116
+ released: {
117
+ types: [
118
+ {
119
+ bsonType: 'Document',
120
+ fields: {
121
+ $date: {
122
+ types: [
123
+ {
124
+ bsonType: 'Document',
125
+ fields: {
126
+ $numberLong: { types: [{ bsonType: 'String' }] },
127
+ },
128
+ },
129
+ ],
130
+ },
131
+ },
132
+ },
133
+ ],
134
+ },
135
+ poster: { types: [{ bsonType: 'String' }] },
136
+ plot: { types: [{ bsonType: 'String' }] },
137
+ fullplot: { types: [{ bsonType: 'String' }] },
138
+ lastupdated: { types: [{ bsonType: 'String' }] },
139
+ type: { types: [{ bsonType: 'String' }] },
140
+ directors: {
141
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
142
+ },
143
+ imdb: {
144
+ types: [
145
+ {
146
+ bsonType: 'Document',
147
+ fields: {
148
+ rating: {
149
+ types: [
150
+ {
151
+ bsonType: 'Document',
152
+ fields: {
153
+ $numberDouble: { types: [{ bsonType: 'String' }] },
154
+ },
155
+ },
156
+ ],
157
+ },
158
+ votes: {
159
+ types: [
160
+ {
161
+ bsonType: 'Document',
162
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
163
+ },
164
+ ],
165
+ },
166
+ id: {
167
+ types: [
168
+ {
169
+ bsonType: 'Document',
170
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
171
+ },
172
+ ],
173
+ },
174
+ },
175
+ },
176
+ ],
177
+ },
178
+ cast: { types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }] },
179
+ countries: {
180
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
181
+ },
182
+ genres: {
183
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
184
+ },
185
+ tomatoes: {
186
+ types: [
187
+ {
188
+ bsonType: 'Document',
189
+ fields: {
190
+ viewer: {
191
+ types: [
192
+ {
193
+ bsonType: 'Document',
194
+ fields: {
195
+ rating: {
196
+ types: [
197
+ {
198
+ bsonType: 'Document',
199
+ fields: {
200
+ $numberDouble: {
201
+ types: [{ bsonType: 'String' }],
202
+ },
203
+ },
204
+ },
205
+ ],
206
+ },
207
+ numReviews: {
208
+ types: [
209
+ {
210
+ bsonType: 'Document',
211
+ fields: {
212
+ $numberInt: { types: [{ bsonType: 'String' }] },
213
+ },
214
+ },
215
+ ],
216
+ },
217
+ },
218
+ },
219
+ ],
220
+ },
221
+ lastUpdated: {
222
+ types: [
223
+ {
224
+ bsonType: 'Document',
225
+ fields: {
226
+ $date: {
227
+ types: [
228
+ {
229
+ bsonType: 'Document',
230
+ fields: {
231
+ $numberLong: { types: [{ bsonType: 'String' }] },
232
+ },
233
+ },
234
+ ],
235
+ },
236
+ },
237
+ },
238
+ ],
239
+ },
240
+ },
241
+ },
242
+ ],
243
+ },
244
+ num_mflix_comments: {
245
+ types: [
246
+ {
247
+ bsonType: 'Document',
248
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
249
+ },
250
+ ],
251
+ },
252
+ },
253
+ };
254
+ const sampleSuppliesSalesSchema = {
255
+ collectionName: 'sales',
256
+ schema: {
257
+ _id: {
258
+ types: [
259
+ {
260
+ bsonType: 'Document',
261
+ fields: { $oid: { types: [{ bsonType: 'String' }] } },
262
+ },
263
+ ],
264
+ },
265
+ saleDate: {
266
+ types: [
267
+ {
268
+ bsonType: 'Document',
269
+ fields: {
270
+ $date: {
271
+ types: [
272
+ {
273
+ bsonType: 'Document',
274
+ fields: {
275
+ $numberLong: { types: [{ bsonType: 'String' }] },
276
+ },
277
+ },
278
+ ],
279
+ },
280
+ },
281
+ },
282
+ ],
283
+ },
284
+ items: {
285
+ types: [
286
+ {
287
+ bsonType: 'Array',
288
+ types: [
289
+ {
290
+ bsonType: 'Document',
291
+ fields: {
292
+ name: { types: [{ bsonType: 'String' }] },
293
+ tags: {
294
+ types: [
295
+ { bsonType: 'Array', types: [{ bsonType: 'String' }] },
296
+ ],
297
+ },
298
+ price: {
299
+ types: [
300
+ {
301
+ bsonType: 'Document',
302
+ fields: {
303
+ $numberDecimal: { types: [{ bsonType: 'String' }] },
304
+ },
305
+ },
306
+ ],
307
+ },
308
+ quantity: {
309
+ types: [
310
+ {
311
+ bsonType: 'Document',
312
+ fields: {
313
+ $numberInt: { types: [{ bsonType: 'String' }] },
314
+ },
315
+ },
316
+ ],
317
+ },
318
+ },
319
+ },
320
+ ],
321
+ },
322
+ ],
323
+ },
324
+ storeLocation: { types: [{ bsonType: 'String' }] },
325
+ customer: {
326
+ types: [
327
+ {
328
+ bsonType: 'Document',
329
+ fields: {
330
+ gender: { types: [{ bsonType: 'String' }] },
331
+ age: {
332
+ types: [
333
+ {
334
+ bsonType: 'Document',
335
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
336
+ },
337
+ ],
338
+ },
339
+ email: { types: [{ bsonType: 'String' }] },
340
+ satisfaction: {
341
+ types: [
342
+ {
343
+ bsonType: 'Document',
344
+ fields: { $numberInt: { types: [{ bsonType: 'String' }] } },
345
+ },
346
+ ],
347
+ },
348
+ },
349
+ },
350
+ ],
351
+ },
352
+ couponUsed: { types: [{ bsonType: 'Boolean' }] },
353
+ purchaseMethod: { types: [{ bsonType: 'String' }] },
354
+ },
355
+ };
356
+ const listingsAndReviewsSchema = {
357
+ collectionName: 'listingsAndReviews',
358
+ schema: {
359
+ _id: {
360
+ types: [
361
+ {
362
+ bsonType: 'String',
363
+ },
364
+ ],
365
+ },
366
+ listing_url: {
367
+ types: [
368
+ {
369
+ bsonType: 'String',
370
+ },
371
+ ],
372
+ },
373
+ name: {
374
+ types: [
375
+ {
376
+ bsonType: 'String',
377
+ },
378
+ ],
379
+ },
380
+ summary: {
381
+ types: [
382
+ {
383
+ bsonType: 'String',
384
+ },
385
+ ],
386
+ },
387
+ interaction: {
388
+ types: [
389
+ {
390
+ bsonType: 'String',
391
+ },
392
+ ],
393
+ },
394
+ house_rules: {
395
+ types: [
396
+ {
397
+ bsonType: 'String',
398
+ },
399
+ ],
400
+ },
401
+ property_type: {
402
+ types: [
403
+ {
404
+ bsonType: 'String',
405
+ },
406
+ ],
407
+ },
408
+ room_type: {
409
+ types: [
410
+ {
411
+ bsonType: 'String',
412
+ },
413
+ ],
414
+ },
415
+ bed_type: {
416
+ types: [
417
+ {
418
+ bsonType: 'String',
419
+ },
420
+ ],
421
+ },
422
+ minimum_nights: {
423
+ types: [
424
+ {
425
+ bsonType: 'String',
426
+ },
427
+ ],
428
+ },
429
+ maximum_nights: {
430
+ types: [
431
+ {
432
+ bsonType: 'String',
433
+ },
434
+ ],
435
+ },
436
+ cancellation_policy: {
437
+ types: [
438
+ {
439
+ bsonType: 'String',
440
+ },
441
+ ],
442
+ },
443
+ last_scraped: {
444
+ types: [
445
+ {
446
+ bsonType: 'Document',
447
+ fields: {
448
+ $date: {
449
+ types: [
450
+ {
451
+ bsonType: 'Document',
452
+ fields: {
453
+ $numberLong: {
454
+ types: [
455
+ {
456
+ bsonType: 'String',
457
+ },
458
+ ],
459
+ },
460
+ },
461
+ },
462
+ ],
463
+ },
464
+ },
465
+ },
466
+ ],
467
+ },
468
+ calendar_last_scraped: {
469
+ types: [
470
+ {
471
+ bsonType: 'Document',
472
+ fields: {
473
+ $date: {
474
+ types: [
475
+ {
476
+ bsonType: 'Document',
477
+ fields: {
478
+ $numberLong: {
479
+ types: [
480
+ {
481
+ bsonType: 'String',
482
+ },
483
+ ],
484
+ },
485
+ },
486
+ },
487
+ ],
488
+ },
489
+ },
490
+ },
491
+ ],
492
+ },
493
+ first_review: {
494
+ types: [
495
+ {
496
+ bsonType: 'Document',
497
+ fields: {
498
+ $date: {
499
+ types: [
500
+ {
501
+ bsonType: 'Document',
502
+ fields: {
503
+ $numberLong: {
504
+ types: [
505
+ {
506
+ bsonType: 'String',
507
+ },
508
+ ],
509
+ },
510
+ },
511
+ },
512
+ ],
513
+ },
514
+ },
515
+ },
516
+ ],
517
+ },
518
+ last_review: {
519
+ types: [
520
+ {
521
+ bsonType: 'Document',
522
+ fields: {
523
+ $date: {
524
+ types: [
525
+ {
526
+ bsonType: 'Document',
527
+ fields: {
528
+ $numberLong: {
529
+ types: [
530
+ {
531
+ bsonType: 'String',
532
+ },
533
+ ],
534
+ },
535
+ },
536
+ },
537
+ ],
538
+ },
539
+ },
540
+ },
541
+ ],
542
+ },
543
+ accommodates: {
544
+ types: [
545
+ {
546
+ bsonType: 'Document',
547
+ fields: {
548
+ $numberInt: {
549
+ types: [
550
+ {
551
+ bsonType: 'String',
552
+ },
553
+ ],
554
+ },
555
+ },
556
+ },
557
+ ],
558
+ },
559
+ bedrooms: {
560
+ types: [
561
+ {
562
+ bsonType: 'Document',
563
+ fields: {
564
+ $numberInt: {
565
+ types: [
566
+ {
567
+ bsonType: 'String',
568
+ },
569
+ ],
570
+ },
571
+ },
572
+ },
573
+ ],
574
+ },
575
+ beds: {
576
+ types: [
577
+ {
578
+ bsonType: 'Document',
579
+ fields: {
580
+ $numberInt: {
581
+ types: [
582
+ {
583
+ bsonType: 'String',
584
+ },
585
+ ],
586
+ },
587
+ },
588
+ },
589
+ ],
590
+ },
591
+ number_of_reviews: {
592
+ types: [
593
+ {
594
+ bsonType: 'Document',
595
+ fields: {
596
+ $numberInt: {
597
+ types: [
598
+ {
599
+ bsonType: 'String',
600
+ },
601
+ ],
602
+ },
603
+ },
604
+ },
605
+ ],
606
+ },
607
+ bathrooms: {
608
+ types: [
609
+ {
610
+ bsonType: 'Document',
611
+ fields: {
612
+ $numberDecimal: {
613
+ types: [
614
+ {
615
+ bsonType: 'String',
616
+ },
617
+ ],
618
+ },
619
+ },
620
+ },
621
+ ],
622
+ },
623
+ amenities: {
624
+ types: [
625
+ {
626
+ bsonType: 'Array',
627
+ types: [
628
+ {
629
+ bsonType: 'String',
630
+ },
631
+ ],
632
+ },
633
+ ],
634
+ },
635
+ price: {
636
+ types: [
637
+ {
638
+ bsonType: 'Document',
639
+ fields: {
640
+ $numberDecimal: {
641
+ types: [
642
+ {
643
+ bsonType: 'String',
644
+ },
645
+ ],
646
+ },
647
+ },
648
+ },
649
+ ],
650
+ },
651
+ security_deposit: {
652
+ types: [
653
+ {
654
+ bsonType: 'Document',
655
+ fields: {
656
+ $numberDecimal: {
657
+ types: [
658
+ {
659
+ bsonType: 'String',
660
+ },
661
+ ],
662
+ },
663
+ },
664
+ },
665
+ ],
666
+ },
667
+ cleaning_fee: {
668
+ types: [
669
+ {
670
+ bsonType: 'Document',
671
+ fields: {
672
+ $numberDecimal: {
673
+ types: [
674
+ {
675
+ bsonType: 'String',
676
+ },
677
+ ],
678
+ },
679
+ },
680
+ },
681
+ ],
682
+ },
683
+ extra_people: {
684
+ types: [
685
+ {
686
+ bsonType: 'Document',
687
+ fields: {
688
+ $numberDecimal: {
689
+ types: [
690
+ {
691
+ bsonType: 'String',
692
+ },
693
+ ],
694
+ },
695
+ },
696
+ },
697
+ ],
698
+ },
699
+ guests_included: {
700
+ types: [
701
+ {
702
+ bsonType: 'Document',
703
+ fields: {
704
+ $numberDecimal: {
705
+ types: [
706
+ {
707
+ bsonType: 'String',
708
+ },
709
+ ],
710
+ },
711
+ },
712
+ },
713
+ ],
714
+ },
715
+ images: {
716
+ types: [
717
+ {
718
+ bsonType: 'Document',
719
+ fields: {
720
+ thumbnail_url: {
721
+ types: [
722
+ {
723
+ bsonType: 'String',
724
+ },
725
+ ],
726
+ },
727
+ medium_url: {
728
+ types: [
729
+ {
730
+ bsonType: 'String',
731
+ },
732
+ ],
733
+ },
734
+ picture_url: {
735
+ types: [
736
+ {
737
+ bsonType: 'String',
738
+ },
739
+ ],
740
+ },
741
+ xl_picture_url: {
742
+ types: [
743
+ {
744
+ bsonType: 'String',
745
+ },
746
+ ],
747
+ },
748
+ },
749
+ },
750
+ ],
751
+ },
752
+ host: {
753
+ types: [
754
+ {
755
+ bsonType: 'Document',
756
+ fields: {
757
+ host_id: {
758
+ types: [
759
+ {
760
+ bsonType: 'String',
761
+ },
762
+ ],
763
+ },
764
+ host_url: {
765
+ types: [
766
+ {
767
+ bsonType: 'String',
768
+ },
769
+ ],
770
+ },
771
+ host_name: {
772
+ types: [
773
+ {
774
+ bsonType: 'String',
775
+ },
776
+ ],
777
+ },
778
+ host_location: {
779
+ types: [
780
+ {
781
+ bsonType: 'String',
782
+ },
783
+ ],
784
+ },
785
+ host_about: {
786
+ types: [
787
+ {
788
+ bsonType: 'String',
789
+ },
790
+ ],
791
+ },
792
+ host_response_time: {
793
+ types: [
794
+ {
795
+ bsonType: 'String',
796
+ },
797
+ ],
798
+ },
799
+ host_thumbnail_url: {
800
+ types: [
801
+ {
802
+ bsonType: 'String',
803
+ },
804
+ ],
805
+ },
806
+ host_picture_url: {
807
+ types: [
808
+ {
809
+ bsonType: 'String',
810
+ },
811
+ ],
812
+ },
813
+ host_neighbourhood: {
814
+ types: [
815
+ {
816
+ bsonType: 'String',
817
+ },
818
+ ],
819
+ },
820
+ host_response_rate: {
821
+ types: [
822
+ {
823
+ bsonType: 'Document',
824
+ fields: {
825
+ $numberInt: {
826
+ types: [
827
+ {
828
+ bsonType: 'String',
829
+ },
830
+ ],
831
+ },
832
+ },
833
+ },
834
+ ],
835
+ },
836
+ host_is_superhost: {
837
+ types: [
838
+ {
839
+ bsonType: 'Boolean',
840
+ },
841
+ ],
842
+ },
843
+ host_has_profile_pic: {
844
+ types: [
845
+ {
846
+ bsonType: 'Boolean',
847
+ },
848
+ ],
849
+ },
850
+ host_identity_verified: {
851
+ types: [
852
+ {
853
+ bsonType: 'Boolean',
854
+ },
855
+ ],
856
+ },
857
+ host_listings_count: {
858
+ types: [
859
+ {
860
+ bsonType: 'Document',
861
+ fields: {
862
+ $numberInt: {
863
+ types: [
864
+ {
865
+ bsonType: 'String',
866
+ },
867
+ ],
868
+ },
869
+ },
870
+ },
871
+ ],
872
+ },
873
+ host_total_listings_count: {
874
+ types: [
875
+ {
876
+ bsonType: 'Document',
877
+ fields: {
878
+ $numberInt: {
879
+ types: [
880
+ {
881
+ bsonType: 'String',
882
+ },
883
+ ],
884
+ },
885
+ },
886
+ },
887
+ ],
888
+ },
889
+ host_verifications: {
890
+ types: [
891
+ {
892
+ bsonType: 'Array',
893
+ types: [
894
+ {
895
+ bsonType: 'String',
896
+ },
897
+ ],
898
+ },
899
+ ],
900
+ },
901
+ },
902
+ },
903
+ ],
904
+ },
905
+ address: {
906
+ types: [
907
+ {
908
+ bsonType: 'Document',
909
+ fields: {
910
+ street: {
911
+ types: [
912
+ {
913
+ bsonType: 'String',
914
+ },
915
+ ],
916
+ },
917
+ suburb: {
918
+ types: [
919
+ {
920
+ bsonType: 'String',
921
+ },
922
+ ],
923
+ },
924
+ government_area: {
925
+ types: [
926
+ {
927
+ bsonType: 'String',
928
+ },
929
+ ],
930
+ },
931
+ market: {
932
+ types: [
933
+ {
934
+ bsonType: 'String',
935
+ },
936
+ ],
937
+ },
938
+ country: {
939
+ types: [
940
+ {
941
+ bsonType: 'String',
942
+ },
943
+ ],
944
+ },
945
+ country_code: {
946
+ types: [
947
+ {
948
+ bsonType: 'String',
949
+ },
950
+ ],
951
+ },
952
+ location: {
953
+ types: [
954
+ {
955
+ bsonType: 'Document',
956
+ fields: {
957
+ type: {
958
+ types: [
959
+ {
960
+ bsonType: 'String',
961
+ },
962
+ ],
963
+ },
964
+ coordinates: {
965
+ types: [
966
+ {
967
+ bsonType: 'Array',
968
+ types: [
969
+ {
970
+ bsonType: 'Document',
971
+ fields: {
972
+ $numberDouble: {
973
+ types: [
974
+ {
975
+ bsonType: 'String',
976
+ },
977
+ ],
978
+ },
979
+ },
980
+ },
981
+ ],
982
+ },
983
+ ],
984
+ },
985
+ is_location_exact: {
986
+ types: [
987
+ {
988
+ bsonType: 'Boolean',
989
+ },
990
+ ],
991
+ },
992
+ },
993
+ },
994
+ ],
995
+ },
996
+ },
997
+ },
998
+ ],
999
+ },
1000
+ availability: {
1001
+ types: [
1002
+ {
1003
+ bsonType: 'Document',
1004
+ fields: {
1005
+ availability_30: {
1006
+ types: [
1007
+ {
1008
+ bsonType: 'Document',
1009
+ fields: {
1010
+ $numberInt: {
1011
+ types: [
1012
+ {
1013
+ bsonType: 'String',
1014
+ },
1015
+ ],
1016
+ },
1017
+ },
1018
+ },
1019
+ ],
1020
+ },
1021
+ availability_60: {
1022
+ types: [
1023
+ {
1024
+ bsonType: 'Document',
1025
+ fields: {
1026
+ $numberInt: {
1027
+ types: [
1028
+ {
1029
+ bsonType: 'String',
1030
+ },
1031
+ ],
1032
+ },
1033
+ },
1034
+ },
1035
+ ],
1036
+ },
1037
+ availability_90: {
1038
+ types: [
1039
+ {
1040
+ bsonType: 'Document',
1041
+ fields: {
1042
+ $numberInt: {
1043
+ types: [
1044
+ {
1045
+ bsonType: 'String',
1046
+ },
1047
+ ],
1048
+ },
1049
+ },
1050
+ },
1051
+ ],
1052
+ },
1053
+ availability_365: {
1054
+ types: [
1055
+ {
1056
+ bsonType: 'Document',
1057
+ fields: {
1058
+ $numberInt: {
1059
+ types: [
1060
+ {
1061
+ bsonType: 'String',
1062
+ },
1063
+ ],
1064
+ },
1065
+ },
1066
+ },
1067
+ ],
1068
+ },
1069
+ },
1070
+ },
1071
+ ],
1072
+ },
1073
+ review_scores: {
1074
+ types: [
1075
+ {
1076
+ bsonType: 'Document',
1077
+ fields: {
1078
+ review_scores_accuracy: {
1079
+ types: [
1080
+ {
1081
+ bsonType: 'Document',
1082
+ fields: {
1083
+ $numberInt: {
1084
+ types: [
1085
+ {
1086
+ bsonType: 'String',
1087
+ },
1088
+ ],
1089
+ },
1090
+ },
1091
+ },
1092
+ ],
1093
+ },
1094
+ review_scores_cleanliness: {
1095
+ types: [
1096
+ {
1097
+ bsonType: 'Document',
1098
+ fields: {
1099
+ $numberInt: {
1100
+ types: [
1101
+ {
1102
+ bsonType: 'String',
1103
+ },
1104
+ ],
1105
+ },
1106
+ },
1107
+ },
1108
+ ],
1109
+ },
1110
+ review_scores_checkin: {
1111
+ types: [
1112
+ {
1113
+ bsonType: 'Document',
1114
+ fields: {
1115
+ $numberInt: {
1116
+ types: [
1117
+ {
1118
+ bsonType: 'String',
1119
+ },
1120
+ ],
1121
+ },
1122
+ },
1123
+ },
1124
+ ],
1125
+ },
1126
+ review_scores_communication: {
1127
+ types: [
1128
+ {
1129
+ bsonType: 'Document',
1130
+ fields: {
1131
+ $numberInt: {
1132
+ types: [
1133
+ {
1134
+ bsonType: 'String',
1135
+ },
1136
+ ],
1137
+ },
1138
+ },
1139
+ },
1140
+ ],
1141
+ },
1142
+ review_scores_location: {
1143
+ types: [
1144
+ {
1145
+ bsonType: 'Document',
1146
+ fields: {
1147
+ $numberInt: {
1148
+ types: [
1149
+ {
1150
+ bsonType: 'String',
1151
+ },
1152
+ ],
1153
+ },
1154
+ },
1155
+ },
1156
+ ],
1157
+ },
1158
+ review_scores_value: {
1159
+ types: [
1160
+ {
1161
+ bsonType: 'Document',
1162
+ fields: {
1163
+ $numberInt: {
1164
+ types: [
1165
+ {
1166
+ bsonType: 'String',
1167
+ },
1168
+ ],
1169
+ },
1170
+ },
1171
+ },
1172
+ ],
1173
+ },
1174
+ review_scores_rating: {
1175
+ types: [
1176
+ {
1177
+ bsonType: 'Document',
1178
+ fields: {
1179
+ $numberInt: {
1180
+ types: [
1181
+ {
1182
+ bsonType: 'String',
1183
+ },
1184
+ ],
1185
+ },
1186
+ },
1187
+ },
1188
+ ],
1189
+ },
1190
+ },
1191
+ },
1192
+ ],
1193
+ },
1194
+ reviews: {
1195
+ types: [
1196
+ {
1197
+ bsonType: 'Array',
1198
+ types: [
1199
+ {
1200
+ bsonType: 'Document',
1201
+ fields: {
1202
+ _id: {
1203
+ types: [
1204
+ {
1205
+ bsonType: 'String',
1206
+ },
1207
+ ],
1208
+ },
1209
+ date: {
1210
+ types: [
1211
+ {
1212
+ bsonType: 'Document',
1213
+ fields: {
1214
+ $date: {
1215
+ types: [
1216
+ {
1217
+ bsonType: 'Document',
1218
+ fields: {
1219
+ $numberLong: {
1220
+ types: [
1221
+ {
1222
+ bsonType: 'String',
1223
+ },
1224
+ ],
1225
+ },
1226
+ },
1227
+ },
1228
+ ],
1229
+ },
1230
+ },
1231
+ },
1232
+ ],
1233
+ },
1234
+ listing_id: {
1235
+ types: [
1236
+ {
1237
+ bsonType: 'String',
1238
+ },
1239
+ ],
1240
+ },
1241
+ reviewer_id: {
1242
+ types: [
1243
+ {
1244
+ bsonType: 'String',
1245
+ },
1246
+ ],
1247
+ },
1248
+ reviewer_name: {
1249
+ types: [
1250
+ {
1251
+ bsonType: 'String',
1252
+ },
1253
+ ],
1254
+ },
1255
+ comments: {
1256
+ types: [
1257
+ {
1258
+ bsonType: 'String',
1259
+ },
1260
+ ],
1261
+ },
1262
+ },
1263
+ },
1264
+ ],
1265
+ },
1266
+ ],
1267
+ },
1268
+ },
1269
+ };
1270
+ const analyticsCustomersSchema = {
1271
+ collectionName: 'customers',
1272
+ schema: {
1273
+ _id: {
1274
+ types: [
1275
+ {
1276
+ bsonType: 'ObjectId',
1277
+ },
1278
+ ],
1279
+ },
1280
+ username: {
1281
+ types: [
1282
+ {
1283
+ bsonType: 'String',
1284
+ },
1285
+ ],
1286
+ },
1287
+ name: {
1288
+ types: [
1289
+ {
1290
+ bsonType: 'String',
1291
+ },
1292
+ ],
1293
+ },
1294
+ address: {
1295
+ types: [
1296
+ {
1297
+ bsonType: 'String',
1298
+ },
1299
+ ],
1300
+ },
1301
+ birthdate: {
1302
+ types: [
1303
+ {
1304
+ bsonType: 'Document',
1305
+ fields: {
1306
+ $date: {
1307
+ types: [
1308
+ {
1309
+ bsonType: 'Double',
1310
+ },
1311
+ ],
1312
+ },
1313
+ },
1314
+ },
1315
+ ],
1316
+ },
1317
+ email: {
1318
+ types: [
1319
+ {
1320
+ bsonType: 'String',
1321
+ },
1322
+ ],
1323
+ },
1324
+ accounts: {
1325
+ types: [
1326
+ {
1327
+ bsonType: 'Array',
1328
+ types: [
1329
+ {
1330
+ bsonType: 'Double',
1331
+ },
1332
+ ],
1333
+ },
1334
+ ],
1335
+ },
1336
+ tier_and_details: {
1337
+ types: [
1338
+ {
1339
+ bsonType: 'Document',
1340
+ fields: {
1341
+ b5f19cb532fa436a9be2cf1d7d1cac8a: {
1342
+ types: [
1343
+ {
1344
+ bsonType: 'Document',
1345
+ fields: {
1346
+ tier: {
1347
+ types: [
1348
+ {
1349
+ bsonType: 'String',
1350
+ },
1351
+ ],
1352
+ },
1353
+ benefits: {
1354
+ types: [
1355
+ {
1356
+ bsonType: 'Array',
1357
+ types: [
1358
+ {
1359
+ bsonType: 'String',
1360
+ },
1361
+ ],
1362
+ },
1363
+ ],
1364
+ },
1365
+ active: {
1366
+ types: [
1367
+ {
1368
+ bsonType: 'Boolean',
1369
+ },
1370
+ ],
1371
+ },
1372
+ id: {
1373
+ types: [
1374
+ {
1375
+ bsonType: 'String',
1376
+ },
1377
+ ],
1378
+ },
1379
+ },
1380
+ },
1381
+ ],
1382
+ },
1383
+ },
1384
+ },
1385
+ ],
1386
+ },
1387
+ },
1388
+ };
1389
+ const dummySchema = {
1390
+ collectionName: 'TestCollection',
1391
+ schema: {
1392
+ _id: {
1393
+ types: [
1394
+ {
1395
+ bsonType: 'ObjectId',
1396
+ },
1397
+ ],
1398
+ },
1399
+ },
1400
+ };
1401
+ const staticSchemas = {
1402
+ expression: {
1403
+ dateFromParts: {
1404
+ Example: {
1405
+ collectionName: 'sales',
1406
+ schema: {
1407
+ _id: {
1408
+ types: [{ bsonType: 'ObjectId' }],
1409
+ },
1410
+ },
1411
+ },
1412
+ },
1413
+ setIntersection: {
1414
+ ['Retrieve Documents for Roles Granted to the Current User']: {
1415
+ collectionName: 'budget',
1416
+ schema: {
1417
+ _id: {
1418
+ types: [{ bsonType: 'Int32' }],
1419
+ },
1420
+ allowedRoles: {
1421
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
1422
+ },
1423
+ comment: {
1424
+ types: [{ bsonType: 'String' }],
1425
+ },
1426
+ yearlyBudget: {
1427
+ types: [{ bsonType: 'Double' }],
1428
+ },
1429
+ cloudBudget: {
1430
+ types: [{ bsonType: 'Double' }, { bsonType: 'Undefined' }],
1431
+ },
1432
+ salesEventsBudget: {
1433
+ types: [{ bsonType: 'Double' }, { bsonType: 'Undefined' }],
1434
+ },
1435
+ },
1436
+ },
1437
+ },
1438
+ dateAdd: {
1439
+ 'Filter on a Date Range': {
1440
+ collectionName: 'shipping',
1441
+ schema: {
1442
+ custId: {
1443
+ types: [{ bsonType: 'Int32' }],
1444
+ },
1445
+ purchaseDate: {
1446
+ types: [{ bsonType: 'Date' }],
1447
+ },
1448
+ deliveryDate: {
1449
+ types: [{ bsonType: 'Date' }],
1450
+ },
1451
+ },
1452
+ },
1453
+ },
1454
+ first: {
1455
+ collectionName: 'collection',
1456
+ schema: {
1457
+ items: {
1458
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
1459
+ },
1460
+ },
1461
+ },
1462
+ last: {
1463
+ collectionName: 'collection',
1464
+ schema: {
1465
+ items: {
1466
+ types: [{ bsonType: 'Array', types: [{ bsonType: 'String' }] }],
1467
+ },
1468
+ },
1469
+ },
1470
+ },
1471
+ query: {
1472
+ and: inventorySchema,
1473
+ eq: {
1474
+ ['Regex Match Behaviour']: {
1475
+ collectionName: 'companies',
1476
+ schema: {
1477
+ _id: { types: [{ bsonType: 'Int32' }] },
1478
+ company: { types: [{ bsonType: 'String' }] },
1479
+ },
1480
+ },
1481
+ },
1482
+ exists: inventorySchema,
1483
+ geoIntersects: geoPolygonSchema,
1484
+ geoWithin: geoPolygonSchema,
1485
+ jsonSchema: {
1486
+ collectionName: 'TestCollection',
1487
+ schema: {
1488
+ name: {
1489
+ types: [{ bsonType: 'String' }],
1490
+ },
1491
+ major: {
1492
+ types: [{ bsonType: 'String' }],
1493
+ },
1494
+ gpa: {
1495
+ types: [{ bsonType: 'Double' }],
1496
+ },
1497
+ address: {
1498
+ types: [
1499
+ {
1500
+ bsonType: 'Document',
1501
+ fields: {
1502
+ street: { types: [{ bsonType: 'String' }] },
1503
+ zipcode: { types: [{ bsonType: 'String' }] },
1504
+ },
1505
+ },
1506
+ ],
1507
+ },
1508
+ },
1509
+ },
1510
+ near: geoPointSchema,
1511
+ nearSphere: geoPointSchema,
1512
+ nor: inventorySchema,
1513
+ not: inventorySchema,
1514
+ or: {
1515
+ ['$or Clauses']: inventorySchema,
1516
+ ['Error Handling']: {
1517
+ collectionName: 'example',
1518
+ schema: {
1519
+ x: {
1520
+ types: [{ bsonType: 'Int32' }],
1521
+ },
1522
+ },
1523
+ },
1524
+ },
1525
+ sampleRate: dummySchema,
1526
+ size: inventorySchema,
1527
+ },
1528
+ search: {
1529
+ autocomplete: mflixMoviesSchema,
1530
+ embeddedDocument: sampleSuppliesSalesSchema,
1531
+ facet: mflixMoviesSchema,
1532
+ geoShape: listingsAndReviewsSchema,
1533
+ geoWithin: listingsAndReviewsSchema,
1534
+ in: analyticsCustomersSchema,
1535
+ moreLikeThis: mflixMoviesSchema,
1536
+ near: {
1537
+ Number: mflixMoviesSchema,
1538
+ Date: mflixMoviesSchema,
1539
+ ['GeoJSON Point']: listingsAndReviewsSchema,
1540
+ Compound: listingsAndReviewsSchema,
1541
+ },
1542
+ phrase: mflixMoviesSchema,
1543
+ queryString: mflixMoviesSchema,
1544
+ range: mflixMoviesSchema,
1545
+ regex: mflixMoviesSchema,
1546
+ text: mflixMoviesSchema,
1547
+ wildcard: mflixMoviesSchema,
1548
+ },
1549
+ stage: {
1550
+ sort: {
1551
+ collectionName: 'users',
1552
+ schema: {
1553
+ age: { types: [{ bsonType: 'Int32' }] },
1554
+ posts: { types: [{ bsonType: 'Int32' }] },
1555
+ name: { types: [{ bsonType: 'String' }] },
1556
+ },
1557
+ },
1558
+ bucketAuto: {
1559
+ collectionName: 'artwork',
1560
+ schema: {
1561
+ _id: { types: [{ bsonType: 'Int32' }] },
1562
+ title: { types: [{ bsonType: 'String' }] },
1563
+ artist: { types: [{ bsonType: 'String' }] },
1564
+ year: { types: [{ bsonType: 'Int32' }] },
1565
+ price: { types: [{ bsonType: 'Decimal128' }] },
1566
+ dimensions: {
1567
+ types: [
1568
+ {
1569
+ bsonType: 'Document',
1570
+ fields: {
1571
+ height: { types: [{ bsonType: 'Int32' }] },
1572
+ width: { types: [{ bsonType: 'Int32' }] },
1573
+ units: { types: [{ bsonType: 'String' }] },
1574
+ },
1575
+ },
1576
+ ],
1577
+ },
1578
+ },
1579
+ },
1580
+ changeStream: {
1581
+ collectionName: 'names',
1582
+ schema: {
1583
+ _id: {
1584
+ types: [{ bsonType: 'ObjectId' }],
1585
+ },
1586
+ },
1587
+ },
1588
+ changeStreamSplitLargeEvent: {
1589
+ collectionName: 'myCollection',
1590
+ schema: {
1591
+ _id: { types: [{ bsonType: 'Int32' }] },
1592
+ largeField: { types: [{ bsonType: 'String' }] },
1593
+ },
1594
+ },
1595
+ collStats: dummySchema,
1596
+ currentOp: dummySchema,
1597
+ limit: dummySchema,
1598
+ listLocalSessions: dummySchema,
1599
+ listSampledQueries: dummySchema,
1600
+ listSearchIndexes: dummySchema,
1601
+ listSessions: dummySchema,
1602
+ search: mflixMoviesSchema,
1603
+ searchMeta: mflixMoviesSchema,
1604
+ shardedDataDistribution: dummySchema,
1605
+ skip: dummySchema,
1606
+ vectorSearch: {
1607
+ 'ANN Filter': mflixMoviesSchema,
1608
+ },
1609
+ },
1610
+ };
1611
+ function getStaticSchema({ category, operator, test, }) {
1612
+ if (operator.startsWith('$')) {
1613
+ operator = operator.slice(1);
1614
+ }
1615
+ return getStaticSchemaByKeys([category, operator, test], staticSchemas);
1616
+ }
1617
+ function getStaticSchemaByKeys(keys, map) {
1618
+ if (keys.length === 0) {
1619
+ return undefined;
1620
+ }
1621
+ const [key, ...rest] = keys;
1622
+ const value = map[key];
1623
+ if (typeof value === 'object') {
1624
+ if ('collectionName' in value && typeof value.collectionName === 'string') {
1625
+ return {
1626
+ [value.collectionName]: value.schema,
1627
+ };
1628
+ }
1629
+ return getStaticSchemaByKeys(rest, value);
1630
+ }
1631
+ return undefined;
1632
+ }
1633
+ //# sourceMappingURL=static-schemas.js.map