nestjs-temporal-core
    Preparing search index...

    Function UpdateMethod

    • Marks a method as an update handler for the workflow. Updates are synchronous-style requests that can both mutate workflow state and return a result to the caller, combining the strengths of Signals (can mutate state) and Queries (can return a result) into a single request/response operation.

      This decorator works in v8 isolated environments by registering update handlers at runtime without relying on dependency injection or external services.

      Parameters

      • OptionalupdateName: string

        Optional custom update name (defaults to method name)

      Returns MethodDecorator

      // In function-based workflow
      const incrementAndGetValueUpdate = wf.defineUpdate<number, [number]>('incrementAndGetValue');

      export async function counterWorkflow(initialValue: number): Promise<void> {
      let value = initialValue;

      wf.setHandler(incrementAndGetValueUpdate, (increment: number) => {
      value += increment;
      return value;
      });
      }
      @UpdateMethod('approveOrder')
      async handleApproval(approval: OrderApproval): Promise<OrderStatus> {
      this.approvals.push(approval);
      return this.currentStatus;
      }