diff --git a/src/application/context/project/stats/AudiencePainStatsView.ts b/src/application/context/project/stats/AudiencePainStatsView.ts new file mode 100644 index 00000000..4dba4985 --- /dev/null +++ b/src/application/context/project/stats/AudiencePainStatsView.ts @@ -0,0 +1,5 @@ +import type { AudiencePainsCount } from "./AudiencePainsCount.js"; + +export type AudiencePainStatsView = { + readonly audiencePainsCount: AudiencePainsCount; +}; diff --git a/src/application/context/project/stats/AudiencePainsCount.ts b/src/application/context/project/stats/AudiencePainsCount.ts new file mode 100644 index 00000000..ceb5f412 --- /dev/null +++ b/src/application/context/project/stats/AudiencePainsCount.ts @@ -0,0 +1 @@ +export type AudiencePainsCount = number; diff --git a/src/application/context/project/stats/AudienceStatsView.ts b/src/application/context/project/stats/AudienceStatsView.ts new file mode 100644 index 00000000..4dc5f738 --- /dev/null +++ b/src/application/context/project/stats/AudienceStatsView.ts @@ -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; +}; diff --git a/src/application/context/project/stats/ClosedGoalsCount.ts b/src/application/context/project/stats/ClosedGoalsCount.ts new file mode 100644 index 00000000..f37e595b --- /dev/null +++ b/src/application/context/project/stats/ClosedGoalsCount.ts @@ -0,0 +1 @@ +export type ClosedGoalsCount = number; diff --git a/src/application/context/project/stats/ComponentStatsView.ts b/src/application/context/project/stats/ComponentStatsView.ts new file mode 100644 index 00000000..681f4e49 --- /dev/null +++ b/src/application/context/project/stats/ComponentStatsView.ts @@ -0,0 +1,5 @@ +import type { ComponentsCount } from "./ComponentsCount.js"; + +export type ComponentStatsView = { + readonly componentsCount: ComponentsCount; +}; diff --git a/src/application/context/project/stats/ComponentsCount.ts b/src/application/context/project/stats/ComponentsCount.ts new file mode 100644 index 00000000..5bb91f22 --- /dev/null +++ b/src/application/context/project/stats/ComponentsCount.ts @@ -0,0 +1 @@ +export type ComponentsCount = number; diff --git a/src/application/context/project/stats/DecisionStatsView.ts b/src/application/context/project/stats/DecisionStatsView.ts new file mode 100644 index 00000000..22dd0a22 --- /dev/null +++ b/src/application/context/project/stats/DecisionStatsView.ts @@ -0,0 +1,5 @@ +import type { DecisionsCount } from "./DecisionsCount.js"; + +export type DecisionStatsView = { + readonly decisionsCount: DecisionsCount; +}; diff --git a/src/application/context/project/stats/DecisionsCount.ts b/src/application/context/project/stats/DecisionsCount.ts new file mode 100644 index 00000000..71bbe584 --- /dev/null +++ b/src/application/context/project/stats/DecisionsCount.ts @@ -0,0 +1 @@ +export type DecisionsCount = number; diff --git a/src/application/context/project/stats/DefinedGoalsCount.ts b/src/application/context/project/stats/DefinedGoalsCount.ts new file mode 100644 index 00000000..666ebfbf --- /dev/null +++ b/src/application/context/project/stats/DefinedGoalsCount.ts @@ -0,0 +1 @@ +export type DefinedGoalsCount = number; diff --git a/src/application/context/project/stats/DependenciesCount.ts b/src/application/context/project/stats/DependenciesCount.ts new file mode 100644 index 00000000..c9dff9a5 --- /dev/null +++ b/src/application/context/project/stats/DependenciesCount.ts @@ -0,0 +1 @@ +export type DependenciesCount = number; diff --git a/src/application/context/project/stats/DependencyStatsView.ts b/src/application/context/project/stats/DependencyStatsView.ts new file mode 100644 index 00000000..f48c819d --- /dev/null +++ b/src/application/context/project/stats/DependencyStatsView.ts @@ -0,0 +1,5 @@ +import type { DependenciesCount } from "./DependenciesCount.js"; + +export type DependencyStatsView = { + readonly dependenciesCount: DependenciesCount; +}; diff --git a/src/application/context/project/stats/GoalStatsView.ts b/src/application/context/project/stats/GoalStatsView.ts new file mode 100644 index 00000000..b68e8530 --- /dev/null +++ b/src/application/context/project/stats/GoalStatsView.ts @@ -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; +}; diff --git a/src/application/context/project/stats/GraphStatsView.ts b/src/application/context/project/stats/GraphStatsView.ts new file mode 100644 index 00000000..8777f93e --- /dev/null +++ b/src/application/context/project/stats/GraphStatsView.ts @@ -0,0 +1,5 @@ +import type { RelationCount } from "./RelationCount.js"; + +export type GraphStatsView = { + readonly relationCount: RelationCount; +}; diff --git a/src/application/context/project/stats/GuidelineStatsView.ts b/src/application/context/project/stats/GuidelineStatsView.ts new file mode 100644 index 00000000..4c7064cd --- /dev/null +++ b/src/application/context/project/stats/GuidelineStatsView.ts @@ -0,0 +1,5 @@ +import type { GuidelinesCount } from "./GuidelinesCount.js"; + +export type GuidelineStatsView = { + readonly guidelinesCount: GuidelinesCount; +}; diff --git a/src/application/context/project/stats/GuidelinesCount.ts b/src/application/context/project/stats/GuidelinesCount.ts new file mode 100644 index 00000000..1e1d80b1 --- /dev/null +++ b/src/application/context/project/stats/GuidelinesCount.ts @@ -0,0 +1 @@ +export type GuidelinesCount = number; diff --git a/src/application/context/project/stats/InProgressGoalsCount.ts b/src/application/context/project/stats/InProgressGoalsCount.ts new file mode 100644 index 00000000..18f99c7b --- /dev/null +++ b/src/application/context/project/stats/InProgressGoalsCount.ts @@ -0,0 +1 @@ +export type InProgressGoalsCount = number; diff --git a/src/application/context/project/stats/InvariantStatsView.ts b/src/application/context/project/stats/InvariantStatsView.ts new file mode 100644 index 00000000..bdd548fd --- /dev/null +++ b/src/application/context/project/stats/InvariantStatsView.ts @@ -0,0 +1,5 @@ +import type { InvariantsCount } from "./InvariantsCount.js"; + +export type InvariantStatsView = { + readonly invariantsCount: InvariantsCount; +}; diff --git a/src/application/context/project/stats/InvariantsCount.ts b/src/application/context/project/stats/InvariantsCount.ts new file mode 100644 index 00000000..49fd16ca --- /dev/null +++ b/src/application/context/project/stats/InvariantsCount.ts @@ -0,0 +1 @@ +export type InvariantsCount = number; diff --git a/src/application/context/project/stats/MemoryStatsView.ts b/src/application/context/project/stats/MemoryStatsView.ts new file mode 100644 index 00000000..1ff69536 --- /dev/null +++ b/src/application/context/project/stats/MemoryStatsView.ts @@ -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; +}; diff --git a/src/application/context/project/stats/PrimaryAudiences.ts b/src/application/context/project/stats/PrimaryAudiences.ts new file mode 100644 index 00000000..2ab5e54b --- /dev/null +++ b/src/application/context/project/stats/PrimaryAudiences.ts @@ -0,0 +1 @@ +export type PrimaryAudiences = number; diff --git a/src/application/context/project/stats/ProjectStatsSnapshotView.ts b/src/application/context/project/stats/ProjectStatsSnapshotView.ts index 8da489bd..e6c86188 100644 --- a/src/application/context/project/stats/ProjectStatsSnapshotView.ts +++ b/src/application/context/project/stats/ProjectStatsSnapshotView.ts @@ -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; +}; diff --git a/src/application/context/project/stats/ProjectStatsView.ts b/src/application/context/project/stats/ProjectStatsView.ts new file mode 100644 index 00000000..c1c4de7d --- /dev/null +++ b/src/application/context/project/stats/ProjectStatsView.ts @@ -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; +}; diff --git a/src/application/context/project/stats/RefinedGoalsCount.ts b/src/application/context/project/stats/RefinedGoalsCount.ts new file mode 100644 index 00000000..24d28f81 --- /dev/null +++ b/src/application/context/project/stats/RefinedGoalsCount.ts @@ -0,0 +1 @@ +export type RefinedGoalsCount = number; diff --git a/src/application/context/project/stats/RelationCount.ts b/src/application/context/project/stats/RelationCount.ts new file mode 100644 index 00000000..0756eb43 --- /dev/null +++ b/src/application/context/project/stats/RelationCount.ts @@ -0,0 +1 @@ +export type RelationCount = number; diff --git a/src/application/context/project/stats/SecondaryAudiences.ts b/src/application/context/project/stats/SecondaryAudiences.ts new file mode 100644 index 00000000..2e240bc2 --- /dev/null +++ b/src/application/context/project/stats/SecondaryAudiences.ts @@ -0,0 +1 @@ +export type SecondaryAudiences = number; diff --git a/src/application/context/project/stats/SessionsCount.ts b/src/application/context/project/stats/SessionsCount.ts new file mode 100644 index 00000000..54141437 --- /dev/null +++ b/src/application/context/project/stats/SessionsCount.ts @@ -0,0 +1 @@ +export type SessionsCount = number; diff --git a/src/application/context/project/stats/SessionsStatsView.ts b/src/application/context/project/stats/SessionsStatsView.ts new file mode 100644 index 00000000..2ffe5017 --- /dev/null +++ b/src/application/context/project/stats/SessionsStatsView.ts @@ -0,0 +1,5 @@ +import type { SessionsCount } from "./SessionsCount.js"; + +export type SessionsStatsView = { + readonly sessionsCount: SessionsCount; +}; diff --git a/src/application/context/project/stats/SubmittedGoalsCount.ts b/src/application/context/project/stats/SubmittedGoalsCount.ts new file mode 100644 index 00000000..676673da --- /dev/null +++ b/src/application/context/project/stats/SubmittedGoalsCount.ts @@ -0,0 +1 @@ +export type SubmittedGoalsCount = number; diff --git a/src/application/context/project/stats/TotalAudiences.ts b/src/application/context/project/stats/TotalAudiences.ts new file mode 100644 index 00000000..8f45d24f --- /dev/null +++ b/src/application/context/project/stats/TotalAudiences.ts @@ -0,0 +1 @@ +export type TotalAudiences = number; diff --git a/src/application/context/project/stats/ValuePropositionsCount.ts b/src/application/context/project/stats/ValuePropositionsCount.ts new file mode 100644 index 00000000..01f5d31e --- /dev/null +++ b/src/application/context/project/stats/ValuePropositionsCount.ts @@ -0,0 +1 @@ +export type ValuePropositionsCount = number; diff --git a/src/application/context/project/stats/ValuePropositionsStatsView.ts b/src/application/context/project/stats/ValuePropositionsStatsView.ts new file mode 100644 index 00000000..dc34c1fe --- /dev/null +++ b/src/application/context/project/stats/ValuePropositionsStatsView.ts @@ -0,0 +1,5 @@ +import type { ValuePropositionsCount } from "./ValuePropositionsCount.js"; + +export type ValuePropositionsStatsView = { + readonly valuePropositionsCount: ValuePropositionsCount; +}; diff --git a/src/application/context/project/stats/WorkStatsView.ts b/src/application/context/project/stats/WorkStatsView.ts new file mode 100644 index 00000000..242da7a3 --- /dev/null +++ b/src/application/context/project/stats/WorkStatsView.ts @@ -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; +}; diff --git a/tests/application/context/project/stats/ProjectStatsSnapshotView.test.ts b/tests/application/context/project/stats/ProjectStatsSnapshotView.test.ts new file mode 100644 index 00000000..e7a1119b --- /dev/null +++ b/tests/application/context/project/stats/ProjectStatsSnapshotView.test.ts @@ -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 }, + }); + }); +});