From b7e064508ae58411fbeadc7d986dde60cdb51806 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 21 Jun 2026 19:58:34 +0200 Subject: [PATCH] feat: PoolProfile companion node Co-Authored-By: Claude Opus 4.8 --- gates/profile_node.py | 30 ++++++++++++++++++++++++++++++ tests/test_profile_node.py | 13 +++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 gates/profile_node.py create mode 100644 tests/test_profile_node.py diff --git a/gates/profile_node.py b/gates/profile_node.py new file mode 100644 index 0000000..4d743aa --- /dev/null +++ b/gates/profile_node.py @@ -0,0 +1,30 @@ +# gates/profile_node.py +NODE_CLASS_MAPPINGS = {} +NODE_DISPLAY_NAME_MAPPINGS = {} + + +class PoolProfile: + CATEGORY = "Datasete Gates" + FUNCTION = "run" + RETURN_TYPES = ("POOL_PROFILE",) + RETURN_NAMES = ("profile",) + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "profile": ("STRING", {"default": ""}), # name; JS renders a dropdown + "profile_id": ("STRING", {"default": ""}), # hidden, JS-owned id + }, + } + + def run(self, profile, profile_id=""): + return (profile_id or "default",) + + @classmethod + def IS_CHANGED(cls, profile, profile_id="", **kwargs): + return profile_id + + +NODE_CLASS_MAPPINGS = {"PoolProfile": PoolProfile} +NODE_DISPLAY_NAME_MAPPINGS = {"PoolProfile": "Pool Profile"} diff --git a/tests/test_profile_node.py b/tests/test_profile_node.py new file mode 100644 index 0000000..b555d92 --- /dev/null +++ b/tests/test_profile_node.py @@ -0,0 +1,13 @@ +# tests/test_profile_node.py +from gates import profile_node as pn + +def test_io(): + assert pn.PoolProfile.RETURN_TYPES == ("POOL_PROFILE",) + assert pn.PoolProfile.RETURN_NAMES == ("profile",) + +def test_run_returns_id_or_default(): + assert pn.PoolProfile().run(profile="setA", profile_id="id1") == ("id1",) + assert pn.PoolProfile().run(profile="", profile_id="") == ("default",) + +def test_is_changed_tracks_id(): + assert pn.PoolProfile.IS_CHANGED(profile="x", profile_id="id1") == "id1"