@@ -3,14 +3,14 @@ import { forwardRef, inject, Injectable, Injector } from '@angular/core';
33import { Exception } from '@angularity/core' ;
44import { catchError , map , Observable } from 'rxjs' ;
55
6- import { ConfigFileMetadata } from './metadata ' ;
6+ import { ConfigFileDefinition } from './definition ' ;
77
88@Injectable ( {
99 providedIn : 'root' ,
1010 useExisting : forwardRef ( ( ) => HttpClientConfigFileLoader ) ,
1111} )
1212export abstract class ConfigFileLoader {
13- abstract load < T , Schema > ( meta : ConfigFileMetadata < T , Schema > ) : Observable < T > ;
13+ abstract load < T , Schema > ( def : ConfigFileDefinition < T , Schema > ) : Observable < T > ;
1414}
1515
1616export class ConfigFileNotFoundException extends Exception {
@@ -24,18 +24,18 @@ export class HttpClientConfigFileLoader {
2424 protected httpClient = inject ( HttpClient ) ;
2525 protected injector = inject ( Injector ) ;
2626
27- load < T , Schema > ( meta : ConfigFileMetadata < T , Schema > ) : Observable < T > {
28- const parser = this . injector . get ( meta . parser ) ;
29- const validator = this . injector . get ( meta . validator ) ;
27+ load < T , Schema > ( def : ConfigFileDefinition < T , Schema > ) : Observable < T > {
28+ const parser = this . injector . get ( def . parser ) ;
29+ const validator = this . injector . get ( def . validator ) ;
3030
31- return this . fetch ( meta . path ) . pipe (
31+ return this . fetch ( def . path ) . pipe (
3232 map ( ( res ) => {
33- if ( ! res ) throw new ConfigFileNotFoundException ( meta . path ) ;
33+ if ( ! res ) throw new ConfigFileNotFoundException ( def . path ) ;
3434 return res ;
3535 } ) ,
3636 map ( ( raw ) => {
3737 const parsed = parser . parse ( raw ) ;
38- validator . validate ( meta . schema , parsed ) ;
38+ validator . validate ( def . schema , parsed ) ;
3939 return parsed as T ;
4040 } ) ,
4141 ) ;
0 commit comments