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