Types
DiffResult
typescript
interface DiffResult {
meta: {
fromFile: string
toFile: string
timestamp: string // ISO 8601
hasChanges: boolean
}
summary: {
added: number
removed: number
modified: number
unchanged: number
}
changes: Change[]
}Change
A discriminated union of three change types:
typescript
type Change = AddedChange | RemovedChange | ModifiedChangeAddedChange
typescript
interface AddedChange {
type: 'added'
id: string
elementType: ElementType
parentId?: string
path: string // e.g. "decision[d1].decisionTable[dt1].rule[r3]"
element: DMNElement // full parsed element data
}RemovedChange
typescript
interface RemovedChange {
type: 'removed'
id: string
elementType: ElementType
parentId?: string
path: string
element: DMNElement
}ModifiedChange
typescript
interface ModifiedChange {
type: 'modified'
id: string
elementType: ElementType
parentId?: string
path: string
fieldChanges: FieldChange[]
}FieldChange
typescript
interface FieldChange {
field: string // e.g. "text", "@name", "inputExpression.@typeRef"
from: unknown
to: unknown
severity: 'breaking' | 'non-breaking' | 'cosmetic'
}ElementType
typescript
type ElementType =
| 'definitions' | 'decision' | 'inputData' | 'businessKnowledgeModel'
| 'knowledgeSource' | 'decisionService' | 'import' | 'itemDefinition'
| 'itemComponent' | 'functionItem' | 'elementCollection'
| 'performanceIndicator' | 'organizationUnit' | 'group'
| 'textAnnotation' | 'association' | 'decisionTable' | 'literalExpression'
| 'context' | 'contextEntry' | 'list' | 'relation' | 'informationItem'
| 'functionDefinition' | 'invocation' | 'conditional' | 'filter' | 'iterator'
| 'inputClause' | 'outputClause' | 'rule' | 'inputEntry' | 'outputEntry'
| 'annotationClause' | 'annotationEntry'
| 'informationRequirement' | 'knowledgeRequirement' | 'authorityRequirement'
| 'formalParameter' | 'binding' | 'importedValues'DiffToken
The token stream produced by tokenize(). A discriminated union — each variant carries exactly the data a formatter needs, nothing more.
typescript
type DiffToken =
| { type: 'header'; fromFile: string; toFile: string }
| { type: 'no-changes' }
| { type: 'breaking-summary'; count: number }
| { type: 'added'; elementType: ElementType; id: string; name: string; path: string; parentId?: string }
| { type: 'removed'; elementType: ElementType; id: string; name: string; path: string; parentId?: string }
| { type: 'modified'; elementType: ElementType; id: string; path: string; parentId?: string; fieldChanges: FieldChange[] }
| { type: 'summary'; added: number; removed: number; modified: number; unchanged: number }Token order (when hasChanges is true):
header? → breaking-summary? → (added | removed | modified)* → summaryWhen hasChanges is false:
header? → no-changesname on added/removed is the element's @name attribute, falling back to id if absent. modified tokens do not carry name — use id to identify the element.
DMNElement
The raw parsed element data, typed as:
typescript
type DMNElement = Record<string, unknown>Attributes are prefixed with @ (e.g. element['@name']). Text content of child <text> elements is at element.text.
