mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +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);
|
||||
|
||||
+3
-6
@@ -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) {
|
||||
|
||||
+3
-6
@@ -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.
|
||||
|
||||
+8
-18
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user