prisma-sql 1.49.0 → 1.50.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.
@@ -56,7 +56,7 @@ var require_package = __commonJS({
56
56
  "package.json"(exports$1, module) {
57
57
  module.exports = {
58
58
  name: "prisma-sql",
59
- version: "1.49.0",
59
+ version: "1.50.0",
60
60
  description: "Convert Prisma queries to optimized SQL with type safety. 2-7x faster than Prisma Client.",
61
61
  main: "dist/index.cjs",
62
62
  module: "dist/index.js",
@@ -4221,6 +4221,12 @@ var HAVING_FIELD_FIRST_AGG_KEYS = Object.freeze([
4221
4221
  "_min",
4222
4222
  "_max"
4223
4223
  ]);
4224
+ function hasAnyOwnKey(obj) {
4225
+ for (const k in obj) {
4226
+ if (Object.prototype.hasOwnProperty.call(obj, k)) return true;
4227
+ }
4228
+ return false;
4229
+ }
4224
4230
  function isTruthySelection(v) {
4225
4231
  return v === true;
4226
4232
  }
@@ -4373,14 +4379,7 @@ function buildHavingForAggregateFirstShape(aggKey, target, alias, params, dialec
4373
4379
  const filter = targetObj[field];
4374
4380
  if (!isPlainObject(filter)) continue;
4375
4381
  const filterObj = filter;
4376
- let hasAny = false;
4377
- for (const k in filterObj) {
4378
- if (Object.prototype.hasOwnProperty.call(filterObj, k)) {
4379
- hasAny = true;
4380
- break;
4381
- }
4382
- }
4383
- if (!hasAny) continue;
4382
+ if (!hasAnyOwnKey(filterObj)) continue;
4384
4383
  const expr = aggExprForField(aggKey, field, alias, model);
4385
4384
  out.push(...buildHavingOpsForExpr(expr, filterObj, params, dialect));
4386
4385
  }
@@ -4397,14 +4396,7 @@ function buildHavingForFieldFirstShape(fieldName, target, alias, params, dialect
4397
4396
  const aggFilter = obj[aggKey];
4398
4397
  if (!isPlainObject(aggFilter)) continue;
4399
4398
  const aggFilterObj = aggFilter;
4400
- let hasAny = false;
4401
- for (const k in aggFilterObj) {
4402
- if (Object.prototype.hasOwnProperty.call(aggFilterObj, k)) {
4403
- hasAny = true;
4404
- break;
4405
- }
4406
- }
4407
- if (!hasAny) continue;
4399
+ if (!hasAnyOwnKey(aggFilterObj)) continue;
4408
4400
  if (aggKey === "_sum" || aggKey === "_avg") {
4409
4401
  assertNumericField(model, fieldName, "HAVING");
4410
4402
  }