@spinajs/configuration-common
Advanced tools
Comparing version 2.0.288 to 2.0.289
@@ -113,2 +113,12 @@ import { AsyncService, Class } from '@spinajs/di'; | ||
} | ||
/** | ||
* wrapper for lazy load config vars from protocols | ||
* it allow to calculate vars only when needed / all modules are resolved | ||
*/ | ||
export declare class ConfigVar { | ||
protected lazyVal: () => any; | ||
protected cache: any; | ||
constructor(lazyVal: () => any); | ||
get(): any; | ||
} | ||
export declare abstract class ConfigVarProtocol extends AsyncService { | ||
@@ -126,4 +136,4 @@ /** | ||
*/ | ||
abstract getVar(path: string, configuration: any): Promise<unknown>; | ||
abstract getVar(path: string, configuration: any): Promise<string | number | boolean | ConfigVar | {}>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ConfigVarProtocol = exports.ConfigurationSource = exports.Configuration = void 0; | ||
exports.ConfigVarProtocol = exports.ConfigVar = exports.ConfigurationSource = exports.Configuration = void 0; | ||
const di_1 = require("@spinajs/di"); | ||
@@ -27,2 +27,18 @@ __exportStar(require("./variables.js"), exports); | ||
exports.ConfigurationSource = ConfigurationSource; | ||
/** | ||
* wrapper for lazy load config vars from protocols | ||
* it allow to calculate vars only when needed / all modules are resolved | ||
*/ | ||
class ConfigVar { | ||
constructor(lazyVal) { | ||
this.lazyVal = lazyVal; | ||
} | ||
get() { | ||
if (!this.cache) { | ||
this.cache = this.lazyVal(); | ||
} | ||
return this.cache; | ||
} | ||
} | ||
exports.ConfigVar = ConfigVar; | ||
class ConfigVarProtocol extends di_1.AsyncService { | ||
@@ -29,0 +45,0 @@ } |
@@ -113,2 +113,12 @@ import { AsyncService, Class } from '@spinajs/di'; | ||
} | ||
/** | ||
* wrapper for lazy load config vars from protocols | ||
* it allow to calculate vars only when needed / all modules are resolved | ||
*/ | ||
export declare class ConfigVar { | ||
protected lazyVal: () => any; | ||
protected cache: any; | ||
constructor(lazyVal: () => any); | ||
get(): any; | ||
} | ||
export declare abstract class ConfigVarProtocol extends AsyncService { | ||
@@ -126,4 +136,4 @@ /** | ||
*/ | ||
abstract getVar(path: string, configuration: any): Promise<unknown>; | ||
abstract getVar(path: string, configuration: any): Promise<string | number | boolean | ConfigVar | {}>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,4 +7,19 @@ import { AsyncService } from '@spinajs/di'; | ||
} | ||
/** | ||
* wrapper for lazy load config vars from protocols | ||
* it allow to calculate vars only when needed / all modules are resolved | ||
*/ | ||
export class ConfigVar { | ||
constructor(lazyVal) { | ||
this.lazyVal = lazyVal; | ||
} | ||
get() { | ||
if (!this.cache) { | ||
this.cache = this.lazyVal(); | ||
} | ||
return this.cache; | ||
} | ||
} | ||
export class ConfigVarProtocol extends AsyncService { | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@spinajs/configuration-common", | ||
"version": "2.0.288", | ||
"version": "2.0.289", | ||
"description": "> TODO: description", | ||
@@ -50,5 +50,5 @@ "author": "Grzegorz Beń <grzegorz.ben@coderush.pl>", | ||
"dependencies": { | ||
"@spinajs/di": "^2.0.288" | ||
"@spinajs/di": "^2.0.289" | ||
}, | ||
"gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171449
736
Updated@spinajs/di@^2.0.289