@@ -10,11 +10,38 @@ import { Cancellation } from '@dolittle/sdk.resilience';
1010import { Key } from '../Key' ;
1111import { ProjectionId } from '../ProjectionId' ;
1212import { CurrentState } from './CurrentState' ;
13+ import { IProjectionOf } from './IProjectionOf' ;
1314
1415/**
1516 * Defines the API surface for getting projections.
1617 */
1718export abstract class IProjectionStore {
19+
20+ /**
21+ * Gets the {@link IProjectionOf} the projection read model type.
22+ * @param {Constructor<TProjection> } type - The type of the projection.
23+ * @returns {IProjectionOf<TProjection> } The {@link IProjectionOf} for the {@link TProjection} projection read model type.
24+ * @template TProjection The type of the projection read model.
25+ */
26+ abstract of < TProjection > ( type : Constructor < TProjection > ) : IProjectionOf < TProjection > ;
27+ /**
28+ * Gets the {@link IProjectionOf} the projection read model type.
29+ * @param {Constructor<TReadModel> } type - The type of the projection.
30+ * @param {ProjectionId | Guid | string } projection - The id of the projection.
31+ * @returns {IProjectionOf<TReadModel> } The {@link IProjectionOf} for the {@link TReadModel} projection read model type.
32+ * @template TReadModel The type of the projection read model.
33+ */
34+ abstract of < TReadModel > ( type : Constructor < TReadModel > , projection : ProjectionId | Guid | string ) : IProjectionOf < TReadModel > ;
35+ /**
36+ * Gets the {@link IProjectionOf} the projection read model type.
37+ * @param {Constructor<TReadModel> } type - The type of the projection.
38+ * @param {ProjectionId | Guid | string } projection - The id of the projection.
39+ * @param {ScopeId | Guid | string } scope - The scope the projection in.
40+ * @returns {IProjectionOf<TReadModel> } The {@link IProjectionOf} for the {@link TReadModel} projection read model type.
41+ * @template TReadModel The type of the projection read model.
42+ */
43+ abstract of < TReadModel > ( type : Constructor < TReadModel > , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string ) : IProjectionOf < TReadModel > ;
44+
1845 /**
1946 * Gets a projection read model by key for a projection associated with a type.
2047 * @param {Constructor<TProjection> } type - The type of the projection.
@@ -27,26 +54,26 @@ export abstract class IProjectionStore {
2754
2855 /**
2956 * Gets a projection read model by key for a projection specified by projection identifier.
30- * @param {Constructor<TProjection > } type - The type of the projection.
57+ * @param {Constructor<TReadModel > } type - The type of the projection.
3158 * @param {Key | any } key - The key of the projection.
3259 * @param {ProjectionId | Guid | string } projection - The id of the projection.
3360 * @param {Cancellation } [cancellation] - The cancellation token.
34- * @returns {Promise<TProjection > } A {@link Promise} that when resolved returns the read model of the projection.
35- * @template TProjection The type of the projection.
61+ * @returns {Promise<TReadModel > } A {@link Promise} that when resolved returns the read model of the projection.
62+ * @template TReadModel The type of the projection.
3663 */
37- abstract get < TProjection > ( type : Constructor < TProjection > , key : Key | any , projection : ProjectionId | Guid | string , cancellation ?: Cancellation ) : Promise < TProjection > ;
64+ abstract get < TReadModel > ( type : Constructor < TReadModel > , key : Key | any , projection : ProjectionId | Guid | string , cancellation ?: Cancellation ) : Promise < TReadModel > ;
3865
3966 /**
4067 * Gets a projection read model by key for a projection specified by projection and scope identifier.
41- * @param {Constructor<TProjection > } type - The type of the projection.
68+ * @param {Constructor<TReadModel > } type - The type of the projection.
4269 * @param {Key | any } key - The key of the projection.
4370 * @param {ProjectionId | Guid | string } projection - The id of the projection.
4471 * @param {ScopeId | Guid | string } scope - The scope the projection in.
4572 * @param {Cancellation } [cancellation] - The cancellation token.
46- * @returns {Promise<TProjection > } A {@link Promise} that when resolved returns the read model of the projection.
47- * @template TProjection The type of the projection.
73+ * @returns {Promise<TReadModel > } A {@link Promise} that when resolved returns the read model of the projection.
74+ * @template TReadModel The type of the projection.
4875 */
49- abstract get < TProjection > ( type : Constructor < TProjection > , key : Key | any , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string , cancellation ?: Cancellation ) : Promise < TProjection > ;
76+ abstract get < TReadModel > ( type : Constructor < TReadModel > , key : Key | any , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string , cancellation ?: Cancellation ) : Promise < TReadModel > ;
5077
5178 /**
5279 * Gets a projection read model by key for a projection specified by projection identifier.
@@ -61,7 +88,7 @@ export abstract class IProjectionStore {
6188 * Gets a projection read model by key for a projection specified by projection and scope identifier.
6289 * @param {Key | any } key - The key of the projection.
6390 * @param {ProjectionId | Guid | string } projection - The id of the projection.
64- * @param {ScopeId | Guid | string } scpåe - The scope the projection in.
91+ * @param {ScopeId | Guid | string } scope - The scope the projection in.
6592 * @param {Cancellation } [cancellation] - The cancellation token.
6693 * @returns {Promise<any> } A {@link Promise} that when resolved returns the read model of the projection.
6794 */
@@ -79,24 +106,24 @@ export abstract class IProjectionStore {
79106
80107 /**
81108 * Gets all projection read models for a projection specified by projection identifier.
82- * @param {Constructor<TProjection > } type - The type of the projection.
109+ * @param {Constructor<TReadModel > } type - The type of the projection.
83110 * @param {ProjectionId | Guid | string } projection - The id of the projection.
84111 * @param {Cancellation } [cancellation] - The cancellation token.
85- * @returns {Promise<TProjection []> } A {@link Promise} that when resolved returns the all the read models of the projection.
86- * @template TProjection The type of the projection.
112+ * @returns {Promise<TReadModel []> } A {@link Promise} that when resolved returns the all the read models of the projection.
113+ * @template TReadModel The type of the projection.
87114 */
88- abstract getAll < TProjection > ( type : Constructor < TProjection > , projection : ProjectionId | Guid | string , cancellation ?: Cancellation ) : Promise < TProjection [ ] > ;
115+ abstract getAll < TReadModel > ( type : Constructor < TReadModel > , projection : ProjectionId | Guid | string , cancellation ?: Cancellation ) : Promise < TReadModel [ ] > ;
89116
90117 /**
91118 * Gets all projection read models for a projection specified by projection and scope identifier.
92- * @param {Constructor<TProjection > } type - The type of the projection.
119+ * @param {Constructor<TReadModel > } type - The type of the projection.
93120 * @param {ProjectionId | Guid | string } projection - The id of the projection.
94121 * @param {ScopeId | Guid | string } scope - The scope the projection in.
95122 * @param {Cancellation } [cancellation] - The cancellation token.
96- * @returns {Promise<TProjection []> } A {@link Promise} that when resolved returns the all the read models of the projection.
97- * @template TProjection The type of the projection.
123+ * @returns {Promise<TReadModel []> } A {@link Promise} that when resolved returns the all the read models of the projection.
124+ * @template TReadModel The type of the projection.
98125 */
99- abstract getAll < TProjection > ( type : Constructor < TProjection > , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string , cancellation ?: Cancellation ) : Promise < TProjection [ ] > ;
126+ abstract getAll < TReadModel > ( type : Constructor < TReadModel > , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string , cancellation ?: Cancellation ) : Promise < TReadModel [ ] > ;
100127
101128 /**
102129 * Gets all projection read models for a projection specified by projection identifier.
@@ -127,26 +154,26 @@ export abstract class IProjectionStore {
127154
128155 /**
129156 * Gets a projection state by key for a projection specified by projection identifier.
130- * @param {Constructor<TProjection > } type - The type of the projection.
157+ * @param {Constructor<TReadModel > } type - The type of the projection.
131158 * @param {Key | any } key - The key of the projection.
132159 * @param {ProjectionId | Guid | string } projection - The id of the projection.
133160 * @param {Cancellation } [cancellation] - The cancellation token.
134- * @returns {Promise<CurrentState<TProjection >> } A {@link Promise} that when resolved returns the current state of the projection.
135- * @template TProjection The type of the projection.
161+ * @returns {Promise<CurrentState<TReadModel >> } A {@link Promise} that when resolved returns the current state of the projection.
162+ * @template TReadModel The type of the projection.
136163 */
137- abstract getState < TProjection > ( type : Constructor < TProjection > , key : Key | any , projection : ProjectionId | Guid | string , cancellation ?: Cancellation ) : Promise < CurrentState < TProjection > > ;
164+ abstract getState < TReadModel > ( type : Constructor < TReadModel > , key : Key | any , projection : ProjectionId | Guid | string , cancellation ?: Cancellation ) : Promise < CurrentState < TReadModel > > ;
138165
139166 /**
140167 * Gets a projection state by key for a projection specified by projection and scope identifier.
141- * @param {Constructor<TProjection > } type - The type of the projection.
168+ * @param {Constructor<TReadModel > } type - The type of the projection.
142169 * @param {Key | any } key - The key of the projection.
143170 * @param {ProjectionId | Guid | string } projection - The id of the projection.
144171 * @param {ScopeId | Guid | string } scope - The scope the projection in.
145172 * @param {Cancellation } [cancellation] - The cancellation token.
146- * @returns {Promise<CurrentState<TProjection >> } A {@link Promise} that when resolved returns the current state of the projection.
147- * @template TProjection The type of the projection.
173+ * @returns {Promise<CurrentState<TReadModel >> } A {@link Promise} that when resolved returns the current state of the projection.
174+ * @template TReadModel The type of the projection.
148175 */
149- abstract getState < TProjection > ( type : Constructor < TProjection > , key : Key | any , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string , cancellation ?: Cancellation ) : Promise < CurrentState < TProjection > > ;
176+ abstract getState < TReadModel > ( type : Constructor < TReadModel > , key : Key | any , projection : ProjectionId | Guid | string , scope : ScopeId | Guid | string , cancellation ?: Cancellation ) : Promise < CurrentState < TReadModel > > ;
150177
151178 /**
152179 * Gets a projection state by key for a projection specified by projection identifier.
0 commit comments