@snowtop/ent 0.2.0-alpha.10 → 0.2.0-alpha.11-test1

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 (72) hide show
  1. package/action/action.js +5 -5
  2. package/action/executor.d.ts +1 -1
  3. package/action/executor.js +4 -4
  4. package/action/experimental_action.js +5 -5
  5. package/action/orchestrator.d.ts +2 -2
  6. package/action/privacy.d.ts +2 -2
  7. package/action/relative_value.js +3 -3
  8. package/auth/auth.d.ts +0 -1
  9. package/auth/auth.js +4 -5
  10. package/core/base.js +5 -5
  11. package/core/clause.js +59 -60
  12. package/core/config.d.ts +0 -1
  13. package/core/config.js +1 -2
  14. package/core/context.d.ts +0 -1
  15. package/core/convert.d.ts +0 -1
  16. package/core/convert.js +16 -17
  17. package/core/date.js +1 -2
  18. package/core/ent.js +50 -51
  19. package/core/global_schema.js +6 -7
  20. package/core/loaders/assoc_count_loader.d.ts +2 -2
  21. package/core/loaders/assoc_edge_loader.d.ts +2 -2
  22. package/core/loaders/loader.js +3 -3
  23. package/core/loaders/object_loader.d.ts +4 -4
  24. package/core/loaders/query_loader.d.ts +2 -2
  25. package/core/loaders/raw_count_loader.d.ts +2 -2
  26. package/core/loaders/raw_count_loader.js +2 -2
  27. package/core/logger.js +6 -7
  28. package/core/privacy.d.ts +2 -2
  29. package/core/privacy.js +4 -4
  30. package/core/query/shared_assoc_test.js +1 -2
  31. package/core/query_impl.js +4 -5
  32. package/core/viewer.d.ts +2 -2
  33. package/graphql/graphql_field_helpers.js +22 -22
  34. package/graphql/mutations/union.js +1 -2
  35. package/graphql/node_resolver.js +7 -7
  36. package/graphql/query/shared_assoc_test.js +1 -2
  37. package/graphql/scalars/time.d.ts +1 -1
  38. package/imports/dataz/example1/_auth.js +14 -10
  39. package/imports/index.js +1 -2
  40. package/names/names.js +5 -6
  41. package/package.json +13 -13
  42. package/parse_schema/parse.js +2 -3
  43. package/schema/binary_field.d.ts +2 -2
  44. package/schema/binary_field.js +3 -3
  45. package/schema/field.js +28 -28
  46. package/schema/json_field.js +7 -7
  47. package/schema/schema.js +12 -12
  48. package/schema/struct_field.js +4 -4
  49. package/schema/union_field.js +3 -3
  50. package/testutils/action/complex_schemas.js +11 -11
  51. package/testutils/builder.d.ts +1 -1
  52. package/testutils/builder.js +7 -7
  53. package/testutils/db/fixture.js +1 -2
  54. package/testutils/db/temp_db.js +37 -37
  55. package/testutils/db/value.js +3 -4
  56. package/testutils/db_mock.js +38 -6
  57. package/testutils/ent-graphql-tests/index.d.ts +3 -3
  58. package/testutils/ent-graphql-tests/index.js +10 -11
  59. package/testutils/fake_data/const.js +2 -2
  60. package/testutils/fake_data/fake_contact.js +3 -3
  61. package/testutils/fake_data/fake_event.js +3 -3
  62. package/testutils/fake_data/fake_tag.js +4 -4
  63. package/testutils/fake_data/fake_user.js +4 -4
  64. package/testutils/fake_data/test_helpers.js +17 -17
  65. package/testutils/fake_data/user_query.js +2 -2
  66. package/testutils/parse_sql.js +3 -3
  67. package/testutils/query.js +2 -3
  68. package/testutils/write.js +3 -4
  69. package/tsc/ast.js +10 -11
  70. package/tsc/compilerOptions.js +4 -5
  71. package/tsc/move_generated.js +1 -2
  72. package/tsc/transform.js +1 -2
