Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { AudiencePainsCount } from "./AudiencePainsCount.js";

export type AudiencePainStatsView = {
readonly audiencePainsCount: AudiencePainsCount;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AudiencePainsCount = number;
9 changes: 9 additions & 0 deletions src/application/context/project/stats/AudienceStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { PrimaryAudiences } from "./PrimaryAudiences.js";
import type { SecondaryAudiences } from "./SecondaryAudiences.js";
import type { TotalAudiences } from "./TotalAudiences.js";

export type AudienceStatsView = {
readonly totalAudiences: TotalAudiences;
readonly primaryAudiences: PrimaryAudiences;
readonly secondaryAudiences: SecondaryAudiences;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/ClosedGoalsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type ClosedGoalsCount = number;
5 changes: 5 additions & 0 deletions src/application/context/project/stats/ComponentStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { ComponentsCount } from "./ComponentsCount.js";

export type ComponentStatsView = {
readonly componentsCount: ComponentsCount;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/ComponentsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type ComponentsCount = number;
5 changes: 5 additions & 0 deletions src/application/context/project/stats/DecisionStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { DecisionsCount } from "./DecisionsCount.js";

export type DecisionStatsView = {
readonly decisionsCount: DecisionsCount;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/DecisionsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type DecisionsCount = number;
1 change: 1 addition & 0 deletions src/application/context/project/stats/DefinedGoalsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type DefinedGoalsCount = number;
1 change: 1 addition & 0 deletions src/application/context/project/stats/DependenciesCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type DependenciesCount = number;
5 changes: 5 additions & 0 deletions src/application/context/project/stats/DependencyStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { DependenciesCount } from "./DependenciesCount.js";

export type DependencyStatsView = {
readonly dependenciesCount: DependenciesCount;
};
13 changes: 13 additions & 0 deletions src/application/context/project/stats/GoalStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ClosedGoalsCount } from "./ClosedGoalsCount.js";
import type { DefinedGoalsCount } from "./DefinedGoalsCount.js";
import type { InProgressGoalsCount } from "./InProgressGoalsCount.js";
import type { RefinedGoalsCount } from "./RefinedGoalsCount.js";
import type { SubmittedGoalsCount } from "./SubmittedGoalsCount.js";

export type GoalStatsView = {
readonly definedGoalsCount: DefinedGoalsCount;
readonly refinedGoalsCount: RefinedGoalsCount;
readonly inProgressGoalsCount: InProgressGoalsCount;
readonly submittedGoalsCount: SubmittedGoalsCount;
readonly closedGoalsCount: ClosedGoalsCount;
};
5 changes: 5 additions & 0 deletions src/application/context/project/stats/GraphStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { RelationCount } from "./RelationCount.js";

export type GraphStatsView = {
readonly relationCount: RelationCount;
};
5 changes: 5 additions & 0 deletions src/application/context/project/stats/GuidelineStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { GuidelinesCount } from "./GuidelinesCount.js";

export type GuidelineStatsView = {
readonly guidelinesCount: GuidelinesCount;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/GuidelinesCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type GuidelinesCount = number;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type InProgressGoalsCount = number;
5 changes: 5 additions & 0 deletions src/application/context/project/stats/InvariantStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { InvariantsCount } from "./InvariantsCount.js";

export type InvariantStatsView = {
readonly invariantsCount: InvariantsCount;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/InvariantsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type InvariantsCount = number;
13 changes: 13 additions & 0 deletions src/application/context/project/stats/MemoryStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ComponentStatsView } from "./ComponentStatsView.js";
import type { DecisionStatsView } from "./DecisionStatsView.js";
import type { DependencyStatsView } from "./DependencyStatsView.js";
import type { GuidelineStatsView } from "./GuidelineStatsView.js";
import type { InvariantStatsView } from "./InvariantStatsView.js";

export type MemoryStatsView = {
readonly decisions: DecisionStatsView;
readonly components: ComponentStatsView;
readonly dependencies: DependencyStatsView;
readonly invariants: InvariantStatsView;
readonly guidelines: GuidelineStatsView;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/PrimaryAudiences.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type PrimaryAudiences = number;
96 changes: 7 additions & 89 deletions src/application/context/project/stats/ProjectStatsSnapshotView.ts
Original file line number Diff line number Diff line change
@@ -1,93 +1,11 @@
export interface ProjectStatsSnapshotView {
import type { GraphStatsView } from "./GraphStatsView.js";
import type { MemoryStatsView } from "./MemoryStatsView.js";
import type { ProjectStatsView } from "./ProjectStatsView.js";
import type { WorkStatsView } from "./WorkStatsView.js";

export type ProjectStatsSnapshotView = {
readonly project: ProjectStatsView;
readonly work: WorkStatsView;
readonly memory: MemoryStatsView;
readonly graph: GraphStatsView;
}

export interface ProjectStatsView {
readonly audiences: AudienceStatsView;
readonly audiencePains: AudiencePainStatsView;
readonly valuePropositions: ValuePropositionsStatsView;
}

export interface AudienceStatsView {
readonly totalAudiences: TotalAudiences;
readonly primaryAudiences: PrimaryAudiences;
readonly secondaryAudiences: SecondaryAudiences;
}

export interface AudiencePainStatsView {
readonly audiencePainsCount: AudiencePainsCount;
}

export interface ValuePropositionsStatsView {
readonly valuePropositionsCount: ValuePropositionsCount;
}

export interface WorkStatsView {
readonly goals: GoalStatsView;
readonly sessions: SessionsStatsView;
}

export interface GoalStatsView {
readonly definedGoalsCount: DefinedGoalsCount;
readonly refinedGoalsCount: RefinedGoalsCount;
readonly inProgressGoalsCount: InProgressGoalsCount;
readonly submittedGoalsCount: SubmittedGoalsCount;
readonly closedGoalsCount: ClosedGoalsCount;
}

export interface SessionsStatsView {
readonly sessionsCount: SessionsCount;
}

export interface MemoryStatsView {
readonly decisions: DecisionStatsView;
readonly components: ComponentStatsView;
readonly dependencies: DependencyStatsView;
readonly invariants: InvariantStatsView;
readonly guidelines: GuidelineStatsView;
}

export interface DecisionStatsView {
readonly decisionsCount: DecisionsCount;
}

export interface ComponentStatsView {
readonly componentsCount: ComponentsCount;
}

export interface DependencyStatsView {
readonly dependenciesCount: DependenciesCount;
}

export interface InvariantStatsView {
readonly invariantsCount: InvariantsCount;
}

export interface GuidelineStatsView {
readonly guidelinesCount: GuidelinesCount;
}

export interface GraphStatsView {
readonly relationCount: RelationCount;
}

export type TotalAudiences = number;
export type PrimaryAudiences = number;
export type SecondaryAudiences = number;
export type AudiencePainsCount = number;
export type ValuePropositionsCount = number;
export type DefinedGoalsCount = number;
export type RefinedGoalsCount = number;
export type InProgressGoalsCount = number;
export type SubmittedGoalsCount = number;
export type ClosedGoalsCount = number;
export type SessionsCount = number;
export type DecisionsCount = number;
export type ComponentsCount = number;
export type DependenciesCount = number;
export type InvariantsCount = number;
export type GuidelinesCount = number;
export type RelationCount = number;
};
9 changes: 9 additions & 0 deletions src/application/context/project/stats/ProjectStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { AudiencePainStatsView } from "./AudiencePainStatsView.js";
import type { AudienceStatsView } from "./AudienceStatsView.js";
import type { ValuePropositionsStatsView } from "./ValuePropositionsStatsView.js";

export type ProjectStatsView = {
readonly audiences: AudienceStatsView;
readonly audiencePains: AudiencePainStatsView;
readonly valuePropositions: ValuePropositionsStatsView;
};
1 change: 1 addition & 0 deletions src/application/context/project/stats/RefinedGoalsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type RefinedGoalsCount = number;
1 change: 1 addition & 0 deletions src/application/context/project/stats/RelationCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type RelationCount = number;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type SecondaryAudiences = number;
1 change: 1 addition & 0 deletions src/application/context/project/stats/SessionsCount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type SessionsCount = number;
5 changes: 5 additions & 0 deletions src/application/context/project/stats/SessionsStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { SessionsCount } from "./SessionsCount.js";

export type SessionsStatsView = {
readonly sessionsCount: SessionsCount;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type SubmittedGoalsCount = number;
1 change: 1 addition & 0 deletions src/application/context/project/stats/TotalAudiences.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type TotalAudiences = number;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type ValuePropositionsCount = number;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { ValuePropositionsCount } from "./ValuePropositionsCount.js";

export type ValuePropositionsStatsView = {
readonly valuePropositionsCount: ValuePropositionsCount;
};
7 changes: 7 additions & 0 deletions src/application/context/project/stats/WorkStatsView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { GoalStatsView } from "./GoalStatsView.js";
import type { SessionsStatsView } from "./SessionsStatsView.js";

export type WorkStatsView = {
readonly goals: GoalStatsView;
readonly sessions: SessionsStatsView;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import type { AudiencePainStatsView } from "../../../../../src/application/context/project/stats/AudiencePainStatsView.js";
import type { AudiencePainsCount } from "../../../../../src/application/context/project/stats/AudiencePainsCount.js";
import type { AudienceStatsView } from "../../../../../src/application/context/project/stats/AudienceStatsView.js";
import type { ClosedGoalsCount } from "../../../../../src/application/context/project/stats/ClosedGoalsCount.js";
import type { ComponentStatsView } from "../../../../../src/application/context/project/stats/ComponentStatsView.js";
import type { ComponentsCount } from "../../../../../src/application/context/project/stats/ComponentsCount.js";
import type { DecisionsCount } from "../../../../../src/application/context/project/stats/DecisionsCount.js";
import type { DecisionStatsView } from "../../../../../src/application/context/project/stats/DecisionStatsView.js";
import type { DefinedGoalsCount } from "../../../../../src/application/context/project/stats/DefinedGoalsCount.js";
import type { DependenciesCount } from "../../../../../src/application/context/project/stats/DependenciesCount.js";
import type { DependencyStatsView } from "../../../../../src/application/context/project/stats/DependencyStatsView.js";
import type { GoalStatsView } from "../../../../../src/application/context/project/stats/GoalStatsView.js";
import type { GraphStatsView } from "../../../../../src/application/context/project/stats/GraphStatsView.js";
import type { GuidelineStatsView } from "../../../../../src/application/context/project/stats/GuidelineStatsView.js";
import type { GuidelinesCount } from "../../../../../src/application/context/project/stats/GuidelinesCount.js";
import type { InProgressGoalsCount } from "../../../../../src/application/context/project/stats/InProgressGoalsCount.js";
import type { InvariantStatsView } from "../../../../../src/application/context/project/stats/InvariantStatsView.js";
import type { InvariantsCount } from "../../../../../src/application/context/project/stats/InvariantsCount.js";
import type { MemoryStatsView } from "../../../../../src/application/context/project/stats/MemoryStatsView.js";
import type { PrimaryAudiences } from "../../../../../src/application/context/project/stats/PrimaryAudiences.js";
import type { ProjectStatsSnapshotView } from "../../../../../src/application/context/project/stats/ProjectStatsSnapshotView.js";
import type { ProjectStatsView } from "../../../../../src/application/context/project/stats/ProjectStatsView.js";
import type { RefinedGoalsCount } from "../../../../../src/application/context/project/stats/RefinedGoalsCount.js";
import type { RelationCount } from "../../../../../src/application/context/project/stats/RelationCount.js";
import type { SecondaryAudiences } from "../../../../../src/application/context/project/stats/SecondaryAudiences.js";
import type { SessionsCount } from "../../../../../src/application/context/project/stats/SessionsCount.js";
import type { SessionsStatsView } from "../../../../../src/application/context/project/stats/SessionsStatsView.js";
import type { SubmittedGoalsCount } from "../../../../../src/application/context/project/stats/SubmittedGoalsCount.js";
import type { TotalAudiences } from "../../../../../src/application/context/project/stats/TotalAudiences.js";
import type { ValuePropositionsCount } from "../../../../../src/application/context/project/stats/ValuePropositionsCount.js";
import type { ValuePropositionsStatsView } from "../../../../../src/application/context/project/stats/ValuePropositionsStatsView.js";
import type { WorkStatsView } from "../../../../../src/application/context/project/stats/WorkStatsView.js";

describe("ProjectStatsSnapshotView", () => {
it("composes the decomposed stats views without changing the snapshot shape", () => {
const audiences: AudienceStatsView = {
totalAudiences: 3 satisfies TotalAudiences,
primaryAudiences: 1 satisfies PrimaryAudiences,
secondaryAudiences: 2 satisfies SecondaryAudiences,
};
const audiencePains: AudiencePainStatsView = {
audiencePainsCount: 4 satisfies AudiencePainsCount,
};
const valuePropositions: ValuePropositionsStatsView = {
valuePropositionsCount: 5 satisfies ValuePropositionsCount,
};
const project: ProjectStatsView = {
audiences,
audiencePains,
valuePropositions,
};

const goals: GoalStatsView = {
definedGoalsCount: 6 satisfies DefinedGoalsCount,
refinedGoalsCount: 7 satisfies RefinedGoalsCount,
inProgressGoalsCount: 8 satisfies InProgressGoalsCount,
submittedGoalsCount: 9 satisfies SubmittedGoalsCount,
closedGoalsCount: 10 satisfies ClosedGoalsCount,
};
const sessions: SessionsStatsView = {
sessionsCount: 11 satisfies SessionsCount,
};
const work: WorkStatsView = {
goals,
sessions,
};

const memory: MemoryStatsView = {
decisions: {
decisionsCount: 12 satisfies DecisionsCount,
} satisfies DecisionStatsView,
components: {
componentsCount: 13 satisfies ComponentsCount,
} satisfies ComponentStatsView,
dependencies: {
dependenciesCount: 14 satisfies DependenciesCount,
} satisfies DependencyStatsView,
invariants: {
invariantsCount: 15 satisfies InvariantsCount,
} satisfies InvariantStatsView,
guidelines: {
guidelinesCount: 16 satisfies GuidelinesCount,
} satisfies GuidelineStatsView,
};

const graph: GraphStatsView = {
relationCount: 17 satisfies RelationCount,
};
const snapshot: ProjectStatsSnapshotView = {
project,
work,
memory,
graph,
};

expect(snapshot).toEqual({
project: {
audiences: {
totalAudiences: 3,
primaryAudiences: 1,
secondaryAudiences: 2,
},
audiencePains: { audiencePainsCount: 4 },
valuePropositions: { valuePropositionsCount: 5 },
},
work: {
goals: {
definedGoalsCount: 6,
refinedGoalsCount: 7,
inProgressGoalsCount: 8,
submittedGoalsCount: 9,
closedGoalsCount: 10,
},
sessions: { sessionsCount: 11 },
},
memory: {
decisions: { decisionsCount: 12 },
components: { componentsCount: 13 },
dependencies: { dependenciesCount: 14 },
invariants: { invariantsCount: 15 },
guidelines: { guidelinesCount: 16 },
},
graph: { relationCount: 17 },
});
});
});
Loading