import "../chunk-2E224ZSN.js";

// runtime/eav-helpers.ts
function toEavRows(entityId, entityType, userId, fields, fieldDefIds) {
  const rows = [];
  for (const [key, value] of Object.entries(fields)) {
    const fieldDefinitionId = fieldDefIds.get(key);
    if (!fieldDefinitionId) continue;
    rows.push({ entityId, entityType, userId, fieldDefinitionId, value });
  }
  return rows;
}
function mergeEavRows(rows, defsById) {
  const out = {};
  for (const row of rows) {
    if (!row.fieldDefinitionId) continue;
    const def = defsById.get(row.fieldDefinitionId);
    if (!def) continue;
    out[def.key] = row.value;
  }
  return out;
}
export {
  mergeEavRows,
  toEavRows
};
//# sourceMappingURL=eav-helpers.js.map