Skip to content

Commit dd73d94

Browse files
committed
cleanup code
1 parent 18dfa39 commit dd73d94

10 files changed

Lines changed: 54 additions & 35 deletions

File tree

apps/sim/app/api/workflows/[id]/execute/route.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ export async function executeWorkflow(
102102
metadata,
103103
workflow,
104104
input,
105-
{},
106105
workflow.variables || {},
107106
streamConfig?.selectedOutputs || []
108107
)
@@ -517,7 +516,6 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
517516
metadata,
518517
workflow,
519518
processedInput,
520-
{},
521519
workflow.variables || {},
522520
selectedOutputs
523521
)
@@ -785,7 +783,6 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
785783
metadata,
786784
workflow,
787785
processedInput,
788-
{},
789786
workflow.variables || {},
790787
selectedOutputs
791788
)

apps/sim/background/schedule-execution.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ async function runWorkflowExecution({
208208

209209
const mergedStates = mergeSubblockState(blocks)
210210

211-
// Use workflow owner's personal env vars for scheduled executions
212-
const personalEnvUserId = workflowRecord.userId || actorUserId
211+
const personalEnvUserId = workflowRecord.userId
213212

214213
const { personalEncrypted, workspaceEncrypted } = await getPersonalAndWorkspaceEnv(
215214
personalEnvUserId,
@@ -253,7 +252,6 @@ async function runWorkflowExecution({
253252
metadata,
254253
workflowRecord,
255254
input,
256-
{},
257255
workflowRecord.variables || {},
258256
[]
259257
)

apps/sim/background/webhook-execution.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ async function executeWebhookJobInternal(
233233
metadata,
234234
workflow,
235235
airtableInput,
236-
{},
237236
workflowVariables,
238237
[]
239238
)
@@ -443,14 +442,7 @@ async function executeWebhookJobInternal(
443442
isClientSession: false,
444443
}
445444

446-
const snapshot = new ExecutionSnapshot(
447-
metadata,
448-
workflow,
449-
input || {},
450-
{},
451-
workflowVariables,
452-
[]
453-
)
445+
const snapshot = new ExecutionSnapshot(metadata, workflow, input || {}, workflowVariables, [])
454446

455447
const executionResult = await executeWorkflowCore({
456448
snapshot,

apps/sim/background/workflow-execution.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export async function executeWorkflowJob(payload: WorkflowExecutionPayload) {
8484
metadata,
8585
workflow,
8686
payload.input,
87-
{},
8887
workflow.variables || {},
8988
[]
9089
)

apps/sim/executor/execution/snapshot-serializer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ export function serializePauseSnapshot(
113113
executionMetadata,
114114
context.workflow,
115115
{},
116-
context.environmentVariables ?? {},
117116
context.workflowVariables ?? {},
118117
context.selectedOutputs ?? [],
119118
state

apps/sim/executor/execution/snapshot.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,20 @@ export class ExecutionSnapshot {
5959
public readonly metadata: ExecutionMetadata,
6060
public readonly workflow: any,
6161
public readonly input: any,
62-
public readonly environmentVariables: Record<string, string>,
6362
public readonly workflowVariables: Record<string, any>,
6463
public readonly selectedOutputs: string[] = [],
6564
public readonly state?: SerializableExecutionState
6665
) {}
6766

67+
get environmentVariables(): Record<string, string> {
68+
return {}
69+
}
70+
6871
toJSON(): string {
6972
return JSON.stringify({
7073
metadata: this.metadata,
7174
workflow: this.workflow,
7275
input: this.input,
73-
environmentVariables: this.environmentVariables,
7476
workflowVariables: this.workflowVariables,
7577
selectedOutputs: this.selectedOutputs,
7678
state: this.state,
@@ -83,7 +85,6 @@ export class ExecutionSnapshot {
8385
data.metadata,
8486
data.workflow,
8587
data.input,
86-
data.environmentVariables,
8788
data.workflowVariables,
8889
data.selectedOutputs,
8990
data.state

apps/sim/lib/workflows/executor/execution-core.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ export async function executeWorkflowCore(
9797
options: ExecuteWorkflowCoreOptions
9898
): Promise<ExecutionResult> {
9999
const { snapshot, callbacks, loggingSession, skipLogCreation } = options
100-
const { metadata, workflow, input, environmentVariables, workflowVariables, selectedOutputs } =
101-
snapshot
100+
const { metadata, workflow, input, workflowVariables, selectedOutputs } = snapshot
102101
const { requestId, workflowId, userId, triggerType, executionId, triggerBlockId, useDraftState } =
103102
metadata
104103
const { onBlockStart, onBlockComplete, onStream, onExecutorCreated } = callbacks
@@ -153,9 +152,7 @@ export async function executeWorkflowCore(
153152
const mergedStates = mergeSubblockState(blocks)
154153

155154
const personalEnvUserId =
156-
metadata.isClientSession && metadata.sessionUserId
157-
? metadata.sessionUserId
158-
: workflow.userId || userId
155+
metadata.isClientSession && metadata.sessionUserId ? metadata.sessionUserId : workflow.userId
159156

160157
const { personalEncrypted, workspaceEncrypted, personalDecrypted, workspaceDecrypted } =
161158
await getPersonalAndWorkspaceEnv(personalEnvUserId, providedWorkspaceId)

apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ export class PauseResumeManager {
649649
metadata,
650650
baseSnapshot.workflow,
651651
resumeInput ?? {},
652-
baseSnapshot.environmentVariables || {},
653652
baseSnapshot.workflowVariables || {},
654653
baseSnapshot.selectedOutputs || [],
655654
stateCopy

apps/sim/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@radix-ui/react-visually-hidden": "1.2.4",
6868
"@react-email/components": "^0.0.34",
6969
"@react-email/render": "2.0.0",
70-
"@trigger.dev/sdk": "4.0.4",
70+
"@trigger.dev/sdk": "4.1.2",
7171
"@types/three": "0.177.0",
7272
"better-auth": "1.3.12",
7373
"browser-image-compression": "^2.0.2",
@@ -135,7 +135,7 @@
135135
},
136136
"devDependencies": {
137137
"@testing-library/jest-dom": "^6.6.3",
138-
"@trigger.dev/build": "4.0.4",
138+
"@trigger.dev/build": "4.1.2",
139139
"@types/html-to-text": "9.0.4",
140140
"@types/js-yaml": "4.0.9",
141141
"@types/jsdom": "21.1.7",

0 commit comments

Comments
 (0)