namirasoft-core 1.4.1 → 1.4.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/EnvService.d.ts +7 -0
- package/dist/EnvService.js +22 -0
- package/dist/EnvService.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/EnvService.ts +23 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvService = void 0;
|
|
4
|
+
const ConvertService_1 = require("./ConvertService");
|
|
5
|
+
class EnvService extends ConvertService_1.ConvertService {
|
|
6
|
+
constructor(name, mandatory = false) {
|
|
7
|
+
super(mandatory);
|
|
8
|
+
this.name = name;
|
|
9
|
+
}
|
|
10
|
+
getNullString() {
|
|
11
|
+
let ans = process.env[this.name];
|
|
12
|
+
if (ans)
|
|
13
|
+
return ans;
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
onMandatoryError() {
|
|
17
|
+
if (!process.env.NAMIRASOFT_MUTE)
|
|
18
|
+
throw new Error(`Env value was not provided: ${this.name}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.EnvService = EnvService;
|
|
22
|
+
//# sourceMappingURL=EnvService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvService.js","sourceRoot":"","sources":["../src/EnvService.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD,MAAa,UAAW,SAAQ,+BAAc;IAG1C,YAAY,IAAY,EAAE,YAAqB,KAAK;QAEhD,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACQ,aAAa;QAElB,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IACkB,gBAAgB;QAE/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe;YAC5B,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;CACJ;AApBD,gCAoBC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./Country";
|
|
|
10
10
|
export * from "./CountryOperation";
|
|
11
11
|
export * from "./EncodingOperation";
|
|
12
12
|
export * from "./EncryptionOperation";
|
|
13
|
+
export * from "./EnvService";
|
|
13
14
|
export * from "./ErrorOperation";
|
|
14
15
|
export * from "./FileOperation";
|
|
15
16
|
export * from "./FilterItem";
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./Country"), exports);
|
|
|
26
26
|
__exportStar(require("./CountryOperation"), exports);
|
|
27
27
|
__exportStar(require("./EncodingOperation"), exports);
|
|
28
28
|
__exportStar(require("./EncryptionOperation"), exports);
|
|
29
|
+
__exportStar(require("./EnvService"), exports);
|
|
29
30
|
__exportStar(require("./ErrorOperation"), exports);
|
|
30
31
|
__exportStar(require("./FileOperation"), exports);
|
|
31
32
|
__exportStar(require("./FilterItem"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,iDAA+B;AAC/B,qDAAmC;AACnC,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,wDAAsC;AACtC,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,yDAAuC;AACvC,uDAAqC;AACrC,iDAA+B;AAC/B,kDAAgC;AAChC,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,iDAA+B;AAC/B,qDAAmC;AACnC,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,yDAAuC;AACvC,uDAAqC;AACrC,iDAA+B;AAC/B,kDAAgC;AAChC,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.2",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build": ""
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^22.0
|
|
20
|
+
"@types/node": "^22.1.0",
|
|
21
21
|
"axios": "^1.7.3",
|
|
22
22
|
"buffer": "^6.0.3",
|
|
23
23
|
"moment": "^2.30.1",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ConvertService } from "./ConvertService";
|
|
2
|
+
|
|
3
|
+
export class EnvService extends ConvertService
|
|
4
|
+
{
|
|
5
|
+
name: string;
|
|
6
|
+
constructor(name: string, mandatory: boolean = false)
|
|
7
|
+
{
|
|
8
|
+
super(mandatory);
|
|
9
|
+
this.name = name;
|
|
10
|
+
}
|
|
11
|
+
override getNullString()
|
|
12
|
+
{
|
|
13
|
+
let ans = process.env[this.name];
|
|
14
|
+
if (ans)
|
|
15
|
+
return ans;
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
protected override onMandatoryError(): void
|
|
19
|
+
{
|
|
20
|
+
if (!process.env.NAMIRASOFT_MUTE)
|
|
21
|
+
throw new Error(`Env value was not provided: ${this.name}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./Country";
|
|
|
10
10
|
export * from "./CountryOperation";
|
|
11
11
|
export * from "./EncodingOperation";
|
|
12
12
|
export * from "./EncryptionOperation";
|
|
13
|
+
export * from "./EnvService";
|
|
13
14
|
export * from "./ErrorOperation";
|
|
14
15
|
export * from "./FileOperation";
|
|
15
16
|
export * from "./FilterItem";
|