Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/docs/content/docs/de/tools/apify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Führe einen APIFY-Aktor synchron aus und erhalte Ergebnisse (maximal 5 Minuten)
| `success` | boolean | Ob die Aktor-Ausführung erfolgreich war |
| `runId` | string | APIFY-Ausführungs-ID |
| `status` | string | Ausführungsstatus \(SUCCEEDED, FAILED, usw.\) |
| `datasetId` | string | Dataset-ID mit Ergebnissen |
| `items` | array | Dataset-Elemente \(falls abgeschlossen\) |

### `apify_run_actor_async`
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/en/tools/apify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Run an APIFY actor synchronously and get results (max 5 minutes)
| `success` | boolean | Whether the actor run succeeded |
| `runId` | string | APIFY run ID |
| `status` | string | Run status \(SUCCEEDED, FAILED, etc.\) |
| `datasetId` | string | Dataset ID containing results |
| `items` | array | Dataset items \(if completed\) |

### `apify_run_actor_async`
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/es/tools/apify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Ejecuta un actor de APIFY de forma sincrónica y obtén resultados (máximo 5 mi
| `success` | boolean | Si la ejecución del actor tuvo éxito |
| `runId` | string | ID de ejecución de APIFY |
| `status` | string | Estado de la ejecución \(SUCCEEDED, FAILED, etc.\) |
| `datasetId` | string | ID del conjunto de datos que contiene los resultados |
| `items` | array | Elementos del conjunto de datos \(si se completó\) |

### `apify_run_actor_async`
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/fr/tools/apify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Exécuter un acteur APIFY de manière synchrone et obtenir les résultats (maxim
| `success` | booléen | Indique si l'exécution de l'acteur a réussi |
| `runId` | chaîne | ID d'exécution APIFY |
| `status` | chaîne | Statut d'exécution \(SUCCEEDED, FAILED, etc.\) |
| `datasetId` | chaîne | ID du jeu de données contenant les résultats |
| `items` | tableau | Éléments du jeu de données \(si terminé\) |

### `apify_run_actor_async`
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/ja/tools/apify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ APIPYアクターを同期的に実行して結果を取得(最大5分)
| `success` | boolean | アクター実行が成功したかどうか |
| `runId` | string | APIFY実行ID |
| `status` | string | 実行ステータス(SUCCEEDED、FAILEDなど) |
| `datasetId` | string | 結果を含むデータセットID |
| `items` | array | データセット項目(完了した場合) |

### `apify_run_actor_async`
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/zh/tools/apify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
| `success` | boolean | actor 运行是否成功 |
| `runId` | string | APIFY 运行 ID |
| `status` | string | 运行状态 \(SUCCEEDED, FAILED 等\) |
| `datasetId` | string | 包含结果的数据集 ID |
| `items` | array | 数据集条目 \(如果已完成\) |

### `apify_run_actor_async`
Expand Down
49 changes: 7 additions & 42 deletions apps/sim/app/api/files/parse/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
extractCleanFilename,
extractStorageKey,
extractWorkspaceIdFromExecutionKey,
getMimeTypeFromExtension,
getViewerUrl,
inferContextFromKey,
} from '@/lib/uploads/utils/file-utils'
Expand Down Expand Up @@ -44,36 +45,6 @@ interface ParseResult {
}
}

const fileTypeMap: Record<string, string> = {
// Text formats
txt: 'text/plain',
csv: 'text/csv',
json: 'application/json',
xml: 'application/xml',
md: 'text/markdown',
html: 'text/html',
css: 'text/css',
js: 'application/javascript',
ts: 'application/typescript',
// Document formats
pdf: 'application/pdf',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
// Spreadsheet formats
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
// Presentation formats
ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
// Image formats
png: 'image/png',
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
gif: 'image/gif',
// Archive formats
zip: 'application/zip',
}

