diff --git a/core/apirequest/__pycache__/path.cpython-314.pyc b/core/apirequest/__pycache__/path.cpython-314.pyc index f96d797..922a492 100644 Binary files a/core/apirequest/__pycache__/path.cpython-314.pyc and b/core/apirequest/__pycache__/path.cpython-314.pyc differ diff --git a/core/apirequest/path.py b/core/apirequest/path.py index e78cf94..5ae2e57 100644 --- a/core/apirequest/path.py +++ b/core/apirequest/path.py @@ -6,10 +6,12 @@ def buildPath(path, outputs): for part in path: if isinstance(part, dict): - value = outputs[part["output"]] + value = outputs[part["output"]][part["keys"]] - for key in part.get("keys", []): - value = value[key] + + + #for key in part.get("keys", []): + #value = value[key] result += str(value) else: diff --git a/core/execution/operation/__pycache__/operation.cpython-314.pyc b/core/execution/operation/__pycache__/operation.cpython-314.pyc index b2d9526..ef6c10b 100644 Binary files a/core/execution/operation/__pycache__/operation.cpython-314.pyc and b/core/execution/operation/__pycache__/operation.cpython-314.pyc differ diff --git a/core/execution/operation/operation.py b/core/execution/operation/operation.py index ba99a29..de8cc03 100644 --- a/core/execution/operation/operation.py +++ b/core/execution/operation/operation.py @@ -6,6 +6,7 @@ from core.runtime.outputs import buildOutput from core.runtime.managefailure import manageFailure from core.execution.action.action import buildAction from .skipstep import skipStep +from core.runtime.resolver import resolveItem def buildOperation(definition): actions = definition.actions @@ -20,15 +21,23 @@ def buildOperation(definition): continue if hasattr(action, "recursive"): + outputs[action.recursive["target"]] = {} for item in outputs[action.recursive["source"]]: + resolved = resolveItem(action, item) + print("Resolved value:", resolved) + #outputs[action.recursive["target"]] = outputs[action.recursive["source"]][][action.recursive["target"]] + #print(outputs[action.recursive["target"]]) + outputs[action.recursive["target"]] = item + print(outputs[action.recursive["target"]]) #target = outputs[action.recursive["source"]["target"] outputs, response = buildAction(action, outputs) - #print(outputs["message"]) - return outputs - outputs, response = buildAction(action, outputs) - responses.append(response) + #print(item) + #return outputs + else: + outputs, response = buildAction(action, outputs) + responses.append(response) #except Exception as error: #outputs = manageFailure(error, action, outputs) - #print(outputs["message"]) + print(outputs["message"]) return outputs diff --git a/core/runtime/__pycache__/resolver.cpython-314.pyc b/core/runtime/__pycache__/resolver.cpython-314.pyc new file mode 100644 index 0000000..6905c15 Binary files /dev/null and b/core/runtime/__pycache__/resolver.cpython-314.pyc differ diff --git a/core/runtime/__pycache__/select.cpython-314.pyc b/core/runtime/__pycache__/select.cpython-314.pyc index 988ac4d..883c62c 100644 Binary files a/core/runtime/__pycache__/select.cpython-314.pyc and b/core/runtime/__pycache__/select.cpython-314.pyc differ diff --git a/core/runtime/resolver.py b/core/runtime/resolver.py new file mode 100644 index 0000000..a5cf46a --- /dev/null +++ b/core/runtime/resolver.py @@ -0,0 +1,22 @@ +def resolveItem(action, item): + resolved = {} + label = action.resolve["label"] + targetkeys = action.resolve["targetkeys"] + + target = item + for key in targetkeys: + target = target[key] + + resolved[label] = target + + #for label, keys in action.resolve.items(): + #target = item + + #print(target) + #for key in keys: + #target = target[key] + + #resolved[label] = target + #print(resolved[label]) + + return resolved diff --git a/plugins/rmass/actions/__pycache__/getmessage.cpython-314.pyc b/plugins/rmass/actions/__pycache__/getmessage.cpython-314.pyc index 2f69930..17eda7e 100644 Binary files a/plugins/rmass/actions/__pycache__/getmessage.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/getmessage.cpython-314.pyc differ diff --git a/plugins/rmass/actions/getmessage.py b/plugins/rmass/actions/getmessage.py index a467e34..57db081 100644 --- a/plugins/rmass/actions/getmessage.py +++ b/plugins/rmass/actions/getmessage.py @@ -18,11 +18,17 @@ method = "GET" # {"output": "[messageid][0].id"} #] +resolve = { + "targetkeys": ["id"], + "label": "path", +} + path = [ "https://rentmasseur.com/api/v1/mailbox/", { - "output": "emails", - "keys": [0, "id"] + "output": "id", + #"keys": [0, "id"] + "keys": "id" } ] @@ -45,15 +51,6 @@ outputs = { "message": "messages" } -#select = { -# "source": "message", -# "selectmethod": "include", - #"key": "id", -# "key": "seen", - #"value": {"emails": [0, "id"]}, -# "value": "false", -#} - select = { "source": "message", "include": { diff --git a/tokens.json b/tokens.json index e4c8335..a18a94f 100644 --- a/tokens.json +++ b/tokens.json @@ -1 +1 @@ -{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTE4NTc3MTgsIm5iZiI6MTc5MTg1NzUzOCwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiwic2Vzc2lvbkNvdW50cnlDb250aW5lbnQiOiJOQSIsImlzRnJvemVuIjowLCJsb2NhdGlvbkxhYmVsIjoiQXRsYW50YSwgR0EiLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTg1NzU5OH0.3TLzOxoQQtnfOuPsLzRjueSDLxQ6w1xSTBdJLfUnVacq6qVEVxj51WfedKO7TXhNyPWtI7WP0e8B1PkGjJsSjA", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQ0NDk1OTgsIm5iZiI6MTc5MTg1NzUzOCwianRpIjoiZmJ6YnNxSlY2RUcrTGc4UGVyZzN5WDdPMWhvaXdGZ25NVkFuU0ZYdFJ6cz0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTg1NzU5OCwic3ViIjoiMjM4MzAyIn0.GRlPPC4Ifv-XIrqUNsrBPst5_tW5UIbapGVZOzXroVJDW3F2FMolDNg-0CM_Vrz_uwlyPpnc1aUoAOIIhl2V0w"} \ No newline at end of file +{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTE5MDM5MDEsIm5iZiI6MTc5MTkwMzcyMSwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiwic2Vzc2lvbkNvdW50cnlDb250aW5lbnQiOiJOQSIsImlzRnJvemVuIjowLCJsb2NhdGlvbkxhYmVsIjoiQXRsYW50YSwgR0EiLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTkwMzc4MX0.dwJ10VfIyUSANbKlG0UqzoRqWfZpU0vdUh44IoEbwKeaNPk6d_J6yvrLQy_uY18IfQR_3t4PEp7Qrwa9Eqtyig", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQ0OTU3ODEsIm5iZiI6MTc5MTkwMzcyMSwianRpIjoiK3pMamtvVlhnN1ZhZmd1OGtib21CQkhxR0R5QmZVdVMxeTgzb0NmQWttcz0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTkwMzc4MSwic3ViIjoiMjM4MzAyIn0.q_Bjzys1sCFe29BewT3Ez6cTMvL6vmAwvspSafOmPV980W5Rh2RuytxHnz8JiYj8zGKbi-oM5pNfrOG3gS5Heg"} \ No newline at end of file