package/core/clause.js CHANGED
@@ -23,8 +23,65 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.JSONKeyInList = exports.JSONBKeyInList = exports.JSONKeyExists = exports.JSONPathValuePredicate = exports.JSONObjectFieldKeyAsText = exports.JSONObjectFieldKeyASJSON = exports.sensitiveValue = exports.TsVectorWebsearchToTsQuery = exports.TsVectorPhraseToTsQuery = exports.TsVectorPlainToTsQuery = exports.TsVectorColTsQuery = exports.WebsearchToTsQuery = exports.PhraseToTsQuery = exports.PlainToTsQuery = exports.TsQuery = exports.DBTypeNotIn = exports.TextNotIn = exports.IntegerNotIn = exports.UuidNotIn = exports.DBTypeIn = exports.TextIn = exports.IntegerIn = exports.UuidIn = exports.In = exports.OrOptional = exports.Or = exports.AndOptional = exports.And = exports.LessEq = exports.GreaterEq = exports.Less = exports.Greater = exports.NotEq = exports.ContainsIgnoreCase = exports.EndsWithIgnoreCase = exports.StartsWithIgnoreCase = exports.Contains = exports.EndsWith = exports.StartsWith = exports.Eq = exports.ArrayNotEq = exports.ArrayEq = exports.PostgresArrayNotOverlaps = exports.PostgresArrayOverlaps = exports.PostgresArrayNotContains = exports.PostgresArrayNotContainsValue = exports.PostgresArrayContains = exports.PostgresArrayContainsValue = exports.notInClause = exports.inClause = void 0;
27
- exports.Expression = exports.getCombinedClause = exports.Modulo = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = exports.PaginationMultipleColsQuery = exports.PaginationUnboundColsQuery = exports.PaginationMultipleColsSubQuery = void 0;
26
+ exports.notInClause = exports.inClause = void 0;
27
+ exports.PostgresArrayContainsValue = PostgresArrayContainsValue;
28
+ exports.PostgresArrayContains = PostgresArrayContains;
29
+ exports.PostgresArrayNotContainsValue = PostgresArrayNotContainsValue;
30
+ exports.PostgresArrayNotContains = PostgresArrayNotContains;
31
+ exports.PostgresArrayOverlaps = PostgresArrayOverlaps;
32
+ exports.PostgresArrayNotOverlaps = PostgresArrayNotOverlaps;
33
+ exports.ArrayEq = ArrayEq;
34
+ exports.ArrayNotEq = ArrayNotEq;
35
+ exports.Eq = Eq;
36
+ exports.StartsWith = StartsWith;
37
+ exports.EndsWith = EndsWith;
38
+ exports.Contains = Contains;
39
+ exports.StartsWithIgnoreCase = StartsWithIgnoreCase;
40
+ exports.EndsWithIgnoreCase = EndsWithIgnoreCase;
41
+ exports.ContainsIgnoreCase = ContainsIgnoreCase;
42
+ exports.NotEq = NotEq;
43
+ exports.Greater = Greater;
44
+ exports.Less = Less;
45
+ exports.GreaterEq = GreaterEq;
46
+ exports.LessEq = LessEq;
47
+ exports.And = And;
48
+ exports.AndOptional = AndOptional;
49
+ exports.Or = Or;
50
+ exports.OrOptional = OrOptional;
51
+ exports.In = In;
52
+ exports.UuidIn = UuidIn;
53
+ exports.IntegerIn = IntegerIn;
54
+ exports.TextIn = TextIn;
55
+ exports.DBTypeIn = DBTypeIn;
56
+ exports.UuidNotIn = UuidNotIn;
57
+ exports.IntegerNotIn = IntegerNotIn;
58
+ exports.TextNotIn = TextNotIn;
59
+ exports.DBTypeNotIn = DBTypeNotIn;
60
+ exports.TsQuery = TsQuery;
61
+ exports.PlainToTsQuery = PlainToTsQuery;
62
+ exports.PhraseToTsQuery = PhraseToTsQuery;
63
+ exports.WebsearchToTsQuery = WebsearchToTsQuery;
64
+ exports.TsVectorColTsQuery = TsVectorColTsQuery;
65
+ exports.TsVectorPlainToTsQuery = TsVectorPlainToTsQuery;
66
+ exports.TsVectorPhraseToTsQuery = TsVectorPhraseToTsQuery;
67
+ exports.TsVectorWebsearchToTsQuery = TsVectorWebsearchToTsQuery;
68
+ exports.sensitiveValue = sensitiveValue;
69
+ exports.JSONObjectFieldKeyASJSON = JSONObjectFieldKeyASJSON;
70
+ exports.JSONObjectFieldKeyAsText = JSONObjectFieldKeyAsText;
71
+ exports.JSONPathValuePredicate = JSONPathValuePredicate;
72
+ exports.JSONKeyExists = JSONKeyExists;
73
+ exports.JSONBKeyInList = JSONBKeyInList;
74
+ exports.JSONKeyInList = JSONKeyInList;
75
+ exports.PaginationMultipleColsSubQuery = PaginationMultipleColsSubQuery;
76
+ exports.PaginationUnboundColsQuery = PaginationUnboundColsQuery;
77
+ exports.PaginationMultipleColsQuery = PaginationMultipleColsQuery;
78
+ exports.Add = Add;
79
+ exports.Subtract = Subtract;
80
+ exports.Multiply = Multiply;
81
+ exports.Divide = Divide;
82
+ exports.Modulo = Modulo;
83
+ exports.getCombinedClause = getCombinedClause;
84
+ exports.Expression = Expression;
28
85
  const db_1 = __importStar(require("./db"));
