import { Injector } from '@angular/core'; import { Observable, PartialObserver, Subscriber } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { ValidationError } from "class-validator"; import "reflect-metadata"; import { SortOrder } from 'mel-common'; import { ClientConfig } from '../../core/client.config'; import { EntityLiteral, Range } from '../../core/types'; import { ClientFilters } from './client-filters'; import { ClientFilterCondition, FieldConditions } from './client-filter-condition'; import { BaseEntityService } from './baseentity.service'; import { Entity } from '../../models/entity'; import * as i0 from "@angular/core"; export declare type UpdateResult = { raw?: any; affected?: number; generatedMaps?: EntityLiteral[]; }; export declare type DeleteResult = { raw?: any; affected?: number; }; export declare type RenameResult = { raw?: any; affected?: number; }; export declare class EntityService extends BaseEntityService { protected httpClient: HttpClient; constructor(entityFunc: Function, httpClient: HttpClient, config: ClientConfig); readonly contentType: { 'content-type': string; }; readonly httpOptions: { headers: { 'content-type': string; }; }; private options; private _filters; private beforeInsertEmitter; private beforeModifyEmitter; private beforeRenameEmitter; private beforeDeleteEmitter; private subscriptions; protected get endpointLocked(): boolean; protected get restEndpoint(): string; protected beforeInsert?: Subscriber; protected beforeModify?: Subscriber; protected beforeRename?: Subscriber; protected beforeDelete?: Subscriber; protected onNew?: Subscriber; protected user: string; protected dataSetIndex: number; dataSet?: E[]; initService(service: EntityService, initFilters?: boolean, initData?: boolean, initOptions?: boolean): void; static createFrom(from: EntityService, initFilters?: boolean, initData?: boolean, initOptions?: boolean): EntityService; static create(injector: Injector, entityName: string): EntityService; get canWrite(): boolean; get hasFilters(): boolean; get hasFlowFilters(): boolean; get hasActiveFlowFilters(): boolean; get hasUnlockedFilters(): boolean; afterInit(): Observable; clone(initFilters?: boolean, initData?: boolean, initOptions?: boolean): EntityService; subscribeTriggers(permissions: string): void; unsubscribe(): void; /** * Copies the entitydata include the dataset and the filters, if to include * @param from the service to copy from */ copyDataset(from: EntityService): EntityService; copyParameter(fromRecord: EntityService): EntityService; copy(fromRecord: EntityService): EntityService; private _selectName; select(fieldNames: string[]): EntityService; setOrder(sortOrder: SortOrder | undefined): EntityService; get order(): SortOrder | undefined; setCalcFields(calcFieldNames: string[]): EntityService; take(n: number): EntityService; skip(n: number): EntityService; get rowRange(): Range; /** * resets the options */ resetAll(): EntityService; lockFilters(toLock: string | string[]): EntityService; copyFilters(from: EntityService): EntityService; copyNormalFilters(from: EntityService, includeLocked?: boolean): EntityService; copyFlowFilters(from: EntityService, includeLocked?: boolean): EntityService; getNormalFilters(includeLocked?: boolean): ClientFilters; getFlowFilters(): ClientFilters; resetNormalFilters(): EntityService; resetFlowFilters(): EntityService; /** * resets the unlocked filters */ resetFilters(): EntityService; clearFilters(): EntityService; get friendlyFilters(): string; /** * Sets a range-filter for a field (fromValue..toValue). * if fromValue and toValue are undefined, the filter is cleared * if only fromValue is defined, the range is set to this value (=fromValue) * @param fieldName * @param range? if undefined, the fieldfilter is cleared * if range is an array with 2 values, the between-filter is set * if range is an array with 1 values order is no array the equal-filter is set */ setRange(fieldName: string, range?: any): EntityService; setFilter(fieldName: string, condition: ClientFilterCondition | string | boolean): EntityService; /** * sets the filters given by "findConditions". Other filters are cleared * @param fieldConditions */ setFilters(fieldConditions: FieldConditions): EntityService; setNormalFilters(fieldConditions: FieldConditions): EntityService; setFlowFilters(fieldConditions: FieldConditions): EntityService; /** * Assings the conditions to the existing filters. existing fieldconditions are overwritten * @param conditions */ mergeFilters(filters: ClientFilters, overwrite?: boolean): EntityService; setParameter(param: string | string[] | undefined): EntityService; addParameter(param: string | string[] | undefined): EntityService; private assertGetFieldMetadata; /** * Creates a fieldcondition. * @param key the fieldname for the condition * @param operator complex or simple operators * @param operandsOrFilterExpression is an expression, if the the type is 'string' and the operator is unknown or complex */ private createFieldCondition; private apiToJavaTypes; private updateRecAndxRec; get primaryKeyChanged(): boolean; get normalFieldChanged(): boolean; /** * Initialize the rec-data and the xRec-data, but by default not the primary-keys * @param includePrimaryKeys (default:false) if true, the primary keys are initialized */ initData(includePrimaryKeys?: boolean): void; /** * set the primary-key from the filterconditions-values */ setPrimarykeysFromFilter(): void; get primaryKeyFields(): EntityLiteral; validatePrimaryKeys(): ValidationError[]; /** * Observable adapter converts from Observable> to Observable * @param queryResponseObservable * @param observers additional observers to fire * @returns Obervable */ /** * returns the count of record filtered by conditions */ count(): Observable; /** * get the record with the primarykey in rec * @param observer if defined, all observers are called, and the method return undefined. * If you want to combine the observable of "get" don't support the param observers and handle * the observation for example in the rxjs-Operations-subscription */ get(): Observable; /** * Find the first record within the filter * @param observers if defined, all observers are called, an the method return undefined. * If you want to combine the observable of "findFirst" don't support the param observers and handle * the observation for example in the rxjs-Operations-subscription */ findFirst(): Observable; /** * Find the last record within the filter * @param observers if defined, all observers are called, an the method return undefined. * If you want to combine the observable of "findLast" don't support the param observers and handle * the observation for example in the rxjs-Operations-subscription */ findLast(): Observable; /** * Find all records within the filter * @param observers if defined, all observers are called, an the method return undefined. * If you want to combine the observable of "findMany" don't support the param observers and handle * the observation for example in the rxjs-Operations-subscription */ findMany(): Observable; /** * * @param increment fetches the next data from the recordset into the data * can be negative * @returns the increment or 0, if the target-record is auf of range */ next(increment?: number): number; calcFields(fieldsToCalculate: string[]): Observable; insert(): Observable; /** * * @param dataSetOrObserver (optional) the dataset to insert or an observer. if undefined, the local dataset is inserted * @param observer (optional) the observer of the insert * @returns the observable of the insert */ insertMany(dataSetOrObserver?: E[] | PartialObserver, observer?: PartialObserver): Observable; rename(): Observable; update(): Observable; updateMany(): Observable; delete(): Observable; deleteMany(): Observable; protected getOptionsQueryParam(options?: any): string; private _count; private _get; private _findMany; private _findFirst; private _findLast; private _calcFields; private _insert; private _insertMany; private _rename; private _update; private _updateMany; private _delete; private _deleteMany; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; }