mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-13 07:55:09 -05:00
feat(tools): added download file tool for onedrive, google drive, and slack; added move email tool for gmail and outlook (#1785)
* feat(tools): added download file tool for onedrive, google drive, and slack * added gmail & outlook move tools, added missing credentials descriptions to modal * added slack delete/update message, add reaction; added gmail read/unread/label/unarchive; added outlook copy/delete/read/unread * added threads to slack operations * added timestamp for slack webhook trigger since api uses timestamp for updating/reacting/deleting * cleanup * added file info to slack read messages * updated slack desc * fixed downloading for onedrive, slack, and drive * fix type check * fix build failure * cleanup files, fix triggers with attachments, fix integration blocks with include attachment to parse to user files, remove unused code * fix move files tools * fix tests * fix build errors * fix type error * fix tests * remove redundant code and filter out unecessary user file fields * fix lint error * remove fields from tag dropdown * fix file upload via API * fix pdf parse issue --------- Co-authored-by: waleed <waleed> Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
This commit is contained in:
@@ -38,6 +38,7 @@ async function processTriggerFileOutputs(
|
||||
workflowId: string
|
||||
executionId: string
|
||||
requestId: string
|
||||
userId?: string
|
||||
},
|
||||
path = ''
|
||||
): Promise<any> {
|
||||
@@ -178,21 +179,6 @@ async function executeWebhookJobInternal(
|
||||
// Merge subblock states (matching workflow-execution pattern)
|
||||
const mergedStates = mergeSubblockState(blocks, {})
|
||||
|
||||
// Process block states for execution
|
||||
const processedBlockStates = Object.entries(mergedStates).reduce(
|
||||
(acc, [blockId, blockState]) => {
|
||||
acc[blockId] = Object.entries(blockState.subBlocks).reduce(
|
||||
(subAcc, [key, subBlock]) => {
|
||||
subAcc[key] = subBlock.value
|
||||
return subAcc
|
||||
},
|
||||
{} as Record<string, any>
|
||||
)
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, Record<string, any>>
|
||||
)
|
||||
|
||||
// Create serialized workflow
|
||||
const serializer = new Serializer()
|
||||
const serializedWorkflow = serializer.serializeWorkflow(
|
||||
@@ -263,8 +249,8 @@ async function executeWebhookJobInternal(
|
||||
metadata,
|
||||
workflow,
|
||||
airtableInput,
|
||||
decryptedEnvVars,
|
||||
workflow.variables || {},
|
||||
{},
|
||||
workflowVariables,
|
||||
[]
|
||||
)
|
||||
|
||||
@@ -355,21 +341,30 @@ async function executeWebhookJobInternal(
|
||||
if (input && payload.blockId && blocks[payload.blockId]) {
|
||||
try {
|
||||
const triggerBlock = blocks[payload.blockId]
|
||||
const triggerId = triggerBlock?.subBlocks?.triggerId?.value
|
||||
const rawSelectedTriggerId = triggerBlock?.subBlocks?.selectedTriggerId?.value
|
||||
const rawTriggerId = triggerBlock?.subBlocks?.triggerId?.value
|
||||
|
||||
if (triggerId && typeof triggerId === 'string' && isTriggerValid(triggerId)) {
|
||||
const triggerConfig = getTrigger(triggerId)
|
||||
const resolvedTriggerId = [rawSelectedTriggerId, rawTriggerId].find(
|
||||
(candidate): candidate is string =>
|
||||
typeof candidate === 'string' && isTriggerValid(candidate)
|
||||
)
|
||||
|
||||
if (resolvedTriggerId) {
|
||||
const triggerConfig = getTrigger(resolvedTriggerId)
|
||||
|
||||
if (triggerConfig.outputs) {
|
||||
logger.debug(`[${requestId}] Processing trigger ${triggerId} file outputs`)
|
||||
logger.debug(`[${requestId}] Processing trigger ${resolvedTriggerId} file outputs`)
|
||||
const processedInput = await processTriggerFileOutputs(input, triggerConfig.outputs, {
|
||||
workspaceId: workspaceId || '',
|
||||
workflowId: payload.workflowId,
|
||||
executionId,
|
||||
requestId,
|
||||
userId: payload.userId,
|
||||
})
|
||||
Object.assign(input, processedInput)
|
||||
}
|
||||
} else {
|
||||
logger.debug(`[${requestId}] No valid triggerId found for block ${payload.blockId}`)
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`[${requestId}] Error processing trigger file outputs:`, error)
|
||||
@@ -449,8 +444,8 @@ async function executeWebhookJobInternal(
|
||||
metadata,
|
||||
workflow,
|
||||
input || {},
|
||||
decryptedEnvVars,
|
||||
workflow.variables || {},
|
||||
{},
|
||||
workflowVariables,
|
||||
[]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user