Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/lineage

src/types.ts

75 lines · 1.3 KB · TypeScript
export type ChartMode = 'cumulative' | 'delta' | 'net'
export type FileKind = 'source' | 'tests' | 'docs'

export type RepoSettings = {
	owner: string
	repo: string
	branch: string
}

export type IngestedCommit = {
	sha: string
	committedAt: string
	message: string
	authorName: string
	htmlUrl: string
	parentSha: string | null
	filesTruncated: boolean
	skippedFiles: number
	countedFiles: number
}

export type BucketKey = {
	language: string
	kind: FileKind
}

export type BucketDelta = BucketKey & {
	additions: number
	deletions: number
}

export type Commentary = {
	id: string
	sha: string
	label: string
	narrative: string
	createdAt: string
}

export type SeriesPoint = {
	sha: string
	at: string
	message: string
	htmlUrl: string
	additions: number
	deletions: number
	net: number
	cumulative: number
	buckets: Array<{
		language: string
		kind: FileKind
		additions: number
		deletions: number
		net: number
		cumulative: number
	}>
}

export type SeriesPayload = {
	repo: RepoSettings & { htmlUrl: string }
	mode: ChartMode
	from: string | null
	to: string | null
	generatedAt: string
	commitCount: number
	languages: string[]
	kinds: FileKind[]
	points: SeriesPoint[]
	commentaries: Commentary[]
	ingest: {
		storedCommits: number
		newest: { sha: string; at: string } | null
		oldest: { sha: string; at: string } | null
	}
}