@rxap/config 13.1.3 → 14.1.0

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.
@@ -21,9 +21,9 @@ export class ConfigLoaderService {
21
21
  return loading$.toPromise();
22
22
  }
23
23
  }
24
- ConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
25
- ConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' });
26
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, decorators: [{
24
+ ConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
25
+ ConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, decorators: [{
27
27
  type: Injectable,
28
28
  args: [{ providedIn: 'root' }]
29
29
  }], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
@@ -173,9 +173,9 @@ ConfigService.Defaults = {};
173
173
  ConfigService.Overwrites = {};
174
174
  ConfigService.LocalStorageKey = 'rxap/config/local-config';
175
175
  ConfigService.Urls = ['config.json'];
176
- ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
177
- ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, providedIn: 'root' });
178
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, decorators: [{
176
+ ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
177
+ ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, providedIn: 'root' });
178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, decorators: [{
179
179
  type: Injectable,
180
180
  args: [{
181
181
  providedIn: 'root'
@@ -186,9 +186,9 @@ ConfigService.Defaults = {};
186
186
  ConfigService.Overwrites = {};
187
187
  ConfigService.LocalStorageKey = 'rxap/config/local-config';
188
188
  ConfigService.Urls = ['config.json'];
189
- ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
190
- ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, providedIn: 'root' });
191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, decorators: [{
189
+ ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
190
+ ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, providedIn: 'root' });
191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, decorators: [{
192
192
  type: Injectable,
193
193
  args: [{
194
194
  providedIn: 'root'
@@ -222,9 +222,9 @@ class ConfigLoaderService {
222
222
  });
223
223
  }
224
224
  }
225
- ConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
226
- ConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' });
227
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, decorators: [{
225
+ ConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
226
+ ConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' });
227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, decorators: [{
228
228
  type: Injectable,
229
229
  args: [{ providedIn: 'root' }]
230
230
  }], ctorParameters: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-config.mjs","sources":["../../../../libs/config/src/lib/tokens.ts","../../../../libs/config/src/lib/config.service.ts","../../../../libs/config/src/lib/config-loader.service.ts","../../../../libs/config/src/rxap-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_CONFIG = new InjectionToken('rxap/config');\n","import {\n Injectable,\n Optional,\n Inject\n} from '@angular/core';\nimport {\n deepMerge,\n SetObjectValue\n} from '@rxap/utilities';\nimport { RXAP_CONFIG } from './tokens';\nimport { NoInferType } from './types';\nimport { AnySchema } from 'joi';\n\nexport interface ConfigLoadOptions {\n fromUrlParam?: string | boolean;\n fromLocalStorage?: boolean;\n schema?: AnySchema;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigService<Config extends Record<string, any> = Record<string, any>> {\n\n public static Config: any = null;\n\n /**\n * Static default values for the config object.\n * Will be overwritten by an dynamic config file specified in\n * the Urls array.\n */\n public static Defaults: any = {};\n\n /**\n * Any value definition in the Overwrites object will overwrite any\n * value form the Defaults values or dynamic config files\n */\n public static Overwrites: any = {};\n\n public static LocalStorageKey = 'rxap/config/local-config';\n\n public static Urls = [ 'config.json' ];\n\n private static async loadConfig<T = any>(url: string, required?: boolean, schema?: AnySchema): Promise<T | null> {\n\n let config: any;\n let response: any;\n\n try {\n response = await fetch(url)\n } catch (error: any) {\n const message = `Could not fetch config from '${url}': ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n try {\n config = await response.json()\n } catch (error: any) {\n const message = `Could not parse config from '${url}' to a json object: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n if (schema) {\n try {\n config = await schema.validateAsync(config);\n } catch (error: any) {\n const message = `Config from '${url}' is not valid: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n }\n\n return config;\n\n }\n\n public static async SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void> {\n\n if (!this.Config) {\n throw new Error('Config side load is only possible after the initial config load.');\n }\n\n const config = await this.loadConfig(url, required, schema);\n\n SetObjectValue(this.Config, propertyPath, config);\n\n console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);\n\n }\n\n /**\n * Used to load the app config from a remote resource.\n *\n * Promise.all([ ConfigService.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(options?: ConfigLoadOptions): Promise<void> {\n let config = this.Defaults;\n for (const url of ConfigService.Urls) {\n config = await this.loadConfig(url, true, options?.schema);\n }\n\n config = deepMerge(config, this.Overwrites);\n\n if (options?.fromLocalStorage !== false) {\n\n const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);\n\n if (localConfig) {\n try {\n config = deepMerge(config, JSON.parse(localConfig));\n } catch (e: any) {\n console.error('local config could not be parsed');\n }\n }\n\n }\n\n if (options?.fromUrlParam) {\n const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';\n config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));\n }\n\n console.debug('app config', config);\n\n this.Config = config;\n }\n\n private static LoadConfigDefaultFromUrlParam(param: string = 'config') {\n\n const queryString = window.location.search;\n const urlParams = new URLSearchParams(queryString);\n\n const configFromParams = {};\n\n for (const configParam of urlParams.getAll('config')) {\n\n try {\n const split = configParam.split(';');\n if (split.length === 2) {\n const keyPath = split[ 0 ];\n const value = split[ 1 ];\n SetObjectValue(configFromParams, keyPath, value);\n }\n } catch (e: any) {\n console.warn(`Parsing of url config param failed for '${configParam}': ${e.message}`);\n }\n\n }\n\n return configFromParams;\n\n }\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: NoInferType<T>,\n config: Record<string, any> = this.Config\n ): T {\n if (!config) {\n throw new Error('config not loaded');\n }\n let configValue: any = config;\n if (typeof path !== 'string') {\n throw new Error('The config property path is not a string');\n }\n for (const fragment of (path as any).split('.')) {\n if (configValue.hasOwnProperty(fragment)) {\n configValue = configValue[ fragment ];\n } else {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n console.warn(`Config with path '${path}' not found`);\n return undefined as any;\n }\n }\n return configValue;\n }\n\n public readonly config!: Config;\n\n constructor(@Optional() @Inject(RXAP_CONFIG) config: any | null = null) {\n this.config = ConfigService.Config;\n if (config) {\n this.config = deepMerge(this.config ?? {}, config);\n }\n if (!this.config) {\n throw new Error('config not available');\n }\n }\n\n public setLocalConfig(config: Config): void {\n localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));\n }\n\n public clearLocalConfig(): void {\n localStorage.removeItem(ConfigService.LocalStorageKey);\n }\n\n public get<T = any>(propertyPath: string): T | undefined;\n public get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public get<T = any>(propertyPath: string, defaultValue?: T): T | undefined {\n return ConfigService.Get(propertyPath, defaultValue, this.config);\n }\n\n public getOrThrow<T = any>(propertyPath: string): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue?: T): T {\n const value = ConfigService.Get(propertyPath, defaultValue, this.config);\n if (value === undefined) {\n throw new Error(`Could not find config in path '${propertyPath}'`);\n }\n return value;\n }\n\n}\n","import { Injectable, Inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { HttpClient } from '@angular/common/http';\nimport { finalize, share } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class ConfigLoaderService {\n public readonly configs = new Map<string, any>();\n\n public readonly configLoading = new Map<string, Observable<any>>();\n\n constructor(\n @Inject(HttpClient)\n public readonly http: HttpClient\n ) {}\n\n public async load$<T = any>(url: string): Promise<T> {\n if (this.configs.has(url)) {\n return this.configs.get(url);\n }\n\n if (this.configLoading.has(url)) {\n return this.configLoading.get(url)!.toPromise();\n }\n\n const loading$ = this.http.get<T>(url).pipe(\n finalize(() => this.configLoading.delete(url)),\n share()\n );\n\n this.configLoading.set(url, loading$);\n\n return loading$.toPromise();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAEa,WAAW,GAAG,IAAI,cAAc,CAAC,aAAa;;MCoB9C,aAAa;IAoLxB,YAA6C,SAA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M,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC,IAAI,CACzC,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAC9C,KAAK,EAAE,CACR,CAAC;YAEF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAEtC,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;SAC7B;KAAA;;gHA3BU,mBAAmB,kBAMpB,UAAU;oHANT,mBAAmB,cADN,MAAM;2FACnB,mBAAmB;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;8BAO7B,MAAM;+BAAC,UAAU;;;;ACZtB;;;;;;"}
1
+ {"version":3,"file":"rxap-config.mjs","sources":["../../../../libs/config/src/lib/tokens.ts","../../../../libs/config/src/lib/config.service.ts","../../../../libs/config/src/lib/config-loader.service.ts","../../../../libs/config/src/rxap-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_CONFIG = new InjectionToken('rxap/config');\n","import {\n Injectable,\n Optional,\n Inject\n} from '@angular/core';\nimport {\n deepMerge,\n SetObjectValue\n} from '@rxap/utilities';\nimport { RXAP_CONFIG } from './tokens';\nimport { NoInferType } from './types';\nimport { AnySchema } from 'joi';\n\nexport interface ConfigLoadOptions {\n fromUrlParam?: string | boolean;\n fromLocalStorage?: boolean;\n schema?: AnySchema;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigService<Config extends Record<string, any> = Record<string, any>> {\n\n public static Config: any = null;\n\n /**\n * Static default values for the config object.\n * Will be overwritten by an dynamic config file specified in\n * the Urls array.\n */\n public static Defaults: any = {};\n\n /**\n * Any value definition in the Overwrites object will overwrite any\n * value form the Defaults values or dynamic config files\n */\n public static Overwrites: any = {};\n\n public static LocalStorageKey = 'rxap/config/local-config';\n\n public static Urls = [ 'config.json' ];\n\n private static async loadConfig<T = any>(url: string, required?: boolean, schema?: AnySchema): Promise<T | null> {\n\n let config: any;\n let response: any;\n\n try {\n response = await fetch(url)\n } catch (error: any) {\n const message = `Could not fetch config from '${url}': ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n try {\n config = await response.json()\n } catch (error: any) {\n const message = `Could not parse config from '${url}' to a json object: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n if (schema) {\n try {\n config = await schema.validateAsync(config);\n } catch (error: any) {\n const message = `Config from '${url}' is not valid: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n }\n\n return config;\n\n }\n\n public static async SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void> {\n\n if (!this.Config) {\n throw new Error('Config side load is only possible after the initial config load.');\n }\n\n const config = await this.loadConfig(url, required, schema);\n\n SetObjectValue(this.Config, propertyPath, config);\n\n console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);\n\n }\n\n /**\n * Used to load the app config from a remote resource.\n *\n * Promise.all([ ConfigService.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(options?: ConfigLoadOptions): Promise<void> {\n let config = this.Defaults;\n for (const url of ConfigService.Urls) {\n config = await this.loadConfig(url, true, options?.schema);\n }\n\n config = deepMerge(config, this.Overwrites);\n\n if (options?.fromLocalStorage !== false) {\n\n const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);\n\n if (localConfig) {\n try {\n config = deepMerge(config, JSON.parse(localConfig));\n } catch (e: any) {\n console.error('local config could not be parsed');\n }\n }\n\n }\n\n if (options?.fromUrlParam) {\n const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';\n config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));\n }\n\n console.debug('app config', config);\n\n this.Config = config;\n }\n\n private static LoadConfigDefaultFromUrlParam(param: string = 'config') {\n\n const queryString = window.location.search;\n const urlParams = new URLSearchParams(queryString);\n\n const configFromParams = {};\n\n for (const configParam of urlParams.getAll('config')) {\n\n try {\n const split = configParam.split(';');\n if (split.length === 2) {\n const keyPath = split[ 0 ];\n const value = split[ 1 ];\n SetObjectValue(configFromParams, keyPath, value);\n }\n } catch (e: any) {\n console.warn(`Parsing of url config param failed for '${configParam}': ${e.message}`);\n }\n\n }\n\n return configFromParams;\n\n }\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: NoInferType<T>,\n config: Record<string, any> = this.Config\n ): T {\n if (!config) {\n throw new Error('config not loaded');\n }\n let configValue: any = config;\n if (typeof path !== 'string') {\n throw new Error('The config property path is not a string');\n }\n for (const fragment of (path as any).split('.')) {\n if (configValue.hasOwnProperty(fragment)) {\n configValue = configValue[ fragment ];\n } else {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n console.warn(`Config with path '${path}' not found`);\n return undefined as any;\n }\n }\n return configValue;\n }\n\n public readonly config!: Config;\n\n constructor(@Optional() @Inject(RXAP_CONFIG) config: any | null = null) {\n this.config = ConfigService.Config;\n if (config) {\n this.config = deepMerge(this.config ?? {}, config);\n }\n if (!this.config) {\n throw new Error('config not available');\n }\n }\n\n public setLocalConfig(config: Config): void {\n localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));\n }\n\n public clearLocalConfig(): void {\n localStorage.removeItem(ConfigService.LocalStorageKey);\n }\n\n public get<T = any>(propertyPath: string): T | undefined;\n public get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public get<T = any>(propertyPath: string, defaultValue?: T): T | undefined {\n return ConfigService.Get(propertyPath, defaultValue, this.config);\n }\n\n public getOrThrow<T = any>(propertyPath: string): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue?: T): T {\n const value = ConfigService.Get(propertyPath, defaultValue, this.config);\n if (value === undefined) {\n throw new Error(`Could not find config in path '${propertyPath}'`);\n }\n return value;\n }\n\n}\n","import { Injectable, Inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { HttpClient } from '@angular/common/http';\nimport { finalize, share } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class ConfigLoaderService {\n public readonly configs = new Map<string, any>();\n\n public readonly configLoading = new Map<string, Observable<any>>();\n\n constructor(\n @Inject(HttpClient)\n public readonly http: HttpClient\n ) {}\n\n public async load$<T = any>(url: string): Promise<T> {\n if (this.configs.has(url)) {\n return this.configs.get(url);\n }\n\n if (this.configLoading.has(url)) {\n return this.configLoading.get(url)!.toPromise();\n }\n\n const loading$ = this.http.get<T>(url).pipe(\n finalize(() => this.configLoading.delete(url)),\n share()\n );\n\n this.configLoading.set(url, loading$);\n\n return loading$.toPromise();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAEa,WAAW,GAAG,IAAI,cAAc,CAAC,aAAa;;MCoB9C,aAAa,CAAA;IAoLxB,WAA6C,CAAA,SAAqB,IAAI,EAAA;;AACpE,QAAA,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;AACnC,QAAA,IAAI,MAAM,EAAE;AACV,YAAA,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA,EAAA,GAAA,IAAI,CAAC,MAAM,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,EAAE,MAAM,CAAC,CAAC;AACpD,SAAA;AACD,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AACzC,SAAA;KACF;AAvKO,IAAA,OAAa,UA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AED,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC,IAAI,CACzC,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAC9C,KAAK,EAAE,CACR,CAAC;YAEF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAEtC,YAAA,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;SAC7B,CAAA,CAAA;AAAA,KAAA;;AA3BU,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,kBAMpB,UAAU,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AANT,mBAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;8BAO7B,MAAM;+BAAC,UAAU,CAAA;;;;ACZtB;;AAEG;;;;"}
@@ -178,9 +178,9 @@ ConfigService.Defaults = {};
178
178
  ConfigService.Overwrites = {};
179
179
  ConfigService.LocalStorageKey = 'rxap/config/local-config';
180
180
  ConfigService.Urls = ['config.json'];
181
- ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
182
- ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, providedIn: 'root' });
183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigService, decorators: [{
181
+ ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
182
+ ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, providedIn: 'root' });
183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigService, decorators: [{
184
184
  type: Injectable,
185
185
  args: [{
186
186
  providedIn: 'root'
@@ -210,9 +210,9 @@ class ConfigLoaderService {
210
210
  return loading$.toPromise();
211
211
  }
212
212
  }
213
- ConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
214
- ConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' });
215
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ConfigLoaderService, decorators: [{
213
+ ConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
214
+ ConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' });
215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ConfigLoaderService, decorators: [{
216
216
  type: Injectable,
217
217
  args: [{ providedIn: 'root' }]
218
218
  }], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-config.mjs","sources":["../../../../libs/config/src/lib/tokens.ts","../../../../libs/config/src/lib/config.service.ts","../../../../libs/config/src/lib/config-loader.service.ts","../../../../libs/config/src/rxap-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_CONFIG = new InjectionToken('rxap/config');\n","import {\n Injectable,\n Optional,\n Inject\n} from '@angular/core';\nimport {\n deepMerge,\n SetObjectValue\n} from '@rxap/utilities';\nimport { RXAP_CONFIG } from './tokens';\nimport { NoInferType } from './types';\nimport { AnySchema } from 'joi';\n\nexport interface ConfigLoadOptions {\n fromUrlParam?: string | boolean;\n fromLocalStorage?: boolean;\n schema?: AnySchema;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigService<Config extends Record<string, any> = Record<string, any>> {\n\n public static Config: any = null;\n\n /**\n * Static default values for the config object.\n * Will be overwritten by an dynamic config file specified in\n * the Urls array.\n */\n public static Defaults: any = {};\n\n /**\n * Any value definition in the Overwrites object will overwrite any\n * value form the Defaults values or dynamic config files\n */\n public static Overwrites: any = {};\n\n public static LocalStorageKey = 'rxap/config/local-config';\n\n public static Urls = [ 'config.json' ];\n\n private static async loadConfig<T = any>(url: string, required?: boolean, schema?: AnySchema): Promise<T | null> {\n\n let config: any;\n let response: any;\n\n try {\n response = await fetch(url)\n } catch (error: any) {\n const message = `Could not fetch config from '${url}': ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n try {\n config = await response.json()\n } catch (error: any) {\n const message = `Could not parse config from '${url}' to a json object: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n if (schema) {\n try {\n config = await schema.validateAsync(config);\n } catch (error: any) {\n const message = `Config from '${url}' is not valid: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n }\n\n return config;\n\n }\n\n public static async SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void> {\n\n if (!this.Config) {\n throw new Error('Config side load is only possible after the initial config load.');\n }\n\n const config = await this.loadConfig(url, required, schema);\n\n SetObjectValue(this.Config, propertyPath, config);\n\n console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);\n\n }\n\n /**\n * Used to load the app config from a remote resource.\n *\n * Promise.all([ ConfigService.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(options?: ConfigLoadOptions): Promise<void> {\n let config = this.Defaults;\n for (const url of ConfigService.Urls) {\n config = await this.loadConfig(url, true, options?.schema);\n }\n\n config = deepMerge(config, this.Overwrites);\n\n if (options?.fromLocalStorage !== false) {\n\n const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);\n\n if (localConfig) {\n try {\n config = deepMerge(config, JSON.parse(localConfig));\n } catch (e: any) {\n console.error('local config could not be parsed');\n }\n }\n\n }\n\n if (options?.fromUrlParam) {\n const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';\n config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));\n }\n\n console.debug('app config', config);\n\n this.Config = config;\n }\n\n private static LoadConfigDefaultFromUrlParam(param: string = 'config') {\n\n const queryString = window.location.search;\n const urlParams = new URLSearchParams(queryString);\n\n const configFromParams = {};\n\n for (const configParam of urlParams.getAll('config')) {\n\n try {\n const split = configParam.split(';');\n if (split.length === 2) {\n const keyPath = split[ 0 ];\n const value = split[ 1 ];\n SetObjectValue(configFromParams, keyPath, value);\n }\n } catch (e: any) {\n console.warn(`Parsing of url config param failed for '${configParam}': ${e.message}`);\n }\n\n }\n\n return configFromParams;\n\n }\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: NoInferType<T>,\n config: Record<string, any> = this.Config\n ): T {\n if (!config) {\n throw new Error('config not loaded');\n }\n let configValue: any = config;\n if (typeof path !== 'string') {\n throw new Error('The config property path is not a string');\n }\n for (const fragment of (path as any).split('.')) {\n if (configValue.hasOwnProperty(fragment)) {\n configValue = configValue[ fragment ];\n } else {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n console.warn(`Config with path '${path}' not found`);\n return undefined as any;\n }\n }\n return configValue;\n }\n\n public readonly config!: Config;\n\n constructor(@Optional() @Inject(RXAP_CONFIG) config: any | null = null) {\n this.config = ConfigService.Config;\n if (config) {\n this.config = deepMerge(this.config ?? {}, config);\n }\n if (!this.config) {\n throw new Error('config not available');\n }\n }\n\n public setLocalConfig(config: Config): void {\n localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));\n }\n\n public clearLocalConfig(): void {\n localStorage.removeItem(ConfigService.LocalStorageKey);\n }\n\n public get<T = any>(propertyPath: string): T | undefined;\n public get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public get<T = any>(propertyPath: string, defaultValue?: T): T | undefined {\n return ConfigService.Get(propertyPath, defaultValue, this.config);\n }\n\n public getOrThrow<T = any>(propertyPath: string): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue?: T): T {\n const value = ConfigService.Get(propertyPath, defaultValue, this.config);\n if (value === undefined) {\n throw new Error(`Could not find config in path '${propertyPath}'`);\n }\n return value;\n }\n\n}\n","import { Injectable, Inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { HttpClient } from '@angular/common/http';\nimport { finalize, share } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class ConfigLoaderService {\n public readonly configs = new Map<string, any>();\n\n public readonly configLoading = new Map<string, Observable<any>>();\n\n constructor(\n @Inject(HttpClient)\n public readonly http: HttpClient\n ) {}\n\n public async load$<T = any>(url: string): Promise<T> {\n if (this.configs.has(url)) {\n return this.configs.get(url);\n }\n\n if (this.configLoading.has(url)) {\n return this.configLoading.get(url)!.toPromise();\n }\n\n const loading$ = this.http.get<T>(url).pipe(\n finalize(() => this.configLoading.delete(url)),\n share()\n );\n\n this.configLoading.set(url, loading$);\n\n return loading$.toPromise();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAEa,WAAW,GAAG,IAAI,cAAc,CAAC,aAAa;;MCoB9C,aAAa;IAoLxB,YAA6C,SAAqB,IAAI;QACpE,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QACnC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;SACpD;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACzC;KACF;IAvKO,aAAa,UAAU,CAAU,GAAW,EAAE,QAAkB,EAAE,MAAkB;QAE1F,IAAI,MAAW,CAAC;QAChB,IAAI,QAAa,CAAC;QAElB,IAAI;YACF,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;SAC5B;QAAC,OAAO,KAAU,EAAE;YACnB,MAAM,OAAO,GAAG,gCAAgC,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;YACzE,IAAI,QAAQ,EAAE;gBACZ,KAAK,CAAC,OAAO,CAAC,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;aAC1B;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO,IAAI,CAAC;aACb;SACF;QAED,IAA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AAW;QACrC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACzB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SAC9B;QAED,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,SAAS,EAAE,CAAC;SACjD;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC,IAAI,CACzC,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAC9C,KAAK,EAAE,CACR,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAEtC,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;KAC7B;;gHA3BU,mBAAmB,kBAMpB,UAAU;oHANT,mBAAmB,cADN,MAAM;2FACnB,mBAAmB;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BAO7B,MAAM;2BAAC,UAAU;;;ACZtB;;;;;;"}
1
+ {"version":3,"file":"rxap-config.mjs","sources":["../../../../libs/config/src/lib/tokens.ts","../../../../libs/config/src/lib/config.service.ts","../../../../libs/config/src/lib/config-loader.service.ts","../../../../libs/config/src/rxap-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_CONFIG = new InjectionToken('rxap/config');\n","import {\n Injectable,\n Optional,\n Inject\n} from '@angular/core';\nimport {\n deepMerge,\n SetObjectValue\n} from '@rxap/utilities';\nimport { RXAP_CONFIG } from './tokens';\nimport { NoInferType } from './types';\nimport { AnySchema } from 'joi';\n\nexport interface ConfigLoadOptions {\n fromUrlParam?: string | boolean;\n fromLocalStorage?: boolean;\n schema?: AnySchema;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigService<Config extends Record<string, any> = Record<string, any>> {\n\n public static Config: any = null;\n\n /**\n * Static default values for the config object.\n * Will be overwritten by an dynamic config file specified in\n * the Urls array.\n */\n public static Defaults: any = {};\n\n /**\n * Any value definition in the Overwrites object will overwrite any\n * value form the Defaults values or dynamic config files\n */\n public static Overwrites: any = {};\n\n public static LocalStorageKey = 'rxap/config/local-config';\n\n public static Urls = [ 'config.json' ];\n\n private static async loadConfig<T = any>(url: string, required?: boolean, schema?: AnySchema): Promise<T | null> {\n\n let config: any;\n let response: any;\n\n try {\n response = await fetch(url)\n } catch (error: any) {\n const message = `Could not fetch config from '${url}': ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n try {\n config = await response.json()\n } catch (error: any) {\n const message = `Could not parse config from '${url}' to a json object: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n if (schema) {\n try {\n config = await schema.validateAsync(config);\n } catch (error: any) {\n const message = `Config from '${url}' is not valid: ${error.message}`;\n if (required) {\n alert(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n }\n\n return config;\n\n }\n\n public static async SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void> {\n\n if (!this.Config) {\n throw new Error('Config side load is only possible after the initial config load.');\n }\n\n const config = await this.loadConfig(url, required, schema);\n\n SetObjectValue(this.Config, propertyPath, config);\n\n console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);\n\n }\n\n /**\n * Used to load the app config from a remote resource.\n *\n * Promise.all([ ConfigService.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(options?: ConfigLoadOptions): Promise<void> {\n let config = this.Defaults;\n for (const url of ConfigService.Urls) {\n config = await this.loadConfig(url, true, options?.schema);\n }\n\n config = deepMerge(config, this.Overwrites);\n\n if (options?.fromLocalStorage !== false) {\n\n const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);\n\n if (localConfig) {\n try {\n config = deepMerge(config, JSON.parse(localConfig));\n } catch (e: any) {\n console.error('local config could not be parsed');\n }\n }\n\n }\n\n if (options?.fromUrlParam) {\n const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';\n config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));\n }\n\n console.debug('app config', config);\n\n this.Config = config;\n }\n\n private static LoadConfigDefaultFromUrlParam(param: string = 'config') {\n\n const queryString = window.location.search;\n const urlParams = new URLSearchParams(queryString);\n\n const configFromParams = {};\n\n for (const configParam of urlParams.getAll('config')) {\n\n try {\n const split = configParam.split(';');\n if (split.length === 2) {\n const keyPath = split[ 0 ];\n const value = split[ 1 ];\n SetObjectValue(configFromParams, keyPath, value);\n }\n } catch (e: any) {\n console.warn(`Parsing of url config param failed for '${configParam}': ${e.message}`);\n }\n\n }\n\n return configFromParams;\n\n }\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: NoInferType<T>,\n config: Record<string, any> = this.Config\n ): T {\n if (!config) {\n throw new Error('config not loaded');\n }\n let configValue: any = config;\n if (typeof path !== 'string') {\n throw new Error('The config property path is not a string');\n }\n for (const fragment of (path as any).split('.')) {\n if (configValue.hasOwnProperty(fragment)) {\n configValue = configValue[ fragment ];\n } else {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n console.warn(`Config with path '${path}' not found`);\n return undefined as any;\n }\n }\n return configValue;\n }\n\n public readonly config!: Config;\n\n constructor(@Optional() @Inject(RXAP_CONFIG) config: any | null = null) {\n this.config = ConfigService.Config;\n if (config) {\n this.config = deepMerge(this.config ?? {}, config);\n }\n if (!this.config) {\n throw new Error('config not available');\n }\n }\n\n public setLocalConfig(config: Config): void {\n localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));\n }\n\n public clearLocalConfig(): void {\n localStorage.removeItem(ConfigService.LocalStorageKey);\n }\n\n public get<T = any>(propertyPath: string): T | undefined;\n public get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public get<T = any>(propertyPath: string, defaultValue?: T): T | undefined {\n return ConfigService.Get(propertyPath, defaultValue, this.config);\n }\n\n public getOrThrow<T = any>(propertyPath: string): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue?: T): T {\n const value = ConfigService.Get(propertyPath, defaultValue, this.config);\n if (value === undefined) {\n throw new Error(`Could not find config in path '${propertyPath}'`);\n }\n return value;\n }\n\n}\n","import { Injectable, Inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { HttpClient } from '@angular/common/http';\nimport { finalize, share } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class ConfigLoaderService {\n public readonly configs = new Map<string, any>();\n\n public readonly configLoading = new Map<string, Observable<any>>();\n\n constructor(\n @Inject(HttpClient)\n public readonly http: HttpClient\n ) {}\n\n public async load$<T = any>(url: string): Promise<T> {\n if (this.configs.has(url)) {\n return this.configs.get(url);\n }\n\n if (this.configLoading.has(url)) {\n return this.configLoading.get(url)!.toPromise();\n }\n\n const loading$ = this.http.get<T>(url).pipe(\n finalize(() => this.configLoading.delete(url)),\n share()\n );\n\n this.configLoading.set(url, loading$);\n\n return loading$.toPromise();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAEa,WAAW,GAAG,IAAI,cAAc,CAAC,aAAa;;MCoB9C,aAAa,CAAA;AAoLxB,IAAA,WAAA,CAA6C,SAAqB,IAAI,EAAA;AACpE,QAAA,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;AACnC,QAAA,IAAI,MAAM,EAAE;AACV,YAAA,IAAI,CAAC,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AC,GAAG,CAAI,GAAG,CAAC,CAAC,IAAI,CACzC,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAC9C,KAAK,EAAE,CACR,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAEtC,QAAA,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;KAC7B;;AA3BU,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,kBAMpB,UAAU,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AANT,mBAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAO7B,MAAM;2BAAC,UAAU,CAAA;;;ACZtB;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxap/config",
3
- "version": "13.1.3",
3
+ "version": "14.1.0",
4
4
  "private": false,
5
5
  "author": "Merzough Münker",
6
6
  "homepage": "https://gitlab.com/rxap/packages/libs/config",
@@ -17,14 +17,14 @@
17
17
  },
18
18
  "description": "Simple config file manager for angular applications.",
19
19
  "peerDependencies": {
20
- "@angular-devkit/schematics": "^13.2.4",
21
- "@angular/common": "^13.2.3",
22
- "@angular/core": "^13.2.3",
23
- "@angular/platform-browser-dynamic": "^13.2.3",
24
- "@rxap/utilities": "^13.0.0",
20
+ "@angular-devkit/schematics": "^14.2.3",
21
+ "@angular/common": "^14.2.2",
22
+ "@angular/core": "^14.2.2",
23
+ "@angular/platform-browser-dynamic": "^14.2.2",
24
+ "@rxap/utilities": "^14.0.1",
25
25
  "joi": "^17.6.3",
26
26
  "reflect-metadata": "^0.1.13",
27
- "rxjs": "^6.5.5"
27
+ "rxjs": "^6.6.0"
28
28
  },
29
29
  "schematics": "./collection.json",
30
30
  "ng-update": {
@@ -42,8 +42,8 @@
42
42
  "save": "dependencies"
43
43
  },
44
44
  "dependencies": {
45
- "@rxap/schematics-ts-morph": "^13.0.0-next.1",
46
- "@rxap/schematics-utilities": "^13.0.0-next.1",
45
+ "@rxap/schematics-ts-morph": "^14.0.0",
46
+ "@rxap/schematics-utilities": "^14.0.0",
47
47
  "ts-morph": "^13.0.3",
48
48
  "tslib": "^2.3.1"
49
49
  },
@@ -52,13 +52,13 @@
52
52
  "esm2020": "esm2020/rxap-config.mjs",
53
53
  "fesm2020": "fesm2020/rxap-config.mjs",
54
54
  "fesm2015": "fesm2015/rxap-config.mjs",
55
- "typings": "rxap-config.d.ts",
55
+ "typings": "index.d.ts",
56
56
  "exports": {
57
57
  "./package.json": {
58
58
  "default": "./package.json"
59
59
  },
60
60
  ".": {
61
- "types": "./rxap-config.d.ts",
61
+ "types": "./index.d.ts",
62
62
  "esm2020": "./esm2020/rxap-config.mjs",
63
63
  "es2020": "./fesm2020/rxap-config.mjs",
64
64
  "es2015": "./fesm2015/rxap-config.mjs",
@@ -7,7 +7,7 @@ const schematics_utilities_1 = require("@rxap/schematics-utilities");
7
7
  const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
8
8
  const path_1 = require("path");
9
9
  function default_1(options) {
10
- return (host) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
10
+ return (host) => tslib_1.__awaiter(this, void 0, void 0, function* () {
11
11
  var _a;
12
12
  const project = new ts_morph_1.Project({
13
13
  manipulationSettings: {
package/rxap-config.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@rxap/config" />
5
- export * from './index';