"""Run only after configuring the provider's EasyNet Runtime."""

from easyremote import ComputeNode

node = ComputeNode(namespace="sales")


@node.register
def clean_names(rows: list[dict[str, str]]) -> list[dict[str, str]]:
    if len(rows) > 100:
        raise ValueError("Too many rows")
    result = []
    for row in rows:
        if not isinstance(row.get("customer"), str):
            raise ValueError("customer must be text")
        result.append({"customer": row["customer"].strip()})
    return result


if __name__ == "__main__":
    node.serve()
