// `orders.fulfill` — DESCRIPTOR (browser-safe). // // Imports `workflow` from the `@voltro/workflow/define` subpath — the // browser-safe contract surface. The codegen value-imports this so the // web client can start the workflow over rpc; importing the executor's // server graph here would drag database/cluster into the browser bundle. import { workflow } from '@voltro/workflow/define' import { Schema } from 'effect' export const FulfillOrder = workflow({ name: 'orders.fulfill', payload: { orderId: Schema.String, tenantId: Schema.String, }, success: Schema.Struct({ orderId: Schema.String, outcome: Schema.Literal('shipped', 'rejected'), }), // Dedup concurrent starts for the same order — the `order.placed` // trigger could (after a crash + replay) fan out twice; the same key // collapses them to one run. idempotencyKey: ({ orderId }) => `fulfill:${orderId}`, })