29
86
  const query_impl_1 = require("./query_impl");
30
87
  function isSensitive(val) {
@@ -518,7 +575,6 @@ class websearchTosQueryClause extends tsQueryClause {
518
575
  function PostgresArrayContainsValue(col, value, overrideAlias) {
519
576
  return new postgresArrayOperator(col, value, "@>", { overrideAlias });
520
577
  }
521
- exports.PostgresArrayContainsValue = PostgresArrayContainsValue;
522
578
  /**
523
579
  * creates a clause to determine if every item in the list is stored in the array stored in the column in the db
524
580
  * only works with postgres gin indexes
@@ -527,7 +583,6 @@ exports.PostgresArrayContainsValue = PostgresArrayContainsValue;
527
583
  function PostgresArrayContains(col, value, overrideAlias) {
528
584
  return new postgresArrayOperatorList(col, value, "@>", { overrideAlias });
529
585
  }
530
- exports.PostgresArrayContains = PostgresArrayContains;
531
586
  /**
532
587
  * creates a clause to determine if the given value is NOT contained in the array stored in the column in the db
533
588
  * only works with postgres gin indexes
@@ -539,7 +594,6 @@ function PostgresArrayNotContainsValue(col, value, overrideAlias) {
539
594
  overrideAlias,
540
595
  });
541
596
  }
542
- exports.PostgresArrayNotContainsValue = PostgresArrayNotContainsValue;
543
597
  /**
544
598
  * creates a clause to determine if every item in the list is NOT stored in the array stored in the column in the db
545
599
  * only works with postgres gin indexes
@@ -551,7 +605,6 @@ function PostgresArrayNotContains(col, value, overrideAlias) {
551
605
  overrideAlias,
552
606
  });
553
607
  }
554
- exports.PostgresArrayNotContains = PostgresArrayNotContains;
555
608
  /**
556
609
  * creates a clause to determine if the arrays overlap, that is, do they have any elements in common
557
610
  * only works with postgres gin indexes
@@ -562,7 +615,6 @@ function PostgresArrayOverlaps(col, value, overrideAlias) {
562
615
  overrideAlias,
563
616
  });
564
617
  }
565
- exports.PostgresArrayOverlaps = PostgresArrayOverlaps;
566
618
  /**
567
619
  * creates a clause to determine if the arrays do not overlap, that is, do they have any elements in common
568
620
  * only works with postgres gin indexes
@@ -574,91 +626,75 @@ function PostgresArrayNotOverlaps(col, value, overrideAlias) {
574
626
  overrideAlias,
575
627
  });
576
628
  }
577
- exports.PostgresArrayNotOverlaps = PostgresArrayNotOverlaps;
578
629
  /**
579
630
  * @deprecated use PostgresArrayContainsValue
580
631
  */
581
632
  function ArrayEq(col, value) {
582
633
  return new arraySimpleClause(col, value, "=");
583
634
  }
584
- exports.ArrayEq = ArrayEq;
585
635
  /**
586
636
  * @deprecated use PostgresNotArrayContains
587
637
  */
588
638
  function ArrayNotEq(col, value) {
589
639
  return new arraySimpleClause(col, value, "!=");
590
640
  }
591
- exports.ArrayNotEq = ArrayNotEq;
592
641
  function Eq(col, value, overrideAlias) {
593
642
  return new simpleClause(col, value, "=", {
594
643
  handleNull: new isNullClause(col, overrideAlias),
595
644
  overrideAlias,
596
645
  });
597
646
  }
598
- exports.Eq = Eq;
599
647
  function StartsWith(col, value, overrideAlias) {
600
648
  return new simpleClause(col, `${value}%`, "LIKE", {
601
649
  overrideAlias,
602
650
  });
603
651
  }
604
- exports.StartsWith = StartsWith;
605
652
  function EndsWith(col, value, overrideAlias) {
606
653
  return new simpleClause(col, `%${value}`, "LIKE", {
607
654
  overrideAlias,
608
655
  });
609
656
  }
610
- exports.EndsWith = EndsWith;
611
657
  function Contains(col, value, overrideAlias) {
612
658
  return new simpleClause(col, `%${value}%`, "LIKE", {
613
659
  overrideAlias,
614
660
  });
615
661
  }
616
- exports.Contains = Contains;
617
662
  function StartsWithIgnoreCase(col, value, overrideAlias) {
618
663
  return new simpleClause(col, `${value}%`, "ILIKE", {
619
664
  overrideAlias,
620
665
  });
621
666
  }
622
- exports.StartsWithIgnoreCase = StartsWithIgnoreCase;
623
667
  function EndsWithIgnoreCase(col, value, overrideAlias) {
624
668
  return new simpleClause(col, `%${value}`, "ILIKE", { overrideAlias });
625
669
  }
626
- exports.EndsWithIgnoreCase = EndsWithIgnoreCase;
627
670
  function ContainsIgnoreCase(col, value, overrideAlias) {
628
671
  return new simpleClause(col, `%${value}%`, "ILIKE", {
629
672
  overrideAlias,
630
673
  });
631
674
  }
632
- exports.ContainsIgnoreCase = ContainsIgnoreCase;
633
675
  function NotEq(col, value, overrideAlias) {
634
676
  return new simpleClause(col, value, "!=", {
635
677
  handleNull: new isNotNullClause(col, overrideAlias),
636
678
  overrideAlias,
637
679
  });
638
680
  }
639
- exports.NotEq = NotEq;
640
681
  function Greater(col, value, overrideAlias) {
641
682
  return new simpleClause(col, value, ">", {
642
683
  overrideAlias,
643
684
  });
644
685
  }
645
- exports.Greater = Greater;
646
686
  function Less(col, value, overrideAlias) {
647
687
  return new simpleClause(col, value, "<", { overrideAlias });
648
688
  }
649
- exports.Less = Less;
650
689
  function GreaterEq(col, value, overrideAlias) {
651
690
  return new simpleClause(col, value, ">=", { overrideAlias });
652
691
  }
653
- exports.GreaterEq = GreaterEq;
654
692
  function LessEq(col, value, overrideAlias) {
655
693
  return new simpleClause(col, value, "<=", { overrideAlias });
656
694
  }
657
- exports.LessEq = LessEq;
658
695
  function And(...args) {
659
696
  return new compositeClause(args, " AND ");
660
697
  }
661
- exports.And = And;
662
698
  function AndOptional(...args) {
663
699
  // @ts-ignore
664
700
  let filtered = args.filter((v) => v !== undefined);
@@ -667,11 +703,9 @@ function AndOptional(...args) {
667
703
  }
668
704
  return And(...filtered);
669
705
  }
670
- exports.AndOptional = AndOptional;
671
706
  function Or(...args) {
672
707
  return new compositeClause(args, " OR ");
673
708
  }
674
- exports.Or = Or;
675
709
  function OrOptional(...args) {
676
710
  // @ts-ignore
677
711
  let filtered = args.filter((v) => v !== undefined);
@@ -680,7 +714,6 @@ function OrOptional(...args) {
680
714
  }
681
715
  return Or(...filtered);
682
716
  }
683
- exports.OrOptional = OrOptional;
684
717
  function In(...args) {
685
718
  if (args.length < 2) {
686
719
  throw new Error(`invalid args passed to In`);
@@ -691,19 +724,15 @@ function In(...args) {
691
724
  }
692
725
  return new inClause(args[0], args.slice(1));
693
726
  }
694
- exports.In = In;
695
727
  function UuidIn(col, values, overrideAlias) {
696
728
  return new inClause(col, values, "uuid", overrideAlias);
697
729
  }
698
- exports.UuidIn = UuidIn;
699
730
  function IntegerIn(col, values, overrideAlias) {
700
731
  return new inClause(col, values, "integer", overrideAlias);
701
732
  }
702
- exports.IntegerIn = IntegerIn;
703
733
  function TextIn(col, values, overrideAlias) {
704
734
  return new inClause(col, values, "text", overrideAlias);
705
735
  }
706
- exports.TextIn = TextIn;
707
736
  /*
708
737
  * if not uuid or text, pass the db type that can be used to cast this query
709
738
  * if we end up with a large list of ids
@@ -711,19 +740,15 @@ exports.TextIn = TextIn;
711
740
  function DBTypeIn(col, values, typ, overrideAlias) {
712
741
  return new inClause(col, values, typ, overrideAlias);
713
742
  }
714
- exports.DBTypeIn = DBTypeIn;
715
743
  function UuidNotIn(col, values, overrideAlias) {
716
744
  return new notInClause(col, values, "uuid", overrideAlias);
717
745
  }
718
- exports.UuidNotIn = UuidNotIn;
719
746
  function IntegerNotIn(col, values, overrideAlias) {
720
747
  return new notInClause(col, values, "integer", overrideAlias);
721
748
  }
722
- exports.IntegerNotIn = IntegerNotIn;
723
749
  function TextNotIn(col, values, overrideAlias) {
724
750
  return new notInClause(col, values, "text", overrideAlias);
725
751
  }
726
- exports.TextNotIn = TextNotIn;
727
752
  /*
728
753
  * if not uuid or text, pass the db type that can be used to cast this query
729
754
  * if we end up with a large list of ids
@@ -731,7 +756,6 @@ exports.TextNotIn = TextNotIn;
731
756
  function DBTypeNotIn(col, values, typ, overrideAlias) {
732
757
  return new notInClause(col, values, typ, overrideAlias);
733
758
  }
734
- exports.DBTypeNotIn = DBTypeNotIn;
735
759
  // if string defaults to english
736
760
  // https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES
737
761
  // to_tsquery
@@ -741,25 +765,20 @@ exports.DBTypeNotIn = DBTypeNotIn;
741
765
  function TsQuery(col, val, overrideAlias) {
742
766
  return new tsQueryClause(col, val, { overrideAlias });
743
767
  }
744
- exports.TsQuery = TsQuery;
745
768
  function PlainToTsQuery(col, val, overrideAlias) {
746
769
  return new plainToTsQueryClause(col, val, { overrideAlias });
747
770
  }
748
- exports.PlainToTsQuery = PlainToTsQuery;
749
771
  function PhraseToTsQuery(col, val, overrideAlias) {
750
772
  return new phraseToTsQueryClause(col, val, { overrideAlias });
751
773
  }
752
- exports.PhraseToTsQuery = PhraseToTsQuery;
753
774
  function WebsearchToTsQuery(col, val, overrideAlias) {
754
775
  return new websearchTosQueryClause(col, val, { overrideAlias });
755
776
  }
756
- exports.WebsearchToTsQuery = WebsearchToTsQuery;
757
777
  // TsVectorColTsQuery is used when the column is not a tsvector field e.g.
758
778
  // when there's an index just on the field and is not a combination of multiple fields
759
779
  function TsVectorColTsQuery(col, val, overrideAlias) {
760
780
  return new tsQueryClause(col, val, { tsVectorCol: true, overrideAlias });
761
781
  }
762
- exports.TsVectorColTsQuery = TsVectorColTsQuery;
763
782
  // TsVectorPlainToTsQuery is used when the column is not a tsvector field e.g.
764
783
  // when there's an index just on the field and is not a combination of multiple fields
765
784
  // TODO do these 4 need TsQuery because would be nice to have language?
@@ -770,7 +789,6 @@ function TsVectorPlainToTsQuery(col, val, overrideAlias) {
770
789
  overrideAlias,
771
790
  });
772
791
  }
773
- exports.TsVectorPlainToTsQuery = TsVectorPlainToTsQuery;
774
792
  // TsVectorPhraseToTsQuery is used when the column is not a tsvector field e.g.
775
793
  // when there's an index just on the field and is not a combination of multiple fields
776
794
  function TsVectorPhraseToTsQuery(col, val, overrideAlias) {
@@ -779,7 +797,6 @@ function TsVectorPhraseToTsQuery(col, val, overrideAlias) {
779
797
  overrideAlias,
780
798
  });
781
799
  }
782
- exports.TsVectorPhraseToTsQuery = TsVectorPhraseToTsQuery;
783
800
  // TsVectorWebsearchToTsQuery is used when the column is not a tsvector field e.g.
784
801
  // when there's an index just on the field and is not a combination of multiple fields
785
802
  function TsVectorWebsearchToTsQuery(col, val, overrideAlias) {
@@ -788,7 +805,6 @@ function TsVectorWebsearchToTsQuery(col, val, overrideAlias) {
788
805
  overrideAlias,
789
806
  });
790
807
  }
791
- exports.TsVectorWebsearchToTsQuery = TsVectorWebsearchToTsQuery;
792
808
  // TODO would be nice to support this with building blocks but not supporting for now
793
809
  // AND: foo & bar,
794
810
  // OR: foo | bar
@@ -808,7 +824,6 @@ function sensitiveValue(val) {
808
824
  },
809
825
  };
810
826
  }
811
- exports.sensitiveValue = sensitiveValue;
812
827
  // These don't return Clauses but return helpful things that can be passed to clauses
813
828
  // https://www.postgresql.org/docs/12/functions-json.html#FUNCTIONS-JSON-OP-TABLE
814
829
  // see test in db_clause.test.ts
@@ -817,12 +832,10 @@ function JSONObjectFieldKeyASJSON(col, field, overrideAlias) {
817
832
  // type as keyof T to make it easier to use in other queries
818
833
  return `${renderCol(col, overrideAlias)}->'${field}'`;
819
834
  }
820
- exports.JSONObjectFieldKeyASJSON = JSONObjectFieldKeyASJSON;
821
835
  function JSONObjectFieldKeyAsText(col, field, overrideAlias) {
822
836
  // type as keyof T to make it easier to use in other queries
823
837
  return `${renderCol(col, overrideAlias)}->>'${field}'`;
824
838
  }
825
- exports.JSONObjectFieldKeyAsText = JSONObjectFieldKeyAsText;
826
839
  class jSONPathValuePredicateClause {
827
840
  constructor(col, path, value, pred, overrideAlias) {
828
841
  this.col = col;
@@ -866,7 +879,6 @@ class jSONPathValuePredicateClause {
866
879
  function JSONPathValuePredicate(dbCol, path, val, pred, overrideAlias) {
867
880
  return new jSONPathValuePredicateClause(dbCol, path, val, pred, overrideAlias);
868
881
  }
869
- exports.JSONPathValuePredicate = JSONPathValuePredicate;
870
882
  function JSONKeyExists(dbCol, val, overrideAlias) {
871
883
  return new simpleClause(dbCol, val, "?", {
872
884
  // TODO ola: does isNullClause make sense here???
@@ -874,7 +886,6 @@ function JSONKeyExists(dbCol, val, overrideAlias) {
874
886
  overrideAlias,
875
887
  });
876
888
  }
877
- exports.JSONKeyExists = JSONKeyExists;
878
889
  function JSONBKeyInList(dbCol, jsonCol, val, overrideAlias) {
879
890
  const opts = {
880
891
  fields: ["1"],
@@ -886,7 +897,6 @@ function JSONBKeyInList(dbCol, jsonCol, val, overrideAlias) {
886
897
  };
887
898
  return new existsQueryClause(opts);
888
899
  }
889
- exports.JSONBKeyInList = JSONBKeyInList;
890
900
  function JSONKeyInList(dbCol, jsonCol, val, overrideAlias) {
891
901
  const opts = {
892
902
  fields: ["1"],
@@ -898,7 +908,6 @@ function JSONKeyInList(dbCol, jsonCol, val, overrideAlias) {
898
908
  };
899
909
  return new existsQueryClause(opts);
900
910
  }
901
- exports.JSONKeyInList = JSONKeyInList;
902
911
  // TODO need a better name for this lol
903
912
  // this assumes we're doing the same direction twice which isn't necessarily accurate in the future...
904
913
  class paginationMultipleColumnsSubQueryClause {
@@ -942,7 +951,6 @@ class paginationMultipleColumnsSubQueryClause {
942
951
  function PaginationMultipleColsSubQuery(col, op, tableName, uniqueCol, val, overrideAlias) {
943
952
  return new paginationMultipleColumnsSubQueryClause(col, op, tableName, uniqueCol, val, overrideAlias);
944
953
  }
945
- exports.PaginationMultipleColsSubQuery = PaginationMultipleColsSubQuery;
946
954
  /**
947
955
  * When paginating over multiple ordered columns, we need to construct a nested
948
956
  * set of clauses to correctly filter. The resulting query will be structured as
@@ -1015,13 +1023,11 @@ function PaginationUnboundColsQuery(ordering) {
1015
1023
  });
1016
1024
  return nesting;
1017
1025
  }
1018
- exports.PaginationUnboundColsQuery = PaginationUnboundColsQuery;
1019
1026
  function PaginationMultipleColsQuery(sortCol, cursorCol, less, // if true, <, if false, >
1020
1027
  sortValue, cursorValue, overrideAlias) {
1021
1028
  const clauseFn = less ? Less : Greater;
1022
1029
  return And(Or(clauseFn(sortCol, sortValue, overrideAlias), And(Eq(sortCol, sortValue, overrideAlias), clauseFn(cursorCol, cursorValue, overrideAlias))));
1023
1030
  }
1024
- exports.PaginationMultipleColsQuery = PaginationMultipleColsQuery;
1025
1031
  // These 5 are used on the RHS of an expression
1026
1032
  function Add(col, value, overrideAlias) {
1027
1033
  return new simpleClause(col, value, "+", {
@@ -1029,35 +1035,30 @@ function Add(col, value, overrideAlias) {
1029
1035
  overrideAlias,
1030
1036
  });
1031
1037
  }
1032
- exports.Add = Add;
1033
1038
  function Subtract(col, value, overrideAlias) {
1034
1039
  return new simpleClause(col, value, "-", {
1035
1040
  handleNull: new isNullClause(col, overrideAlias),
1036
1041
  overrideAlias,
1037
1042
  });
1038
1043
  }
1039
- exports.Subtract = Subtract;
1040
1044
  function Multiply(col, value, overrideAlias) {
1041
1045
  return new simpleClause(col, value, "*", {
1042
1046
  handleNull: new isNullClause(col, overrideAlias),
1043
1047
  overrideAlias,
1044
1048
  });
1045
1049
  }
1046
- exports.Multiply = Multiply;
1047
1050
  function Divide(col, value, overrideAlias) {
1048
1051
  return new simpleClause(col, value, "/", {
1049
1052
  handleNull: new isNullClause(col, overrideAlias),
1050
1053
  overrideAlias,
1051
1054
  });
1052
1055
  }
1053
- exports.Divide = Divide;
1054
1056
  function Modulo(col, value, overrideAlias) {
1055
1057
  return new simpleClause(col, value, "%", {
1056
1058
  handleNull: new isNullClause(col, overrideAlias),
1057
1059
  overrideAlias,
1058
1060
  });
1059
1061
  }
1060
- exports.Modulo = Modulo;
1061
1062
  function getCombinedClause(options, cls, checkIntersection = false) {
1062
1063
  if (options.clause) {
1063
1064
  let optionClause;
@@ -1089,8 +1090,6 @@ function getCombinedClause(options, cls, checkIntersection = false) {
1089
1090
  }
1090
1091
  return cls;
1091
1092
  }
1092
- exports.getCombinedClause = getCombinedClause;
1093
1093
  function Expression(expression) {
1094
1094
  return new simpleExpression(expression);
1095
1095
  }
1096
- exports.Expression = Expression;
package/core/config.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Database, DBDict } from "./db";
3
2
  type logType = "query" | "warn" | "info" | "error" | "debug";
4
3
  declare enum graphqlMutationName {
package/core/config.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.loadConfig = void 0;
29
+ exports.loadConfig = loadConfig;
30
30
  const fs = __importStar(require("fs"));
31
31
  const js_yaml_1 = require("js-yaml");
32
32
  const db_1 = __importDefault(require("./db"));
@@ -105,4 +105,3 @@ function loadConfig(file) {
105
105
  throw e;
106
106
  }
107
107
  }
108
- exports.loadConfig = loadConfig;
package/core/context.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { IncomingMessage, ServerResponse } from "http";
3
2
  import { Data, Loader, LoaderWithLoadMany, QueryOptions, Viewer } from "./base";
4
3
  import { Context } from "./base";
package/core/convert.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function convertDate(val: any): Date;
3
2
  export declare function convertNullableDate(val: any): Date | null;
4
3
  export declare function convertBool(val: any): boolean;
package/core/convert.js CHANGED
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertNullableTextToBuffer = exports.convertTextToBuffer = exports.convertNullableJSONList = exports.convertJSONList = exports.convertNullableJSON = exports.convertJSON = exports.convertNullableBoolList = exports.convertBoolList = exports.convertNullableDateList = exports.convertDateList = exports.convertNullableList = exports.convertList = exports.convertNullableBool = exports.convertBool = exports.convertNullableDate = exports.convertDate = void 0;
3
+ exports.convertDate = convertDate;
4
+ exports.convertNullableDate = convertNullableDate;
5
+ exports.convertBool = convertBool;
6
+ exports.convertNullableBool = convertNullableBool;
7
+ exports.convertList = convertList;
8
+ exports.convertNullableList = convertNullableList;
9
+ exports.convertDateList = convertDateList;
10
+ exports.convertNullableDateList = convertNullableDateList;
11
+ exports.convertBoolList = convertBoolList;
12
+ exports.convertNullableBoolList = convertNullableBoolList;
13
+ exports.convertJSON = convertJSON;
14
+ exports.convertNullableJSON = convertNullableJSON;
15
+ exports.convertJSONList = convertJSONList;
16
+ exports.convertNullableJSONList = convertNullableJSONList;
17
+ exports.convertTextToBuffer = convertTextToBuffer;
18
+ exports.convertNullableTextToBuffer = convertNullableTextToBuffer;
4
19
  const luxon_1 = require("luxon");
5
20
  // these are needed to deal with SQLite having different types stored in the db vs the representation
6
21
  // gotten back from the db/needed in ent land
@@ -17,14 +32,12 @@ function convertDate(val) {
17
32
  // assume date
18
33
  return val;
19
34
  }
20
- exports.convertDate = convertDate;
21
35
  function convertNullableDate(val) {
22
36
  if (val === null) {
23
37
  return null;
24
38
  }
25
39
  return convertDate(val);
26
40
  }
27
- exports.convertNullableDate = convertNullableDate;
28
41
  function convertBool(val) {
29
42
  if (typeof val === "number") {
30
43
  // assume 1 or 0
@@ -33,14 +46,12 @@ function convertBool(val) {
33
46
  // assume boolean
34
47
  return val;
35
48
  }
36
- exports.convertBool = convertBool;
37
49
  function convertNullableBool(val) {
38
50
  if (val === null) {
39
51
  return null;
40
52
  }
41
53
  return convertBool(val);
42
54
  }
43
- exports.convertNullableBool = convertNullableBool;
44
55
  function convertList(val, conv) {
45
56
  if (Array.isArray(val)) {
46
57
  return val;
@@ -57,7 +68,6 @@ function convertList(val, conv) {
57
68
  }
58
69
  return res;
59
70
  }
60
- exports.convertList = convertList;
61
71
  function convertNullableList(val, conv) {
62
72
  // undefined can happen with unsafe ents
63
73
  if (val === null || val === undefined) {
@@ -65,56 +75,45 @@ function convertNullableList(val, conv) {
65
75
  }
66
76
  return convertList(val, conv);
67
77
  }
68
- exports.convertNullableList = convertNullableList;
69
78
  function convertDateList(val) {
70
79
  return convertList(val, convertDate);
71
80
  }
72
- exports.convertDateList = convertDateList;
73
81
  function convertNullableDateList(val) {
74
82
  return convertNullableList(val, convertDate);
75
83
  }
76
- exports.convertNullableDateList = convertNullableDateList;
77
84
  function convertBoolList(val) {
78
85
  return convertList(val, convertBool);
79
86
  }
80
- exports.convertBoolList = convertBoolList;
81
87
  function convertNullableBoolList(val) {
82
88
  return convertNullableList(val, convertBool);
83
89
  }
84
- exports.convertNullableBoolList = convertNullableBoolList;
85
90
  function convertJSON(val) {
86
91
  if (typeof val === "string") {
87
92
  return JSON.parse(val);
88
93
  }
89
94
  return val;
90
95
  }
91
- exports.convertJSON = convertJSON;
92
96
  function convertNullableJSON(val) {
93
97
  if (val === null) {
94
98
  return val;
95
99
  }
96
100
  return convertJSON(val);
97
101
  }
98
- exports.convertNullableJSON = convertNullableJSON;
99
102
  function convertJSONList(val) {
100
103
  return convertList(val, convertJSON);
101
104
  }
102
- exports.convertJSONList = convertJSONList;
103
105
  function convertNullableJSONList(val) {
104
106
  return convertNullableList(val, convertJSON);
105
107
  }
106
- exports.convertNullableJSONList = convertNullableJSONList;
107
108
  function convertTextToBuffer(val) {
108
109
  if (typeof val === "string") {
109
110
  return Buffer.from(val, "base64");
110
111
  }
111
112
  return val;
112
113
  }
113
- exports.convertTextToBuffer = convertTextToBuffer;
114
114
  function convertNullableTextToBuffer(val) {
115
115
  if (val == null) {
116
116
  return val;
117
117
  }
118
118
  return convertTextToBuffer(val);
119
119
  }
120
- exports.convertNullableTextToBuffer = convertNullableTextToBuffer;
package/core/date.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseDate = void 0;
3
+ exports.parseDate = parseDate;
4
4
  const luxon_1 = require("luxon");
5
5
  function parseDate(val, throwErr) {
6
6
  let dt;
@@ -27,4 +27,3 @@ function parseDate(val, throwErr) {
27
27
  }
28
28
  return dt;
29
29
  }
30
- exports.parseDate = parseDate;