Skip to content

Commit eaf9aa6

Browse files
authored
Don't shadow globalThis (#649)
1 parent 6cd1a47 commit eaf9aa6

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.changeset/grumpy-apes-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@workflow/core": patch
3+
---
4+
5+
Don't shadow `globalThis`

packages/core/src/runtime/suspension-handler.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Span } from '@opentelemetry/api';
12
import { waitUntil } from '@vercel/functions';
23
import { WorkflowAPIError } from '@workflow/errors';
34
import type { World } from '@workflow/world';
@@ -11,7 +12,6 @@ import type { Serializable } from '../schemas.js';
1112
import { dehydrateStepArguments } from '../serialization.js';
1213
import * as Attribute from '../telemetry/semantic-conventions.js';
1314
import { serializeTraceCarrier } from '../telemetry.js';
14-
import type { Span } from '@opentelemetry/api';
1515
import { queueMessage } from './helpers.js';
1616

1717
export interface SuspensionHandlerParams {
@@ -31,7 +31,7 @@ interface ProcessHookParams {
3131
queueItem: HookInvocationQueueItem;
3232
world: World;
3333
runId: string;
34-
globalThis: typeof globalThis;
34+
global: typeof globalThis;
3535
}
3636

3737
/**
@@ -41,14 +41,14 @@ async function processHook({
4141
queueItem,
4242
world,
4343
runId,
44-
globalThis,
44+
global,
4545
}: ProcessHookParams): Promise<void> {
4646
try {
4747
// Create hook in database
4848
const hookMetadata =
4949
typeof queueItem.metadata === 'undefined'
5050
? undefined
51-
: dehydrateStepArguments(queueItem.metadata, globalThis);
51+
: dehydrateStepArguments(queueItem.metadata, global);
5252
await world.hooks.create(runId, {
5353
hookId: queueItem.correlationId,
5454
token: queueItem.token,
@@ -86,7 +86,7 @@ interface ProcessStepParams {
8686
runId: string;
8787
workflowName: string;
8888
workflowStartedAt: number;
89-
globalThis: typeof globalThis;
89+
global: typeof globalThis;
9090
}
9191

9292
/**
@@ -98,15 +98,15 @@ async function processStep({
9898
runId,
9999
workflowName,
100100
workflowStartedAt,
101-
globalThis,
101+
global,
102102
}: ProcessStepParams): Promise<void> {
103103
const ops: Promise<void>[] = [];
104104
const dehydratedInput = dehydrateStepArguments(
105105
{
106106
args: queueItem.args,
107107
closureVars: queueItem.closureVars,
108108
},
109-
globalThis
109+
global
110110
);
111111

112112
try {
@@ -226,7 +226,7 @@ export async function handleSuspension({
226226
queueItem,
227227
world,
228228
runId,
229-
globalThis: suspension.globalThis,
229+
global: suspension.globalThis,
230230
})
231231
)
232232
);
@@ -241,7 +241,7 @@ export async function handleSuspension({
241241
runId,
242242
workflowName,
243243
workflowStartedAt,
244-
globalThis: suspension.globalThis,
244+
global: suspension.globalThis,
245245
})
246246
)
247247
),

0 commit comments

Comments
 (0)