import { OnDestroy } from '@angular/core'; import { Observable, ReplaySubject, Subject } from 'rxjs'; import { Net } from './net'; import { PetriNetResourceService } from '../resources/engine-endpoint/petri-net-resource.service'; import { LoggerService } from '../logger/services/logger.service'; import Transition from './transition'; import Transaction from './transaction'; import RolesAndPermissions from './rolesAndPermissions'; import { PetriNetReference } from '../resources/interface/petri-net-reference'; import { PetriNetReferenceWithPermissions } from './petri-net-reference-with-permissions'; import * as i0 from "@angular/core"; export interface NetCache { [k: string]: Net; } /** * Process service is responsible for loading and caching processes needed for any functionality of an app. */ export declare class ProcessService implements OnDestroy { private _petriNetResource; private _log; protected readonly _nets: NetCache; protected _netsSubject: Subject; protected _netUpdate: Subject; protected _requestCache: Map>; protected _referenceRequestCache: Map>; readonly LATEST = "latest"; constructor(_petriNetResource: PetriNetResourceService, _log: LoggerService); ngOnDestroy(): void; /** * Get process nets according to provided identifiers. * If any of the requested processes is not cached it will be loaded from the server and saved for later. * @param identifiers Array of identifiers of requested processes. See {@link Net} * @param forceLoad when set to `true` cached processes will be ignored and a backend request will always be made * (unless another is already pending) * @returns Observable of array of loaded processes. Array is emitted only when every process finished loading. * If any of the processes failed to load it is skipped from the result. */ getNets(identifiers: Array, forceLoad?: boolean): Observable>; /** * Get process net by identifier. * @param identifier Identifier of the requested process. See {@link Net} * @param forceLoad when set to `true` cached processes will be ignored and a backend request will always be made * (unless another is already pending) * @returns Observable of [the process]{@link Net}. Process is loaded from a server or picked from the cache. */ getNet(identifier: string, forceLoad?: boolean): Observable; /** * Get process net referencess according to provided identifiers. * * `PetriNetReferences` are not cached. * Each call will result in a new backend request unless a request for the same net is already pending. * @param identifiers Array of identifiers of requested processes. See {@link Net} * @returns Observable of array of loaded processes. Array is emitted only when every process finished loading. * If any of the processes failed to load it is skipped from the result. */ getNetReferences(identifiers: Array): Observable>; /** * Get process net reference by identifier. * * `PetriNetReferences` are not cached. * Each call will result in a new backend request unless a request for the same net is already pending. * @param identifier Identifier of the requested process. See {@link Net} * @returns Observable of [the process]{@link Net}. Process is loaded from a server or picked from the cache. */ getNetReference(identifier: string): Observable; /** * Remove cached process by identifier. If the process is not found nothing happens. * @param identifier Process identifier */ removeNet(identifier: string): void; /** * Update cached process object. If the process is not found nothing happens. Process object is replaced. * @param net Updated process object. */ updateNet(net: Net): void; /** * Stream of change of the process cache. * New state of cache is emitted every time the cached changed by inserting, updating or deleting a process. * @returns Observable of whole updated cache. */ get nets$(): Observable; /** * Stream of change in the process cache. * New state of cache is emitted every time the cached changed by inserting, updating or deleting a process. * @returns Observable of updated or newly loaded process net. */ get netUpdate$(): Observable; areNetsLoaded(identifiers: Array): boolean; isNetLoaded(identifier: string): boolean; protected loadNet(id: string): Observable; protected loadNetReference(id: string): Observable; protected loadTransitions(id: string): Observable>; protected loadTransactions(id: string): Observable>; protected loadRoles(id: string): Observable; protected publishUpdate(net?: Net): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }