prisma-sql 1.18.0 → 1.20.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.cjs CHANGED
@@ -4268,6 +4268,23 @@ function parseAggregateValue(value) {
4268
4268
  }
4269
4269
  return value;
4270
4270
  }
4271
+ function transformGroupByResults(results) {
4272
+ return results.map((row) => {
4273
+ const raw = row;
4274
+ const parsed = {};
4275
+ for (const [key, value] of Object.entries(raw)) {
4276
+ const parts = key.split(".");
4277
+ if (parts.length === 2) {
4278
+ const [group, field] = parts;
4279
+ if (!parsed[group]) parsed[group] = {};
4280
+ parsed[group][field] = parseAggregateValue(value);
4281
+ } else {
4282
+ parsed[key] = value;
4283
+ }
4284
+ }
4285
+ return parsed;
4286
+ });
4287
+ }
4271
4288
  function transformCountResults(results) {
4272
4289
  const result = results[0];
4273
4290
  const count = (result == null ? void 0 : result["_count._all"]) || (result == null ? void 0 : result.count) || 0;
@@ -4292,7 +4309,8 @@ var RESULT_TRANSFORMERS = {
4292
4309
  findFirst: (results) => results[0] || null,
4293
4310
  findUnique: (results) => results[0] || null,
4294
4311
  count: transformCountResults,
4295
- aggregate: transformAggregateResults
4312
+ aggregate: transformAggregateResults,
4313
+ groupBy: transformGroupByResults
4296
4314
  };
4297
4315
  function transformQueryResults(method, results) {
4298
4316
  const transformer = RESULT_TRANSFORMERS[method];