/**
* Main API route handler
*/
Expand Down Expand Up @@ -378,7 +349,8 @@ async function handleExternalUrl(
})
} else {
const { uploadWorkspaceFile } = await import('@/lib/uploads/contexts/workspace')
const mimeType = response.headers.get('content-type') || getMimeType(extension)
const mimeType =
response.headers.get('content-type') || getMimeTypeFromExtension(extension)
await uploadWorkspaceFile(workspaceId, userId, buffer, filename, mimeType)
logger.info(`Saved URL file to workspace storage: ${filename}`)
}
Expand Down Expand Up @@ -570,7 +542,7 @@ async function handleLocalFile(
content: result.content,
filePath,
metadata: {
fileType: fileType || getMimeType(extension),
fileType: fileType || getMimeTypeFromExtension(extension),
size: stats.size,
hash,
processingTime: 0,
Expand Down Expand Up @@ -705,7 +677,7 @@ async function handleGenericTextBuffer(
content: result.content,
filePath: originalPath || filename,
metadata: {
fileType: fileType || getMimeType(extension),
fileType: fileType || getMimeTypeFromExtension(extension),
size: fileBuffer.length,
hash: createHash('md5').update(fileBuffer).digest('hex'),
processingTime: 0,
Expand All @@ -723,7 +695,7 @@ async function handleGenericTextBuffer(
content,
filePath: originalPath || filename,
metadata: {
fileType: fileType || getMimeType(extension),
fileType: fileType || getMimeTypeFromExtension(extension),
size: fileBuffer.length,
hash: createHash('md5').update(fileBuffer).digest('hex'),
processingTime: 0,
Expand Down Expand Up @@ -764,7 +736,7 @@ function handleGenericBuffer(
content,
filePath: filename,
metadata: {
fileType: fileType || getMimeType(extension),
fileType: fileType || getMimeTypeFromExtension(extension),
size: fileBuffer.length,
hash: createHash('md5').update(fileBuffer).digest('hex'),
processingTime: 0,
Expand All @@ -787,13 +759,6 @@ async function parseBufferAsPdf(buffer: Buffer) {
}
}

/**
* Get MIME type from file extension
*/
function getMimeType(extension: string): string {
return fileTypeMap[extension] || 'application/octet-stream'
}

/**
* Format bytes to human readable size
*/
Expand Down
22 changes: 10 additions & 12 deletions apps/sim/app/api/tools/asana/add-comment/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,16 @@ export async function POST(request: Request) {

return NextResponse.json({
success: true,
output: {
ts: new Date().toISOString(),
gid: story.gid,
text: story.text || '',
created_at: story.created_at,
created_by: story.created_by
? {
gid: story.created_by.gid,
name: story.created_by.name,
}
: undefined,
},
ts: new Date().toISOString(),
gid: story.gid,
text: story.text || '',
created_at: story.created_at,
created_by: story.created_by
? {
gid: story.created_by.gid,
name: story.created_by.name,
}
: undefined,
})
} catch (error) {
logger.error('Error processing request:', error)
Expand Down
16 changes: 7 additions & 9 deletions apps/sim/app/api/tools/asana/create-task/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,13 @@ export async function POST(request: Request) {

return NextResponse.json({
success: true,
output: {
ts: new Date().toISOString(),
gid: task.gid,
name: task.name,
notes: task.notes || '',
completed: task.completed || false,
created_at: task.created_at,
permalink_url: task.permalink_url,
},
ts: new Date().toISOString(),
gid: task.gid,
name: task.name,
notes: task.notes || '',
completed: task.completed || false,
created_at: task.created_at,
permalink_url: task.permalink_url,
})
} catch (error: any) {
logger.error('Error creating Asana task:', {
Expand Down
14 changes: 6 additions & 8 deletions apps/sim/app/api/tools/asana/get-projects/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ export async function POST(request: Request) {

return NextResponse.json({
success: true,
output: {
ts: new Date().toISOString(),
projects: projects.map((project: any) => ({
gid: project.gid,
name: project.name,
resource_type: project.resource_type,
})),
},
ts: new Date().toISOString(),
projects: projects.map((project: any) => ({
gid: project.gid,
name: project.name,
resource_type: project.resource_type,
})),
})
} catch (error) {
logger.error('Error processing request:', error)
Expand Down
102 changes: 49 additions & 53 deletions apps/sim/app/api/tools/asana/get-task/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,29 @@ export async function POST(request: Request) {

return NextResponse.json({
success: true,
output: {
ts: new Date().toISOString(),
gid: task.gid,
resource_type: task.resource_type,
resource_subtype: task.resource_subtype,
name: task.name,
notes: task.notes || '',
completed: task.completed || false,
assignee: task.assignee
? {
gid: task.assignee.gid,
name: task.assignee.name,
}
: undefined,
created_by: task.created_by
? {
gid: task.created_by.gid,
resource_type: task.created_by.resource_type,
name: task.created_by.name,
}
: undefined,
due_on: task.due_on || undefined,
created_at: task.created_at,
modified_at: task.modified_at,
},
ts: new Date().toISOString(),
gid: task.gid,
resource_type: task.resource_type,
resource_subtype: task.resource_subtype,
name: task.name,
notes: task.notes || '',
completed: task.completed || false,
assignee: task.assignee
? {
gid: task.assignee.gid,
name: task.assignee.name,
}
: undefined,
created_by: task.created_by
? {
gid: task.created_by.gid,
resource_type: task.created_by.resource_type,
name: task.created_by.name,
}
: undefined,
due_on: task.due_on || undefined,
created_at: task.created_at,
modified_at: task.modified_at,
})
}

Expand Down Expand Up @@ -180,34 +178,32 @@ export async function POST(request: Request) {

return NextResponse.json({
success: true,
output: {
ts: new Date().toISOString(),
tasks: tasks.map((task: any) => ({
gid: task.gid,
resource_type: task.resource_type,
resource_subtype: task.resource_subtype,
name: task.name,
notes: task.notes || '',
completed: task.completed || false,
assignee: task.assignee
? {
gid: task.assignee.gid,
name: task.assignee.name,
}
: undefined,
created_by: task.created_by
? {
gid: task.created_by.gid,
resource_type: task.created_by.resource_type,
name: task.created_by.name,
}
: undefined,
due_on: task.due_on || undefined,
created_at: task.created_at,
modified_at: task.modified_at,
})),
next_page: result.next_page,
},
ts: new Date().toISOString(),
tasks: tasks.map((task: any) => ({
gid: task.gid,
resource_type: task.resource_type,
resource_subtype: task.resource_subtype,
name: task.name,
notes: task.notes || '',
completed: task.completed || false,
assignee: task.assignee
? {
gid: task.assignee.gid,
name: task.assignee.name,
}
: undefined,
created_by: task.created_by
? {
gid: task.created_by.gid,
resource_type: task.created_by.resource_type,
name: task.created_by.name,
}
: undefined,
due_on: task.due_on || undefined,
created_at: task.created_at,
modified_at: task.modified_at,
})),
next_page: result.next_page,
})
} catch (error) {
logger.error('Error processing request:', error)
Expand Down
Loading