@pristine-ts/configuration 0.0.160 → 0.0.164
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.
- package/dist/lib/cjs/configuration.module.js +1 -0
- package/dist/lib/cjs/configuration.module.js.map +1 -1
- package/dist/lib/cjs/resolvers/environment-variable.resolver.js +4 -2
- package/dist/lib/cjs/resolvers/environment-variable.resolver.js.map +1 -1
- package/dist/lib/cjs/utils/configuration.utils.js +15 -0
- package/dist/lib/cjs/utils/configuration.utils.js.map +1 -0
- package/dist/lib/cjs/utils/utils.js +14 -0
- package/dist/lib/cjs/utils/utils.js.map +1 -0
- package/dist/lib/esm/configuration.module.js +1 -0
- package/dist/lib/esm/configuration.module.js.map +1 -1
- package/dist/lib/esm/resolvers/environment-variable.resolver.js +4 -2
- package/dist/lib/esm/resolvers/environment-variable.resolver.js.map +1 -1
- package/dist/lib/esm/utils/configuration.utils.js +11 -0
- package/dist/lib/esm/utils/configuration.utils.js.map +1 -0
- package/dist/lib/esm/utils/utils.js +2 -0
- package/dist/lib/esm/utils/utils.js.map +1 -0
- package/dist/types/configuration.module.d.ts +1 -0
- package/dist/types/utils/configuration.utils.d.ts +5 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +3 -3
|
@@ -18,6 +18,7 @@ __exportStar(require("./managers/managers"), exports);
|
|
|
18
18
|
__exportStar(require("./parsers/parsers"), exports);
|
|
19
19
|
__exportStar(require("./resolvers/resolvers"), exports);
|
|
20
20
|
__exportStar(require("./types/types"), exports);
|
|
21
|
+
__exportStar(require("./utils/utils"), exports);
|
|
21
22
|
__exportStar(require("./configuration.module.keyname"), exports);
|
|
22
23
|
exports.ConfigurationModule = {
|
|
23
24
|
keyname: configuration_module_keyname_1.ConfigurationModuleKeyname,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.module.js","sourceRoot":"","sources":["../../../src/configuration.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,iFAA0E;AAE1E,kDAAgC;AAChC,0DAAwC;AACxC,sDAAoC;AACpC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,iEAA+C;AAElC,QAAA,mBAAmB,GAAoB;IAChD,OAAO,EAAE,yDAA0B;IAEnC,aAAa,EAAC,EACb;CACJ,CAAA"}
|
|
1
|
+
{"version":3,"file":"configuration.module.js","sourceRoot":"","sources":["../../../src/configuration.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,iFAA0E;AAE1E,kDAAgC;AAChC,0DAAwC;AACxC,sDAAoC;AACpC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iEAA+C;AAElC,QAAA,mBAAmB,GAAoB;IAChD,OAAO,EAAE,yDAA0B;IAEnC,aAAa,EAAC,EACb;CACJ,CAAA"}
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EnvironmentVariableResolver = void 0;
|
|
13
13
|
const configuration_resolver_error_1 = require("../errors/configuration-resolver.error");
|
|
14
|
+
const configuration_utils_1 = require("../utils/configuration.utils");
|
|
14
15
|
/**
|
|
15
16
|
* This class takes the name of the environment variable and returns the value.
|
|
16
17
|
*/
|
|
@@ -23,10 +24,11 @@ class EnvironmentVariableResolver {
|
|
|
23
24
|
*/
|
|
24
25
|
resolve() {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
|
|
27
|
+
const environmentVariables = configuration_utils_1.ConfigurationUtils.getEnvironmentVariablesMemoized();
|
|
28
|
+
if (environmentVariables[this.environmentVariableName] === undefined) {
|
|
27
29
|
throw new configuration_resolver_error_1.ConfigurationResolverError("Cannot find the environment variable.", this.environmentVariableName);
|
|
28
30
|
}
|
|
29
|
-
return Promise.resolve(
|
|
31
|
+
return Promise.resolve(environmentVariables[this.environmentVariableName]);
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-variable.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/environment-variable.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yFAAkF;
|
|
1
|
+
{"version":3,"file":"environment-variable.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/environment-variable.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yFAAkF;AAClF,sEAAgE;AAEhE;;GAEG;AACH,MAAa,2BAA2B;IACpC,YAAoC,uBAA+B;QAA/B,4BAAuB,GAAvB,uBAAuB,CAAQ;IACnE,CAAC;IAED;;OAEG;IACG,OAAO;;YACT,MAAM,oBAAoB,GAAG,wCAAkB,CAAC,+BAA+B,EAAE,CAAC;YAElF,IAAG,oBAAoB,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,SAAS,EAAE;gBACjE,MAAM,IAAI,yDAA0B,CAAC,uCAAuC,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;aAC/G;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,uBAAuB,CAAW,CAAC,CAAC;QACzF,CAAC;KAAA;CACJ;AAhBD,kEAgBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationUtils = void 0;
|
|
4
|
+
let environmentVariables = undefined;
|
|
5
|
+
class ConfigurationUtils {
|
|
6
|
+
static getEnvironmentVariablesMemoized() {
|
|
7
|
+
if (environmentVariables) {
|
|
8
|
+
return environmentVariables;
|
|
9
|
+
}
|
|
10
|
+
environmentVariables = process.env;
|
|
11
|
+
return environmentVariables;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ConfigurationUtils = ConfigurationUtils;
|
|
15
|
+
//# sourceMappingURL=configuration.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.utils.js","sourceRoot":"","sources":["../../../../src/utils/configuration.utils.ts"],"names":[],"mappings":";;;AAAA,IAAI,oBAAoB,GAAmD,SAAS,CAAC;AAErF,MAAa,kBAAkB;IAC3B,MAAM,CAAC,+BAA+B;QAClC,IAAG,oBAAoB,EAAE;YACrB,OAAO,oBAAoB,CAAC;SAC/B;QAED,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;QAEnC,OAAO,oBAAqB,CAAC;IACjC,CAAC;CACJ;AAVD,gDAUC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./configuration.utils"), exports);
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAsC"}
|
|
@@ -5,6 +5,7 @@ export * from "./managers/managers";
|
|
|
5
5
|
export * from "./parsers/parsers";
|
|
6
6
|
export * from "./resolvers/resolvers";
|
|
7
7
|
export * from "./types/types";
|
|
8
|
+
export * from "./utils/utils";
|
|
8
9
|
export * from "./configuration.module.keyname";
|
|
9
10
|
export const ConfigurationModule = {
|
|
10
11
|
keyname: ConfigurationModuleKeyname,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.module.js","sourceRoot":"","sources":["../../../src/configuration.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAE1E,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAE/C,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAChD,OAAO,EAAE,0BAA0B;IAEnC,aAAa,EAAC,EACb;CACJ,CAAA"}
|
|
1
|
+
{"version":3,"file":"configuration.module.js","sourceRoot":"","sources":["../../../src/configuration.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAE1E,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAE/C,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAChD,OAAO,EAAE,0BAA0B;IAEnC,aAAa,EAAC,EACb;CACJ,CAAA"}
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { ConfigurationResolverError } from "../errors/configuration-resolver.error";
|
|
11
|
+
import { ConfigurationUtils } from "../utils/configuration.utils";
|
|
11
12
|
/**
|
|
12
13
|
* This class takes the name of the environment variable and returns the value.
|
|
13
14
|
*/
|
|
@@ -20,10 +21,11 @@ export class EnvironmentVariableResolver {
|
|
|
20
21
|
*/
|
|
21
22
|
resolve() {
|
|
22
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
|
|
24
|
+
const environmentVariables = ConfigurationUtils.getEnvironmentVariablesMemoized();
|
|
25
|
+
if (environmentVariables[this.environmentVariableName] === undefined) {
|
|
24
26
|
throw new ConfigurationResolverError("Cannot find the environment variable.", this.environmentVariableName);
|
|
25
27
|
}
|
|
26
|
-
return Promise.resolve(
|
|
28
|
+
return Promise.resolve(environmentVariables[this.environmentVariableName]);
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-variable.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/environment-variable.resolver.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"environment-variable.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/environment-variable.resolver.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACpC,YAAoC,uBAA+B;QAA/B,4BAAuB,GAAvB,uBAAuB,CAAQ;IACnE,CAAC;IAED;;OAEG;IACG,OAAO;;YACT,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,+BAA+B,EAAE,CAAC;YAElF,IAAG,oBAAoB,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,SAAS,EAAE;gBACjE,MAAM,IAAI,0BAA0B,CAAC,uCAAuC,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;aAC/G;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,uBAAuB,CAAW,CAAC,CAAC;QACzF,CAAC;KAAA;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let environmentVariables = undefined;
|
|
2
|
+
export class ConfigurationUtils {
|
|
3
|
+
static getEnvironmentVariablesMemoized() {
|
|
4
|
+
if (environmentVariables) {
|
|
5
|
+
return environmentVariables;
|
|
6
|
+
}
|
|
7
|
+
environmentVariables = process.env;
|
|
8
|
+
return environmentVariables;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=configuration.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.utils.js","sourceRoot":"","sources":["../../../../src/utils/configuration.utils.ts"],"names":[],"mappings":"AAAA,IAAI,oBAAoB,GAAmD,SAAS,CAAC;AAErF,MAAM,OAAO,kBAAkB;IAC3B,MAAM,CAAC,+BAA+B;QAClC,IAAG,oBAAoB,EAAE;YACrB,OAAO,oBAAoB,CAAC;SAC/B;QAED,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;QAEnC,OAAO,oBAAqB,CAAC;IACjC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -5,5 +5,6 @@ export * from "./managers/managers";
|
|
|
5
5
|
export * from "./parsers/parsers";
|
|
6
6
|
export * from "./resolvers/resolvers";
|
|
7
7
|
export * from "./types/types";
|
|
8
|
+
export * from "./utils/utils";
|
|
8
9
|
export * from "./configuration.module.keyname";
|
|
9
10
|
export declare const ConfigurationModule: ModuleInterface;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./configuration.utils";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/configuration",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.164",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/configuration.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/configuration.module.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pristine-ts/common": "^0.0.
|
|
17
|
+
"@pristine-ts/common": "^0.0.164"
|
|
18
18
|
},
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"src/*.{js,ts}"
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "c4e421eb5c60f895d6ae19d9b8c7078dd26d0fd4"
|
|
59
59
|
}
|