@punks/backend-entity-manager 0.0.143 → 0.0.145
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/dist/cjs/index.js +75 -104
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/index.d.ts +1 -1
- package/dist/cjs/types/abstractions/searchResults.d.ts +3 -4
- package/dist/cjs/types/integrations/repository/typeorm/facets.d.ts +10 -6
- package/dist/cjs/types/integrations/repository/typeorm/queryBuilder.d.ts +7 -4
- package/dist/cjs/types/platforms/nest/__test__/server/entities/appEmailLogs/appEmailLog.models.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/entities/crmContacts/crmContact.models.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foos/foo.models.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/shared/api/facets.d.ts +18 -8
- package/dist/cjs/types/platforms/nest/index.d.ts +0 -1
- package/dist/esm/index.js +76 -99
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/index.d.ts +1 -1
- package/dist/esm/types/abstractions/searchResults.d.ts +3 -4
- package/dist/esm/types/integrations/repository/typeorm/facets.d.ts +10 -6
- package/dist/esm/types/integrations/repository/typeorm/queryBuilder.d.ts +7 -4
- package/dist/esm/types/platforms/nest/__test__/server/entities/appEmailLogs/appEmailLog.models.d.ts +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/entities/crmContacts/crmContact.models.d.ts +2 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/foos/foo.models.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/shared/api/facets.d.ts +18 -8
- package/dist/esm/types/platforms/nest/index.d.ts +0 -1
- package/dist/index.d.ts +19 -35
- package/package.json +1 -1
- package/dist/cjs/types/platforms/nest/dto/facets.d.ts +0 -25
- package/dist/cjs/types/platforms/nest/dto/index.d.ts +0 -1
- package/dist/esm/types/platforms/nest/dto/facets.d.ts +0 -25
- package/dist/esm/types/platforms/nest/dto/index.d.ts +0 -1
|
@@ -25,6 +25,6 @@ export * from "./searchParameters";
|
|
|
25
25
|
export { EntitySerializerColumnDefinition, EntitySerializerSheetDefinition, IEntitySerializer, EntitySerializationFormat, } from "./serializer";
|
|
26
26
|
export { EntityManagerSettings } from "./settings";
|
|
27
27
|
export { IEntitySnapshotService } from "./snapshot";
|
|
28
|
-
export { IEntitySearchResults, IEntityFacet,
|
|
28
|
+
export { IEntitySearchResults, IEntityFacet, IEntityFacetValue, IEntityFacets, ISearchResultsPaging, } from "./searchResults";
|
|
29
29
|
export * from "./tracking";
|
|
30
30
|
export { EntityVersionOperation, EntityVersionInput, IEntityVersioningResults, IEntityVersioningProvider, IEntityVersionsSearchInput, } from "./versioning";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SortingType } from "./common";
|
|
2
2
|
import { IEntitySearchParameters } from "./searchParameters";
|
|
3
|
-
export interface
|
|
3
|
+
export interface IEntityFacetValue<T> {
|
|
4
4
|
value: T;
|
|
5
|
-
|
|
6
|
-
count?: number;
|
|
5
|
+
count: number;
|
|
7
6
|
}
|
|
8
7
|
export interface IEntityFacet<T> {
|
|
9
|
-
|
|
8
|
+
values: IEntityFacetValue<T>[];
|
|
10
9
|
}
|
|
11
10
|
export interface IEntityFacets {
|
|
12
11
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
1
|
+
export type FacetValueType<T> = {
|
|
2
|
+
value: T;
|
|
3
|
+
count: number;
|
|
3
4
|
};
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type
|
|
5
|
+
export type FacetType<T> = {
|
|
6
|
+
values: FacetValueType<T>[];
|
|
7
|
+
};
|
|
8
|
+
export type StringFacetsType = FacetType<string>;
|
|
9
|
+
export type NumberFacetsType = FacetType<number>;
|
|
10
|
+
export type BooleanFacetsType = FacetType<boolean>;
|
|
11
|
+
export type DateFacetsType = FacetType<Date>;
|
|
@@ -6,7 +6,7 @@ import { TypeOrmRepository } from "./repository";
|
|
|
6
6
|
import { EntityServiceLocator } from "../../../providers/services";
|
|
7
7
|
import { IEntitiesDeleteResult } from "../../../abstractions/repository";
|
|
8
8
|
import { QueryClauseBuilder } from "./queryClauseBuilder";
|
|
9
|
-
import {
|
|
9
|
+
import { BooleanFacetsType, FacetType, NumberFacetsType, StringFacetsType } from "./facets";
|
|
10
10
|
import { QueryBuilderOperation } from "../../../templates/queryBuilder";
|
|
11
11
|
export declare abstract class TypeOrmQueryBuilder<TEntity extends ObjectLiteral, TEntityId, TEntitySearchParameters extends IEntitySearchParameters<TSorting, number>, TSorting extends SortingType, TFacets extends IEntityFacets, TUserContext> extends QueryBuilderBase<TEntity, TEntityId, TEntitySearchParameters, TSorting, number, TFacets, TUserContext> {
|
|
12
12
|
private readonly services;
|
|
@@ -22,8 +22,8 @@ export declare abstract class TypeOrmQueryBuilder<TEntity extends ObjectLiteral,
|
|
|
22
22
|
sorting?: TEntitySearchParameters["sorting"];
|
|
23
23
|
}, context?: IAuthenticationContext<TUserContext>): Promise<TEntity>;
|
|
24
24
|
search(request: TEntitySearchParameters, context?: IAuthenticationContext<TUserContext>): Promise<IEntitiesSearchResults<TEntitySearchParameters, TEntity, TSorting, number, TFacets>>;
|
|
25
|
-
protected
|
|
26
|
-
protected findPagedQueryResults(request: TEntitySearchParameters, context
|
|
25
|
+
protected getFieldDistinctValues<T>(field: keyof TEntity, request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<T[]>;
|
|
26
|
+
protected findPagedQueryResults(request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<TEntity[]>;
|
|
27
27
|
protected getRelationsToLoad(request: TEntitySearchParameters | undefined, context: IAuthenticationContext<TUserContext> | undefined, operation: QueryBuilderOperation): FindOptionsRelations<TEntity> | undefined;
|
|
28
28
|
protected buildPagingParameters(request: TEntitySearchParameters): {
|
|
29
29
|
skip: number | undefined;
|
|
@@ -34,6 +34,9 @@ export declare abstract class TypeOrmQueryBuilder<TEntity extends ObjectLiteral,
|
|
|
34
34
|
protected abstract buildWhereClause(request: TEntitySearchParameters): FindOptionsWhere<TEntity>[] | FindOptionsWhere<TEntity>;
|
|
35
35
|
protected abstract buildContextFilter(context?: IAuthenticationContext<TUserContext>): FindOptionsWhere<TEntity>[] | FindOptionsWhere<TEntity>;
|
|
36
36
|
protected abstract calculateFacets(request: TEntitySearchParameters, context?: IAuthenticationContext<TUserContext>): Promise<TFacets>;
|
|
37
|
-
protected calculateFacet<TField extends keyof TEntity, TValue>(field: TField, request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<
|
|
37
|
+
protected calculateFacet<TField extends keyof TEntity, TValue>(field: TField, request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<FacetType<TValue>>;
|
|
38
|
+
protected calculateStringFieldFacets(field: keyof TEntity, request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<StringFacetsType>;
|
|
39
|
+
protected calculateNumericFieldFacets(field: keyof TEntity, request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<NumberFacetsType>;
|
|
40
|
+
protected calculateBooleanFieldFacets(field: keyof TEntity, request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): Promise<BooleanFacetsType>;
|
|
38
41
|
protected getRepository(): TypeOrmRepository<TEntity, unknown>;
|
|
39
42
|
}
|
package/dist/cjs/types/platforms/nest/__test__/server/entities/appEmailLogs/appEmailLog.models.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AppEmailLogEntity } from "../../database/core/entities/appEmailLog.enti
|
|
|
3
3
|
export type AppEmailLogCreateData = DeepPartial<Omit<AppEmailLogEntity, "id">>;
|
|
4
4
|
export type AppEmailLogUpdateData = DeepPartial<Omit<AppEmailLogEntity, "id">>;
|
|
5
5
|
export declare enum AppEmailLogSorting {
|
|
6
|
-
|
|
6
|
+
Timestamp = "Timestamp"
|
|
7
7
|
}
|
|
8
8
|
export type AppEmailLogCursor = number;
|
|
9
9
|
export declare class AppEmailLogSearchFilters {
|
package/dist/cjs/types/platforms/nest/__test__/server/entities/crmContacts/crmContact.models.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DeepPartial } from "../../../../../..";
|
|
2
2
|
import { CrmContactEntity } from "../../database/core/entities/crmContact.entity";
|
|
3
|
+
import { StringFacets } from "../../shared/api/facets";
|
|
3
4
|
export type CrmContactEntityId = string;
|
|
4
5
|
export type CrmContactCreateData = DeepPartial<Omit<CrmContactEntity, "id">>;
|
|
5
6
|
export type CrmContactUpdateData = DeepPartial<Omit<CrmContactEntity, "id">>;
|
|
@@ -10,4 +11,5 @@ export type CrmContactCursor = number;
|
|
|
10
11
|
export declare class CrmContactSearchFilters {
|
|
11
12
|
}
|
|
12
13
|
export declare class CrmContactFacets {
|
|
14
|
+
email: StringFacets;
|
|
13
15
|
}
|
|
@@ -2,7 +2,7 @@ import { IEntitySearchParameters, ISearchSorting, ISearchSortingField, SortDirec
|
|
|
2
2
|
import { IEntitiesSearchResults, IEntitiesSearchResultsPaging } from "../../../../../../models";
|
|
3
3
|
import { FooEntity } from "../../database/core/entities/foo.entity";
|
|
4
4
|
import { IEntitiesDeleteParameters } from "../../../../../../abstractions/commands";
|
|
5
|
-
import {
|
|
5
|
+
import { NumberFacetsType } from "../../../../../../integrations/repository/typeorm/facets";
|
|
6
6
|
export type FooEntityId = string;
|
|
7
7
|
export type FooCreateData = Partial<FooEntity>;
|
|
8
8
|
export type FooUpdateData = Partial<FooEntity>;
|
|
@@ -10,7 +10,7 @@ export interface FooSearchParameters extends IEntitySearchParameters<FooSorting,
|
|
|
10
10
|
filters?: FooSearchFilters;
|
|
11
11
|
}
|
|
12
12
|
export interface FooFacets {
|
|
13
|
-
age:
|
|
13
|
+
age: NumberFacetsType;
|
|
14
14
|
}
|
|
15
15
|
export interface FooSearchFilters {
|
|
16
16
|
minAge?: number;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { IEntityFacet, IEntityFacetValue } from "../../../../../../abstractions";
|
|
2
|
+
export declare class NumericFacetValue implements IEntityFacetValue<number> {
|
|
3
|
+
value: number;
|
|
4
|
+
count: number;
|
|
3
5
|
}
|
|
4
|
-
export declare class
|
|
5
|
-
values
|
|
6
|
+
export declare class NumericFacets implements IEntityFacet<number> {
|
|
7
|
+
values: NumericFacetValue[];
|
|
6
8
|
}
|
|
7
|
-
export declare class
|
|
8
|
-
|
|
9
|
+
export declare class BooleanFacetValue implements IEntityFacetValue<boolean> {
|
|
10
|
+
value: boolean;
|
|
11
|
+
count: number;
|
|
9
12
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
values
|
|
13
|
+
export declare class BooleanFacet implements IEntityFacet<boolean> {
|
|
14
|
+
values: BooleanFacetValue[];
|
|
15
|
+
}
|
|
16
|
+
export declare class StringFacetValue implements IEntityFacetValue<string> {
|
|
17
|
+
value: string;
|
|
18
|
+
count: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class StringFacets implements IEntityFacet<string> {
|
|
21
|
+
values: StringFacetValue[];
|
|
12
22
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Log, csvParse, excelParse, excelBuild, csvBuild, isNullOrUndefined, sort, byField, toDict, newUuid as newUuid$1, ensureTailingSlash, ensureStartSlash, removeUndefinedProps } from '@punks/backend-core';
|
|
2
2
|
import { applyDecorators, Injectable, SetMetadata, createParamDecorator, Global, Module, Scope, Logger, StreamableFile, HttpException, HttpStatus } from '@nestjs/common';
|
|
3
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
4
3
|
import { Reflector } from '@nestjs/core';
|
|
5
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
6
5
|
import { hash } from 'bcrypt';
|
|
@@ -2445,98 +2444,6 @@ const WpEntityVersioningProvider = (props = {}) => applyDecorators(Injectable(),
|
|
|
2445
2444
|
...props,
|
|
2446
2445
|
}));
|
|
2447
2446
|
|
|
2448
|
-
/******************************************************************************
|
|
2449
|
-
Copyright (c) Microsoft Corporation.
|
|
2450
|
-
|
|
2451
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2452
|
-
purpose with or without fee is hereby granted.
|
|
2453
|
-
|
|
2454
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2455
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2456
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2457
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2458
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2459
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2460
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2461
|
-
***************************************************************************** */
|
|
2462
|
-
|
|
2463
|
-
function __decorate(decorators, target, key, desc) {
|
|
2464
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2465
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2466
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2467
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2468
|
-
}
|
|
2469
|
-
|
|
2470
|
-
function __metadata(metadataKey, metadataValue) {
|
|
2471
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2475
|
-
var e = new Error(message);
|
|
2476
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2477
|
-
};
|
|
2478
|
-
|
|
2479
|
-
class NumericFacetItem {
|
|
2480
|
-
}
|
|
2481
|
-
__decorate([
|
|
2482
|
-
ApiProperty(),
|
|
2483
|
-
__metadata("design:type", Number)
|
|
2484
|
-
], NumericFacetItem.prototype, "value", void 0);
|
|
2485
|
-
__decorate([
|
|
2486
|
-
ApiProperty({ required: false }),
|
|
2487
|
-
__metadata("design:type", String)
|
|
2488
|
-
], NumericFacetItem.prototype, "name", void 0);
|
|
2489
|
-
__decorate([
|
|
2490
|
-
ApiProperty({ required: false }),
|
|
2491
|
-
__metadata("design:type", Number)
|
|
2492
|
-
], NumericFacetItem.prototype, "count", void 0);
|
|
2493
|
-
class NumericFacet {
|
|
2494
|
-
}
|
|
2495
|
-
__decorate([
|
|
2496
|
-
ApiProperty({ type: [NumericFacetItem] }),
|
|
2497
|
-
__metadata("design:type", Array)
|
|
2498
|
-
], NumericFacet.prototype, "items", void 0);
|
|
2499
|
-
class BooleanFacetItem {
|
|
2500
|
-
}
|
|
2501
|
-
__decorate([
|
|
2502
|
-
ApiProperty(),
|
|
2503
|
-
__metadata("design:type", Boolean)
|
|
2504
|
-
], BooleanFacetItem.prototype, "value", void 0);
|
|
2505
|
-
__decorate([
|
|
2506
|
-
ApiProperty({ required: false }),
|
|
2507
|
-
__metadata("design:type", String)
|
|
2508
|
-
], BooleanFacetItem.prototype, "name", void 0);
|
|
2509
|
-
__decorate([
|
|
2510
|
-
ApiProperty({ required: false }),
|
|
2511
|
-
__metadata("design:type", Number)
|
|
2512
|
-
], BooleanFacetItem.prototype, "count", void 0);
|
|
2513
|
-
class BooleanFacet {
|
|
2514
|
-
}
|
|
2515
|
-
__decorate([
|
|
2516
|
-
ApiProperty({ type: [BooleanFacetItem] }),
|
|
2517
|
-
__metadata("design:type", Array)
|
|
2518
|
-
], BooleanFacet.prototype, "items", void 0);
|
|
2519
|
-
class StringFacetItem {
|
|
2520
|
-
}
|
|
2521
|
-
__decorate([
|
|
2522
|
-
ApiProperty(),
|
|
2523
|
-
__metadata("design:type", String)
|
|
2524
|
-
], StringFacetItem.prototype, "value", void 0);
|
|
2525
|
-
__decorate([
|
|
2526
|
-
ApiProperty({ required: false }),
|
|
2527
|
-
__metadata("design:type", String)
|
|
2528
|
-
], StringFacetItem.prototype, "name", void 0);
|
|
2529
|
-
__decorate([
|
|
2530
|
-
ApiProperty({ required: false }),
|
|
2531
|
-
__metadata("design:type", Number)
|
|
2532
|
-
], StringFacetItem.prototype, "count", void 0);
|
|
2533
|
-
class StringFacet {
|
|
2534
|
-
}
|
|
2535
|
-
__decorate([
|
|
2536
|
-
ApiProperty({ type: [StringFacetItem] }),
|
|
2537
|
-
__metadata("design:type", Array)
|
|
2538
|
-
], StringFacet.prototype, "items", void 0);
|
|
2539
|
-
|
|
2540
2447
|
const CurrentUser = createParamDecorator((data, context) => {
|
|
2541
2448
|
const request = context.switchToHttp().getRequest();
|
|
2542
2449
|
if (!request.auth) {
|
|
@@ -2610,6 +2517,37 @@ const AuthenticationEvents = {
|
|
|
2610
2517
|
UserPasswordResetCompleted: `${AUTHENTICATION_EVENTS_NAMESPACE}:user.passwordResetCompleted`,
|
|
2611
2518
|
};
|
|
2612
2519
|
|
|
2520
|
+
/******************************************************************************
|
|
2521
|
+
Copyright (c) Microsoft Corporation.
|
|
2522
|
+
|
|
2523
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2524
|
+
purpose with or without fee is hereby granted.
|
|
2525
|
+
|
|
2526
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2527
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2528
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2529
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2530
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2531
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2532
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2533
|
+
***************************************************************************** */
|
|
2534
|
+
|
|
2535
|
+
function __decorate(decorators, target, key, desc) {
|
|
2536
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2537
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2538
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2539
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
function __metadata(metadataKey, metadataValue) {
|
|
2543
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2547
|
+
var e = new Error(message);
|
|
2548
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2549
|
+
};
|
|
2550
|
+
|
|
2613
2551
|
var AuthGuard_1;
|
|
2614
2552
|
let AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
2615
2553
|
constructor(reflector) {
|
|
@@ -22248,8 +22186,13 @@ class TypeOrmQueryBuilder extends QueryBuilderBase {
|
|
|
22248
22186
|
facets,
|
|
22249
22187
|
};
|
|
22250
22188
|
}
|
|
22251
|
-
async
|
|
22252
|
-
this.getRepository().
|
|
22189
|
+
async getFieldDistinctValues(field, request, context) {
|
|
22190
|
+
return await this.getRepository().distinct(field, {
|
|
22191
|
+
where: {
|
|
22192
|
+
...(context ? this.buildContextFilter(context) : {}),
|
|
22193
|
+
...this.buildWhereClause(request),
|
|
22194
|
+
},
|
|
22195
|
+
});
|
|
22253
22196
|
}
|
|
22254
22197
|
async findPagedQueryResults(request, context) {
|
|
22255
22198
|
return await this.getRepository().find({
|
|
@@ -22282,14 +22225,48 @@ class TypeOrmQueryBuilder extends QueryBuilderBase {
|
|
|
22282
22225
|
});
|
|
22283
22226
|
}
|
|
22284
22227
|
async calculateFacet(field, request, context) {
|
|
22285
|
-
const
|
|
22228
|
+
const where = {
|
|
22286
22229
|
...(context ? this.buildContextFilter(context) : {}),
|
|
22287
22230
|
...this.buildWhereClause(request),
|
|
22288
|
-
}
|
|
22231
|
+
};
|
|
22232
|
+
const results = await this.getRepository()
|
|
22233
|
+
.getInnerRepository()
|
|
22234
|
+
.createQueryBuilder()
|
|
22235
|
+
.select(field, "value")
|
|
22236
|
+
.addSelect(`COUNT(${field})`, "count")
|
|
22237
|
+
.where(where)
|
|
22238
|
+
.addGroupBy(field)
|
|
22239
|
+
.orderBy(field)
|
|
22240
|
+
.getRawMany();
|
|
22289
22241
|
return {
|
|
22290
|
-
values
|
|
22242
|
+
values: results.map((x) => ({
|
|
22243
|
+
value: x.value,
|
|
22244
|
+
count: Number(x.count),
|
|
22245
|
+
})),
|
|
22291
22246
|
};
|
|
22292
22247
|
}
|
|
22248
|
+
async calculateStringFieldFacets(field, request, context) {
|
|
22249
|
+
return await this.calculateFacet(field, request, context);
|
|
22250
|
+
}
|
|
22251
|
+
async calculateNumericFieldFacets(field, request, context) {
|
|
22252
|
+
return await this.calculateFacet(field, request, context);
|
|
22253
|
+
}
|
|
22254
|
+
async calculateBooleanFieldFacets(field, request, context) {
|
|
22255
|
+
return await this.calculateFacet(field, request, context);
|
|
22256
|
+
}
|
|
22257
|
+
// protected async calculateFacet<TField extends keyof TEntity, TValue>(
|
|
22258
|
+
// field: TField,
|
|
22259
|
+
// request: TEntitySearchParameters,
|
|
22260
|
+
// context: IAuthenticationContext<TUserContext> | undefined
|
|
22261
|
+
// ): Promise<Facet<TValue>> {
|
|
22262
|
+
// const values = await this.getRepository().distinct<TField, TValue>(field, {
|
|
22263
|
+
// ...(context ? this.buildContextFilter(context) : {}),
|
|
22264
|
+
// ...this.buildWhereClause(request),
|
|
22265
|
+
// } as any)
|
|
22266
|
+
// return {
|
|
22267
|
+
// values,
|
|
22268
|
+
// }
|
|
22269
|
+
// }
|
|
22293
22270
|
getRepository() {
|
|
22294
22271
|
if (!this.repository) {
|
|
22295
22272
|
this.repository = this.services.resolveRepository();
|
|
@@ -28193,5 +28170,5 @@ InMemoryEmailProvider = __decorate([
|
|
|
28193
28170
|
WpEmailProvider("in-memory")
|
|
28194
28171
|
], InMemoryEmailProvider);
|
|
28195
28172
|
|
|
28196
|
-
export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsEmailModule, AwsS3BucketError as AwsS2BucketError, AwsS3BucketProvider, AwsSesEmailTemplate,
|
|
28173
|
+
export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsEmailModule, AwsS3BucketError as AwsS2BucketError, AwsS3BucketProvider, AwsSesEmailTemplate, BucketItemType, CurrentUser, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EntitySerializationFormat, EntitySerializer, EntitySnapshotService, EntityVersionOperation, EventsService, FilesService, IEntityVersionsCursor, InMemoryBucketProvider, InMemoryEmailProvider, InvalidCredentialsError, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestEntitySerializer, NestEntitySnapshotService, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PipelineController, PipelineErrorType, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, QueryBuilderOperation, ReplicationMode, Roles, SendgridEmailModule, SendgridEmailTemplate, SortDirection, TrackingService, UserCreationError, UserRegistrationError, WpAppInitializer, WpAwsSesEmailTemplate, WpBucketProvider, WpEmailLogger, WpEmailProvider, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEntitySerializer, WpEntitySnapshotService, WpEntityVersioningProvider, WpEventsTracker, WpFileProvider, WpFileReferenceRepository, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, buildRolesGuard, createContainer, createExpressFileResponse, getLocalizedText, newUuid, renderHandlebarsTemplate, toEntitiesImportInput };
|
|
28197
28174
|
//# sourceMappingURL=index.js.map
|