supabase-typed-query 0.10.0 → 0.12.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/index.js CHANGED
@@ -555,10 +555,10 @@ const createMappedQuery = (sourceQuery, mapFn) => {
555
555
  }
556
556
  };
557
557
  };
558
- const createQuery = (client, table, where = {}, is, wherein, order, softDeleteConfig, schema) => {
558
+ const createQuery = (client, table, where = {}, is, wherein, order, softDeleteConfig, schema, comparison) => {
559
559
  const config = {
560
560
  table,
561
- conditions: [{ where, is, wherein }],
561
+ conditions: [{ where, is, wherein, ...comparison }],
562
562
  order,
563
563
  softDeleteMode: softDeleteConfig?.mode,
564
564
  softDeleteAppliedByDefault: softDeleteConfig?.appliedByDefault,
@@ -868,7 +868,7 @@ function createGetItemQuery(client, name, whereConditions, is, softDeleteMode, s
868
868
  schema
869
869
  );
870
870
  }
871
- function createGetItemsQuery(client, name, whereConditions, is, wherein, order, softDeleteMode, schema) {
871
+ function createGetItemsQuery(client, name, whereConditions, is, wherein, order, softDeleteMode, schema, comparison) {
872
872
  return createQuery(
873
873
  client,
874
874
  name,
@@ -880,7 +880,8 @@ function createGetItemsQuery(client, name, whereConditions, is, wherein, order,
880
880
  mode: softDeleteMode,
881
881
  appliedByDefault: true
882
882
  },
883
- schema
883
+ schema,
884
+ comparison
884
885
  );
885
886
  }
886
887
  function createAddItemsMutation(client, name, items, schema) {
@@ -890,17 +891,43 @@ function createAddItemsMutation(client, name, items, schema) {
890
891
  }
891
892
  function createUpdateItemMutation(client, name, item, whereConditions, is, wherein, schema) {
892
893
  return SingleMutationQuery(
893
- updateEntity(client, name, item, whereConditions, is, wherein, schema)
894
+ updateEntity(
895
+ client,
896
+ name,
897
+ item,
898
+ whereConditions,
899
+ is,
900
+ wherein,
901
+ schema
902
+ )
894
903
  );
895
904
  }
896
905
  function createUpdateItemsMutation(client, name, data, where, is, wherein, schema) {
897
906
  return MultiMutationQuery(
898
- upsertEntities(client, name, [data], void 0, where, is, wherein, schema)
907
+ upsertEntities(
908
+ client,
909
+ name,
910
+ [data],
911
+ void 0,
912
+ where,
913
+ is,
914
+ wherein,
915
+ schema
916
+ )
899
917
  );
900
918
  }
901
919
  function createUpsertItemsMutation(client, name, items, identity, schema) {
902
920
  return MultiMutationQuery(
903
- upsertEntities(client, name, items, identity, void 0, void 0, void 0, schema)
921
+ upsertEntities(
922
+ client,
923
+ name,
924
+ items,
925
+ identity,
926
+ void 0,
927
+ void 0,
928
+ void 0,
929
+ schema
930
+ )
904
931
  );
905
932
  }
906
933
  function makeGetItem(client, name, softDeleteMode, schema) {
@@ -910,7 +937,19 @@ function makeGetItem(client, name, softDeleteMode, schema) {
910
937
  };
911
938
  }
912
939
  function makeGetItems(client, name, softDeleteMode, schema) {
913
- return function getItems({ where, is, wherein, order } = {}) {
940
+ return function getItems({
941
+ where,
942
+ is,
943
+ wherein,
944
+ order,
945
+ gte,
946
+ gt,
947
+ lte,
948
+ lt,
949
+ neq,
950
+ like,
951
+ ilike
952
+ } = {}) {
914
953
  return createGetItemsQuery(
915
954
  client,
916
955
  name,
@@ -919,7 +958,8 @@ function makeGetItems(client, name, softDeleteMode, schema) {
919
958
  wherein,
920
959
  order,
921
960
  softDeleteMode,
922
- schema
961
+ schema,
962
+ { gte, gt, lte, lt, neq, like, ilike }
923
963
  );
924
964
  };
925
965
  }
@@ -937,7 +977,7 @@ function makePartitionedGetItem(client, name, partitionField, softDeleteMode, sc
937
977
  };
938
978
  }
939
979
  function makePartitionedGetItems(client, name, partitionField, softDeleteMode, schema) {
940
- return function getItems(partitionKey, { where, is, wherein, order } = {}) {
980
+ return function getItems(partitionKey, { where, is, wherein, order, gte, gt, lte, lt, neq, like, ilike } = {}) {
941
981
  const whereConditions = buildWhereWithPartition(partitionField, partitionKey, where);
942
982
  return createGetItemsQuery(
943
983
  client,
@@ -947,7 +987,8 @@ function makePartitionedGetItems(client, name, partitionField, softDeleteMode, s
947
987
  wherein,
948
988
  order,
949
989
  softDeleteMode,
950
- schema
990
+ schema,
991
+ { gte, gt, lte, lt, neq, like, ilike }
951
992
  );
952
993
  };
953
994
  }
@@ -1024,11 +1065,39 @@ function makePartitionedUpsertItems(client, name, _partitionField, schema) {
1024
1065
  };
1025
1066
  }
1026
1067
  function createDeleteItemMutation(client, name, whereConditions, is, wherein, softDelete, schema) {
1027
- const operation = softDelete ? softDeleteEntity(client, name, whereConditions, is, wherein, schema) : deleteEntity(client, name, whereConditions, is, wherein, schema);
1068
+ const operation = softDelete ? softDeleteEntity(
1069
+ client,
1070
+ name,
1071
+ whereConditions,
1072
+ is,
1073
+ wherein,
1074
+ schema
1075
+ ) : deleteEntity(
1076
+ client,
1077
+ name,
1078
+ whereConditions,
1079
+ is,
1080
+ wherein,
1081
+ schema
1082
+ );
1028
1083
  return SingleMutationQuery(operation);
1029
1084
  }
1030
1085
  function createDeleteItemsMutation(client, name, whereConditions, is, wherein, softDelete, schema) {
1031
- const operation = softDelete ? softDeleteEntities(client, name, whereConditions, is, wherein, schema) : deleteEntities(client, name, whereConditions, is, wherein, schema);
1086
+ const operation = softDelete ? softDeleteEntities(
1087
+ client,
1088
+ name,
1089
+ whereConditions,
1090
+ is,
1091
+ wherein,
1092
+ schema
1093
+ ) : deleteEntities(
1094
+ client,
1095
+ name,
1096
+ whereConditions,
1097
+ is,
1098
+ wherein,
1099
+ schema
1100
+ );
1032
1101
  return MultiMutationQuery(operation);
1033
1102
  }
1034
1103
  function makeDeleteItem(client, name, softDelete, schema) {