Working resolver tool
This commit is contained in:
Binary file not shown.
@@ -6,10 +6,12 @@ def buildPath(path, outputs):
|
|||||||
|
|
||||||
for part in path:
|
for part in path:
|
||||||
if isinstance(part, dict):
|
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)
|
result += str(value)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Binary file not shown.
@@ -6,6 +6,7 @@ from core.runtime.outputs import buildOutput
|
|||||||
from core.runtime.managefailure import manageFailure
|
from core.runtime.managefailure import manageFailure
|
||||||
from core.execution.action.action import buildAction
|
from core.execution.action.action import buildAction
|
||||||
from .skipstep import skipStep
|
from .skipstep import skipStep
|
||||||
|
from core.runtime.resolver import resolveItem
|
||||||
|
|
||||||
def buildOperation(definition):
|
def buildOperation(definition):
|
||||||
actions = definition.actions
|
actions = definition.actions
|
||||||
@@ -20,15 +21,23 @@ def buildOperation(definition):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if hasattr(action, "recursive"):
|
if hasattr(action, "recursive"):
|
||||||
|
outputs[action.recursive["target"]] = {}
|
||||||
for item in outputs[action.recursive["source"]]:
|
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"]
|
#target = outputs[action.recursive["source"]["target"]
|
||||||
outputs, response = buildAction(action, outputs)
|
outputs, response = buildAction(action, outputs)
|
||||||
#print(outputs["message"])
|
#print(item)
|
||||||
return outputs
|
#return outputs
|
||||||
|
else:
|
||||||
outputs, response = buildAction(action, outputs)
|
outputs, response = buildAction(action, outputs)
|
||||||
responses.append(response)
|
responses.append(response)
|
||||||
|
|
||||||
#except Exception as error:
|
#except Exception as error:
|
||||||
#outputs = manageFailure(error, action, outputs)
|
#outputs = manageFailure(error, action, outputs)
|
||||||
#print(outputs["message"])
|
print(outputs["message"])
|
||||||
return outputs
|
return outputs
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -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
|
||||||
Binary file not shown.
@@ -18,11 +18,17 @@ method = "GET"
|
|||||||
# {"output": "[messageid][0].id"}
|
# {"output": "[messageid][0].id"}
|
||||||
#]
|
#]
|
||||||
|
|
||||||
|
resolve = {
|
||||||
|
"targetkeys": ["id"],
|
||||||
|
"label": "path",
|
||||||
|
}
|
||||||
|
|
||||||
path = [
|
path = [
|
||||||
"https://rentmasseur.com/api/v1/mailbox/",
|
"https://rentmasseur.com/api/v1/mailbox/",
|
||||||
{
|
{
|
||||||
"output": "emails",
|
"output": "id",
|
||||||
"keys": [0, "id"]
|
#"keys": [0, "id"]
|
||||||
|
"keys": "id"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -45,15 +51,6 @@ outputs = {
|
|||||||
"message": "messages"
|
"message": "messages"
|
||||||
}
|
}
|
||||||
|
|
||||||
#select = {
|
|
||||||
# "source": "message",
|
|
||||||
# "selectmethod": "include",
|
|
||||||
#"key": "id",
|
|
||||||
# "key": "seen",
|
|
||||||
#"value": {"emails": [0, "id"]},
|
|
||||||
# "value": "false",
|
|
||||||
#}
|
|
||||||
|
|
||||||
select = {
|
select = {
|
||||||
"source": "message",
|
"source": "message",
|
||||||
"include": {
|
"include": {
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTE4NTc3MTgsIm5iZiI6MTc5MTg1NzUzOCwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiwic2Vzc2lvbkNvdW50cnlDb250aW5lbnQiOiJOQSIsImlzRnJvemVuIjowLCJsb2NhdGlvbkxhYmVsIjoiQXRsYW50YSwgR0EiLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTg1NzU5OH0.3TLzOxoQQtnfOuPsLzRjueSDLxQ6w1xSTBdJLfUnVacq6qVEVxj51WfedKO7TXhNyPWtI7WP0e8B1PkGjJsSjA", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQ0NDk1OTgsIm5iZiI6MTc5MTg1NzUzOCwianRpIjoiZmJ6YnNxSlY2RUcrTGc4UGVyZzN5WDdPMWhvaXdGZ25NVkFuU0ZYdFJ6cz0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTg1NzU5OCwic3ViIjoiMjM4MzAyIn0.GRlPPC4Ifv-XIrqUNsrBPst5_tW5UIbapGVZOzXroVJDW3F2FM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