@alfresco/adf-content-services 8.4.0-19067731876 → 8.4.0-19126740914

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ /*!
2
+ * @license
3
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Observable } from 'rxjs';
18
+ import { NodeEntry } from '@alfresco/js-api';
19
+ import { SavedSearch } from './saved-search.interface';
20
+ /**
21
+ * Contract that describes the public API for saved searches strategy.
22
+ * Implemented by both the new and legacy SavedSearches services so callers
23
+ * can depend on the same shape.
24
+ */
25
+ export interface SavedSearchStrategy {
26
+ savedSearches$: Observable<SavedSearch[]>;
27
+ init(): void;
28
+ /**
29
+ * Gets a list of saved searches by user.
30
+ *
31
+ * @returns SavedSearch list containing user saved searches
32
+ */
33
+ getSavedSearches(): Observable<SavedSearch[]>;
34
+ /**
35
+ * Saves a new search into state and updates state. If there are less than 5 searches,
36
+ * it will be pushed on first place, if more it will be pushed to 6th place.
37
+ *
38
+ * @param newSaveSearch object { name: string, description: string, encodedUrl: string }
39
+ * @returns NodeEntry
40
+ */
41
+ saveSearch(newSaveSearch: Pick<SavedSearch, 'name' | 'description' | 'encodedUrl'>): Observable<NodeEntry>;
42
+ /**
43
+ * Replace Save Search with new one and also updates the state.
44
+ *
45
+ * @param updatedSavedSearch - updated Save Search
46
+ * @returns NodeEntry
47
+ */
48
+ editSavedSearch(updatedSavedSearch: SavedSearch): Observable<NodeEntry>;
49
+ /**
50
+ * Deletes Save Search and update state.
51
+ *
52
+ * @param deletedSavedSearch - Save Search to delete
53
+ * @returns NodeEntry
54
+ */
55
+ deleteSavedSearch(deletedSavedSearch: SavedSearch): Observable<NodeEntry>;
56
+ /**
57
+ * Reorders saved search place
58
+ *
59
+ * @param previousIndex - previous index of saved search
60
+ * @param currentIndex - new index of saved search
61
+ */
62
+ changeOrder(previousIndex: number, currentIndex: number): void;
63
+ }
@@ -24,6 +24,8 @@ export * from './services/discovery-api.service';
24
24
  export * from './services/people-content.service';
25
25
  export * from './services/content.service';
26
26
  export * from './services/saved-searches.service';
27
+ export * from './services/saved-searches-legacy.service';
28
+ export * from './services/saved-searches-base.service';
27
29
  export * from './events/file.event';
28
30
  export * from './models/ecm-user.model';
29
31
  export * from './models/ecm-company.model';
@@ -33,4 +35,5 @@ export * from './models/permissions.enum';
33
35
  export * from './models/allowable-operations.enum';
34
36
  export * from './interfaces/search-configuration.interface';
35
37
  export * from './interfaces/saved-search.interface';
38
+ export * from './interfaces/saved-searches-strategy.interface';
36
39
  export * from './mocks/ecm-user.service.mock';
