remult 0.27.20-next.3 → 0.27.20-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.27.20-next.3",
3
+ "version": "0.27.20-next.4",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -529,8 +529,8 @@ export interface Repository<entityType> {
529
529
  query<Options extends QueryOptions<entityType> & {
530
530
  aggregate?: Omit<GroupByOptions<entityType, never, NumericKeys<entityType>[], NumericKeys<entityType>[], (keyof MembersOnly<entityType>)[], (keyof MembersOnly<entityType>)[], (keyof MembersOnly<entityType>)[]>, 'group' | 'orderBy' | 'where' | 'limit' | 'page'>;
531
531
  }>(options?: Options): Options extends {
532
- aggregate: GroupByOptions<entityType, never, infer sumFields, infer averageFields, infer minFields, infer maxFields, infer distinctCountFields>;
533
- } ? QueryResult<entityType, GroupByResult<entityType, never, sumFields, averageFields, minFields, maxFields, distinctCountFields>> : QueryResult<entityType>;
532
+ aggregate: Omit<GroupByOptions<entityType, never, NumericKeys<entityType>[], NumericKeys<entityType>[], (keyof MembersOnly<entityType>)[], (keyof MembersOnly<entityType>)[], (keyof MembersOnly<entityType>)[]>, 'group' | 'orderBy' | 'where' | 'limit' | 'page'>;
533
+ } ? QueryResult<entityType, GroupByResult<entityType, never, NonNullable<Options['aggregate']['sum']>, NonNullable<Options['aggregate']['avg']>, NonNullable<Options['aggregate']['min']>, NonNullable<Options['aggregate']['max']>, NonNullable<Options['aggregate']['distinctCount']>>> : QueryResult<entityType>;
534
534
  /** Returns a count of the items matching the criteria.
535
535
  * @see [EntityFilter](http://remult.dev/docs/entityFilter.html)
536
536
  * @example
@@ -1061,9 +1061,10 @@ export interface QueryOptions<entityType> extends FindOptionsBase<entityType> {
1061
1061
  progress: (progress: number) => void;
1062
1062
  };
1063
1063
  }
1064
+ export type EmptyAggregateResult = 'EmptyAggregateResult';
1064
1065
  /** The result of a call to the `query` method in the `Repository` object.
1065
1066
  */
1066
- export interface QueryResult<entityType, AggregateResult = never> {
1067
+ export interface QueryResult<entityType, AggregateResult = EmptyAggregateResult> {
1067
1068
  /** returns an iterator that iterates the rows in the result using a paging mechanism
1068
1069
  * @example
1069
1070
  * for await (const task of taskRepo.query()) {
@@ -1098,7 +1099,7 @@ export interface QueryResult<entityType, AggregateResult = never> {
1098
1099
  * console.log(paginator.items.length)
1099
1100
  * }
1100
1101
  */
1101
- export type Paginator<entityType, AggregateResult = never> = {
1102
+ export type Paginator<entityType, AggregateResult = EmptyAggregateResult> = {
1102
1103
  /** the items in the current page */
1103
1104
  items: entityType[];
1104
1105
  /** True if next page exists */
@@ -1107,8 +1108,9 @@ export type Paginator<entityType, AggregateResult = never> = {
1107
1108
  count(): Promise<number>;
1108
1109
  /** Gets the next page in the `query`'s result set */
1109
1110
  nextPage(): Promise<Paginator<entityType, AggregateResult>>;
1111
+ } & (AggregateResult extends EmptyAggregateResult ? {} : {
1110
1112
  aggregates: AggregateResult;
1111
- };
1113
+ });
1112
1114
  /**
1113
1115
  * Options for configuring a relation between entities.
1114
1116
  *