prisma-sql 1.49.0 → 1.50.1

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.cjs CHANGED
@@ -4111,6 +4111,12 @@ var HAVING_FIELD_FIRST_AGG_KEYS = Object.freeze([
4111
4111
  "_min",
4112
4112
  "_max"
4113
4113
  ]);
4114
+ function hasAnyOwnKey(obj) {
4115
+ for (const k in obj) {
4116
+ if (Object.prototype.hasOwnProperty.call(obj, k)) return true;
4117
+ }
4118
+ return false;
4119
+ }
4114
4120
  function isTruthySelection(v) {
4115
4121
  return v === true;
4116
4122
  }
@@ -4263,14 +4269,7 @@ function buildHavingForAggregateFirstShape(aggKey, target, alias, params, dialec
4263
4269
  const filter = targetObj[field];
4264
4270
  if (!isPlainObject(filter)) continue;
4265
4271
  const filterObj = filter;
4266
- let hasAny = false;
4267
- for (const k in filterObj) {
4268
- if (Object.prototype.hasOwnProperty.call(filterObj, k)) {
4269
- hasAny = true;
4270
- break;
4271
- }
4272
- }
4273
- if (!hasAny) continue;
4272
+ if (!hasAnyOwnKey(filterObj)) continue;
4274
4273
  const expr = aggExprForField(aggKey, field, alias, model);
4275
4274
  out.push(...buildHavingOpsForExpr(expr, filterObj, params, dialect));
4276
4275
  }
@@ -4287,14 +4286,7 @@ function buildHavingForFieldFirstShape(fieldName, target, alias, params, dialect
4287
4286
  const aggFilter = obj[aggKey];
4288
4287
  if (!isPlainObject(aggFilter)) continue;
4289
4288
  const aggFilterObj = aggFilter;
4290
- let hasAny = false;
4291
- for (const k in aggFilterObj) {
4292
- if (Object.prototype.hasOwnProperty.call(aggFilterObj, k)) {
4293
- hasAny = true;
4294
- break;
4295
- }
4296
- }
4297
- if (!hasAny) continue;
4289
+ if (!hasAnyOwnKey(aggFilterObj)) continue;
4298
4290
  if (aggKey === "_sum" || aggKey === "_avg") {
4299
4291
  assertNumericField(model, fieldName, "HAVING");
4300
4292
  }