Skip to content

Commit ffd5385

Browse files
waleedlatif1claude
andcommitted
improvement(processing): replace as any casts with proper types in logging
- logger.ts: cast JSONB cost column to `WorkflowExecutionLog['cost']` instead of `any` in both `completeWorkflowExecution` and `getWorkflowExecution` - logger.ts: replace `(orgUsageBefore as any)?.toString?.()` with `String()` since COALESCE guarantees a non-null SQL aggregate value - logging-session.ts: cast JSONB cost to `AccumulatedCost` (the local interface) instead of `any` in `loadExistingCost` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eba3358 commit ffd5385

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

apps/sim/lib/logs/execution/logger.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
359359
.leftJoin(userStats, eq(member.userId, userStats.userId))
360360
.where(eq(member.organizationId, sub.referenceId))
361361
.limit(1)
362-
const orgUsageBeforeNum = Number.parseFloat(
363-
(orgUsageBefore as any)?.toString?.() || '0'
364-
)
362+
const orgUsageBeforeNum = Number.parseFloat(String(orgUsageBefore ?? '0'))
365363

366364
await this.updateUserStats(
367365
updatedLog.workflowId,
@@ -433,7 +431,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
433431
endedAt: updatedLog.endedAt?.toISOString() || endedAt,
434432
totalDurationMs: updatedLog.totalDurationMs || totalDurationMs,
435433
executionData: updatedLog.executionData as WorkflowExecutionLog['executionData'],
436-
cost: updatedLog.cost as any,
434+
cost: updatedLog.cost as WorkflowExecutionLog['cost'],
437435
createdAt: updatedLog.createdAt.toISOString(),
438436
}
439437

@@ -467,7 +465,7 @@ export class ExecutionLogger implements IExecutionLoggerService {
467465
endedAt: workflowLog.endedAt?.toISOString() || workflowLog.startedAt.toISOString(),
468466
totalDurationMs: workflowLog.totalDurationMs || 0,
469467
executionData: workflowLog.executionData as WorkflowExecutionLog['executionData'],
470-
cost: workflowLog.cost as any,
468+
cost: workflowLog.cost as WorkflowExecutionLog['cost'],
471469
createdAt: workflowLog.createdAt.toISOString(),
472470
}
473471
}

apps/sim/lib/logs/execution/logging-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class LoggingSession {
186186
.limit(1)
187187

188188
if (existing?.cost) {
189-
const cost = existing.cost as any
189+
const cost = existing.cost as AccumulatedCost
190190
this.accumulatedCost = {
191191
total: cost.total || BASE_EXECUTION_CHARGE,
192192
input: cost.input || 0,

0 commit comments

Comments
 (0)