Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
THardy98 committed Mar 10, 2025
1 parent 7e9971a commit 94fa3e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/workflow/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export type DefaultSignalHandler = (signalName: string, ...args: unknown[]) => v
/**
* A handler function accepting update calls for non-registered update names.
*/
export type DefaultUpdateHandler = (updateName: string, ...args: any[]) => Promise<any> | any;
export type DefaultUpdateHandler = (updateName: string, ...args: unknown[]) => Promise<unknown> | unknown;

/**
* A validation function capable of accepting the arguments for a given UpdateDefinition.
Expand Down
21 changes: 10 additions & 11 deletions packages/workflow/src/internals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,21 +671,20 @@ export class Activator implements ActivationHandler {
if (!protocolInstanceId) {
throw new TypeError('Missing activation update protocolInstanceId');
}
if (!this.updateHandlers.get(name) && !this.defaultUpdateHandler) {

let entry = this.updateHandlers.get(name);
if (entry === undefined && this.defaultUpdateHandler) {
entry = {
handler: this.defaultUpdateHandler.bind(name),
validator: undefined,
// Default to a warning policy.
unfinishedPolicy: HandlerUnfinishedPolicy.WARN_AND_ABANDON,
};
} else {
this.bufferedUpdates.push(activation);
return;
}

const entry = this.updateHandlers.get(name) ?? {
// Logically, this must be defined as we got passed the conditional above
// pushing to the buffer. But Typescript doesn't know that so we use a
// non-null assertion (!).
handler: (...args: any[]) => this.defaultUpdateHandler!(name, ...args),
validator: undefined,
// Default to a warning policy.
unfinishedPolicy: HandlerUnfinishedPolicy.WARN_AND_ABANDON,
};

const makeInput = (): UpdateInput => ({
updateId,
args: arrayFromPayloads(this.payloadConverter, activation.input),
Expand Down

0 comments on commit 94fa3e6

Please sign in to comment.