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 lost.
Goal
Close a deal as unsuccessful.
Context
Deal closing flow.
Emitted Events
•
`deal.lost` (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 LoseDealContract = defineCommand({
meta: {
key: 'crm.deal.lose',
version: '1.0.0',
stability: 'stable',
owners: ['@example.crm-pipeline'],
tags: ['crm', 'deal', 'lost'],
description: 'Mark a deal as lost.',
goal: 'Close a deal as unsuccessful.',
context: 'Deal closing flow.',
},
io: {
input: LoseDealInputModel,
output: DealModel,
},
policy: {
auth: 'user',
},
sideEffects: {
emits: [
{
key: 'deal.lost',
version: '1.0.0',
when: 'Deal is lost',
payload: DealLostPayloadModel,
},
],
audit: ['deal.lost'],
},
acceptance: {
scenarios: [
{
key: 'lose-deal-happy-path',
given: ['Deal is open'],
when: ['User marks deal as lost'],
then: ['Deal status becomes LOST', 'DealLost event is emitted'],
},
],
examples: [
{
key: 'mark-lost',
input: {
dealId: 'deal-789',
reason: 'competitor',
note: 'Went with cheaper option',
},
output: {
id: 'deal-789',
status: 'lost',
closedAt: '2025-01-21T09:00:00Z',
},
},
],
},
});