@@ -0,0 +1,29 @@
1
+ import { SavedSearchStrategy } from '../interfaces/saved-searches-strategy.interface';
2
+ import { AuthenticationService } from '@alfresco/adf-core';
3
+ import { ReplaySubject, Observable } from 'rxjs';
4
+ import { NodeEntry, NodesApi } from '@alfresco/js-api';
5
+ import { SavedSearch } from '../interfaces/saved-search.interface';
6
+ import { AlfrescoApiService } from '../../services';
7
+ import * as i0 from "@angular/core";
8
+ export declare abstract class SavedSearchesBaseService implements SavedSearchStrategy {
9
+ protected readonly apiService: AlfrescoApiService;
10
+ protected readonly authService: AuthenticationService;
11
+ private _nodesApi;
12
+ private static readonly SAVE_MODE_THRESHOLD;
13
+ protected readonly _savedSearches$: ReplaySubject<SavedSearch[]>;
14
+ readonly savedSearches$: Observable<SavedSearch[]>;
15
+ get nodesApi(): NodesApi;
16
+ protected constructor(apiService: AlfrescoApiService, authService: AuthenticationService);
17
+ protected abstract fetchAllSavedSearches(): Observable<SavedSearch[]>;
18
+ protected abstract updateSavedSearches(searches: SavedSearch[]): Observable<NodeEntry>;
19
+ init(): void;
20
+ getSavedSearches(): Observable<SavedSearch[]>;
21
+ saveSearch(newSaveSearch: Pick<SavedSearch, 'name' | 'description' | 'encodedUrl'>): Observable<NodeEntry>;
22
+ editSavedSearch(updatedSavedSearch: SavedSearch): Observable<NodeEntry>;
23
+ deleteSavedSearch(deletedSavedSearch: SavedSearch): Observable<NodeEntry>;
24
+ changeOrder(previousIndex: number, currentIndex: number): void;
25
+ protected resetSavedSearchesStream(): void;
26
+ private fetchSavedSearches;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<SavedSearchesBaseService, never>;
28
+ static ɵprov: i0.ɵɵInjectableDeclaration<SavedSearchesBaseService>;
29
+ }
@@ -0,0 +1,37 @@
1
+ /*!
2
+ * @license
3
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { NodeEntry } from '@alfresco/js-api';
18
+ import { Observable } from 'rxjs';
19
+ import { AlfrescoApiService } from '../../services';
20
+ import { SavedSearch } from '../interfaces/saved-search.interface';
21
+ import { AuthenticationService } from '@alfresco/adf-core';
22
+ import { SavedSearchesBaseService } from './saved-searches-base.service';
23
+ import * as i0 from "@angular/core";
24
+ export declare class SavedSearchesLegacyService extends SavedSearchesBaseService {
25
+ private savedSearchFileNodeId;
26
+ private currentUserLocalStorageKey;
27
+ private createFileAttempt;
28
+ constructor(apiService: AlfrescoApiService, authService: AuthenticationService);
29
+ protected fetchAllSavedSearches(): Observable<SavedSearch[]>;
30
+ protected updateSavedSearches(searches: SavedSearch[]): Observable<NodeEntry>;
31
+ private getSavedSearchesNodeId;
32
+ private createSavedSearchesNode;
33
+ private mapFileContentToSavedSearches;
34
+ private getLocalStorageKey;
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<SavedSearchesLegacyService, never>;
36
+ static ɵprov: i0.ɵɵInjectableDeclaration<SavedSearchesLegacyService>;
37
+ }
@@ -14,69 +14,30 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { NodesApi, NodeEntry, ContentFieldsQuery, PreferenceEntry } from '@alfresco/js-api';
17
+ import { NodeEntry, ContentFieldsQuery, PreferenceEntry } from '@alfresco/js-api';
18
18
  import { InjectionToken } from '@angular/core';
19
- import { Observable, ReplaySubject } from 'rxjs';
19
+ import { Observable } from 'rxjs';
20
20
  import { AlfrescoApiService } from '../../services/alfresco-api.service';
21
21
  import { SavedSearch } from '../interfaces/saved-search.interface';
22
22
  import { AuthenticationService } from '@alfresco/adf-core';
23
+ import { SavedSearchesBaseService } from './saved-searches-base.service';
23
24
  import * as i0 from "@angular/core";
24
25
  export interface SavedSearchesPreferencesApiService {
25
26
  getPreference: (personId: string, preferenceName: string, opts?: ContentFieldsQuery) => Promise<PreferenceEntry> | Observable<PreferenceEntry>;
26
27
  updatePreference: (personId: string, preferenceName: string, preferenceValue: string) => Promise<PreferenceEntry> | Observable<PreferenceEntry>;
27
28
  }
28
29
  export declare const SAVED_SEARCHES_SERVICE_PREFERENCES: InjectionToken<SavedSearchesPreferencesApiService>;
29
- export declare class SavedSearchesService {
30
- private readonly apiService;
31
- private readonly authService;
30
+ export declare class SavedSearchesService extends SavedSearchesBaseService {
32
31
  private savedSearchFileNodeId;
33
- private _nodesApi;
34
32
  private _preferencesApi;
35
33
  private preferencesService;
36
- get nodesApi(): NodesApi;
37
34
  get preferencesApi(): SavedSearchesPreferencesApiService;
38
- readonly savedSearches$: ReplaySubject<SavedSearch[]>;
39
35
  constructor(apiService: AlfrescoApiService, authService: AuthenticationService);
40
- init(): void;
41
- /**
42
- * Gets a list of saved searches by user.
43
- *
44
- * @returns SavedSearch list containing user saved searches
45
- */
46
- getSavedSearches(): Observable<SavedSearch[]>;
47
- /**
48
- * Saves a new search into state and updates state. If there are less than 5 searches,
49
- * it will be pushed on first place, if more it will be pushed to 6th place.
50
- *
51
- * @param newSaveSearch object { name: string, description: string, encodedUrl: string }
52
- * @returns NodeEntry
53
- */
54
- saveSearch(newSaveSearch: Pick<SavedSearch, 'name' | 'description' | 'encodedUrl'>): Observable<NodeEntry>;
55
- /**
56
- * Replace Save Search with new one and also updates the state.
57
- *
58
- * @param updatedSavedSearch - updated Save Search
59
- * @returns NodeEntry
60
- */
61
- editSavedSearch(updatedSavedSearch: SavedSearch): Observable<NodeEntry>;
62
- /**
63
- * Deletes Save Search and update state.
64
- *
65
- * @param deletedSavedSearch - Save Search to delete
66
- * @returns NodeEntry
67
- */
68
- deleteSavedSearch(deletedSavedSearch: SavedSearch): Observable<NodeEntry>;
69
- /**
70
- * Reorders saved search place
71
- *
72
- * @param previousIndex - previous index of saved search
73
- * @param currentIndex - new index of saved search
74
- */
75
- changeOrder(previousIndex: number, currentIndex: number): void;
36
+ protected fetchAllSavedSearches(): Observable<SavedSearch[]>;
37
+ protected updateSavedSearches(updatedSavedSearches: SavedSearch[]): Observable<NodeEntry>;
76
38
  private getSavedSearchesNodeId;
77
39
  private mapFileContentToSavedSearches;
78
40
  private getLocalStorageKey;
79
- private fetchSavedSearches;
80
41
  private migrateSavedSearches;
81
42
  private getSavedSearchesFromPreferenceApi;
82
43
  static ɵfac: i0.ɵɵFactoryDeclaration<SavedSearchesService, never>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alfresco/adf-content-services",
3
3
  "description": "Alfresco ADF content services",
4
- "version": "8.4.0-19067731876",
4
+ "version": "8.4.0-19126740914",
5
5
  "author": "Hyland Software, Inc. and its affiliates",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,9 +21,9 @@
21
21
  "@angular/platform-browser": ">=14.1.3",
22
22
  "@angular/platform-browser-dynamic": ">=14.1.3",
23
23
  "@angular/router": ">=14.1.3",
24
- "@alfresco/js-api": ">=9.4.0-19067731876",
24
+ "@alfresco/js-api": ">=9.4.0-19126740914",
25
25
  "@ngx-translate/core": ">=16.0.0",
26
- "@alfresco/adf-core": ">=8.4.0-19067731876"
26
+ "@alfresco/adf-core": ">=8.4.0-19126740914"
27
27
  },
28
28
  "keywords": [
29
29
  "content-services",