mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-04-16 22:24:49 +00:00
[ACS-11205] Add LazyApi decorator (#11711)
* [ACS-11205] Add LazyApi decorator * [ACS-11205] Add unit tests and CR fixes * [ACS-11259] Storybook build fix
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Agent, AgentsApi } from '@alfresco/js-api';
|
||||
import { Agent, AgentsApi, LazyApi } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
@@ -27,13 +27,10 @@ import { AlfrescoApiService } from '../../services';
|
||||
export class AgentService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _agentsApi: AgentsApi;
|
||||
private readonly agents = new BehaviorSubject<Agent[]>([]);
|
||||
|
||||
get agentsApi(): AgentsApi {
|
||||
this._agentsApi = this._agentsApi ?? new AgentsApi(this.apiService.getInstance());
|
||||
return this._agentsApi;
|
||||
}
|
||||
@LazyApi((self: AgentService) => new AgentsApi(self.apiService.getInstance()))
|
||||
declare readonly agentsApi: AgentsApi;
|
||||
|
||||
agents$ = this.agents.asObservable();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { from, Observable, of, zip } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { AspectEntry, AspectPaging, AspectsApi, ListAspectsOpts } from '@alfresco/js-api';
|
||||
import { AspectEntry, AspectPaging, AspectsApi, LazyApi, ListAspectsOpts } from '@alfresco/js-api';
|
||||
import { CustomAspectPaging } from '../interfaces/custom-aspect-paging.interface';
|
||||
|
||||
export const StandardAspectsWhere = `(modelId in ('cm:contentmodel', 'emailserver:emailserverModel', 'smf:smartFolder', 'app:applicationmodel' ))`;
|
||||
@@ -33,11 +33,8 @@ export class AspectListService {
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
private readonly appConfigService = inject(AppConfigService);
|
||||
|
||||
private _aspectsApi: AspectsApi;
|
||||
get aspectsApi(): AspectsApi {
|
||||
this._aspectsApi = this._aspectsApi ?? new AspectsApi(this.alfrescoApiService.getInstance());
|
||||
return this._aspectsApi;
|
||||
}
|
||||
@LazyApi((self: AspectListService) => new AspectsApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly aspectsApi: AspectsApi;
|
||||
|
||||
getAllAspects(standardOpts?: ListAspectsOpts, customOpts?: ListAspectsOpts): Observable<CustomAspectPaging> {
|
||||
const visibleAspectList = this.getVisibleAspects();
|
||||
|
||||
@@ -25,7 +25,8 @@ import {
|
||||
CategoryPaging,
|
||||
ResultSetPaging,
|
||||
SearchApi,
|
||||
SEARCH_LANGUAGE
|
||||
SEARCH_LANGUAGE,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { from, Observable } from 'rxjs';
|
||||
@@ -36,18 +37,11 @@ export class CategoryService {
|
||||
private readonly userPreferencesService = inject(UserPreferencesService);
|
||||
private readonly appConfigService = inject(AppConfigService);
|
||||
|
||||
private _categoriesApi: CategoriesApi;
|
||||
private _searchApi: SearchApi;
|
||||
@LazyApi((self: CategoryService) => new CategoriesApi(self.apiService.getInstance()))
|
||||
declare readonly categoriesApi: CategoriesApi;
|
||||
|
||||
get categoriesApi(): CategoriesApi {
|
||||
this._categoriesApi = this._categoriesApi ?? new CategoriesApi(this.apiService.getInstance());
|
||||
return this._categoriesApi;
|
||||
}
|
||||
|
||||
get searchApi(): SearchApi {
|
||||
this._searchApi = this._searchApi ?? new SearchApi(this.apiService.getInstance());
|
||||
return this._searchApi;
|
||||
}
|
||||
@LazyApi((self: CategoryService) => new SearchApi(self.apiService.getInstance()))
|
||||
declare readonly searchApi: SearchApi;
|
||||
|
||||
/**
|
||||
* Get subcategories of a given parent category
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { ContentApi, Node, NodeEntry } from '@alfresco/js-api';
|
||||
import { ContentApi, LazyApi, Node, NodeEntry } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { PermissionsEnum } from '../models/permissions.enum';
|
||||
@@ -42,11 +42,8 @@ export class ContentService {
|
||||
folderCreate = new Subject<Node>();
|
||||
folderEdit = new Subject<Node>();
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: ContentService) => new ContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
/**
|
||||
* Gets a content URL for the given node.
|
||||
|
||||
@@ -24,7 +24,8 @@ import {
|
||||
DiscoveryApi,
|
||||
AboutApi,
|
||||
SystemPropertiesApi,
|
||||
BpmProductVersionModel
|
||||
BpmProductVersionModel,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
@@ -36,11 +37,14 @@ export class DiscoveryApiService {
|
||||
private readonly authenticationService = inject(AuthenticationService);
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
private _discoveryApi: DiscoveryApi;
|
||||
get discoveryApi(): DiscoveryApi {
|
||||
this._discoveryApi = this._discoveryApi ?? new DiscoveryApi(this.alfrescoApiService.getInstance());
|
||||
return this._discoveryApi;
|
||||
}
|
||||
@LazyApi((self: DiscoveryApiService) => new DiscoveryApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly discoveryApi: DiscoveryApi;
|
||||
|
||||
@LazyApi((self: DiscoveryApiService) => new AboutApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly aboutApi: AboutApi;
|
||||
|
||||
@LazyApi((self: DiscoveryApiService) => new SystemPropertiesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly systemPropertiesApi: SystemPropertiesApi;
|
||||
|
||||
/**
|
||||
* Gets product information for Content Services.
|
||||
@@ -78,14 +82,11 @@ export class DiscoveryApiService {
|
||||
* @returns ProductVersionModel containing product details
|
||||
*/
|
||||
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
||||
const aboutApi = new AboutApi(this.alfrescoApiService.getInstance());
|
||||
return from(aboutApi.getAppVersion());
|
||||
return from(this.aboutApi.getAppVersion());
|
||||
}
|
||||
|
||||
getBPMSystemProperties(): Observable<SystemPropertiesRepresentation> {
|
||||
const systemPropertiesApi = new SystemPropertiesApi(this.alfrescoApiService.getInstance());
|
||||
|
||||
return from(systemPropertiesApi.getProperties()).pipe(
|
||||
return from(this.systemPropertiesApi.getProperties()).pipe(
|
||||
map((res) => {
|
||||
if ('string' === typeof res) {
|
||||
throw new Error('Not valid response');
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { FavoritesApi, NodePaging, FavoritePaging } from '@alfresco/js-api';
|
||||
import { FavoritesApi, NodePaging, FavoritePaging, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, from, of } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
@@ -29,11 +29,8 @@ export class FavoritesApiService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
private readonly preferences = inject(UserPreferencesService);
|
||||
|
||||
private _favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.apiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
@LazyApi((self: FavoritesApiService) => new FavoritesApi(self.apiService.getInstance()))
|
||||
declare readonly favoritesApi: FavoritesApi;
|
||||
|
||||
static remapEntry({ entry }: any): any {
|
||||
entry.properties = {
|
||||
|
||||
@@ -27,7 +27,8 @@ import {
|
||||
TrashcanApi,
|
||||
SizeDetailsEntry,
|
||||
JobIdBodyEntry,
|
||||
NodeAssociationPaging
|
||||
NodeAssociationPaging,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { from, Observable, Subject, throwError } from 'rxjs';
|
||||
@@ -47,17 +48,11 @@ export class NodesApiService {
|
||||
*/
|
||||
nodeUpdated = new Subject<Node>();
|
||||
|
||||
private _trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.apiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
@LazyApi((self: NodesApiService) => new TrashcanApi(self.apiService.getInstance()))
|
||||
declare readonly trashcanApi: TrashcanApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: NodesApiService) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
private getEntryFromEntity(entity: NodeEntry): Node {
|
||||
return entity.entry;
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Injectable, inject } from '@angular/core';
|
||||
import { from, Observable, of } from 'rxjs';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
import { Pagination, PeopleApi, PersonBodyCreate, PersonBodyUpdate } from '@alfresco/js-api';
|
||||
import { LazyApi, Pagination, PeopleApi, PersonBodyCreate, PersonBodyUpdate } from '@alfresco/js-api';
|
||||
import { EcmUserModel } from '../models/ecm-user.model';
|
||||
import { ContentService } from './content.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
@@ -49,11 +49,8 @@ export class PeopleContentService {
|
||||
|
||||
private currentUser: EcmUserModel;
|
||||
|
||||
private _peopleApi: PeopleApi;
|
||||
get peopleApi(): PeopleApi {
|
||||
this._peopleApi = this._peopleApi ?? new PeopleApi(this.apiService.getInstance());
|
||||
return this._peopleApi;
|
||||
}
|
||||
@LazyApi((self: PeopleContentService) => new PeopleApi(self.apiService.getInstance()))
|
||||
declare readonly peopleApi: PeopleApi;
|
||||
|
||||
constructor() {
|
||||
const authenticationService = inject(AuthenticationService);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { ContentApi, RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { ContentApi, LazyApi, RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { Track, TranslationService, ViewUtilService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@@ -56,26 +56,16 @@ export class RenditionService {
|
||||
* Timeout used for setInterval.
|
||||
*/
|
||||
private readonly TRY_TIMEOUT: number = 10000;
|
||||
|
||||
_renditionsApi: RenditionsApi;
|
||||
get renditionsApi(): RenditionsApi {
|
||||
this._renditionsApi = this._renditionsApi ?? new RenditionsApi(this.apiService.getInstance());
|
||||
return this._renditionsApi;
|
||||
}
|
||||
|
||||
_contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
_versionsApi: VersionsApi;
|
||||
private readonly DEFAULT_RENDITION: string = 'imgpreview';
|
||||
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
@LazyApi((self: RenditionService) => new RenditionsApi(self.apiService.getInstance()))
|
||||
declare readonly renditionsApi: RenditionsApi;
|
||||
|
||||
@LazyApi((self: RenditionService) => new ContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
@LazyApi((self: RenditionService) => new VersionsApi(self.apiService.getInstance()))
|
||||
declare readonly versionsApi: VersionsApi;
|
||||
|
||||
getRenditionUrl(nodeId: string, type: string, renditionExists: boolean): string {
|
||||
return renditionExists && type !== RenditionService.ContentGroup.IMAGE
|
||||
|
||||
@@ -19,14 +19,12 @@ import { inject, Injectable } from '@angular/core';
|
||||
import { SavedSearchStrategy } from '../interfaces/saved-searches-strategy.interface';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import { ReplaySubject, Observable, catchError, switchMap, take, tap, throwError, map } from 'rxjs';
|
||||
import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { LazyApi, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { SavedSearch } from '../interfaces/saved-search.interface';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
|
||||
@Injectable()
|
||||
export abstract class SavedSearchesBaseService implements SavedSearchStrategy {
|
||||
private _nodesApi: NodesApi;
|
||||
|
||||
private static readonly SAVE_MODE_THRESHOLD = 5;
|
||||
|
||||
protected readonly _savedSearches$ = new ReplaySubject<SavedSearch[]>(1);
|
||||
@@ -35,10 +33,8 @@ export abstract class SavedSearchesBaseService implements SavedSearchStrategy {
|
||||
protected readonly apiService = inject(AlfrescoApiService);
|
||||
protected readonly authService = inject(AuthenticationService);
|
||||
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: SavedSearchesBaseService) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
protected abstract fetchAllSavedSearches(): Observable<SavedSearch[]>;
|
||||
protected abstract updateSavedSearches(searches: SavedSearch[]): Observable<NodeEntry>;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NodeEntry, PreferencesApi, ContentFieldsQuery, PreferenceEntry } from '@alfresco/js-api';
|
||||
import { NodeEntry, PreferencesApi, ContentFieldsQuery, PreferenceEntry, LazyApi } from '@alfresco/js-api';
|
||||
import { Injectable, InjectionToken, inject } from '@angular/core';
|
||||
import { Observable, of, from, throwError } from 'rxjs';
|
||||
import { catchError, concatMap, first, map, switchMap, take, tap } from 'rxjs/operators';
|
||||
@@ -34,18 +34,15 @@ export const SAVED_SEARCHES_SERVICE_PREFERENCES = new InjectionToken<SavedSearch
|
||||
})
|
||||
export class SavedSearchesService extends SavedSearchesBaseService {
|
||||
private savedSearchFileNodeId: string;
|
||||
private _preferencesApi: SavedSearchesPreferencesApiService;
|
||||
private readonly preferencesService = inject(SAVED_SEARCHES_SERVICE_PREFERENCES, { optional: true });
|
||||
|
||||
get preferencesApi(): SavedSearchesPreferencesApiService {
|
||||
if (this.preferencesService) {
|
||||
this._preferencesApi = this.preferencesService;
|
||||
return this._preferencesApi;
|
||||
@LazyApi((self: SavedSearchesService) => {
|
||||
if (self.preferencesService) {
|
||||
return self.preferencesService;
|
||||
}
|
||||
|
||||
this._preferencesApi = this._preferencesApi ?? new PreferencesApi(this.apiService.getInstance());
|
||||
return this._preferencesApi;
|
||||
}
|
||||
return new PreferencesApi(self.apiService.getInstance());
|
||||
})
|
||||
declare readonly preferencesApi: SavedSearchesPreferencesApiService;
|
||||
|
||||
protected fetchAllSavedSearches(): Observable<SavedSearch[]> {
|
||||
const savedSearchesMigrated = localStorage.getItem(this.getLocalStorageKey()) ?? '';
|
||||
|
||||
@@ -29,7 +29,8 @@ import {
|
||||
SiteMembershipBodyUpdate,
|
||||
SiteMembershipRequestWithPersonPaging,
|
||||
SitePaging,
|
||||
SitesApi
|
||||
SitesApi,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@@ -39,11 +40,8 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
export class SitesService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _sitesApi: SitesApi;
|
||||
get sitesApi(): SitesApi {
|
||||
this._sitesApi = this._sitesApi ?? new SitesApi(this.apiService.getInstance());
|
||||
return this._sitesApi;
|
||||
}
|
||||
@LazyApi((self: SitesService) => new SitesApi(self.apiService.getInstance()))
|
||||
declare readonly sitesApi: SitesApi;
|
||||
|
||||
/**
|
||||
* Create a site
|
||||
|
||||
@@ -23,7 +23,7 @@ import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
||||
import { NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { LazyApi, NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
||||
@@ -56,23 +56,14 @@ export class UploadService {
|
||||
private abortedFile: string;
|
||||
private isThumbnailGenerationEnabled: boolean;
|
||||
|
||||
private _uploadApi: UploadApi;
|
||||
get uploadApi(): UploadApi {
|
||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
||||
return this._uploadApi;
|
||||
}
|
||||
@LazyApi((self: UploadService) => new UploadApi(self.apiService.getInstance()))
|
||||
declare readonly uploadApi: UploadApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: UploadService) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
private _versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
@LazyApi((self: UploadService) => new VersionsApi(self.apiService.getInstance()))
|
||||
declare readonly versionsApi: VersionsApi;
|
||||
|
||||
protected apiService = inject(AlfrescoApiService);
|
||||
protected appConfigService = inject(AppConfigService);
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { Observable, defer, forkJoin } from 'rxjs';
|
||||
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ClassesApi } from '@alfresco/js-api';
|
||||
import { ClassesApi, LazyApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -28,11 +28,8 @@ import { ClassesApi } from '@alfresco/js-api';
|
||||
export class PropertyDescriptorsService {
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
private _classesApi: ClassesApi;
|
||||
get classesApi(): ClassesApi {
|
||||
this._classesApi = this._classesApi ?? new ClassesApi(this.alfrescoApiService.getInstance());
|
||||
return this._classesApi;
|
||||
}
|
||||
@LazyApi((self: PropertyDescriptorsService) => new ClassesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly classesApi: ClassesApi;
|
||||
|
||||
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
||||
const groupFetchStreams = groupNames
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import { DestroyRef, Directive, HostListener, inject, Input, NgZone, OnChanges } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { LazyApi, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
|
||||
import { ShareDialogComponent } from './content-node-share.dialog';
|
||||
import { from, Observable } from 'rxjs';
|
||||
@@ -45,11 +45,8 @@ export class NodeSharedDirective implements OnChanges {
|
||||
@Input()
|
||||
baseShareUrl: string;
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: NodeSharedDirective) => new NodesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
shareNode(nodeEntry: NodeEntry) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { NodePaging, SharedLinkBodyCreate, SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
||||
import { LazyApi, NodePaging, SharedLinkBodyCreate, SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
||||
import { Observable, from, of, Subject } from 'rxjs';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
@@ -31,11 +31,8 @@ export class SharedLinksApiService {
|
||||
|
||||
error = new Subject<{ statusCode: number; message: string }>();
|
||||
|
||||
private _sharedLinksApi: SharedlinksApi;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
this._sharedLinksApi = this._sharedLinksApi ?? new SharedlinksApi(this.apiService.getInstance());
|
||||
return this._sharedLinksApi;
|
||||
}
|
||||
@LazyApi((self: SharedLinksApiService) => new SharedlinksApi(self.apiService.getInstance()))
|
||||
declare readonly sharedLinksApi: SharedlinksApi;
|
||||
|
||||
/**
|
||||
* Gets shared links available to the current user.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api';
|
||||
import { LazyApi, TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { from, Observable } from 'rxjs';
|
||||
@@ -27,11 +27,8 @@ import { map } from 'rxjs/operators';
|
||||
export class ContentTypeService {
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
private _typesApi: TypesApi;
|
||||
get typesApi(): TypesApi {
|
||||
this._typesApi = this._typesApi ?? new TypesApi(this.alfrescoApiService.getInstance());
|
||||
return this._typesApi;
|
||||
}
|
||||
@LazyApi((self: ContentTypeService) => new TypesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly typesApi: TypesApi;
|
||||
|
||||
getContentTypeByPrefix(prefixedType: string): Observable<TypeEntry> {
|
||||
return from(this.typesApi.getType(prefixedType));
|
||||
|
||||
@@ -62,11 +62,7 @@ class DownloadsApiMock extends DownloadsApi {
|
||||
}
|
||||
|
||||
export class DownloadZipMockService extends DownloadZipService {
|
||||
private _mockDownloadsApi: DownloadsApi;
|
||||
get downloadsApi(): DownloadsApi {
|
||||
this._mockDownloadsApi = this._mockDownloadsApi ?? new DownloadsApiMock();
|
||||
return this._mockDownloadsApi;
|
||||
}
|
||||
override readonly downloadsApi: DownloadsApi = new DownloadsApiMock();
|
||||
|
||||
createDownload(payload: DownloadBodyCreate): Observable<DownloadEntry> {
|
||||
return from(this.downloadsApi.createDownload(payload)).pipe(catchError((err) => of(err)));
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api';
|
||||
import { DownloadEntry, DownloadBodyCreate, DownloadsApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
@@ -26,11 +26,8 @@ import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
export class DownloadZipService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _downloadsApi: DownloadsApi;
|
||||
get downloadsApi(): DownloadsApi {
|
||||
this._downloadsApi = this._downloadsApi ?? new DownloadsApi(this.apiService.getInstance());
|
||||
return this._downloadsApi;
|
||||
}
|
||||
@LazyApi((self: DownloadZipService) => new DownloadsApi(self.apiService.getInstance()))
|
||||
declare readonly downloadsApi: DownloadsApi;
|
||||
|
||||
/**
|
||||
* Creates a new download.
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
Validators
|
||||
} from '@angular/forms';
|
||||
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { QueriesApi, SiteBodyCreate, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { LazyApi, QueriesApi, SiteBodyCreate, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { debounceTime, finalize, map, mergeMap, take } from 'rxjs/operators';
|
||||
import { SitesService } from '../../common/services/sites.service';
|
||||
@@ -101,11 +101,8 @@ export class LibraryDialogComponent implements OnInit {
|
||||
];
|
||||
disableCreateButton = false;
|
||||
|
||||
_queriesApi: QueriesApi;
|
||||
get queriesApi(): QueriesApi {
|
||||
this._queriesApi = this._queriesApi ?? new QueriesApi(this.alfrescoApiService.getInstance());
|
||||
return this._queriesApi;
|
||||
}
|
||||
@LazyApi((self: LibraryDialogComponent) => new QueriesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly queriesApi: QueriesApi;
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Component, OnInit, ViewEncapsulation, inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { differenceInSeconds } from 'date-fns';
|
||||
import { NodeBodyLock, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { NodeBodyLock, Node, NodeEntry, NodesApi, LazyApi } from '@alfresco/js-api';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
@@ -55,11 +55,8 @@ export class NodeLockDialogComponent implements OnInit {
|
||||
node: Node = null;
|
||||
nodeName: string;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApi.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: NodeLockDialogComponent) => new NodesApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
ngOnInit() {
|
||||
const { node } = this.data;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Directive, HostListener, Input, OnChanges, Output, EventEmitter, SimpleChanges, inject } from '@angular/core';
|
||||
import { FavoriteBodyCreate, FavoritesApi } from '@alfresco/js-api';
|
||||
import { FavoriteBodyCreate, FavoritesApi, LazyApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { LibraryEntity } from '../interfaces/library-entity.interface';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
@@ -39,11 +39,8 @@ export class LibraryFavoriteDirective implements OnChanges {
|
||||
|
||||
private targetLibrary = null;
|
||||
|
||||
private _favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.alfrescoApiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
@LazyApi((self: LibraryFavoriteDirective) => new FavoritesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly favoritesApi: FavoritesApi;
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core';
|
||||
import { SiteEntry, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry, SitesApi } from '@alfresco/js-api';
|
||||
import { LazyApi, SiteEntry, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry, SitesApi } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, from, Observable } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { LibraryMembershipToggleEvent } from '../interfaces/library-membership-toggle-event.interface';
|
||||
@@ -38,11 +38,8 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
|
||||
isJoinRequested: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
private _sitesApi: SitesApi;
|
||||
get sitesApi(): SitesApi {
|
||||
this._sitesApi = this._sitesApi ?? new SitesApi(this.alfrescoApiService.getInstance());
|
||||
return this._sitesApi;
|
||||
}
|
||||
@LazyApi((self: LibraryMembershipDirective) => new SitesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly sitesApi: SitesApi;
|
||||
|
||||
/** Site for which to toggle the membership request. */
|
||||
@Input('adf-library-membership')
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/* eslint-disable @angular-eslint/no-input-rename */
|
||||
|
||||
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, inject } from '@angular/core';
|
||||
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
|
||||
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { map, catchError, retry } from 'rxjs/operators';
|
||||
@@ -67,17 +67,11 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
@Output()
|
||||
delete: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
private _trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.alfrescoApiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
@LazyApi((self: NodeDeleteDirective) => new TrashcanApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly trashcanApi: TrashcanApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: NodeDeleteDirective) => new NodesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Directive, Input, HostListener, inject } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { DownloadService } from '@alfresco/adf-core';
|
||||
import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
|
||||
import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||
import { ContentApi, LazyApi, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
/**
|
||||
@@ -35,11 +35,8 @@ export class NodeDownloadDirective {
|
||||
private readonly downloadService = inject(DownloadService);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: NodeDownloadDirective) => new ContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
/** Nodes to download. */
|
||||
@Input('adfNodeDownload')
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/* eslint-disable @angular-eslint/no-input-rename */
|
||||
|
||||
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges, inject } from '@angular/core';
|
||||
import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi } from '@alfresco/js-api';
|
||||
import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, from, forkJoin, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
@@ -35,11 +35,8 @@ export class NodeFavoriteDirective implements OnChanges {
|
||||
|
||||
favorites: any[] = [];
|
||||
|
||||
private _favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.alfrescoApiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
@LazyApi((self: NodeFavoriteDirective) => new FavoritesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly favoritesApi: FavoritesApi;
|
||||
|
||||
/** Array of nodes to toggle as favorites. */
|
||||
@Input('adf-node-favorite')
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
||||
|
||||
import { Directive, EventEmitter, HostListener, Input, Output, inject } from '@angular/core';
|
||||
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging } from '@alfresco/js-api';
|
||||
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
||||
import { tap, mergeMap, map, catchError } from 'rxjs/operators';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
@@ -35,11 +35,8 @@ export class NodeRestoreDirective {
|
||||
|
||||
private readonly restoreProcessStatus;
|
||||
|
||||
private _trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.alfrescoApiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
@LazyApi((self: NodeRestoreDirective) => new TrashcanApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly trashcanApi: TrashcanApi;
|
||||
|
||||
/** Array of deleted nodes to restore. */
|
||||
@Input('adf-restore')
|
||||
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
UserPreferencesService,
|
||||
UserPreferenceValues
|
||||
} from '@alfresco/adf-core';
|
||||
import { Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api';
|
||||
import { LazyApi, Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api';
|
||||
import {
|
||||
AfterContentInit,
|
||||
Component,
|
||||
@@ -469,11 +469,8 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: DocumentListComponent) => new NodesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
constructor() {
|
||||
const appConfig = inject(AppConfigService);
|
||||
|
||||
@@ -33,7 +33,8 @@ import {
|
||||
NodesApi,
|
||||
SitePaging,
|
||||
ResultSetPaging,
|
||||
SEARCH_LANGUAGE
|
||||
SEARCH_LANGUAGE,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, of } from 'rxjs';
|
||||
@@ -45,47 +46,26 @@ const CREATE_PERMISSION: string = 'create';
|
||||
export class CustomResourcesService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _peopleApi: PeopleApi;
|
||||
get peopleApi(): PeopleApi {
|
||||
this._peopleApi = this._peopleApi ?? new PeopleApi(this.apiService.getInstance());
|
||||
return this._peopleApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new PeopleApi(self.apiService.getInstance()))
|
||||
declare readonly peopleApi: PeopleApi;
|
||||
|
||||
private _sitesApi: SitesApi;
|
||||
get sitesApi(): SitesApi {
|
||||
this._sitesApi = this._sitesApi ?? new SitesApi(this.apiService.getInstance());
|
||||
return this._sitesApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new SitesApi(self.apiService.getInstance()))
|
||||
declare readonly sitesApi: SitesApi;
|
||||
|
||||
private _trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.apiService.getInstance());
|
||||
return this._trashcanApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new TrashcanApi(self.apiService.getInstance()))
|
||||
declare readonly trashcanApi: TrashcanApi;
|
||||
|
||||
private _searchApi: SearchApi;
|
||||
get searchApi(): SearchApi {
|
||||
this._searchApi = this._searchApi ?? new SearchApi(this.apiService.getInstance());
|
||||
return this._searchApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new SearchApi(self.apiService.getInstance()))
|
||||
declare readonly searchApi: SearchApi;
|
||||
|
||||
private _sharedLinksApi: SharedlinksApi;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
this._sharedLinksApi = this._sharedLinksApi ?? new SharedlinksApi(this.apiService.getInstance());
|
||||
return this._sharedLinksApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new SharedlinksApi(self.apiService.getInstance()))
|
||||
declare readonly sharedLinksApi: SharedlinksApi;
|
||||
|
||||
private _favoritesApi: FavoritesApi;
|
||||
get favoritesApi(): FavoritesApi {
|
||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.apiService.getInstance());
|
||||
return this._favoritesApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new FavoritesApi(self.apiService.getInstance()))
|
||||
declare readonly favoritesApi: FavoritesApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: CustomResourcesService) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
/**
|
||||
* Gets files recently accessed by a user.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { PaginationModel } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Node, NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api';
|
||||
import { LazyApi, Node, NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api';
|
||||
import { DocumentLoaderNode } from '../models/document-folder.model';
|
||||
import { Observable, from, forkJoin, Subject } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -36,11 +36,8 @@ export class DocumentListService implements DocumentListLoader {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
private readonly customResourcesService = inject(CustomResourcesService);
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodes(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: DocumentListService) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodes: NodesApi;
|
||||
|
||||
private readonly _reload = new Subject<void>();
|
||||
private readonly _resetSelection = new Subject<void>();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { ContentIncludeQuery, Group, GroupEntry, GroupsApi } from '@alfresco/js-api';
|
||||
import { ContentIncludeQuery, Group, GroupEntry, GroupsApi, LazyApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -27,11 +27,8 @@ import { map } from 'rxjs/operators';
|
||||
export class GroupService {
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
private _groupsApi: GroupsApi;
|
||||
get groupsApi(): GroupsApi {
|
||||
this._groupsApi = this._groupsApi ?? new GroupsApi(this.alfrescoApiService.getInstance());
|
||||
return this._groupsApi;
|
||||
}
|
||||
@LazyApi((self: GroupService) => new GroupsApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly groupsApi: GroupsApi;
|
||||
|
||||
async listAllGroupMembershipsForPerson(personId: string, opts?: any, accumulator = []): Promise<GroupEntry[]> {
|
||||
const groupsPaginated = await this.groupsApi.listGroupMembershipsForPerson(personId, opts);
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
HoldBulkStatusEntry,
|
||||
HoldEntry,
|
||||
HoldPaging,
|
||||
LazyApi,
|
||||
LegalHoldApi,
|
||||
RequestQuery
|
||||
} from '@alfresco/js-api';
|
||||
@@ -37,11 +38,8 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
export class LegalHoldService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _legalHoldApi: LegalHoldApi;
|
||||
get legalHoldApi(): LegalHoldApi {
|
||||
this._legalHoldApi = this._legalHoldApi ?? new LegalHoldApi(this.apiService.getInstance());
|
||||
return this._legalHoldApi;
|
||||
}
|
||||
@LazyApi((self: LegalHoldService) => new LegalHoldApi(self.apiService.getInstance()))
|
||||
declare readonly legalHoldApi: LegalHoldApi;
|
||||
|
||||
/**
|
||||
* Gets the list of holds available in the file plan.
|
||||
|
||||
@@ -20,7 +20,7 @@ import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog';
|
||||
import { VersionsApi } from '@alfresco/js-api';
|
||||
import { VersionsApi, LazyApi } from '@alfresco/js-api';
|
||||
import { NewVersionUploaderData, NewVersionUploaderDialogData } from './models';
|
||||
import { Observable } from 'rxjs';
|
||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
@@ -34,11 +34,8 @@ export class NewVersionUploaderService {
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly overlayContainer = inject(OverlayContainer);
|
||||
|
||||
private _versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
@LazyApi((self: NewVersionUploaderService) => new VersionsApi(self.apiService.getInstance()))
|
||||
declare readonly versionsApi: VersionsApi;
|
||||
|
||||
/**
|
||||
* Open a dialog NewVersionUploaderDialogComponent to display:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { CommentModel, CommentsService, User } from '@alfresco/adf-core';
|
||||
import { CommentEntry, CommentsApi, Comment, PeopleApi } from '@alfresco/js-api';
|
||||
import { CommentEntry, CommentsApi, Comment, PeopleApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -28,17 +28,11 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
export class NodeCommentsService implements CommentsService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _commentsApi: CommentsApi;
|
||||
get commentsApi(): CommentsApi {
|
||||
this._commentsApi = this._commentsApi ?? new CommentsApi(this.apiService.getInstance());
|
||||
return this._commentsApi;
|
||||
}
|
||||
@LazyApi((self: NodeCommentsService) => new CommentsApi(self.apiService.getInstance()))
|
||||
declare readonly commentsApi: CommentsApi;
|
||||
|
||||
private _peopleApi: PeopleApi;
|
||||
get peopleApi(): PeopleApi {
|
||||
this._peopleApi = this._peopleApi ?? new PeopleApi(this.apiService.getInstance());
|
||||
return this._peopleApi;
|
||||
}
|
||||
@LazyApi((self: NodeCommentsService) => new PeopleApi(self.apiService.getInstance()))
|
||||
declare readonly peopleApi: PeopleApi;
|
||||
|
||||
/**
|
||||
* Gets all comments that have been added to a task.
|
||||
|
||||
@@ -19,7 +19,7 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
||||
import { Group, GroupMemberPaging, GroupsApi, Node, PathElement, PermissionElement, SearchRequest } from '@alfresco/js-api';
|
||||
import { Group, GroupMemberPaging, GroupsApi, LazyApi, Node, PathElement, PermissionElement, SearchRequest } from '@alfresco/js-api';
|
||||
import { SearchService } from '../../search/services/search.service';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { forkJoin, from, Observable, of, throwError } from 'rxjs';
|
||||
@@ -36,11 +36,8 @@ export class NodePermissionService {
|
||||
private readonly nodeService = inject(NodesApiService);
|
||||
private readonly translation = inject(TranslationService);
|
||||
|
||||
private _groupsApi: GroupsApi;
|
||||
get groupsApi(): GroupsApi {
|
||||
this._groupsApi = this._groupsApi ?? new GroupsApi(this.apiService.getInstance());
|
||||
return this._groupsApi;
|
||||
}
|
||||
@LazyApi((self: NodePermissionService) => new GroupsApi(self.apiService.getInstance()))
|
||||
declare readonly groupsApi: GroupsApi;
|
||||
|
||||
/**
|
||||
* Gets a list of roles for the current node.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { PredictionsApi, PredictionPaging, ReviewStatus } from '@alfresco/js-api';
|
||||
import { PredictionsApi, PredictionPaging, ReviewStatus, LazyApi } from '@alfresco/js-api';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@@ -24,12 +24,8 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
export class PredictionService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _predictionsApi: PredictionsApi;
|
||||
|
||||
get predictionsApi(): PredictionsApi {
|
||||
this._predictionsApi = this._predictionsApi ?? new PredictionsApi(this.apiService.getInstance());
|
||||
return this._predictionsApi;
|
||||
}
|
||||
@LazyApi((self: PredictionService) => new PredictionsApi(self.apiService.getInstance()))
|
||||
declare readonly predictionsApi: PredictionsApi;
|
||||
|
||||
/**
|
||||
* Get predictions for a given node
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { AiAnswerEntry, KnowledgeRetrievalConfigEntry, QuestionModel, QuestionRequest, SearchAiApi } from '@alfresco/js-api';
|
||||
import { AiAnswerEntry, KnowledgeRetrievalConfigEntry, LazyApi, QuestionModel, QuestionRequest, SearchAiApi } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, from, Observable } from 'rxjs';
|
||||
import { SelectionState } from '@alfresco/adf-extensions';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@@ -33,12 +33,9 @@ export class SearchAiService {
|
||||
private readonly toggleSearchAiInput = new BehaviorSubject<SearchAiInputState>({
|
||||
active: false
|
||||
});
|
||||
private _searchAiApi: SearchAiApi;
|
||||
|
||||
get searchAiApi(): SearchAiApi {
|
||||
this._searchAiApi = this._searchAiApi ?? new SearchAiApi(this.apiService.getInstance());
|
||||
return this._searchAiApi;
|
||||
}
|
||||
@LazyApi((self: SearchAiService) => new SearchAiApi(self.apiService.getInstance()))
|
||||
declare readonly searchAiApi: SearchAiApi;
|
||||
|
||||
toggleSearchAiInput$ = this.toggleSearchAiInput.asObservable();
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import { BehaviorSubject, from, Observable, ReplaySubject, Subject } from 'rxjs';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import {
|
||||
LazyApi,
|
||||
RequestFacetFields,
|
||||
RequestHighlight,
|
||||
RequestScope,
|
||||
@@ -43,11 +44,9 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
export abstract class BaseQueryBuilderService {
|
||||
private readonly router = inject(Router);
|
||||
private readonly activatedRoute = inject(ActivatedRoute);
|
||||
private _searchApi: SearchApi;
|
||||
get searchApi(): SearchApi {
|
||||
this._searchApi = this._searchApi ?? new SearchApi(this.alfrescoApiService.getInstance());
|
||||
return this._searchApi;
|
||||
}
|
||||
|
||||
@LazyApi((self: BaseQueryBuilderService) => new SearchApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly searchApi: SearchApi;
|
||||
|
||||
/* Stream that emits the search configuration whenever the user change the search forms */
|
||||
configUpdated = new Subject<SearchConfiguration>();
|
||||
@@ -693,7 +692,7 @@ export abstract class BaseQueryBuilderService {
|
||||
} else {
|
||||
const configurations = this.loadConfiguration();
|
||||
if (Array.isArray(configurations)) {
|
||||
const defaultConfig = configurations.find(config => config.default);
|
||||
const defaultConfig = configurations.find((config) => config.default);
|
||||
if (defaultConfig && this.selectedConfigurationId !== defaultConfig.id) {
|
||||
this.setSelectedConfiguration(defaultConfig.id);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { NodePaging, QueriesApi, SearchRequest, ResultSetPaging, SearchApi } from '@alfresco/js-api';
|
||||
import { NodePaging, QueriesApi, SearchRequest, ResultSetPaging, SearchApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, Subject, from } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { SearchConfigurationService } from './search-configuration.service';
|
||||
@@ -30,17 +30,11 @@ export class SearchService {
|
||||
|
||||
dataLoaded = new Subject<ResultSetPaging>();
|
||||
|
||||
private _queriesApi: QueriesApi;
|
||||
get queriesApi(): QueriesApi {
|
||||
this._queriesApi = this._queriesApi ?? new QueriesApi(this.apiService.getInstance());
|
||||
return this._queriesApi;
|
||||
}
|
||||
@LazyApi((self: SearchService) => new QueriesApi(self.apiService.getInstance()))
|
||||
declare readonly queriesApi: QueriesApi;
|
||||
|
||||
private _searchApi: SearchApi;
|
||||
get searchApi(): SearchApi {
|
||||
this._searchApi = this._searchApi ?? new SearchApi(this.apiService.getInstance());
|
||||
return this._searchApi;
|
||||
}
|
||||
@LazyApi((self: SearchService) => new SearchApi(self.apiService.getInstance()))
|
||||
declare readonly searchApi: SearchApi;
|
||||
|
||||
/**
|
||||
* Gets a list of nodes that match the given search criteria.
|
||||
|
||||
@@ -30,7 +30,8 @@ import {
|
||||
AuthorityClearanceApi,
|
||||
AuthorityClearanceGroupPaging,
|
||||
NodeSecurityMarkBody,
|
||||
GsGroupInclude
|
||||
GsGroupInclude,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { finalize } from 'rxjs/operators';
|
||||
@@ -59,25 +60,14 @@ export class SecurityControlsService {
|
||||
private readonly loadingSource = new BehaviorSubject<boolean>(true);
|
||||
loading$ = this.loadingSource.asObservable();
|
||||
|
||||
private securityGroup: SecurityGroupsApi;
|
||||
private securityMark: SecurityMarksApi;
|
||||
private authorityClearance: AuthorityClearanceApi;
|
||||
@LazyApi((self: SecurityControlsService) => new SecurityGroupsApi(self.apiService.getInstance()))
|
||||
declare readonly groupsApi: SecurityGroupsApi;
|
||||
|
||||
get groupsApi(): SecurityGroupsApi {
|
||||
return this.securityGroup || (this.securityGroup = new SecurityGroupsApi(this.apiService.getInstance()));
|
||||
}
|
||||
@LazyApi((self: SecurityControlsService) => new SecurityMarksApi(self.apiService.getInstance()))
|
||||
declare readonly marksApi: SecurityMarksApi;
|
||||
|
||||
get marksApi(): SecurityMarksApi {
|
||||
return this.securityMark || (this.securityMark = new SecurityMarksApi(this.apiService.getInstance()));
|
||||
}
|
||||
|
||||
get authorityClearanceApi(): AuthorityClearanceApi {
|
||||
return this.authorityClearance || (this.authorityClearance = new AuthorityClearanceApi(this.apiService.getInstance()));
|
||||
}
|
||||
|
||||
get reloadAuthorityClearance(): Subject<void> {
|
||||
return this._reloadAuthorityClearance;
|
||||
}
|
||||
@LazyApi((self: SecurityControlsService) => new AuthorityClearanceApi(self.apiService.getInstance()))
|
||||
declare readonly authorityClearanceApi: AuthorityClearanceApi;
|
||||
|
||||
/**
|
||||
* Get All security groups
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { EventEmitter, Injectable, Output, inject } from '@angular/core';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
import { TagBody, TagEntry, TagPaging, TagsApi } from '@alfresco/js-api';
|
||||
import { LazyApi, TagBody, TagEntry, TagPaging, TagsApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -30,11 +30,8 @@ export class TagService {
|
||||
private readonly userPreferencesService = inject(UserPreferencesService);
|
||||
private readonly appConfigService = inject(AppConfigService);
|
||||
|
||||
private _tagsApi: TagsApi;
|
||||
get tagsApi(): TagsApi {
|
||||
this._tagsApi = this._tagsApi ?? new TagsApi(this.apiService.getInstance());
|
||||
return this._tagsApi;
|
||||
}
|
||||
@LazyApi((self: TagService) => new TagsApi(self.apiService.getInstance()))
|
||||
declare readonly tagsApi: TagsApi;
|
||||
|
||||
/** Emitted when tag information is updated. */
|
||||
@Output()
|
||||
|
||||
@@ -17,21 +17,15 @@
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { ContentApi } from '@alfresco/js-api';
|
||||
import { ContentApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ContentVersionService {
|
||||
private readonly alfrescoApi = inject(AlfrescoApiService);
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
|
||||
get contentApi(): ContentApi {
|
||||
if (!this._contentApi) {
|
||||
this._contentApi = new ContentApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: ContentVersionService) => new ContentApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
/**
|
||||
* Get content URL for the given nodeId and specific version.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { ConfirmDialogComponent, IconModule } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ContentApi, ContentPagingQuery, Node, NodeEntry, NodesApi, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { ContentApi, ContentPagingQuery, LazyApi, Node, NodeEntry, NodesApi, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ContentVersionService } from './content-version.service';
|
||||
import { ContentService } from '../common';
|
||||
@@ -77,23 +77,14 @@ export class VersionListComponent implements OnChanges, OnInit {
|
||||
private readonly contentVersionService = inject(ContentVersionService);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.alfrescoApi.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: VersionListComponent) => new ContentApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
private _versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.alfrescoApi.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
@LazyApi((self: VersionListComponent) => new VersionsApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly versionsApi: VersionsApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApi.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: VersionListComponent) => new NodesApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
versionsDataSource: VersionListDataSource;
|
||||
latestVersion: VersionEntry;
|
||||
|
||||
@@ -45,7 +45,7 @@ import {
|
||||
ViewUtilService
|
||||
} from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { ContentApi, Node, NodeEntry, NodesApi, RenditionEntry, SharedlinksApi, Version, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { ContentApi, LazyApi, Node, NodeEntry, NodesApi, RenditionEntry, SharedlinksApi, Version, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { RenditionService } from '../../common/services/rendition.service';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { filter } from 'rxjs/operators';
|
||||
@@ -240,29 +240,17 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit {
|
||||
sidebarRightTemplateContext: { node: Node } = { node: null };
|
||||
sidebarLeftTemplateContext: { node: Node } = { node: null };
|
||||
|
||||
private _sharedLinksApi: SharedlinksApi;
|
||||
get sharedLinksApi(): SharedlinksApi {
|
||||
this._sharedLinksApi = this._sharedLinksApi ?? new SharedlinksApi(this.apiService.getInstance());
|
||||
return this._sharedLinksApi;
|
||||
}
|
||||
@LazyApi((self: AlfrescoViewerComponent) => new SharedlinksApi(self.apiService.getInstance()))
|
||||
declare readonly sharedLinksApi: SharedlinksApi;
|
||||
|
||||
private _versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.apiService.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
@LazyApi((self: AlfrescoViewerComponent) => new VersionsApi(self.apiService.getInstance()))
|
||||
declare readonly versionsApi: VersionsApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: AlfrescoViewerComponent) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: AlfrescoViewerComponent) => new ContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import { MultiBarChart } from '../../diagram/models/chart/multi-bar-chart.model'
|
||||
import { PieChart } from '../../diagram/models/chart/pie-chart.model';
|
||||
import { TableChart } from '../../diagram/models/chart/table-chart.model';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ProcessDefinitionsApi, ReportApi } from '@alfresco/js-api';
|
||||
import { LazyApi, ProcessDefinitionsApi, ReportApi } from '@alfresco/js-api';
|
||||
import { ReportQuery } from '../../diagram/models/report/report-query.model';
|
||||
import { LineChart } from '../../diagram/models/chart/line-chart.model';
|
||||
|
||||
@@ -36,17 +36,11 @@ import { LineChart } from '../../diagram/models/chart/line-chart.model';
|
||||
export class AnalyticsService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _reportApi: ReportApi;
|
||||
get reportApi(): ReportApi {
|
||||
this._reportApi = this._reportApi ?? new ReportApi(this.apiService.getInstance());
|
||||
return this._reportApi;
|
||||
}
|
||||
@LazyApi((self: AnalyticsService) => new ReportApi(self.apiService.getInstance()))
|
||||
declare readonly reportApi: ReportApi;
|
||||
|
||||
private _processDefinitionsApi: ProcessDefinitionsApi;
|
||||
get processDefinitionsApi(): ProcessDefinitionsApi {
|
||||
this._processDefinitionsApi = this._processDefinitionsApi ?? new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
return this._processDefinitionsApi;
|
||||
}
|
||||
@LazyApi((self: AnalyticsService) => new ProcessDefinitionsApi(self.apiService.getInstance()))
|
||||
declare readonly processDefinitionsApi: ProcessDefinitionsApi;
|
||||
|
||||
/**
|
||||
* Retrieve all the Deployed app
|
||||
|
||||
@@ -18,17 +18,14 @@
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { ModelJsonBpmnApi } from '@alfresco/js-api';
|
||||
import { LazyApi, ModelJsonBpmnApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DiagramsService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _modelJsonBpmnApi: ModelJsonBpmnApi;
|
||||
get modelJsonBpmnApi(): ModelJsonBpmnApi {
|
||||
this._modelJsonBpmnApi = this._modelJsonBpmnApi ?? new ModelJsonBpmnApi(this.apiService.getInstance());
|
||||
return this._modelJsonBpmnApi;
|
||||
}
|
||||
@LazyApi((self: DiagramsService) => new ModelJsonBpmnApi(self.apiService.getInstance()))
|
||||
declare readonly modelJsonBpmnApi: ModelJsonBpmnApi;
|
||||
|
||||
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
||||
return from(this.modelJsonBpmnApi.getModelJSON(processDefinitionId));
|
||||
|
||||
@@ -16,4 +16,5 @@
|
||||
*/
|
||||
|
||||
export * from './is-browser';
|
||||
export * from './lazy-api';
|
||||
export * from './param-to-string';
|
||||
|
||||
37
lib/js-api/src/utils/lazy-api.ts
Normal file
37
lib/js-api/src/utils/lazy-api.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LazyApi is a decorator that creates a lazy-loaded API instance.
|
||||
* @param factory - A function that creates the API instance.
|
||||
* @returns A decorator function that can be used to decorate a class property.
|
||||
*/
|
||||
export function LazyApi<T>(factory: (self: any) => T) {
|
||||
return function (target: any, propertyKey: string) {
|
||||
const cacheKey = `_${propertyKey}`;
|
||||
Object.defineProperty(target, propertyKey, {
|
||||
get() {
|
||||
if (!this[cacheKey]) {
|
||||
this[cacheKey] = factory(this);
|
||||
}
|
||||
return this[cacheKey];
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
}
|
||||
128
lib/js-api/test/lazy-api.spec.ts
Normal file
128
lib/js-api/test/lazy-api.spec.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import assert from 'assert';
|
||||
import { LazyApi } from '../src/utils/lazy-api';
|
||||
|
||||
describe('LazyApi', () => {
|
||||
it('should create a lazy-loaded property on the target prototype', () => {
|
||||
class TestApi {
|
||||
@LazyApi(() => ({ value: 13 }))
|
||||
api: { value: number };
|
||||
}
|
||||
|
||||
const instance = new TestApi();
|
||||
assert.deepStrictEqual(instance.api, { value: 13 });
|
||||
});
|
||||
|
||||
it('should cache the instance of the property after first access', () => {
|
||||
let accessCount = 0;
|
||||
|
||||
class TestApi {
|
||||
@LazyApi(() => {
|
||||
accessCount++;
|
||||
return { value: 'cached' };
|
||||
})
|
||||
api: { value: string };
|
||||
}
|
||||
|
||||
const instance = new TestApi();
|
||||
const first = instance.api;
|
||||
const second = instance.api;
|
||||
|
||||
assert.strictEqual(first, second);
|
||||
assert.strictEqual(accessCount, 1);
|
||||
});
|
||||
|
||||
it('should pass the class instance as argument to the factory', () => {
|
||||
let receivedSelf: any;
|
||||
|
||||
class TestApi {
|
||||
config = 'test-config';
|
||||
|
||||
@LazyApi((self: any) => {
|
||||
receivedSelf = self;
|
||||
return { config: self.config };
|
||||
})
|
||||
api: { config: string };
|
||||
}
|
||||
|
||||
const instance = new TestApi();
|
||||
const result = instance.api;
|
||||
|
||||
assert.strictEqual(receivedSelf, instance);
|
||||
assert.deepStrictEqual(result, { config: 'test-config' });
|
||||
});
|
||||
|
||||
it('should create separate cached instances per class instance', () => {
|
||||
let accessCount = 0;
|
||||
|
||||
class TestApi {
|
||||
@LazyApi(() => {
|
||||
accessCount++;
|
||||
return { id: accessCount };
|
||||
})
|
||||
api: { id: number };
|
||||
}
|
||||
|
||||
const instance1 = new TestApi();
|
||||
const instance2 = new TestApi();
|
||||
|
||||
assert.strictEqual(instance1.api.id, 1);
|
||||
assert.strictEqual(instance2.api.id, 2);
|
||||
assert.strictEqual(accessCount, 2);
|
||||
});
|
||||
|
||||
it('should define the property as enumerable and configurable', () => {
|
||||
class TestApi {
|
||||
@LazyApi(() => 'value')
|
||||
api: string;
|
||||
}
|
||||
|
||||
const descriptor = Object.getOwnPropertyDescriptor(TestApi.prototype, 'api');
|
||||
assert.strictEqual(descriptor.enumerable, true);
|
||||
assert.strictEqual(descriptor.configurable, true);
|
||||
});
|
||||
|
||||
it('should support multiple decorated properties on the same class', () => {
|
||||
class TestApi {
|
||||
@LazyApi(() => 'first')
|
||||
api1: string;
|
||||
|
||||
@LazyApi(() => 'second')
|
||||
api2: string;
|
||||
}
|
||||
|
||||
const instance = new TestApi();
|
||||
assert.strictEqual(instance.api1, 'first');
|
||||
assert.strictEqual(instance.api2, 'second');
|
||||
});
|
||||
|
||||
it('should store cached value under _propertyKey on the instance', () => {
|
||||
class TestApi {
|
||||
@LazyApi(() => 'cached-value')
|
||||
myApi: string;
|
||||
}
|
||||
|
||||
const instance = new TestApi();
|
||||
assert.strictEqual(instance['_myApi'], undefined);
|
||||
|
||||
instance.myApi;
|
||||
|
||||
assert.strictEqual(instance['_myApi'], 'cached-value');
|
||||
});
|
||||
});
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
ErrorWidgetComponent,
|
||||
IconModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { Node, NodesApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { LazyApi, Node, NodesApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { ContentCloudNodeSelectorService } from '../../../services/content-cloud-node-selector.service';
|
||||
import { UploadCloudWidgetComponent } from '../upload/upload-cloud.widget';
|
||||
import { DestinationFolderPathModel, DestinationFolderPathType } from '../../../models/form-cloud-representation.model';
|
||||
@@ -72,11 +72,10 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
private previewState = false;
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
|
||||
@LazyApi((self: AttachFileCloudWidgetComponent) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
displayedColumns = ['icon', 'fileName', 'title', 'action'];
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Injectable, inject } from '@angular/core';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ContentNodeSelectorComponent, ContentNodeSelectorComponentData, NodeAction, AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { LazyApi, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { firstValueFrom, from, Observable, Subject, throwError } from 'rxjs';
|
||||
import { catchError, map, mapTo } from 'rxjs/operators';
|
||||
import { DestinationFolderPathModel } from '../models/form-cloud-representation.model';
|
||||
@@ -32,11 +32,8 @@ export class ContentCloudNodeSelectorService {
|
||||
private readonly notificationService = inject(NotificationService);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: ContentCloudNodeSelectorService) => new NodesApi(self.apiService.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
sourceNodeNotFound = false;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import { FormValues, FormModel, FormFieldOption, FormFieldValidator, FormService
|
||||
import { Observable, from, EMPTY } from 'rxjs';
|
||||
import { expand, map, reduce, switchMap } from 'rxjs/operators';
|
||||
import { TaskDetailsCloudModel } from '../../task/models/task-details-cloud.model';
|
||||
import { CompleteFormRepresentation, UploadApi } from '@alfresco/js-api';
|
||||
import { CompleteFormRepresentation, LazyApi, UploadApi } from '@alfresco/js-api';
|
||||
import { TaskVariableCloud } from '../models/task-variable-cloud.model';
|
||||
import { BaseCloudService } from '../../services/base-cloud.service';
|
||||
import { FormContent } from '../../services/form-fields.interfaces';
|
||||
@@ -32,13 +32,11 @@ export const FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN = new InjectionToken<Form
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FormCloudService extends BaseCloudService implements FormCloudServiceInterface {
|
||||
private _uploadApi: UploadApi;
|
||||
private readonly fieldValidators: FormFieldValidator[] = inject(FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN, { optional: true }) ?? [];
|
||||
private readonly formService = inject(FormService);
|
||||
get uploadApi(): UploadApi {
|
||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
||||
return this._uploadApi;
|
||||
}
|
||||
|
||||
@LazyApi((self: FormCloudService) => new UploadApi(self.apiService.getInstance()))
|
||||
declare readonly uploadApi: UploadApi;
|
||||
|
||||
/**
|
||||
* Gets the form definition of a task.
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Observable, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { DownloadService } from '@alfresco/adf-core';
|
||||
import { ContentService, NodesApiService, AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { AuthenticationApi, Node, UploadApi } from '@alfresco/js-api';
|
||||
import { AuthenticationApi, LazyApi, Node, UploadApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -31,17 +31,11 @@ export class ProcessCloudContentService {
|
||||
private readonly contentService = inject(ContentService);
|
||||
private readonly downloadService = inject(DownloadService);
|
||||
|
||||
private _uploadApi: UploadApi;
|
||||
get uploadApi(): UploadApi {
|
||||
this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance());
|
||||
return this._uploadApi;
|
||||
}
|
||||
@LazyApi((self: ProcessCloudContentService) => new UploadApi(self.apiService.getInstance()))
|
||||
uploadApi: UploadApi;
|
||||
|
||||
private _authenticationApi: AuthenticationApi;
|
||||
get authenticationApi(): AuthenticationApi {
|
||||
this._authenticationApi = this._authenticationApi ?? new AuthenticationApi(this.apiService.getInstance());
|
||||
return this._authenticationApi;
|
||||
}
|
||||
@LazyApi((self: ProcessCloudContentService) => new AuthenticationApi(self.apiService.getInstance()))
|
||||
authenticationApi: AuthenticationApi;
|
||||
|
||||
createTemporaryRawRelatedContent(file: File, nodeId: string): Observable<Node> {
|
||||
return from(this.uploadApi.uploadFile(file, '', nodeId, null, { overwrite: true })).pipe(
|
||||
|
||||
@@ -24,7 +24,8 @@ import {
|
||||
RelatedContentRepresentation,
|
||||
ActivitiContentApi,
|
||||
AlfrescoEndpointRepresentation,
|
||||
AlfrescoContentRepresentation
|
||||
AlfrescoContentRepresentation,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
@@ -39,18 +40,11 @@ export class ActivitiContentService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
get integrationAlfrescoOnPremiseApi(): IntegrationAlfrescoOnPremiseApi {
|
||||
this._integrationAlfrescoOnPremiseApi =
|
||||
this._integrationAlfrescoOnPremiseApi ?? new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
return this._integrationAlfrescoOnPremiseApi;
|
||||
}
|
||||
@LazyApi((self: ActivitiContentService) => new IntegrationAlfrescoOnPremiseApi(self.apiService.getInstance()))
|
||||
declare readonly integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
|
||||
private _contentApi: ActivitiContentApi;
|
||||
get contentApi(): ActivitiContentApi {
|
||||
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: ActivitiContentService) => new ActivitiContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ActivitiContentApi;
|
||||
|
||||
/**
|
||||
* Returns a list of child nodes below the specified folder
|
||||
|
||||
@@ -20,7 +20,7 @@ import { FormModel } from '@alfresco/adf-core';
|
||||
import { EventEmitter, Injectable, inject } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { CustomModelApi } from '@alfresco/js-api';
|
||||
import { CustomModelApi, LazyApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -34,11 +34,8 @@ export class EcmModelService {
|
||||
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
private _customModelApi: CustomModelApi;
|
||||
get customModelApi(): CustomModelApi {
|
||||
this._customModelApi = this._customModelApi ?? new CustomModelApi(this.apiService.getInstance());
|
||||
return this._customModelApi;
|
||||
}
|
||||
@LazyApi((self: EcmModelService) => new CustomModelApi(self.apiService.getInstance()))
|
||||
declare readonly customModelApi: CustomModelApi;
|
||||
|
||||
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
||||
return new Observable((observer) => {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { FormModelsApi, FormRepresentation } from '@alfresco/js-api';
|
||||
import { FormModelsApi, FormRepresentation, LazyApi } from '@alfresco/js-api';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { FormDefinitionModel } from '../model/form-definition.model';
|
||||
|
||||
@@ -31,11 +31,8 @@ export class EditorService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _editorApi: FormModelsApi;
|
||||
get editorApi(): FormModelsApi {
|
||||
this._editorApi = this._editorApi ?? new FormModelsApi(this.apiService.getInstance());
|
||||
return this._editorApi;
|
||||
}
|
||||
@LazyApi((self: EditorService) => new FormModelsApi(self.apiService.getInstance()))
|
||||
declare readonly editorApi: FormModelsApi;
|
||||
|
||||
/**
|
||||
* Saves a form.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { ModelsApi } from '@alfresco/js-api';
|
||||
import { LazyApi, ModelsApi } from '@alfresco/js-api';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@@ -30,11 +30,8 @@ export class ModelService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _modelsApi: ModelsApi;
|
||||
get modelsApi(): ModelsApi {
|
||||
this._modelsApi = this._modelsApi ?? new ModelsApi(this.apiService.getInstance());
|
||||
return this._modelsApi;
|
||||
}
|
||||
@LazyApi((self: ModelService) => new ModelsApi(self.apiService.getInstance()))
|
||||
declare readonly modelsApi: ModelsApi;
|
||||
|
||||
/**
|
||||
* Create a Form.
|
||||
|
||||
@@ -21,7 +21,8 @@ import {
|
||||
ActivitiContentApi,
|
||||
RelatedContentRepresentation,
|
||||
ResultListDataRepresentationRelatedProcessTask,
|
||||
ResultListDataRepresentationRelatedContentRepresentation
|
||||
ResultListDataRepresentationRelatedContentRepresentation,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
@@ -35,11 +36,8 @@ export class ProcessContentService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _contentApi: ActivitiContentApi;
|
||||
get contentApi(): ActivitiContentApi {
|
||||
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: ProcessContentService) => new ActivitiContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ActivitiContentApi;
|
||||
|
||||
/**
|
||||
* Create temporary related content from an uploaded file.
|
||||
|
||||
@@ -19,7 +19,7 @@ import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { FormFieldOption } from '@alfresco/adf-core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { ProcessDefinitionsApi } from '@alfresco/js-api';
|
||||
import { LazyApi, ProcessDefinitionsApi } from '@alfresco/js-api';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { DynamicTableColumnOption } from '../widgets/dynamic-table/editors/models/dynamic-table-column-option.model';
|
||||
|
||||
@@ -32,11 +32,8 @@ export class ProcessDefinitionService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _processDefinitionsApi: ProcessDefinitionsApi;
|
||||
get processDefinitionsApi(): ProcessDefinitionsApi {
|
||||
this._processDefinitionsApi = this._processDefinitionsApi ?? new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
return this._processDefinitionsApi;
|
||||
}
|
||||
@LazyApi((self: ProcessDefinitionService) => new ProcessDefinitionsApi(self.apiService.getInstance()))
|
||||
declare readonly processDefinitionsApi: ProcessDefinitionsApi;
|
||||
|
||||
/**
|
||||
* Gets values of fields populated by a REST backend using a process ID.
|
||||
|
||||
@@ -19,7 +19,7 @@ import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { FormFieldOption, FormValues, TaskProcessVariableModel } from '@alfresco/adf-core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { from, Observable, throwError } from 'rxjs';
|
||||
import { CompleteFormRepresentation, SaveFormRepresentation, TaskFormsApi } from '@alfresco/js-api';
|
||||
import { CompleteFormRepresentation, LazyApi, SaveFormRepresentation, TaskFormsApi } from '@alfresco/js-api';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { DynamicTableColumnOption } from '../widgets/dynamic-table/editors/models/dynamic-table-column-option.model';
|
||||
|
||||
@@ -32,11 +32,8 @@ export class TaskFormService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _taskFormsApi: TaskFormsApi;
|
||||
get taskFormsApi(): TaskFormsApi {
|
||||
this._taskFormsApi = this._taskFormsApi ?? new TaskFormsApi(this.apiService.getInstance());
|
||||
return this._taskFormsApi;
|
||||
}
|
||||
@LazyApi((self: TaskFormService) => new TaskFormsApi(self.apiService.getInstance()))
|
||||
declare readonly taskFormsApi: TaskFormsApi;
|
||||
|
||||
/**
|
||||
* Saves a task form.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { TaskRepresentation, TasksApi } from '@alfresco/js-api';
|
||||
import { LazyApi, TaskRepresentation, TasksApi } from '@alfresco/js-api';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@@ -30,11 +30,8 @@ export class TaskService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private _taskApi: TasksApi;
|
||||
get taskApi(): TasksApi {
|
||||
this._taskApi = this._taskApi ?? new TasksApi(this.apiService.getInstance());
|
||||
return this._taskApi;
|
||||
}
|
||||
@LazyApi((self: TaskService) => new TasksApi(self.apiService.getInstance()))
|
||||
declare readonly taskApi: TasksApi;
|
||||
|
||||
/**
|
||||
* Gets a task.
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { CommentModel, CommentsService, User } from '@alfresco/adf-core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ActivitiCommentsApi } from '@alfresco/js-api';
|
||||
import { ActivitiCommentsApi, LazyApi } from '@alfresco/js-api';
|
||||
import { PeopleProcessService } from '../../services/people-process.service';
|
||||
|
||||
@Injectable({
|
||||
@@ -30,11 +30,8 @@ export class CommentProcessService implements CommentsService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
private readonly peopleProcessService = inject(PeopleProcessService);
|
||||
|
||||
private _commentsApi: ActivitiCommentsApi;
|
||||
get commentsApi(): ActivitiCommentsApi {
|
||||
this._commentsApi = this._commentsApi ?? new ActivitiCommentsApi(this.apiService.getInstance());
|
||||
return this._commentsApi;
|
||||
}
|
||||
@LazyApi((self: CommentProcessService) => new ActivitiCommentsApi(self.apiService.getInstance()))
|
||||
declare readonly commentsApi: ActivitiCommentsApi;
|
||||
|
||||
/**
|
||||
* Gets all comments that have been added to a process instance.
|
||||
|
||||
@@ -20,6 +20,7 @@ import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, from, forkJoin } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import {
|
||||
LazyApi,
|
||||
ResultListDataRepresentationUserProcessInstanceFilterRepresentation,
|
||||
UserFiltersApi,
|
||||
UserProcessInstanceFilterRepresentation
|
||||
@@ -31,11 +32,8 @@ import {
|
||||
export class ProcessFilterService {
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
private _userFiltersApi: UserFiltersApi;
|
||||
get userFiltersApi(): UserFiltersApi {
|
||||
this._userFiltersApi = this._userFiltersApi ?? new UserFiltersApi(this.alfrescoApiService.getInstance());
|
||||
return this._userFiltersApi;
|
||||
}
|
||||
@LazyApi((self: ProcessFilterService) => new UserFiltersApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly userFiltersApi: UserFiltersApi;
|
||||
|
||||
/**
|
||||
* Gets all filters defined for a Process App.
|
||||
|
||||
@@ -29,7 +29,8 @@ import {
|
||||
ResultListDataRepresentationProcessInstanceRepresentation,
|
||||
TasksApi,
|
||||
ProcessDefinitionRepresentation,
|
||||
TaskRepresentation
|
||||
TaskRepresentation,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { from, Observable } from 'rxjs';
|
||||
@@ -42,25 +43,17 @@ import { DatePipe } from '@angular/common';
|
||||
export class ProcessService {
|
||||
private readonly alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
private _tasksApi: TasksApi;
|
||||
get tasksApi(): TasksApi {
|
||||
return (this._tasksApi ||= new TasksApi(this.alfrescoApiService.getInstance()));
|
||||
}
|
||||
@LazyApi((self: ProcessService) => new TasksApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly tasksApi: TasksApi;
|
||||
|
||||
private _processDefinitionsApi: ProcessDefinitionsApi;
|
||||
get processDefinitionsApi(): ProcessDefinitionsApi {
|
||||
return (this._processDefinitionsApi ||= new ProcessDefinitionsApi(this.alfrescoApiService.getInstance()));
|
||||
}
|
||||
@LazyApi((self: ProcessService) => new ProcessDefinitionsApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly processDefinitionsApi: ProcessDefinitionsApi;
|
||||
|
||||
private _processInstancesApi: ProcessInstancesApi;
|
||||
get processInstancesApi(): ProcessInstancesApi {
|
||||
return (this._processInstancesApi ||= new ProcessInstancesApi(this.alfrescoApiService.getInstance()));
|
||||
}
|
||||
@LazyApi((self: ProcessService) => new ProcessInstancesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly processInstancesApi: ProcessInstancesApi;
|
||||
|
||||
private _processInstanceVariablesApi: ProcessInstanceVariablesApi;
|
||||
get processInstanceVariablesApi(): ProcessInstanceVariablesApi {
|
||||
return (this._processInstanceVariablesApi ||= new ProcessInstanceVariablesApi(this.alfrescoApiService.getInstance()));
|
||||
}
|
||||
@LazyApi((self: ProcessService) => new ProcessInstanceVariablesApi(self.alfrescoApiService.getInstance()))
|
||||
declare readonly processInstanceVariablesApi: ProcessInstanceVariablesApi;
|
||||
|
||||
/**
|
||||
* Gets process instances for a filter and optionally a process definition.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { RuntimeAppDefinitionsApi, AppDefinitionRepresentation } from '@alfresco/js-api';
|
||||
import { RuntimeAppDefinitionsApi, AppDefinitionRepresentation, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -27,11 +27,8 @@ import { map } from 'rxjs/operators';
|
||||
export class AppsProcessService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _appsApi: RuntimeAppDefinitionsApi;
|
||||
get appsApi(): RuntimeAppDefinitionsApi {
|
||||
this._appsApi = this._appsApi ?? new RuntimeAppDefinitionsApi(this.apiService.getInstance());
|
||||
return this._appsApi;
|
||||
}
|
||||
@LazyApi((self: AppsProcessService) => new RuntimeAppDefinitionsApi(self.apiService.getInstance()))
|
||||
declare readonly appsApi: RuntimeAppDefinitionsApi;
|
||||
|
||||
/**
|
||||
* Gets a list of deployed apps for this user.
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Observable, from } from 'rxjs';
|
||||
import { GroupModel } from '@alfresco/adf-core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { TaskActionsApi, UsersApi, ActivitiGroupsApi, UserProfileApi, UserRepresentation, LightUserRepresentation } from '@alfresco/js-api';
|
||||
import { TaskActionsApi, UsersApi, ActivitiGroupsApi, UserProfileApi, UserRepresentation, LightUserRepresentation, LazyApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -28,29 +28,17 @@ import { TaskActionsApi, UsersApi, ActivitiGroupsApi, UserProfileApi, UserRepres
|
||||
export class PeopleProcessService {
|
||||
private readonly apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _taskActionsApi: TaskActionsApi;
|
||||
get taskActionsApi(): TaskActionsApi {
|
||||
this._taskActionsApi = this._taskActionsApi ?? new TaskActionsApi(this.apiService.getInstance());
|
||||
return this._taskActionsApi;
|
||||
}
|
||||
@LazyApi((self: PeopleProcessService) => new TaskActionsApi(self.apiService.getInstance()))
|
||||
declare readonly taskActionsApi: TaskActionsApi;
|
||||
|
||||
private _userApi: UsersApi;
|
||||
get userApi(): UsersApi {
|
||||
this._userApi = this._userApi ?? new UsersApi(this.apiService.getInstance());
|
||||
return this._userApi;
|
||||
}
|
||||
@LazyApi((self: PeopleProcessService) => new UsersApi(self.apiService.getInstance()))
|
||||
declare readonly userApi: UsersApi;
|
||||
|
||||
private _groupsApi: ActivitiGroupsApi;
|
||||
get groupsApi(): ActivitiGroupsApi {
|
||||
this._groupsApi = this._groupsApi ?? new ActivitiGroupsApi(this.apiService.getInstance());
|
||||
return this._groupsApi;
|
||||
}
|
||||
@LazyApi((self: PeopleProcessService) => new ActivitiGroupsApi(self.apiService.getInstance()))
|
||||
declare readonly groupsApi: ActivitiGroupsApi;
|
||||
|
||||
private _profileApi: UserProfileApi;
|
||||
get profileApi(): UserProfileApi {
|
||||
this._profileApi = this._profileApi ?? new UserProfileApi(this.apiService.getInstance());
|
||||
return this._profileApi;
|
||||
}
|
||||
@LazyApi((self: PeopleProcessService) => new UserProfileApi(self.apiService.getInstance()))
|
||||
declare readonly profileApi: UserProfileApi;
|
||||
|
||||
/**
|
||||
* Gets information about the current user.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { CommentModel, CommentsService } from '@alfresco/adf-core';
|
||||
import { ActivitiCommentsApi } from '@alfresco/js-api';
|
||||
import { ActivitiCommentsApi, LazyApi } from '@alfresco/js-api';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -27,11 +27,8 @@ import { PeopleProcessService } from './people-process.service';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskCommentsService implements CommentsService {
|
||||
private _commentsApi: ActivitiCommentsApi;
|
||||
get commentsApi(): ActivitiCommentsApi {
|
||||
this._commentsApi = this._commentsApi ?? new ActivitiCommentsApi(this.apiService.getInstance());
|
||||
return this._commentsApi;
|
||||
}
|
||||
@LazyApi((self: TaskCommentsService) => new ActivitiCommentsApi(self.apiService.getInstance()))
|
||||
declare readonly commentsApi: ActivitiCommentsApi;
|
||||
|
||||
protected apiService = inject(AlfrescoApiService);
|
||||
protected peopleProcessService = inject(PeopleProcessService);
|
||||
|
||||
@@ -16,18 +16,15 @@
|
||||
*/
|
||||
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { ActivitiContentApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { ActivitiContentApi, LazyApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ProcessUploadService extends UploadService {
|
||||
private _contentApi: ActivitiContentApi;
|
||||
get contentApi(): ActivitiContentApi {
|
||||
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: ProcessUploadService) => new ActivitiContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ActivitiContentApi;
|
||||
|
||||
getUploadPromise(file: any): Promise<RelatedContentRepresentation> {
|
||||
const opts = {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Observable, forkJoin, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
||||
import { LazyApi, UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
|
||||
@Injectable({
|
||||
@@ -27,11 +27,8 @@ import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
export class TaskFilterService {
|
||||
protected apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _userFiltersApi: UserFiltersApi;
|
||||
get userFiltersApi(): UserFiltersApi {
|
||||
this._userFiltersApi = this._userFiltersApi ?? new UserFiltersApi(this.apiService.getInstance());
|
||||
return this._userFiltersApi;
|
||||
}
|
||||
@LazyApi((self: TaskFilterService) => new UserFiltersApi(self.apiService.getInstance()))
|
||||
declare readonly userFiltersApi: UserFiltersApi;
|
||||
|
||||
/**
|
||||
* Creates and returns the default filters for a process app.
|
||||
|
||||
@@ -17,17 +17,14 @@
|
||||
|
||||
import { UploadService } from '@alfresco/adf-content-services';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivitiContentApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { ActivitiContentApi, LazyApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskUploadService extends UploadService {
|
||||
private _contentApi: ActivitiContentApi;
|
||||
get contentApi(): ActivitiContentApi {
|
||||
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: TaskUploadService) => new ActivitiContentApi(self.apiService.getInstance()))
|
||||
declare readonly contentApi: ActivitiContentApi;
|
||||
|
||||
getUploadPromise(file: any): Promise<RelatedContentRepresentation> {
|
||||
const opts = {
|
||||
|
||||
@@ -28,7 +28,8 @@ import {
|
||||
ResultListDataRepresentationTaskRepresentation,
|
||||
TaskQueryRepresentation,
|
||||
UserTaskFilterRepresentation,
|
||||
TaskRepresentation
|
||||
TaskRepresentation,
|
||||
LazyApi
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
|
||||
@@ -38,29 +39,17 @@ import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
export class TaskListService {
|
||||
protected apiService = inject(AlfrescoApiService);
|
||||
|
||||
private _modelsApi: ModelsApi;
|
||||
get modelsApi(): ModelsApi {
|
||||
this._modelsApi = this._modelsApi ?? new ModelsApi(this.apiService.getInstance());
|
||||
return this._modelsApi;
|
||||
}
|
||||
@LazyApi((self: TaskListService) => new ModelsApi(self.apiService.getInstance()))
|
||||
declare readonly modelsApi: ModelsApi;
|
||||
|
||||
private _tasksApi: TasksApi;
|
||||
get tasksApi(): TasksApi {
|
||||
this._tasksApi = this._tasksApi ?? new TasksApi(this.apiService.getInstance());
|
||||
return this._tasksApi;
|
||||
}
|
||||
@LazyApi((self: TaskListService) => new TasksApi(self.apiService.getInstance()))
|
||||
declare readonly tasksApi: TasksApi;
|
||||
|
||||
private _taskActionsApi: TaskActionsApi;
|
||||
get taskActionsApi(): TaskActionsApi {
|
||||
this._taskActionsApi = this._taskActionsApi ?? new TaskActionsApi(this.apiService.getInstance());
|
||||
return this._taskActionsApi;
|
||||
}
|
||||
@LazyApi((self: TaskListService) => new TaskActionsApi(self.apiService.getInstance()))
|
||||
declare readonly taskActionsApi: TaskActionsApi;
|
||||
|
||||
private _checklistsApi: ChecklistsApi;
|
||||
get checklistsApi(): ChecklistsApi {
|
||||
this._checklistsApi = this._checklistsApi ?? new ChecklistsApi(this.apiService.getInstance());
|
||||
return this._checklistsApi;
|
||||
}
|
||||
@LazyApi((self: TaskListService) => new ChecklistsApi(self.apiService.getInstance()))
|
||||
declare readonly checklistsApi: ChecklistsApi;
|
||||
|
||||
/**
|
||||
* Gets all the filters in the list that belong to a task.
|
||||
|
||||
Reference in New Issue
Block a user