Add human role decision nodes
This commit is contained in:
+16
-8
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { LGraph, LGraphCanvas, LiteGraph } from 'litegraph.js'
|
||||
import { cloneCapabilities, demoLandscape, SYSTEM_PRESETS, systemFromPreset, type CapabilityModel, type ConnectionModel, type LandscapeModel, type ScenarioModel, type SystemModel, type SystemPreset, uid, validateLandscape } from './model'
|
||||
import { cloneCapabilities, demoLandscape, SYSTEM_PRESETS, systemFromPreset, type CapabilityModel, type ConnectionModel, type LandscapeModel, type ScenarioModel, type ScenarioStep, type SystemModel, type SystemPreset, uid, validateLandscape } from './model'
|
||||
|
||||
const STORAGE_KEY = 'dumas-system-landscape-v1'
|
||||
const PRESET_STORAGE_KEY = 'dumas-system-presets-v1'
|
||||
@@ -31,6 +31,9 @@ const selectedCapabilityIds = ref<string[]>([])
|
||||
const presentationMode = ref(false)
|
||||
const failureState = ref<'none' | 'rejected' | 'timeout'>('none')
|
||||
const retryAttempts = ref<Record<string, number>>({})
|
||||
const pendingDecision = ref<ScenarioStep['humanDecision'] | null>(null)
|
||||
const runtimeConnectionIds = ref<string[]>([])
|
||||
const runtimePayload = ref('')
|
||||
type TransferKind = 'received' | 'sent' | 'stored'
|
||||
interface TransferChange { key: string; status: 'added' | 'removed' | 'changed' | 'same'; incoming?: unknown; outgoing?: unknown }
|
||||
interface TransferRecord { id: string; kind: TransferKind; scenarioName: string; stepNumber: number; stepExplanation: string; senderId: string; destinationId: string; payload: string; incoming: string; outgoing: string; changes: TransferChange[]; timestamp: string }
|
||||
@@ -45,7 +48,7 @@ const selectedSystem = computed(() => landscape.value.systems.find((item) => ite
|
||||
const selectedConnection = computed(() => landscape.value.connections.find((item) => item.id === selectedConnectionId.value))
|
||||
const selectedScenario = computed(() => landscape.value.scenarios.find((item) => item.id === selectedScenarioId.value))
|
||||
const currentStep = computed(() => selectedScenario.value?.steps[stepIndex.value])
|
||||
const currentConnections = computed(() => currentStep.value?.connectionIds.map((id) => landscape.value.connections.find((item) => item.id === id)).filter(Boolean) as ConnectionModel[] || [])
|
||||
const currentConnections = computed(() => { const ids = runtimeConnectionIds.value.length ? runtimeConnectionIds.value : currentStep.value?.connectionIds || []; return ids.map((id) => landscape.value.connections.find((item) => item.id === id)).filter(Boolean) as ConnectionModel[] })
|
||||
const isRunning = computed(() => playing.value || stepIndex.value >= 0)
|
||||
|
||||
function persist() { localStorage.setItem(STORAGE_KEY, JSON.stringify(landscape.value)) }
|
||||
@@ -88,7 +91,7 @@ function addStep() {
|
||||
}
|
||||
function deleteStep(index: number) { selectedScenario.value?.steps.splice(index, 1); persist() }
|
||||
|
||||
function resetPlayback() { playing.value = false; stepIndex.value = -1; packetProgress.value = 0; eventLog.value = []; transferHistory.value = []; failureState.value = 'none'; retryAttempts.value = {}; stopAnimation() }
|
||||
function resetPlayback() { playing.value = false; stepIndex.value = -1; packetProgress.value = 0; eventLog.value = []; transferHistory.value = []; failureState.value = 'none'; retryAttempts.value = {}; pendingDecision.value = null; runtimeConnectionIds.value = []; runtimePayload.value = ''; stopAnimation() }
|
||||
function startScenario(systemId?: string) {
|
||||
if (systemId) {
|
||||
const candidate = landscape.value.scenarios.find((scenario) => scenario.startSystemId === systemId)
|
||||
@@ -100,20 +103,23 @@ function advanceStep() {
|
||||
if (!selectedScenario.value || stepIndex.value + 1 >= selectedScenario.value.steps.length) { playing.value = false; return }
|
||||
stepIndex.value += 1; packetProgress.value = 0
|
||||
const step = selectedScenario.value.steps[stepIndex.value]
|
||||
runtimeConnectionIds.value = []
|
||||
runtimePayload.value = ''
|
||||
if (step.humanDecision) { pendingDecision.value = structuredClone(step.humanDecision); playing.value = false; eventLog.value.unshift(`${new Date().toLocaleTimeString()} · Waiting for ${systemName(step.humanDecision.roleSystemId)} decision`); drawPackets(); return }
|
||||
recordTransfers(step)
|
||||
failureState.value = step.outcome && step.outcome !== 'success' ? step.outcome : 'none'
|
||||
if (failureState.value !== 'none') eventLog.value.unshift(`${new Date().toLocaleTimeString()} · ${step.outcome === 'timeout' ? 'TIMEOUT' : 'REJECTED'} · ${step.explanation}`)
|
||||
eventLog.value.unshift(`${new Date().toLocaleTimeString()} · ${step.explanation}`)
|
||||
animatePacket(step.delayMs / speed.value)
|
||||
}
|
||||
function recordTransfers(step: ScenarioModel['steps'][number]) {
|
||||
function recordTransfers(step: ScenarioModel['steps'][number], selectedConnectionIds = step.connectionIds, selectedPayload = '') {
|
||||
if (!selectedScenario.value) return
|
||||
const now = new Date().toLocaleTimeString()
|
||||
for (const connectionId of step.connectionIds) {
|
||||
for (const connectionId of selectedConnectionIds) {
|
||||
const connection = landscape.value.connections.find((item) => item.id === connectionId)
|
||||
if (!connection) continue
|
||||
const incoming = connection.transformation?.incoming || step.payload || connection.payload
|
||||
const outgoing = connection.transformation?.outgoing || incoming
|
||||
const incoming = connection.transformation?.incoming || selectedPayload || step.payload || connection.payload
|
||||
const outgoing = selectedPayload || connection.transformation?.outgoing || incoming
|
||||
const changes = comparePayloads(incoming, outgoing)
|
||||
const payload = outgoing
|
||||
transferHistory.value.push(
|
||||
@@ -121,6 +127,7 @@ function recordTransfers(step: ScenarioModel['steps'][number]) {
|
||||
)
|
||||
}
|
||||
}
|
||||
function chooseHumanAction(action: NonNullable<ScenarioStep['humanDecision']>['actions'][number]) { if (!selectedScenario.value || !pendingDecision.value) return; const step = selectedScenario.value.steps[stepIndex.value]; let payload = action.payload; try { const parsed = JSON.parse(action.payload); Object.assign(parsed, pendingDecision.value.editableFields); payload = JSON.stringify(parsed) } catch { /* Keep non-JSON simulated payloads unchanged. */ } runtimeConnectionIds.value = [action.connectionId]; runtimePayload.value = payload; pendingDecision.value = null; playing.value = true; failureState.value = 'none'; eventLog.value.unshift(`${new Date().toLocaleTimeString()} · ${systemName(step.humanDecision!.roleSystemId)} chose ${action.name}`); recordTransfers(step, [action.connectionId], payload); animatePacket(step.delayMs / speed.value) }
|
||||
function comparePayloads(incoming: string, outgoing: string): TransferChange[] { try { const before = JSON.parse(incoming); const after = JSON.parse(outgoing); const keys = new Set([...Object.keys(before || {}), ...Object.keys(after || {})]); return [...keys].sort().map((key) => ({ key, status: !(key in before) ? 'added' : !(key in after) ? 'removed' : JSON.stringify(before[key]) !== JSON.stringify(after[key]) ? 'changed' : 'same', incoming: before[key], outgoing: after[key] })) } catch { return [] } }
|
||||
function enableTransformation() { if (selectedConnection.value && !selectedConnection.value.transformation) selectedConnection.value.transformation = { incoming: selectedConnection.value.payload, outgoing: selectedConnection.value.payload, note: '' } }
|
||||
function recordsForSelectedSystem(kind: TransferKind) { if (!selectedSystem.value) return []; return transferHistory.value.filter((record) => kind === 'sent' ? record.senderId === selectedSystem.value?.id : record.destinationId === selectedSystem.value?.id) }
|
||||
@@ -146,7 +153,7 @@ function togglePlay() { if (!selectedScenario.value) return; if (playing.value)
|
||||
|
||||
function buildNode(system: SystemModel) {
|
||||
const node = LiteGraph.createNode('Landscape/System')
|
||||
node.id = system.id; node.title = system.name; node.pos = [...system.position]; node.color = system.color; node.bgcolor = '#111827'; node.size = [190, 100]
|
||||
node.id = system.id; node.title = system.category === 'human' ? `ROLE · ${system.name}` : system.name; node.pos = [...system.position]; node.color = system.color; node.bgcolor = system.category === 'human' ? '#38213b' : '#111827'; node.shape = system.category === 'human' ? LiteGraph.ROUND : LiteGraph.BOX; node.size = [190, 100]
|
||||
node.addInput('in', 'SYSTEM'); node.addOutput('out', 'SYSTEM'); node.systemId = system.id; node.showActions = false
|
||||
for (const capability of system.capabilities) { for (const input of capability.inputs) node.addInput(`${capability.id}:${input.id}`, input.name); for (const output of capability.outputs) node.addOutput(`${capability.id}:${output.id}`, output.name) }
|
||||
if (system.capabilities.length) node.addWidget('button', 'Actions ▸', null, () => { node.showActions = !node.showActions; node.widgets[0].name = node.showActions ? 'Actions ▾' : 'Actions ▸'; graphCanvas?.draw(true, true) })
|
||||
@@ -232,5 +239,6 @@ onUnmounted(stopAnimation)
|
||||
<section class="navigation-panel panel"><div class="nav-fields"><label>Search systems<input v-model="searchQuery" placeholder="Name or description" /></label><label>Category<select v-model="categoryFilter"><option value="all">All categories</option><option value="application">Application</option><option value="service">Service</option><option value="data">Data</option><option value="external">External</option></select></label><label>Data type<select v-model="dataTypeFilter"><option value="all">All data types</option><option>JSON</option><option>Form data</option><option>CSV</option><option>Event</option><option>Binary</option></select></label><button class="ghost" @click="fitToScreen">Fit to screen</button></div><div class="minimap-wrap"><span class="eyebrow">MINIMAP</span><canvas ref="minimapEl" width="220" height="120"></canvas></div></section>
|
||||
<section v-if="selectedScenario" class="scenario-builder panel"><div><span class="eyebrow">EASY SCENARIO BUILDER</span><strong>Start with an action, then build the journey</strong><p class="muted">Connections remain reusable destinations; parallel branches share one step.</p></div><label>Starting system<select v-model="selectedScenario.startSystemId"><option v-for="system in landscape.systems" :key="system.id" :value="system.id">{{ system.name }}</option></select></label><label>Starting action<select v-model="selectedScenario.startActionId"><option value="">Choose an action</option><option v-for="action in actionsForSystem(selectedScenario.startSystemId)" :key="action.id" :value="action.id">{{ action.capabilityName }} · {{ action.name }}</option></select></label><div class="builder-actions"><button class="ghost" @click="addJourneyStep">+ Sequential step</button><button class="ghost" @click="addParallelBranch">+ Parallel branch</button></div><div class="builder-steps"><article v-for="(step, index) in selectedScenario.steps" :key="step.id"><b>{{ index + 1 }}</b><span>{{ step.explanation }}</span><input v-model="step.payload" class="code" title="Editable sample payload" /></article></div></section>
|
||||
<section class="demo-guide panel"><span class="eyebrow">MONDAY DEMO / START HERE</span><strong>Try a journey in three clicks</strong><ol><li>Open <b>Scenarios</b> and choose Contact enquiry, Sample request or Commercial order.</li><li>Press <b>▶</b> in the journey list, then use pause, next or speed controls.</li><li>Try <b>Order retry and recovery</b> to see a rejection, automatic retry and recovery message. Select a system to inspect its data history.</li></ol></section>
|
||||
<section v-if="pendingDecision" class="decision-panel panel"><div><span class="eyebrow">HUMAN DECISION REQUIRED</span><strong>{{ systemName(pendingDecision.roleSystemId) }}</strong><p>{{ pendingDecision.task }}</p></div><div class="decision-data"><div><b>Information received</b><pre>{{ pendingDecision.receivedData }}</pre></div><div><b>Editable fields</b><label v-for="(_, key) in pendingDecision.editableFields" :key="key">{{ key }}<input v-model="pendingDecision.editableFields[key]" /></label></div></div><div class="decision-actions"><button v-for="action in pendingDecision.actions" :key="action.id" class="decision-button" :class="action.name.toLowerCase()" :title="action.description" @click="chooseHumanAction(action)"><b>{{ action.name }}</b><small>{{ action.description }}</small></button></div></section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.decision-panel{padding:16px;border-color:#a64d83;background:linear-gradient(120deg,rgba(91,35,82,.8),rgba(17,23,36,.92))}.decision-panel strong{display:block;color:#ffe7f5;font-size:16px;margin-top:4px}.decision-panel p{color:#e2b5d0;font-size:12px;margin:7px 0}.decision-data{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:12px 0}.decision-data b{color:#f0c2dc;font-size:10px;text-transform:uppercase}.decision-data pre{white-space:pre-wrap;background:#24172b;border:1px solid #633659;color:#ffd2e8;padding:9px;border-radius:5px;font-size:10px}.decision-data label{display:block;color:#cda6c0;font-size:10px;margin:6px 0}.decision-data input{display:block;width:100%;background:#24172b;border:1px solid #633659;color:#ffe6f4;border-radius:4px;padding:7px;margin-top:4px}.decision-actions{display:flex;gap:8px}.decision-button{flex:1;text-align:left;border:1px solid #633659;background:#24172b;color:#ffe6f4;border-radius:6px;padding:9px}.decision-button:hover{border-color:#f06ca9;background:#4b2545}.decision-button b,.decision-button small{display:block}.decision-button small{color:#cda6c0;font-size:10px;margin-top:4px}.decision-button.reject{border-color:#8f4159}.presentation .decision-panel{display:block}@media(max-width:800px){.decision-data{grid-template-columns:1fr}.decision-actions{flex-wrap:wrap}.decision-button{min-width:45%}}
|
||||
@@ -9,6 +9,7 @@ import './connection.css'
|
||||
import './navigation.css'
|
||||
import './scenario-builder.css'
|
||||
import './demo.css'
|
||||
import './human.css'
|
||||
import './style.css'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { demoLandscape, getPreset, systemFromPreset, validateLandscape } from '.
|
||||
describe('landscape model', () => {
|
||||
it('provides the editable demo landscape', () => {
|
||||
const landscape = demoLandscape()
|
||||
expect(landscape.systems).toHaveLength(5)
|
||||
expect(landscape.systems).toHaveLength(6)
|
||||
expect(landscape.scenarios.map((scenario) => scenario.name)).toEqual(expect.arrayContaining(['Place order', 'Register customer', 'Contact enquiry', 'Sample request', 'Commercial order', 'Order retry and recovery']))
|
||||
expect(landscape.scenarios[0].steps[2].connectionIds).toHaveLength(2)
|
||||
})
|
||||
|
||||
+18
-3
@@ -2,6 +2,8 @@ export type SystemCategory = 'application' | 'service' | 'data' | 'human' | 'ext
|
||||
|
||||
export interface PortModel { id: string; name: string; description: string }
|
||||
export interface ActionModel { id: string; name: string; description: string; payload: string }
|
||||
export interface HumanActionModel extends ActionModel { connectionId: string }
|
||||
export interface HumanDecisionModel { roleSystemId: string; task: string; receivedData: string; editableFields: Record<string, string>; actions: HumanActionModel[] }
|
||||
export interface CapabilityModel { id: string; name: string; description: string; inputs: PortModel[]; outputs: PortModel[]; actions: ActionModel[]; payload: string }
|
||||
export interface SystemPreset { id: string; name: string; description: string; category: SystemCategory; color: string; capabilities: CapabilityModel[] }
|
||||
|
||||
@@ -39,6 +41,7 @@ export interface ScenarioStep {
|
||||
outcome?: 'success' | 'rejected' | 'timeout'
|
||||
retryStepId?: string
|
||||
recoveryStepId?: string
|
||||
humanDecision?: HumanDecisionModel
|
||||
}
|
||||
|
||||
export interface ScenarioModel {
|
||||
@@ -75,7 +78,8 @@ export const SYSTEM_PRESETS: SystemPreset[] = [
|
||||
{ id: 'erp', name: 'ERP', description: 'Back-office fulfilment and inventory management.', category: 'data', color: '#f2a65a', capabilities: [capability('orders', 'Order management', 'Create and progress fulfilment orders.', [port('order-request', 'Order request', 'An order to fulfil.')], [port('order-status', 'Order status', 'Current fulfilment status.')], [action('create-order', 'Create order', 'Create a fictional ERP order.', '{"orderId":"ord_1042","status":"new"}')], '{"orderId":"ord_1042","status":"new"}'), capability('inventory', 'Inventory', 'Check and reserve fictional stock.', [port('stock-check', 'Stock check', 'A product stock request.')], [port('stock-result', 'Stock result', 'Available stock information.')], [action('reserve-stock', 'Reserve stock', 'Reserve fictional stock.', '{"sku":"sample-blue","available":24,"reserved":1}')], '{"sku":"sample-blue","available":24}') ]},
|
||||
{ id: 'email', name: 'Email Platform', description: 'Transactional and lifecycle messaging.', category: 'external', color: '#4aa3df', capabilities: [capability('transactional-email', 'Transactional email', 'Send a message from a template.', [port('email-request', 'Email request', 'A message request.')], [port('delivery-event', 'Delivery event', 'Delivery status.')], [action('send-email', 'Send email', 'Send a fictional transactional email.', '{"messageId":"msg_44","template":"order-confirmation","to":"sam@example.test"}')], '{"template":"order-confirmation","to":"sam@example.test"}'), capability('campaigns', 'Campaigns', 'Send lifecycle or campaign messages.', [port('campaign-request', 'Campaign request', 'A campaign message request.')], [port('campaign-event', 'Campaign event', 'Campaign delivery status.')], [action('send-campaign', 'Send campaign', 'Send a fictional campaign message.', '{"campaign":"welcome","customerId":"cus_89"}')], '{"campaign":"welcome","customerId":"cus_89"}') ]},
|
||||
{ id: 'analytics', name: 'Analytics', description: 'Collect and report product and business events.', category: 'data', color: '#8f7cf2', capabilities: [capability('event-collection', 'Event collection', 'Accept events from connected systems.', [port('event', 'Event', 'A product or business event.')], [port('accepted-event', 'Accepted event', 'An accepted analytics event.')], [action('capture-event', 'Capture event', 'Capture a fictional analytics event.', '{"event":"checkout_completed","visitorId":"vis_204"}')], '{"event":"checkout_completed","visitorId":"vis_204"}'), capability('reporting', 'Reporting', 'Produce a simple report payload.', [port('report-query', 'Report query', 'A report query.')], [port('report', 'Report', 'A generated report.')], [action('run-report', 'Run report', 'Generate a fictional report.', '{"report":"weekly-orders","orders":42}')], '{"report":"weekly-orders","orders":42}') ]},
|
||||
{ id: 'api', name: 'API', description: 'Orchestrate requests between applications and services.', category: 'service', color: '#26c6a6', capabilities: [capability('http-api', 'HTTP API', 'Receive and route application requests.', [port('request', 'Request', 'An inbound API request.')], [port('response', 'Response', 'A response returned to the caller.')], [action('handle-request', 'Handle request', 'Handle a fictional API request.', '{"requestId":"req_1001","status":"accepted"}')], '{"requestId":"req_1001","status":"accepted"}'), capability('webhooks', 'Webhooks', 'Send outbound event notifications.', [port('event', 'Event', 'An event to publish.')], [port('webhook', 'Webhook', 'An outbound webhook delivery.')], [action('send-webhook', 'Send webhook', 'Send a fictional webhook.', '{"event":"order.created","id":"ord_1042"}')], '{"event":"order.created","id":"ord_1042"}') ]}
|
||||
{ id: 'api', name: 'API', description: 'Orchestrate requests between applications and services.', category: 'service', color: '#26c6a6', capabilities: [capability('http-api', 'HTTP API', 'Receive and route application requests.', [port('request', 'Request', 'An inbound API request.')], [port('response', 'Response', 'A response returned to the caller.')], [action('handle-request', 'Handle request', 'Handle a fictional API request.', '{"requestId":"req_1001","status":"accepted"}')], '{"requestId":"req_1001","status":"accepted"}'), capability('webhooks', 'Webhooks', 'Send outbound event notifications.', [port('event', 'Event', 'An event to publish.')], [port('webhook', 'Webhook', 'An outbound webhook delivery.')], [action('send-webhook', 'Send webhook', 'Send a fictional webhook.', '{"event":"order.created","id":"ord_1042"}')], '{"event":"order.created","id":"ord_1042"}') ]},
|
||||
{ id: 'sales-review-role', name: 'Sales review', description: 'A sales team role that reviews sample requests.', category: 'human', color: '#f06ca9', capabilities: [capability('sales-review', 'Sales review', 'Review a sample request and choose the next action.', [port('review-request', 'Review request', 'Information waiting for a sales decision.')], [port('decision', 'Decision', 'The selected sales action.')], [action('approve', 'Approve', 'Approve a request for fulfilment.', '{"decision":"approved","reviewerRole":"sales"}'), action('reject', 'Reject', 'Reject a request and notify the customer.', '{"decision":"rejected","reviewerRole":"sales"}'), action('edit', 'Edit', 'Edit the request before forwarding.', '{"decision":"edited","reviewerRole":"sales"}'), action('forward', 'Forward', 'Forward the request for another review.', '{"decision":"forwarded","reviewerRole":"sales"}')], '{"decision":"pending","reviewerRole":"sales"}') ]}
|
||||
]
|
||||
|
||||
export function getPreset(id: string) { return SYSTEM_PRESETS.find((preset) => preset.id === id) }
|
||||
@@ -89,7 +93,8 @@ export const demoLandscape = (): LandscapeModel => ({
|
||||
{ id: 'api', name: 'API', description: 'Order and customer orchestration service.', category: 'service', color: '#26c6a6', position: [360, 180], presetId: 'api', capabilities: cloneCapabilities(getPreset('api')!.capabilities) },
|
||||
{ id: 'erp', name: 'ERP', description: 'Back-office order fulfilment and inventory system.', category: 'data', color: '#f2a65a', position: [650, 100], presetId: 'erp', capabilities: cloneCapabilities(getPreset('erp')!.capabilities) },
|
||||
{ id: 'crm', name: 'CRM', description: 'Customer profile and lifecycle management.', category: 'data', color: '#dd6bca', position: [650, 290], presetId: 'crm', capabilities: cloneCapabilities(getPreset('crm')!.capabilities) },
|
||||
{ id: 'email', name: 'Email Platform', description: 'Transactional and lifecycle messaging.', category: 'external', color: '#4aa3df', position: [930, 290], presetId: 'email', capabilities: cloneCapabilities(getPreset('email')!.capabilities) }
|
||||
{ id: 'email', name: 'Email Platform', description: 'Transactional and lifecycle messaging.', category: 'external', color: '#4aa3df', position: [930, 290], presetId: 'email', capabilities: cloneCapabilities(getPreset('email')!.capabilities) },
|
||||
{ id: 'sales-review', name: 'Sales review', description: 'Sales team role that reviews sample requests.', category: 'human', color: '#f06ca9', position: [650, 480], presetId: 'sales-review-role', capabilities: cloneCapabilities(getPreset('sales-review-role')!.capabilities) }
|
||||
],
|
||||
connections: [
|
||||
{ id: 'website-api', sourceId: 'website', targetId: 'api', label: 'Order request', description: 'Website submits a new order to the API.', payload: '{"orderId":"ord_1042","total":129.5}' },
|
||||
@@ -104,7 +109,10 @@ export const demoLandscape = (): LandscapeModel => ({
|
||||
{ id: 'website-api-sample', sourceId: 'website', targetId: 'api', label: 'Sample request', description: 'Website sends a product sample request.', payload: '{"orderId":"smp_1042","sku":"sample-blue"}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'immediate', showCableLabel: true },
|
||||
{ id: 'api-erp-sample', sourceId: 'api', targetId: 'erp', label: 'Reserve sample', description: 'API asks ERP to reserve sample stock.', payload: '{"sku":"sample-blue","quantity":1}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'scheduled', showCableLabel: true },
|
||||
{ id: 'website-api-commercial', sourceId: 'website', targetId: 'api', label: 'Commercial order', description: 'Website submits a commercial order.', payload: '{"orderId":"ord_2048","total":249.0}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'immediate', showCableLabel: true },
|
||||
{ id: 'api-erp-commercial', sourceId: 'api', targetId: 'erp', label: 'Fulfil commercial order', description: 'API creates the commercial order in ERP.', payload: '{"orderId":"ord_2048","status":"new"}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'immediate', showCableLabel: true }
|
||||
{ id: 'api-erp-commercial', sourceId: 'api', targetId: 'erp', label: 'Fulfil commercial order', description: 'API creates the commercial order in ERP.', payload: '{"orderId":"ord_2048","status":"new"}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'immediate', showCableLabel: true },
|
||||
{ id: 'website-sales-review', sourceId: 'website', targetId: 'sales-review', label: 'Sample review', description: 'Website sends a sample request to Sales.', payload: '{"orderId":"smp_1042","sku":"sample-blue"}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'manual', showCableLabel: true },
|
||||
{ id: 'sales-erp', sourceId: 'sales-review', targetId: 'erp', label: 'Approved sample', description: 'Sales approves the sample for ERP fulfilment.', payload: '{"orderId":"smp_1042","decision":"approved"}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'manual', showCableLabel: true },
|
||||
{ id: 'sales-email', sourceId: 'sales-review', targetId: 'email', label: 'Rejected sample notice', description: 'Sales rejection triggers a customer notification.', payload: '{"template":"sample-rejected","orderId":"smp_1042"}', protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'manual', showCableLabel: true }
|
||||
],
|
||||
scenarios: [
|
||||
{
|
||||
@@ -152,6 +160,13 @@ export const demoLandscape = (): LandscapeModel => ({
|
||||
{ id: 'retry-3', connectionIds: ['api-erp-commercial'], explanation: 'The API retries the fulfilment request after refreshing stock.', payload: '{"orderId":"ord_3001","status":"retry"}', delayMs: 900, outcome: 'success' },
|
||||
{ id: 'retry-4', connectionIds: ['api-email'], explanation: 'The API sends a recovery confirmation to the customer.', payload: '{"template":"order-retry-recovered","orderId":"ord_3001"}', delayMs: 700, outcome: 'success' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'sample-sales-review', name: 'Sample request with Sales review', description: 'A human role decides whether a sample reaches ERP or the customer receives a rejection notice.', startSystemId: 'website', startActionId: 'place-sample',
|
||||
steps: [
|
||||
{ id: 'human-sample-1', connectionIds: ['website-sales-review'], explanation: 'The website sends a sample request to the Sales review role.', payload: '{"orderId":"smp_1042","sku":"sample-blue"}', delayMs: 800, outcome: 'success' },
|
||||
{ id: 'human-sample-decision', connectionIds: [], explanation: 'Sales reviews the sample request and chooses what happens next.', payload: '{"decision":"pending","orderId":"smp_1042"}', delayMs: 500, humanDecision: { roleSystemId: 'sales-review', task: 'Review the sample request and decide whether Sales should approve fulfilment or notify the customer that the request cannot proceed.', receivedData: '{"orderId":"smp_1042","sku":"sample-blue","customer":"sam@example.test"}', editableFields: { customerNote: 'Please confirm the colour before fulfilment.' }, actions: [{ id: 'approve', name: 'Approve', description: 'Send the approved sample to ERP.', payload: '{"orderId":"smp_1042","decision":"approved"}', connectionId: 'sales-erp' }, { id: 'reject', name: 'Reject', description: 'Notify the customer that the sample was rejected.', payload: '{"orderId":"smp_1042","decision":"rejected"}', connectionId: 'sales-email' }, { id: 'edit', name: 'Edit', description: 'Edit the request and forward it to ERP.', payload: '{"orderId":"smp_1042","decision":"edited","note":"Please confirm the colour"}', connectionId: 'sales-erp' }, { id: 'forward', name: 'Forward', description: 'Forward the request to ERP for another review.', payload: '{"orderId":"smp_1042","decision":"forwarded"}', connectionId: 'sales-erp' }] } }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user