AAE-29442 moving to node 20.18.1 (#10500)

* AAE-0000 - moving to node 20.18.1

* AAE-29442 Adjusted to the new eslint rule
This commit is contained in:
Vito Albano
2024-12-18 11:14:52 +00:00
committed by GitHub
parent dd44e492b7
commit 872fb16b62
144 changed files with 5267 additions and 6842 deletions

View File

@@ -43,31 +43,23 @@ export class AppExtensionService {
return;
}
const references = (config.$references || [])
.filter((entry) => typeof entry === 'object')
.map((entry) => entry as ExtensionRef);
const references = (config.$references || []).filter((entry) => typeof entry === 'object').map((entry) => entry as ExtensionRef);
this._references.next(references);
}
/**
* Provides a collection of document list columns for the particular preset.
* The result is filtered by the **disabled** state.
*
* @param key Preset key.
* @returns list of document list presets
*/
getDocumentListPreset(key: string): DocumentListPresetRef[] {
return this.extensionService
.getElements<DocumentListPresetRef>(
`features.documentList.${key}`
)
.filter((entry) => !entry.disabled);
return this.extensionService.getElements<DocumentListPresetRef>(`features.documentList.${key}`).filter((entry) => !entry.disabled);
}
/**
* Provides a list of the Viewer content extensions,
* filtered by **disabled** state and **rules**.
*
* @returns list of viewer extension references
*/
getViewerExtensions(): ViewerExtensionRef[] {
@@ -78,13 +70,13 @@ export class AppExtensionService {
protected isViewerExtensionDisabled(extension: ViewerExtensionRef): boolean {
if (extension) {
if (extension.disabled) {
return true;
}
if (extension.disabled) {
return true;
}
if (extension.rules?.disabled) {
return this.extensionService.evaluateRule(extension.rules.disabled);
}
if (extension.rules?.disabled) {
return this.extensionService.evaluateRule(extension.rules.disabled);
}
}
return false;

View File

@@ -28,15 +28,9 @@ import { RuleRef } from '../config/rule.extensions';
providedIn: 'root'
})
export class ExtensionLoaderService {
constructor(private http: HttpClient) {
}
constructor(private http: HttpClient) {}
load(
configPath: string,
pluginsPath: string,
extensions?: string[],
extensionValues?: ExtensionConfig[]
): Promise<ExtensionConfig> {
load(configPath: string, pluginsPath: string, extensions?: string[], extensionValues?: ExtensionConfig[]): Promise<ExtensionConfig> {
return new Promise<any>((resolve) => {
this.loadConfig(configPath, 0).then((result) => {
if (result) {
@@ -54,9 +48,7 @@ export class ExtensionLoaderService {
}
if (config.$references?.length > 0 || extensionValues) {
const plugins = (config.$references ?? []).map((name, idx) =>
this.loadConfig(`${pluginsPath}/${name}`, idx)
);
const plugins = (config.$references ?? []).map((name, idx) => this.loadConfig(`${pluginsPath}/${name}`, idx));
Promise.all(plugins).then((results) => {
let configs = results
@@ -65,13 +57,9 @@ export class ExtensionLoaderService {
.map((entry) => entry.config);
if (extensionValues) {
configs = [
...configs,
...extensionValues
];
configs = [...configs, ...extensionValues];
}
if (configs.length > 0) {
config = mergeObjects(config, ...configs);
}
@@ -96,26 +84,18 @@ export class ExtensionLoaderService {
* Retrieves configuration elements.
* Filters element by **enabled** and **order** attributes.
* Example:
* `getElements<ViewerExtensionRef>(config, 'features.viewer.extensions')`
*
* `getElements<ViewerExtensionRef>(config, 'features.viewer.extensions')`
* @param config configuration settings
* @param key element key
* @param fallback fallback array of values
* @returns list of elements
*/
getElements<T extends ExtensionElement>(
config: ExtensionConfig,
key: string,
fallback: Array<T> = []
): Array<T> {
getElements<T extends ExtensionElement>(config: ExtensionConfig, key: string, fallback: Array<T> = []): Array<T> {
const values = getValue(config, key) || fallback || [];
return values.filter(filterEnabled).sort(sortByOrder);
}
getContentActions(
config: ExtensionConfig,
key: string
): Array<ContentActionRef> {
getContentActions(config: ExtensionConfig, key: string): Array<ContentActionRef> {
return this.getElements(config, key).map(this.setActionDefaults);
}
@@ -150,8 +130,7 @@ export class ExtensionLoaderService {
protected getMetadata(config: ExtensionConfig): ExtensionRef {
const result: any = {};
Object
.keys(config)
Object.keys(config)
.filter((key) => key.startsWith('$'))
.forEach((key) => {
result[key] = config[key];
@@ -160,10 +139,7 @@ export class ExtensionLoaderService {
return result;
}
protected loadConfig(
url: string,
order: number
): Promise<{ order: number; config: ExtensionConfig }> {
protected loadConfig(url: string, order: number): Promise<{ order: number; config: ExtensionConfig }> {
return new Promise((resolve) => {
this.http.get<ExtensionConfig>(url).subscribe(
(config) => {

View File

@@ -29,7 +29,6 @@ import { BehaviorSubject, Observable } from 'rxjs';
/**
* The default extensions factory
*
* @returns the list of extension json files
*/
export function extensionJsonsFactory() {
@@ -48,7 +47,6 @@ export const EXTENSION_JSON_VALUES = new InjectionToken<string[][]>('extension-j
/**
* Provides the extension json values for the angular modules
*
* @param jsons files to provide
* @returns a provider section
*/
@@ -62,7 +60,6 @@ export function provideExtensionConfig(jsons: string[]) {
/**
* Provides the extension json raw values for the angular modules
*
* @param extensionConfigValue config value
* @returns a provider section
*/
@@ -103,7 +100,6 @@ export class ExtensionService {
/**
* Loads and registers an extension config file and plugins (specified by path properties).
*
* @returns The loaded config data
*/
async load(): Promise<ExtensionConfig> {
@@ -115,7 +111,6 @@ export class ExtensionService {
/**
* Registers extensions from a config object.
*
* @param config Object with config data
*/
setup(config: ExtensionConfig) {
@@ -142,7 +137,6 @@ export class ExtensionService {
/**
* Gets features by key.
*
* @param key Key string using dot notation or array of strings
* @param defaultValue Default value returned if feature is not found, default is empty array
* @returns Feature found by key
@@ -158,7 +152,6 @@ export class ExtensionService {
/**
* Adds one or more new rule evaluators to the existing set.
*
* @param values The new evaluators to add
*/
setEvaluators(values: { [key: string]: RuleEvaluator }) {
@@ -167,7 +160,6 @@ export class ExtensionService {
/**
* Adds one or more new auth guards to the existing set.
*
* @param values The new auth guards to add
*/
setAuthGuards(values: Record<string, unknown>) {
@@ -178,7 +170,6 @@ export class ExtensionService {
/**
* Adds one or more new components to the existing set.
*
* @param values The new components to add
*/
setComponents(values: { [key: string]: Type<any> }) {
@@ -187,7 +178,6 @@ export class ExtensionService {
/**
* Retrieves a route using its ID value.
*
* @param id The ID value to look for
* @returns The route or null if not found
*/
@@ -197,7 +187,6 @@ export class ExtensionService {
/**
* Retrieves one or more auth guards using an array of ID values.
*
* @param ids Array of ID value to look for
* @returns Array of auth guards or empty array if none were found
*/
@@ -207,7 +196,6 @@ export class ExtensionService {
/**
* Retrieves an action using its ID value.
*
* @param id The ID value to look for
* @returns Action or null if not found
*/
@@ -217,7 +205,6 @@ export class ExtensionService {
/**
* Retrieves a RuleEvaluator function using its key name.
*
* @param key Key name to look for
* @returns RuleEvaluator or null if not found
*/
@@ -227,7 +214,6 @@ export class ExtensionService {
/**
* Evaluates a rule.
*
* @param ruleId ID of the rule to evaluate
* @param context Custom rule execution context.
* @returns True if the rule passed, false otherwise
@@ -238,7 +224,6 @@ export class ExtensionService {
/**
* Retrieves a registered extension component using its ID value.
*
* @param id The ID value to look for
* @returns The component or null if not found
*/
@@ -248,7 +233,6 @@ export class ExtensionService {
/**
* Retrieves a rule using its ID value.
*
* @param id The ID value to look for
* @returns The rule or null if not found
*/
@@ -258,7 +242,6 @@ export class ExtensionService {
/**
* Runs a lightweight expression stored in a string.
*
* @param value String containing the expression or literal value
* @param context Parameter object for the expression with details of app state
* @returns Result of evaluated expression, if found, or the literal value otherwise

View File

@@ -36,7 +36,6 @@ export class RuleService {
/**
* Adds one or more new rule evaluators to the existing set.
*
* @param values The new evaluators to add
*/
setEvaluators(values: { [key: string]: RuleEvaluator }) {
@@ -47,7 +46,6 @@ export class RuleService {
/**
* Retrieves a rule using its ID value.
*
* @param id The ID value to look for
* @returns The rule or null if not found
*/
@@ -57,7 +55,6 @@ export class RuleService {
/**
* Retrieves a RuleEvaluator function using its key name.
*
* @param key Key name to look for
* @returns RuleEvaluator or null if not found
*/
@@ -71,7 +68,6 @@ export class RuleService {
/**
* Evaluates a rule.
*
* @param ruleId ID of the rule to evaluate
* @param context Custom rule execution context.
* @returns True if the rule passed, false otherwise