[MIGRATION] - Something happened on the way to heaven

This commit is contained in:
VitoAlbano
2024-08-23 00:00:52 +01:00
parent 7836f8c706
commit ae27801430
21 changed files with 102 additions and 89 deletions

View File

@@ -27,7 +27,6 @@ import { RuleService } from './rule.service';
import { ExtensionElement } from '../config/extension-element';
import { BehaviorSubject, Observable } from 'rxjs';
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
/**
* The default extensions factory
*
@@ -35,7 +34,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
*/
export function extensionJsonsFactory() {
return [];
};
}
export const EXTENSION_JSONS = new InjectionToken<string[][]>('extension-jsons', {
providedIn: 'root',
@@ -47,7 +46,6 @@ export const EXTENSION_JSON_VALUES = new InjectionToken<string[][]>('extension-j
factory: extensionJsonsFactory
});
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
/**
* Provides the extension json values for the angular modules
*
@@ -60,7 +58,7 @@ export function provideExtensionConfig(jsons: string[]) {
useValue: jsons,
multi: true
};
};
}
/**
* Provides the extension json raw values for the angular modules
@@ -74,7 +72,7 @@ export function provideExtensionConfigValues(extensionConfigValue: ExtensionConf
useValue: extensionConfigValue,
multi: true
};
};
}
@Injectable({
providedIn: 'root'
@@ -109,12 +107,7 @@ export class ExtensionService {
* @returns The loaded config data
*/
async load(): Promise<ExtensionConfig> {
const config = await this.loader.load(
this.configPath,
this.pluginsPath,
this.extensionJsons.flat(),
this.extensionJsonValues.flat()
);
const config = await this.loader.load(this.configPath, this.pluginsPath, this.extensionJsons.flat(), this.extensionJsonValues.flat());
this.setup(config);
return config;
@@ -209,9 +202,7 @@ export class ExtensionService {
* @returns Array of auth guards or empty array if none were found
*/
getAuthGuards(ids: string[]): Array<Type<any>> {
return (ids || [])
.map((id) => this.authGuards[id])
.filter((guard) => guard);
return (ids || []).map((id) => this.authGuards[id]).filter((guard) => guard);
}
/**
@@ -272,12 +263,12 @@ export class ExtensionService {
* @param context Parameter object for the expression with details of app state
* @returns Result of evaluated expression, if found, or the literal value otherwise
*/
runExpression(value: string | any , context?: any) {
if (typeof value === 'string' ) {
runExpression(value: string | any, context?: any) {
if (typeof value === 'string') {
return this.evaluateExpression(value, context);
} else {
const duplicate = Object.assign({}, value);
Object.keys(duplicate).forEach( (key) => {
Object.keys(duplicate).forEach((key) => {
duplicate[key] = this.evaluateExpression(duplicate[key], context);
});
return duplicate;