Added stop signals to RMASS incoming message flows. Nested attachment handling in its own operation for Synapse outgoing message flows
This commit is contained in:
@@ -16,6 +16,9 @@ def buildOperation(definition, outputs):
|
|||||||
dependency in outputs["stopsignals"]
|
dependency in outputs["stopsignals"]
|
||||||
for dependency in action.depends
|
for dependency in action.depends
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#print(f"STOP SIGNAL DEBUGGING during {action.name}")
|
||||||
|
#print(outputs["stopsignals"])
|
||||||
#stop = True
|
#stop = True
|
||||||
#break
|
#break
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from core.execution import action
|
||||||
from core.execution.action.action import buildAction
|
from core.execution.action.action import buildAction
|
||||||
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
||||||
from core.apirequest import executeRequest
|
from core.apirequest import executeRequest
|
||||||
@@ -33,15 +34,21 @@ def buildRecursive(definition, outputs):
|
|||||||
dependency in outputs["stopsignals"]
|
dependency in outputs["stopsignals"]
|
||||||
for dependency in job.depends
|
for dependency in job.depends
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
|
||||||
|
#print(outputs["stopsignals"])
|
||||||
#stop = True
|
#stop = True
|
||||||
#break
|
#break
|
||||||
|
|
||||||
if stop:
|
if stop:
|
||||||
|
#print("STOP SIGNAL DETECTED")
|
||||||
|
#print(f"Stopping {job.name} due to stop signal")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#print(f"RECURSIVE DEBUG DURING {job.name}")
|
#print(f"RECURSIVE DEBUG DURING {job.name}")
|
||||||
#print(item)
|
#print(item)
|
||||||
#outputs, response = buildAction(job, outputs)
|
#outputs, response = buildAction(job, outputs)
|
||||||
|
|
||||||
outputs, response = executeContract(job, outputs)
|
outputs, response = executeContract(job, outputs)
|
||||||
responses.append(response)
|
responses.append(response)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ name = "Get User Avatar"
|
|||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
alias = "getavatar"
|
alias = "getrmassuseravatar"
|
||||||
|
|
||||||
|
depends = []
|
||||||
|
|
||||||
allowaction = bool(os.environ.get("UPDATE_AVATARS", True))
|
allowaction = bool(os.environ.get("UPDATE_AVATARS", True))
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ name = "Get message list"
|
|||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
alias = "pullmessages"
|
alias = "pullmessagelist"
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
|
|||||||
@@ -48,17 +48,17 @@ resolve = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
#{
|
|
||||||
# "keytitle": "message",
|
|
||||||
# "keyvalue": {
|
|
||||||
# "resolved": "message_body",
|
|
||||||
# },
|
|
||||||
#},
|
|
||||||
{
|
{
|
||||||
"keytitle": "message",
|
"keytitle": "message",
|
||||||
"keyvalue": "Here's a photo!",
|
"keyvalue": {
|
||||||
|
"resolved": "message_body",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
#{
|
#{
|
||||||
|
# "keytitle": "message",
|
||||||
|
# "keyvalue": "Here's a photo!",
|
||||||
|
#},
|
||||||
|
#{
|
||||||
# "keytitle": "profileId",
|
# "keytitle": "profileId",
|
||||||
# "keyvalue": {
|
# "keyvalue": {
|
||||||
# "resolved": "rmass_user",
|
# "resolved": "rmass_user",
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ name = "Upload Attachments to Synapse"
|
|||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
alias = "uploadattachment"
|
alias = "rmassuploadattachmenttosynapse"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"getrmassattachments",
|
||||||
|
]
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ name = "Upload Avatar to Synapse"
|
|||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
alias = "uploadavatar"
|
alias = "rmassavatartosynapse"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"getrmassuseravatar",
|
||||||
|
]
|
||||||
|
|
||||||
allowaction = os.environ.get("UPDATE_AVATARS", True)
|
allowaction = os.environ.get("UPDATE_AVATARS", True)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
name = "Save RMASS Message ID"
|
||||||
|
|
||||||
|
kind = "action"
|
||||||
|
|
||||||
|
alias = "savermassmessageid"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"synapsegetroomalias",
|
||||||
|
"rmassmessagepush",
|
||||||
|
"rmassattachmentpush",
|
||||||
|
]
|
||||||
|
|
||||||
|
showstatus = True
|
||||||
|
|
||||||
|
isrequest = True
|
||||||
|
|
||||||
|
method = "GET"
|
||||||
|
|
||||||
|
#Used to resolve path for recursive handling. Path location must match the location of the recursiveset data from pullmessage operation
|
||||||
|
resolve = {
|
||||||
|
"get": {
|
||||||
|
"event_id": ["outmessageitem", "event_id"],
|
||||||
|
"path": ["lastmessage", 0, "content", "com.loxthelion.rmass_message_id"],
|
||||||
|
#"matrix_sender": ["outmessageitem", "sender"],
|
||||||
|
#"msg_type": ["outmessageitem", "type"],
|
||||||
|
#"echo_tag": ["outmessageitem", "content", "com.loxthelion.rmass_message_id"],
|
||||||
|
"rmass_sent_status": ["rmass_sent_status"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#To add resolution suffix, second item must be a dictionary. References the "path" library under resolved
|
||||||
|
path = [
|
||||||
|
"https://rentmasseur.com/api/v1/mailbox/",
|
||||||
|
{"resolved": "path"},
|
||||||
|
]
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Authorization": {
|
||||||
|
"output": "access_token",
|
||||||
|
"prefix": "Bearer ",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
"rmasslastmessages": "messages",
|
||||||
|
}
|
||||||
|
|
||||||
|
extract = {
|
||||||
|
"get": {
|
||||||
|
"rmass_message_id": ["rmasslastmessages", 0, "id"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#outputs["rmasslastmessages"][0]["id"] is where we get our messageid
|
||||||
|
select = {
|
||||||
|
"source": "rmasslastmessages",
|
||||||
|
"include": {
|
||||||
|
"key": "senderId",
|
||||||
|
"value": 238302,
|
||||||
|
},
|
||||||
|
"exclude": {
|
||||||
|
"key": "currentFolder",
|
||||||
|
"value": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saverow = {
|
||||||
|
"table": "message_mapping",
|
||||||
|
"columns": [
|
||||||
|
{"rmass_message_id": "INTEGER PRIMARY KEY"},
|
||||||
|
{"matrix_event_id": "TEXT NOT NULL UNIQUE"},
|
||||||
|
],
|
||||||
|
|
||||||
|
"rowitems": [
|
||||||
|
{"outputs": "rmass_message_id"},
|
||||||
|
{"resolved": "event_id"},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
filters = [
|
||||||
|
{
|
||||||
|
"filterkey": "rmass_sent_status",
|
||||||
|
"operator": "==",
|
||||||
|
"filtervalue": "fail",
|
||||||
|
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filterkey": "rmass_sent_status",
|
||||||
|
"operator": "==",
|
||||||
|
"filtervalue": "error",
|
||||||
|
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
|
||||||
|
},
|
||||||
|
]
|
||||||
@@ -2,6 +2,13 @@ import os
|
|||||||
|
|
||||||
name = "Synapse Assign Avatar"
|
name = "Synapse Assign Avatar"
|
||||||
|
|
||||||
|
alias = "synapseassignavatar"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"getrmassuseravatar",
|
||||||
|
"rmassavatartosynapse",
|
||||||
|
]
|
||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|||||||
@@ -2,6 +2,15 @@ import os
|
|||||||
|
|
||||||
name = "Synapse Assign DM Room Avatar"
|
name = "Synapse Assign DM Room Avatar"
|
||||||
|
|
||||||
|
alias = "synapseassigndmavatar"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"getrmassuseravatar",
|
||||||
|
"rmassavatartosynapse",
|
||||||
|
"synapsegetroomid",
|
||||||
|
"synapsecreatedmroom",
|
||||||
|
]
|
||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ kind = "action"
|
|||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
|
alias = "synapseassignusername"
|
||||||
|
|
||||||
|
#depends = []
|
||||||
|
|
||||||
#astoken = os.environ["AS_TOKEN"]
|
#astoken = os.environ["AS_TOKEN"]
|
||||||
|
|
||||||
resolve = {
|
resolve = {
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ kind = "action"
|
|||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
|
alias = "synapsecreatedmroom"
|
||||||
|
|
||||||
|
depends = []
|
||||||
|
|
||||||
resolve = {
|
resolve = {
|
||||||
"get": {
|
"get": {
|
||||||
"sender": ["messageheaders", "userCard", "id"],
|
"sender": ["messageheaders", "userCard", "id"],
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ kind = "action"
|
|||||||
|
|
||||||
depends = [
|
depends = [
|
||||||
"synapsegetroomalias",
|
"synapsegetroomalias",
|
||||||
"rmassmessagepush",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ name = "Synapse Get Room ID"
|
|||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
|
alias = "synapsegetroomid"
|
||||||
|
|
||||||
|
#depends = [
|
||||||
|
# "synapsecreatedmroom",
|
||||||
|
#]
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
resolve = {
|
resolve = {
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ from . import synapsenotify
|
|||||||
|
|
||||||
name = "Synapse Attachment Push"
|
name = "Synapse Attachment Push"
|
||||||
|
|
||||||
|
alias = "synapsepushattachments"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"getrmassattachments",
|
||||||
|
"rmassattachmenttosynapse",
|
||||||
|
]
|
||||||
|
|
||||||
kind = "action"
|
kind = "action"
|
||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ kind = "action"
|
|||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
|
alias = "synapseregister"
|
||||||
|
|
||||||
|
#depends = []
|
||||||
|
|
||||||
resolve = {
|
resolve = {
|
||||||
"get": {
|
"get": {
|
||||||
"sender": ["messageheaders", "userCard", "id"],
|
"sender": ["messageheaders", "userCard", "id"],
|
||||||
|
|||||||
@@ -3,10 +3,16 @@ from plugins.rmass.operations import synapsepushmessageitems
|
|||||||
|
|
||||||
name = "Get RMASS Conversations and Synapse Provisioning"
|
name = "Get RMASS Conversations and Synapse Provisioning"
|
||||||
|
|
||||||
|
alias = "getrmassconversations"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"pullmessagelist",
|
||||||
|
]
|
||||||
|
|
||||||
kind = "recursiveset"
|
kind = "recursiveset"
|
||||||
|
|
||||||
recursiveset = {
|
recursiveset = {
|
||||||
"source": "pullmessages_select",
|
"source": "pullmessagelist_select",
|
||||||
"outputlabel": "messageheaders",
|
"outputlabel": "messageheaders",
|
||||||
"actions": [
|
"actions": [
|
||||||
synapseregister,
|
synapseregister,
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from plugins.rmass.actions import rmassmessagepush, savermassmessageid, synapsegetroomalias, refresh_tokens, synapsegetlastmessage, synapsegetattachment, getrmassattachmenturl, synapseattachmenttormass, getrmassattachmentid, rmassattachmentpush
|
||||||
|
|
||||||
|
name = "RMASS Attachment Push"
|
||||||
|
|
||||||
|
alias = "rmassattachmentpushflow"
|
||||||
|
|
||||||
|
depends = [
|
||||||
|
"synapsegetroomalias",
|
||||||
|
"synapsegetlastmessage",
|
||||||
|
]
|
||||||
|
|
||||||
|
kind = "operation"
|
||||||
|
|
||||||
|
actions = [
|
||||||
|
synapsegetattachment,
|
||||||
|
getrmassattachmenturl,
|
||||||
|
synapseattachmenttormass,
|
||||||
|
getrmassattachmentid,
|
||||||
|
rmassattachmentpush,
|
||||||
|
]
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
from plugins.rmass.actions import rmassmessagepush, synapsegetroomalias, refresh_tokens, synapsegetlastmessage, getrmassconversation, synapsegetattachment, getrmassattachmenturl, synapseattachmenttormass, getrmassattachmentid, rmassattachmentpush
|
from plugins.rmass.actions import rmassmessagepush, savermassmessageid, synapsegetroomalias, synapsegetlastmessage
|
||||||
|
from plugins.rmass.operations import rmassattachmentpushflow
|
||||||
|
|
||||||
name = "RMASS Message Push"
|
name = "RMASS Message Push"
|
||||||
|
|
||||||
@@ -9,17 +10,17 @@ recursiveset = {
|
|||||||
#"retain": False,
|
#"retain": False,
|
||||||
"outputlabel": "outmessageitem",
|
"outputlabel": "outmessageitem",
|
||||||
"actions": [
|
"actions": [
|
||||||
#refresh_tokens,
|
|
||||||
synapsegetroomalias,
|
synapsegetroomalias,
|
||||||
rmassmessagepush,
|
rmassmessagepush,
|
||||||
synapsegetlastmessage,
|
synapsegetlastmessage,
|
||||||
synapsegetattachment,
|
#synapsegetattachment,
|
||||||
getrmassattachmenturl,
|
#getrmassattachmenturl,
|
||||||
synapseattachmenttormass,
|
#synapseattachmenttormass,
|
||||||
getrmassattachmentid,
|
#getrmassattachmentid,
|
||||||
rmassattachmentpush,
|
#rmassattachmentpush,
|
||||||
|
rmassattachmentpushflow,
|
||||||
#synapsegetlastmessage,
|
#synapsegetlastmessage,
|
||||||
getrmassconversation,
|
savermassmessageid,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user