OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Mark a deal as won.
Goal
Close a deal as successful.
Context
Deal closing flow.
Emitted Events
•
`deal.won` (v1.0.0)
Source Definition
import {
defineCommand,
defineQuery,
} from '@lssm-tech/lib.contracts-spec/operations';
import {
CreateDealInputModel,
DealLostPayloadModel,
DealModel,
DealMovedPayloadModel,
DealWonPayloadModel,
ListDealsInputModel,
ListDealsOutputModel,
LoseDealInputModel,
MoveDealInputModel,
WinDealInputModel,
} from './deal.schema';
export const WinDealContract = defineCommand({
meta: {
key: 'crm.deal.win',
version: '1.0.0',
stability: 'stable',
owners: ['@example.crm-pipeline'],
tags: ['crm', 'deal', 'won'],
description: 'Mark a deal as won.',
goal: 'Close a deal as successful.',
context: 'Deal closing flow.',
},
io: {
input: WinDealInputModel,
output: DealModel,
},
policy: {
auth: 'user',
},
sideEffects: {
emits: [
{
key: 'deal.won',
version: '1.0.0',
when: 'Deal is won',
payload: DealWonPayloadModel,
},
],
audit: ['deal.won'],
},
acceptance: {
scenarios: [
{
key: 'win-deal-happy-path',
given: ['Deal is open'],
when: ['User marks deal as won'],
then: ['Deal status becomes WON', 'DealWon event is emitted'],
},
],
examples: [
{
key: 'mark-won',
input: {
dealId: 'deal-789',
actualValue: 52000,
note: 'Signed contract attached',
},
output: {
id: 'deal-789',
status: 'won',
closedAt: '2025-01-20T14:30:00Z',
},
},
],
},
});