@nattyjs/common 0.0.1-beta.0 → 0.0.1-beta.2
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/index.cjs +9 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +9 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,9 @@ const commonContainer = new class {
|
|
|
43
43
|
setEnvTsDefinition(tsDefinition) {
|
|
44
44
|
this.envTsDefinition = tsDefinition;
|
|
45
45
|
}
|
|
46
|
+
setEnvValueInfo(valueInfo) {
|
|
47
|
+
this.envValueInfo = valueInfo;
|
|
48
|
+
}
|
|
46
49
|
setMetadata(key, value, propName) {
|
|
47
50
|
this.metadataConfig[propName].set(key, value);
|
|
48
51
|
}
|
|
@@ -186,6 +189,7 @@ function tsDefinition(value) {
|
|
|
186
189
|
|
|
187
190
|
function getEnvTsDefinition(parsed) {
|
|
188
191
|
let serverTypedDefinition = {};
|
|
192
|
+
let envVariableValueInfo = {};
|
|
189
193
|
if (parsed) {
|
|
190
194
|
const keys = Object.keys(parsed);
|
|
191
195
|
if (keys.length > 0) {
|
|
@@ -193,10 +197,11 @@ function getEnvTsDefinition(parsed) {
|
|
|
193
197
|
let keyName = key;
|
|
194
198
|
const { definition, transformValue } = tsDefinition(parsed[key]);
|
|
195
199
|
serverTypedDefinition[keyName] = definition;
|
|
200
|
+
envVariableValueInfo[keyName] = parsed[keyName];
|
|
196
201
|
});
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
|
-
return serverTypedDefinition;
|
|
204
|
+
return { parsedEnvTsDefinition: serverTypedDefinition, envVariableValueInfo };
|
|
200
205
|
}
|
|
201
206
|
|
|
202
207
|
function createPath(pathToCreate) {
|
|
@@ -228,8 +233,10 @@ async function readEnv() {
|
|
|
228
233
|
debug: !!process.env.DEBUG || void 0,
|
|
229
234
|
path: filePath
|
|
230
235
|
});
|
|
231
|
-
|
|
236
|
+
const info = getEnvTsDefinition(parsed);
|
|
237
|
+
parsedEnvTsDefinition = info.parsedEnvTsDefinition;
|
|
232
238
|
commonContainer.setEnvTsDefinition(parsedEnvTsDefinition);
|
|
239
|
+
commonContainer.setEnvValueInfo(info.envVariableValueInfo);
|
|
233
240
|
dotenvExpand__namespace.expand({ parsed });
|
|
234
241
|
}
|
|
235
242
|
return parsedEnvTsDefinition;
|
package/dist/index.d.ts
CHANGED
|
@@ -71,9 +71,15 @@ declare const commonContainer: {
|
|
|
71
71
|
get envTsDefinition(): {
|
|
72
72
|
[key: string]: string;
|
|
73
73
|
};
|
|
74
|
+
get envValueInfo(): {
|
|
75
|
+
[key: string]: string;
|
|
76
|
+
};
|
|
74
77
|
setEnvTsDefinition(tsDefinition: {
|
|
75
78
|
[key: string]: string;
|
|
76
79
|
}): void;
|
|
80
|
+
setEnvValueInfo(envValueInfo: {
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
}): void;
|
|
77
83
|
setMetadata(key: string, value: any, propName: string): void;
|
|
78
84
|
getMetadataValue(key: string, propName: string): any;
|
|
79
85
|
get globalConfig(): GlobalConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -25,6 +25,9 @@ const commonContainer = new class {
|
|
|
25
25
|
setEnvTsDefinition(tsDefinition) {
|
|
26
26
|
this.envTsDefinition = tsDefinition;
|
|
27
27
|
}
|
|
28
|
+
setEnvValueInfo(valueInfo) {
|
|
29
|
+
this.envValueInfo = valueInfo;
|
|
30
|
+
}
|
|
28
31
|
setMetadata(key, value, propName) {
|
|
29
32
|
this.metadataConfig[propName].set(key, value);
|
|
30
33
|
}
|
|
@@ -168,6 +171,7 @@ function tsDefinition(value) {
|
|
|
168
171
|
|
|
169
172
|
function getEnvTsDefinition(parsed) {
|
|
170
173
|
let serverTypedDefinition = {};
|
|
174
|
+
let envVariableValueInfo = {};
|
|
171
175
|
if (parsed) {
|
|
172
176
|
const keys = Object.keys(parsed);
|
|
173
177
|
if (keys.length > 0) {
|
|
@@ -175,10 +179,11 @@ function getEnvTsDefinition(parsed) {
|
|
|
175
179
|
let keyName = key;
|
|
176
180
|
const { definition, transformValue } = tsDefinition(parsed[key]);
|
|
177
181
|
serverTypedDefinition[keyName] = definition;
|
|
182
|
+
envVariableValueInfo[keyName] = parsed[keyName];
|
|
178
183
|
});
|
|
179
184
|
}
|
|
180
185
|
}
|
|
181
|
-
return serverTypedDefinition;
|
|
186
|
+
return { parsedEnvTsDefinition: serverTypedDefinition, envVariableValueInfo };
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
function createPath(pathToCreate) {
|
|
@@ -210,8 +215,10 @@ async function readEnv() {
|
|
|
210
215
|
debug: !!process.env.DEBUG || void 0,
|
|
211
216
|
path: filePath
|
|
212
217
|
});
|
|
213
|
-
|
|
218
|
+
const info = getEnvTsDefinition(parsed);
|
|
219
|
+
parsedEnvTsDefinition = info.parsedEnvTsDefinition;
|
|
214
220
|
commonContainer.setEnvTsDefinition(parsedEnvTsDefinition);
|
|
221
|
+
commonContainer.setEnvValueInfo(info.envVariableValueInfo);
|
|
215
222
|
dotenvExpand.expand({ parsed });
|
|
216
223
|
}
|
|
217
224
|
return parsedEnvTsDefinition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nattyjs/common",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "ajayojha <ojhaajay@outlook.com>",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "20.3.1",
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.2",
|
|
20
20
|
"unbuild": "1.2.1",
|
|
21
21
|
"dotenv-expand": "10.0.0"
|
|
22
22
|
}
|