@vantreeseba/drizzle-graphql 5.0.0 → 5.1.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
@@ -813,8 +813,8 @@ var innerOrder = new GraphQLInputObjectType2({
813
813
  }
814
814
  }
815
815
  });
816
- var resolveGenericFilterName = (column, columnName, columnGraphQLType) => {
817
- if (columnName === "id" || columnName.endsWith("Id")) {
816
+ var resolveGenericFilterName = (column, columnGraphQLType) => {
817
+ if (columnGraphQLType.type === GraphQLUUID) {
818
818
  return "Id";
819
819
  }
820
820
  if (columnGraphQLType.type === GraphQLBoolean2) {
@@ -847,11 +847,18 @@ var resolveGenericFilterName = (column, columnName, columnGraphQLType) => {
847
847
  if (ct === "PgTimestamp" || ct === "PgTimestampString" || ct === "PgDate") {
848
848
  return "DateTime";
849
849
  }
850
+ if (columnGraphQLType.type === GraphQLInt2) {
851
+ return "Int";
852
+ }
853
+ if (columnGraphQLType.type === GraphQLFloat2) {
854
+ return "Float";
855
+ }
850
856
  return "String";
851
857
  };
858
+ var FILTERS_WITHOUT_STRING_OPS = /* @__PURE__ */ new Set(["Id", "Int", "Float", "BigInt", "Decimal"]);
852
859
  var generateColumnFilterValues = (column, tableName, columnName, cacheCtx) => {
853
860
  const columnGraphQLType = drizzleColumnToGraphQLType(column, columnName, tableName, true, false, true);
854
- const genericName = resolveGenericFilterName(column, columnName, columnGraphQLType);
861
+ const genericName = resolveGenericFilterName(column, columnGraphQLType);
855
862
  const cached = cacheCtx.genericFilterCache.get(genericName);
856
863
  if (cached) {
857
864
  return cached;
@@ -859,7 +866,7 @@ var generateColumnFilterValues = (column, tableName, columnName, cacheCtx) => {
859
866
  const colType = columnGraphQLType.type;
860
867
  const colDesc = columnGraphQLType.description;
861
868
  const colArr = new GraphQLList2(new GraphQLNonNull2(colType));
862
- const omitStringOps = genericName === "Id" || genericName === "BigInt" || genericName === "Decimal";
869
+ const omitStringOps = FILTERS_WITHOUT_STRING_OPS.has(genericName);
863
870
  const baseFields = {
864
871
  eq: { type: colType, description: colDesc },
865
872
  ne: { type: colType, description: colDesc },