Skip to content

Commit d6b97fe

Browse files
committed
Fix lint
1 parent 280ac30 commit d6b97fe

File tree

14 files changed

+377
-1025
lines changed

14 files changed

+377
-1025
lines changed

apps/sim/app/api/schedules/[id]/route.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { createLogger } from '@sim/logger'
44
import { eq } from 'drizzle-orm'
55
import { type NextRequest, NextResponse } from 'next/server'
66
import { z } from 'zod'
7-
import { verifyWorkspaceMembership } from '@/app/api/workflows/utils'
87
import { AuditAction, AuditResourceType, recordAudit } from '@/lib/audit/log'
98
import { getSession } from '@/lib/auth'
109
import { generateRequestId } from '@/lib/core/utils/request'
1110
import { validateCronExpression } from '@/lib/workflows/schedules/utils'
1211
import { authorizeWorkflowByWorkspacePermission } from '@/lib/workflows/utils'
12+
import { verifyWorkspaceMembership } from '@/app/api/workflows/utils'
1313

1414
const logger = createLogger('ScheduleAPI')
1515

@@ -34,10 +34,7 @@ async function fetchAndAuthorize(
3434
scheduleId: string,
3535
userId: string,
3636
action: 'read' | 'write'
37-
): Promise<
38-
| { schedule: ScheduleRow; workspaceId: string | null }
39-
| NextResponse
40-
> {
37+
): Promise<{ schedule: ScheduleRow; workspaceId: string | null } | NextResponse> {
4138
const [schedule] = await db
4239
.select({
4340
id: workflowSchedule.id,

apps/sim/app/api/schedules/execute/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ export async function GET(request: NextRequest) {
7171
})
7272

7373
const totalCount = dueSchedules.length + dueJobs.length
74-
logger.info(`[${requestId}] Processing ${totalCount} due items (${dueSchedules.length} schedules, ${dueJobs.length} jobs)`)
74+
logger.info(
75+
`[${requestId}] Processing ${totalCount} due items (${dueSchedules.length} schedules, ${dueJobs.length} jobs)`
76+
)
7577

7678
const jobQueue = await getJobQueue()
7779

apps/sim/app/api/schedules/route.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { workflow, workflowDeploymentVersion, workflowSchedule } from '@sim/db/s
33
import { createLogger } from '@sim/logger'
44
import { and, eq, isNull, or } from 'drizzle-orm'
55
import { type NextRequest, NextResponse } from 'next/server'
6-
import { verifyWorkspaceMembership } from '@/app/api/workflows/utils'
76
import { getSession } from '@/lib/auth'
87
import { generateRequestId } from '@/lib/core/utils/request'
98
import { authorizeWorkflowByWorkspacePermission } from '@/lib/workflows/utils'
9+
import { verifyWorkspaceMembership } from '@/app/api/workflows/utils'
1010

1111
const logger = createLogger('ScheduledAPI')
1212

@@ -113,11 +113,7 @@ export async function GET(req: NextRequest) {
113113
}
114114
}
115115

116-
async function handleWorkspaceSchedules(
117-
requestId: string,
118-
userId: string,
119-
workspaceId: string
120-
) {
116+
async function handleWorkspaceSchedules(requestId: string, userId: string, workspaceId: string) {
121117
const hasPermission = await verifyWorkspaceMembership(userId, workspaceId)
122118
if (!hasPermission) {
123119
return NextResponse.json({ error: 'Not authorized' }, { status: 403 })
@@ -145,16 +141,10 @@ async function handleWorkspaceSchedules(
145141
and(
146142
eq(workflow.workspaceId, workspaceId),
147143
eq(workflowSchedule.triggerType, 'schedule'),
148-
or(
149-
eq(workflowSchedule.sourceType, 'workflow'),
150-
isNull(workflowSchedule.sourceType)
151-
),
144+
or(eq(workflowSchedule.sourceType, 'workflow'), isNull(workflowSchedule.sourceType)),
152145
or(
153146
eq(workflowSchedule.deploymentVersionId, workflowDeploymentVersion.id),
154-
and(
155-
isNull(workflowDeploymentVersion.id),
156-
isNull(workflowSchedule.deploymentVersionId)
157-
)
147+
and(isNull(workflowDeploymentVersion.id), isNull(workflowSchedule.deploymentVersionId))
158148
)
159149
)
160150
),

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
44
import { createLogger } from '@sim/logger'
5-
import { Calendar, Database, Files, HelpCircle, MoreHorizontal, Plus, Search, Settings } from 'lucide-react'
5+
import {
6+
Calendar,
7+
Database,
8+
Files,
9+
HelpCircle,
10+
MoreHorizontal,
11+
Plus,
12+
Search,
13+
Settings,
14+
} from 'lucide-react'
615
import Link from 'next/link'
716
import { useParams, usePathname, useRouter } from 'next/navigation'
817
import {

apps/sim/background/schedule-execution.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,19 @@ function buildJobPrompt(jobRecord: {
621621
}
622622

623623
if (jobRecord.sourceChatId) {
624-
parts.push('Read the task\'s session.md in the VFS for conversation context.')
624+
parts.push("Read the task's session.md in the VFS for conversation context.")
625625
}
626626

627627
if (jobRecord.lifecycle === 'until_complete') {
628628
parts.push('')
629629
parts.push('COMPLETION PROTOCOL:')
630630
parts.push('This is a poll-until-done job. After executing the task above:')
631-
parts.push(`- If the success condition is met, take the required action, then call complete_job(jobId: "${jobRecord.id}") to stop the job.`)
632-
parts.push('- If the success condition is NOT met, do nothing extra. The job will run again on schedule.')
631+
parts.push(
632+
`- If the success condition is met, take the required action, then call complete_job(jobId: "${jobRecord.id}") to stop the job.`
633+
)
634+
parts.push(
635+
'- If the success condition is NOT met, do nothing extra. The job will run again on schedule.'
636+
)
633637
}
634638

635639
parts.push('--- END JOB EXECUTION ---')
@@ -657,7 +661,9 @@ export async function executeJobInline(payload: JobExecutionPayload) {
657661
}
658662

659663
if (jobRecord.status === 'completed') {
660-
logger.info(`[${requestId}] Job already completed, skipping`, { scheduleId: payload.scheduleId })
664+
logger.info(`[${requestId}] Job already completed, skipping`, {
665+
scheduleId: payload.scheduleId,
666+
})
661667
return
662668
}
663669

apps/sim/hooks/queries/schedules.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ export function useDisableSchedule() {
204204
const queryClient = useQueryClient()
205205

206206
return useMutation({
207-
mutationFn: async ({ scheduleId, workspaceId }: { scheduleId: string; workspaceId: string }) => {
207+
mutationFn: async ({
208+
scheduleId,
209+
workspaceId,
210+
}: {
211+
scheduleId: string
212+
workspaceId: string
213+
}) => {
208214
const response = await fetch(`/api/schedules/${scheduleId}`, {
209215
method: 'PUT',
210216
headers: { 'Content-Type': 'application/json' },
@@ -234,7 +240,13 @@ export function useDeleteSchedule() {
234240
const queryClient = useQueryClient()
235241

236242
return useMutation({
237-
mutationFn: async ({ scheduleId, workspaceId }: { scheduleId: string; workspaceId: string }) => {
243+
mutationFn: async ({
244+
scheduleId,
245+
workspaceId,
246+
}: {
247+
scheduleId: string
248+
workspaceId: string
249+
}) => {
238250
const response = await fetch(`/api/schedules/${scheduleId}`, {
239251
method: 'DELETE',
240252
})

apps/sim/lib/copilot/api.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ export async function sendStreamingMessage(
192192

193193
const userTimezone =
194194
requestBody.userTimezone ||
195-
(typeof Intl !== 'undefined'
196-
? Intl.DateTimeFormat().resolvedOptions().timeZone
197-
: undefined)
195+
(typeof Intl !== 'undefined' ? Intl.DateTimeFormat().resolvedOptions().timeZone : undefined)
198196

199197
const response = await fetch(COPILOT_CHAT_API_PATH, {
200198
method: 'POST',

apps/sim/lib/copilot/orchestrator/tool-executor/job-tools.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ import { copilotChats, workflowSchedule } from '@sim/db/schema'
33
import { createLogger } from '@sim/logger'
44
import { and, eq } from 'drizzle-orm'
55
import { v4 as uuidv4 } from 'uuid'
6-
import type { ToolCallResult } from '@/lib/copilot/orchestrator/types'
7-
import type { ExecutionContext } from '@/lib/copilot/orchestrator/types'
8-
import {
9-
parseCronToHumanReadable,
10-
validateCronExpression,
11-
} from '@/lib/workflows/schedules/utils'
6+
import type { ExecutionContext, ToolCallResult } from '@/lib/copilot/orchestrator/types'
7+
import { parseCronToHumanReadable, validateCronExpression } from '@/lib/workflows/schedules/utils'
128

139
const logger = createLogger('JobTools')
1410

@@ -98,7 +94,7 @@ export async function executeCreateJob(
9894
}
9995

10096
const parsed = new Date(timeStr)
101-
if (isNaN(parsed.getTime())) {
97+
if (Number.isNaN(parsed.getTime())) {
10298
return { success: false, error: `Invalid time value: ${time}` }
10399
}
104100

@@ -384,10 +380,7 @@ export async function executeManageJob(
384380
updates.maxRuns = args.maxRuns
385381
}
386382

387-
await db
388-
.update(workflowSchedule)
389-
.set(updates)
390-
.where(eq(workflowSchedule.id, args.jobId))
383+
await db.update(workflowSchedule).set(updates).where(eq(workflowSchedule.id, args.jobId))
391384

392385
logger.info('Job updated', { jobId: args.jobId, fields: Object.keys(updates) })
393386

@@ -429,9 +422,7 @@ export async function executeManageJob(
429422
return { success: false, error: `Job not found: ${args.jobId}` }
430423
}
431424

432-
await db
433-
.delete(workflowSchedule)
434-
.where(eq(workflowSchedule.id, args.jobId))
425+
await db.delete(workflowSchedule).where(eq(workflowSchedule.id, args.jobId))
435426

436427
logger.info('Job deleted', { jobId: args.jobId })
437428

@@ -473,9 +464,7 @@ export async function executeCompleteJob(
473464
sourceWorkspaceId: workflowSchedule.sourceWorkspaceId,
474465
})
475466
.from(workflowSchedule)
476-
.where(
477-
and(eq(workflowSchedule.id, jobId), eq(workflowSchedule.sourceType, 'job'))
478-
)
467+
.where(and(eq(workflowSchedule.id, jobId), eq(workflowSchedule.sourceType, 'job')))
479468
.limit(1)
480469

481470
if (!job) {

apps/sim/lib/copilot/tools/mcp/definitions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
413413
},
414414
maxRuns: {
415415
type: 'number',
416-
description:
417-
'Maximum number of executions before the job auto-completes. Safety limit.',
416+
description: 'Maximum number of executions before the job auto-completes. Safety limit.',
418417
},
419418
},
420419
required: ['title', 'prompt'],

apps/sim/lib/copilot/workspace-context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
userTableDefinitions,
77
userTableRows,
88
workflow,
9-
workspace,
109
workflowSchedule,
10+
workspace,
1111
} from '@sim/db/schema'
1212
import { createLogger } from '@sim/logger'
1313
import { and, count, desc, eq, isNull } from 'drizzle-orm'
@@ -145,7 +145,7 @@ export function buildWorkspaceMd(data: WorkspaceMdData): string {
145145
if (j.lifecycle !== 'persistent') line += ` [${j.lifecycle}]`
146146
if (j.cronExpression) line += `, cron: ${j.cronExpression}`
147147
if (j.sourceTaskName) line += `, task: ${j.sourceTaskName}`
148-
const promptPreview = j.prompt.length > 80 ? j.prompt.slice(0, 77) + '...' : j.prompt
148+
const promptPreview = j.prompt.length > 80 ? `${j.prompt.slice(0, 77)}...` : j.prompt
149149
line += `\n ${promptPreview}`
150150
return line
151151
})

0 commit comments

Comments
 (0)