JSPM

@loopstack/hitl-confirm-example-workflow

0.23.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 19
    • Score
      100M100P100Q90969F
    • License MIT

    Example workflow that uses @loopstack/hitl's ConfirmUserWorkflow to present a markdown summary and branch on the user's confirm/deny decision

    Package Exports

    • @loopstack/hitl-confirm-example-workflow
    • @loopstack/hitl-confirm-example-workflow/src/__tests__/hitl-confirm-example.workflow.spec.ts
    • @loopstack/hitl-confirm-example-workflow/src/hitl-confirm-example.module.ts
    • @loopstack/hitl-confirm-example-workflow/src/hitl-confirm-example.workflow.ts
    • @loopstack/hitl-confirm-example-workflow/src/index.ts

    Readme


    title: HITL Confirm Example description: Example asking the user for yes/no confirmation using ConfirmUserWorkflow as a sub-workflow, branching on confirmed/denied outcome

    @loopstack/hitl-confirm-example-workflow

    Demonstrates how to ask the user for a yes/no confirmation from inside a workflow using the ConfirmUserWorkflow from @loopstack/hitl and branch on the decision.

    By using this example you'll get...

    • A parent workflow that launches ConfirmUserWorkflow as a sub-workflow
    • Two different outcome branches for the confirmed / denied paths
    • A ConfirmUserDocument rendered in the UI while the workflow is paused

    Installation

    npm install @loopstack/hitl-confirm-example-workflow

    The package depends on @loopstack/hitl.

    Then register the module in your app:

    import { StudioApp } from '@loopstack/common';
    import { HitlConfirmExampleModule, HitlConfirmExampleWorkflow } from '@loopstack/hitl-confirm-example-workflow';
    
    @StudioApp({
      title: 'HITL Confirm Example',
      workflows: [HitlConfirmExampleWorkflow],
    })
    @Module({
      imports: [HitlConfirmExampleModule],
    })
    export class MyAppModule {}

    How It Works

    1. The workflow starts and calls ConfirmUserWorkflow.run({ markdown }) as a sub-workflow.
    2. The sub-workflow renders a ConfirmUserDocument and stops.
    3. When the user confirms or denies, the parent's callback fires with data.confirmed.
    4. The parent saves a MessageDocument indicating which branch was taken.

    Public API

    • HitlConfirmExampleModule
    • HitlConfirmExampleWorkflow

    Dependencies

    • @loopstack/common
    • @loopstack/hitl