namirasoft-node 1.3.76 → 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/BaseApplication.js +3 -10
- package/dist/BaseApplication.js.map +1 -1
- package/dist/BaseTable.d.ts +2 -2
- package/dist/BaseTable.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/AnomalyDetector.ts +84 -84
- package/src/BaseApplication.ts +426 -435
- package/src/BaseApplicationLink.ts +6 -6
- package/src/BaseController.ts +193 -193
- package/src/BaseCron.ts +54 -54
- package/src/BaseDatabase.ts +192 -192
- package/src/BaseEmailService.ts +38 -38
- package/src/BaseTable.ts +104 -104
- package/src/CommandOperation.ts +32 -32
- package/src/EmptyDatabase.ts +7 -7
- package/src/GmailService.ts +22 -22
- package/src/IPOperation.ts +38 -38
- package/src/Meta.ts +40 -40
- package/src/OTPOperation.ts +64 -64
- package/src/RequestHeaderService.ts +27 -27
- package/src/SMTPService.ts +26 -26
- package/src/ServerToServerOperation.ts +23 -23
- package/src/index.ts +16 -17
- package/dist/CMDOperation.d.ts +0 -4
- package/dist/CMDOperation.js +0 -43
- package/dist/CMDOperation.js.map +0 -1
- package/dist/EmailService.d.ts +0 -16
- package/dist/EmailService.js +0 -81
- package/dist/EmailService.js.map +0 -1
- package/dist/EnvService.d.ts +0 -7
- package/dist/EnvService.js +0 -22
- package/dist/EnvService.js.map +0 -1
- package/src/EnvService.ts +0 -23
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { ConvertService, ObjectService } from 'namirasoft-core';
|
|
3
|
-
|
|
4
|
-
export class RequestHeaderService extends ConvertService
|
|
5
|
-
{
|
|
6
|
-
private req: express.Request;
|
|
7
|
-
private name: string;
|
|
8
|
-
constructor(req: express.Request, name: string, mandatory: boolean = false)
|
|
9
|
-
{
|
|
10
|
-
super(mandatory);
|
|
11
|
-
this.req = req;
|
|
12
|
-
this.name = name;
|
|
13
|
-
}
|
|
14
|
-
override getNullString()
|
|
15
|
-
{
|
|
16
|
-
if (this.req)
|
|
17
|
-
if (this.req.headers)
|
|
18
|
-
{
|
|
19
|
-
let item = this.req.headers[this.name];
|
|
20
|
-
return new ObjectService(item).getNullString();
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
protected override onMandatoryError(): void
|
|
25
|
-
{
|
|
26
|
-
throw new Error(`Request Header value was not provided: ${this.name}`);
|
|
27
|
-
}
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { ConvertService, ObjectService } from 'namirasoft-core';
|
|
3
|
+
|
|
4
|
+
export class RequestHeaderService extends ConvertService
|
|
5
|
+
{
|
|
6
|
+
private req: express.Request;
|
|
7
|
+
private name: string;
|
|
8
|
+
constructor(req: express.Request, name: string, mandatory: boolean = false)
|
|
9
|
+
{
|
|
10
|
+
super(mandatory);
|
|
11
|
+
this.req = req;
|
|
12
|
+
this.name = name;
|
|
13
|
+
}
|
|
14
|
+
override getNullString()
|
|
15
|
+
{
|
|
16
|
+
if (this.req)
|
|
17
|
+
if (this.req.headers)
|
|
18
|
+
{
|
|
19
|
+
let item = this.req.headers[this.name];
|
|
20
|
+
return new ObjectService(item).getNullString();
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
protected override onMandatoryError(): void
|
|
25
|
+
{
|
|
26
|
+
throw new Error(`Request Header value was not provided: ${this.name}`);
|
|
27
|
+
}
|
|
28
28
|
}
|
package/src/SMTPService.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { BaseEmailService } from './BaseEmailService';
|
|
2
|
-
|
|
3
|
-
export class SMTPService extends BaseEmailService
|
|
4
|
-
{
|
|
5
|
-
host: string;
|
|
6
|
-
port: number;
|
|
7
|
-
password: string;
|
|
8
|
-
constructor(host: string, port: number, username: string, password: string)
|
|
9
|
-
{
|
|
10
|
-
super(username);
|
|
11
|
-
this.host = host;
|
|
12
|
-
this.port = port;
|
|
13
|
-
this.password = password;
|
|
14
|
-
}
|
|
15
|
-
protected override getTransform(): any
|
|
16
|
-
{
|
|
17
|
-
return {
|
|
18
|
-
host: this.host,
|
|
19
|
-
port: this.port,
|
|
20
|
-
secure: true,
|
|
21
|
-
auth: {
|
|
22
|
-
user: this.username,
|
|
23
|
-
pass: this.password
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
1
|
+
import { BaseEmailService } from './BaseEmailService';
|
|
2
|
+
|
|
3
|
+
export class SMTPService extends BaseEmailService
|
|
4
|
+
{
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
password: string;
|
|
8
|
+
constructor(host: string, port: number, username: string, password: string)
|
|
9
|
+
{
|
|
10
|
+
super(username);
|
|
11
|
+
this.host = host;
|
|
12
|
+
this.port = port;
|
|
13
|
+
this.password = password;
|
|
14
|
+
}
|
|
15
|
+
protected override getTransform(): any
|
|
16
|
+
{
|
|
17
|
+
return {
|
|
18
|
+
host: this.host,
|
|
19
|
+
port: this.port,
|
|
20
|
+
secure: true,
|
|
21
|
+
auth: {
|
|
22
|
+
user: this.username,
|
|
23
|
+
pass: this.password
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
27
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { ErrorOperation, HashOperation } from "namirasoft-core";
|
|
3
|
-
import { RequestHeaderService } from './RequestHeaderService';
|
|
4
|
-
|
|
5
|
-
export class ServerToServerOperation
|
|
6
|
-
{
|
|
7
|
-
static isValid(sign_key: string, data: any, req: express.Request, sign_header: string): boolean
|
|
8
|
-
{
|
|
9
|
-
let signature = new RequestHeaderService(req, sign_header).getString();
|
|
10
|
-
return HashOperation.isValidSHA256Secret(sign_key, data, signature);
|
|
11
|
-
}
|
|
12
|
-
static check(sign_key: string, data: any, req: express.Request, sign_header: string): void
|
|
13
|
-
{
|
|
14
|
-
if (!sign_key)
|
|
15
|
-
ErrorOperation.throwHTTP(401, "Invlid signature - No sign key.");
|
|
16
|
-
if (!sign_header)
|
|
17
|
-
ErrorOperation.throwHTTP(401, "Invlid signature - No sign header name.");
|
|
18
|
-
let signature = new RequestHeaderService(req, sign_header).getString();
|
|
19
|
-
if (!signature)
|
|
20
|
-
ErrorOperation.throwHTTP(401, "Invlid signature - No signature.");
|
|
21
|
-
if (!this.isValid(sign_key, data, req, sign_header))
|
|
22
|
-
ErrorOperation.throwHTTP(401, "Invlid signature.");
|
|
23
|
-
}
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { ErrorOperation, HashOperation } from "namirasoft-core";
|
|
3
|
+
import { RequestHeaderService } from './RequestHeaderService';
|
|
4
|
+
|
|
5
|
+
export class ServerToServerOperation
|
|
6
|
+
{
|
|
7
|
+
static isValid(sign_key: string, data: any, req: express.Request, sign_header: string): boolean
|
|
8
|
+
{
|
|
9
|
+
let signature = new RequestHeaderService(req, sign_header).getString();
|
|
10
|
+
return HashOperation.isValidSHA256Secret(sign_key, data, signature);
|
|
11
|
+
}
|
|
12
|
+
static check(sign_key: string, data: any, req: express.Request, sign_header: string): void
|
|
13
|
+
{
|
|
14
|
+
if (!sign_key)
|
|
15
|
+
ErrorOperation.throwHTTP(401, "Invlid signature - No sign key.");
|
|
16
|
+
if (!sign_header)
|
|
17
|
+
ErrorOperation.throwHTTP(401, "Invlid signature - No sign header name.");
|
|
18
|
+
let signature = new RequestHeaderService(req, sign_header).getString();
|
|
19
|
+
if (!signature)
|
|
20
|
+
ErrorOperation.throwHTTP(401, "Invlid signature - No signature.");
|
|
21
|
+
if (!this.isValid(sign_key, data, req, sign_header))
|
|
22
|
+
ErrorOperation.throwHTTP(401, "Invlid signature.");
|
|
23
|
+
}
|
|
24
24
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export * from "./AnomalyDetector";
|
|
2
|
-
export * from "./BaseApplication";
|
|
3
|
-
export * from "./BaseApplicationLink";
|
|
4
|
-
export * from "./BaseController";
|
|
5
|
-
export * from "./BaseCron";
|
|
6
|
-
export * from "./BaseDatabase";
|
|
7
|
-
export * from "./BaseEmailService";
|
|
8
|
-
export * from "./BaseTable";
|
|
9
|
-
export * from "./CommandOperation";
|
|
10
|
-
export * from "./EmptyDatabase";
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./ServerToServerOperation";
|
|
1
|
+
export * from "./AnomalyDetector";
|
|
2
|
+
export * from "./BaseApplication";
|
|
3
|
+
export * from "./BaseApplicationLink";
|
|
4
|
+
export * from "./BaseController";
|
|
5
|
+
export * from "./BaseCron";
|
|
6
|
+
export * from "./BaseDatabase";
|
|
7
|
+
export * from "./BaseEmailService";
|
|
8
|
+
export * from "./BaseTable";
|
|
9
|
+
export * from "./CommandOperation";
|
|
10
|
+
export * from "./EmptyDatabase";
|
|
11
|
+
export * from "./GmailService";
|
|
12
|
+
export * from "./IPOperation";
|
|
13
|
+
export * from "./Meta";
|
|
14
|
+
export * from "./OTPOperation";
|
|
15
|
+
export * from "./RequestHeaderService";
|
|
16
|
+
export * from "./ServerToServerOperation";
|
|
18
17
|
export * from "./SMTPService";
|
package/dist/CMDOperation.d.ts
DELETED
package/dist/CMDOperation.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.OTPOperation = void 0;
|
|
13
|
-
const { exec, execSync } = require('child_process');
|
|
14
|
-
class OTPOperation {
|
|
15
|
-
static run(command, cwd) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
yield exec(command, { cwd }, (error, stdout, stderr) => {
|
|
18
|
-
if (error) {
|
|
19
|
-
console.error(`error: ${error.message}`);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (stderr) {
|
|
23
|
-
console.error(`stderr: ${stderr}`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
console.log(`stdout:\n${stdout}`);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
static runSync(command, cwd) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
try {
|
|
33
|
-
return yield execSync(command, { cwd, encoding: 'utf-8' });
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error(error.stdout);
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.OTPOperation = OTPOperation;
|
|
43
|
-
//# sourceMappingURL=CMDOperation.js.map
|
package/dist/CMDOperation.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CMDOperation.js","sourceRoot":"","sources":["../src/CMDOperation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AACpD,MAAa,YAAY;IAErB,MAAM,CAAO,GAAG,CAAC,OAAe,EAAE,GAAuB;;YAErD,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBAEnD,IAAI,KAAK,EACT;oBACI,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACzC,OAAO;iBACV;gBACD,IAAI,MAAM,EACV;oBACI,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;oBACnC,OAAO;iBACV;gBACD,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IACD,MAAM,CAAO,OAAO,CAAC,OAAe,EAAE,GAAuB;;YAEzD,IACA;gBACI,OAAO,MAAM,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;aAC9D;YAAC,OAAO,KAAU,EACnB;gBACI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC5B,MAAM,KAAK,CAAC;aACf;QACL,CAAC;KAAA;CACJ;AA9BD,oCA8BC"}
|
package/dist/EmailService.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { AttachmentLike } from "nodemailer/lib/mailer";
|
|
4
|
-
import { Readable } from "stream";
|
|
5
|
-
export declare class EmailService {
|
|
6
|
-
host: string;
|
|
7
|
-
username: string;
|
|
8
|
-
username_from: string;
|
|
9
|
-
password: string;
|
|
10
|
-
error_title: string;
|
|
11
|
-
error_recipients: string;
|
|
12
|
-
constructor(host: string, username: string, username_from: string, password: string, error_title: string, error_recipients: string);
|
|
13
|
-
sendExeption(error: Error, meta: any, callback?: (err: Error | null, info: any) => void): void;
|
|
14
|
-
sendError(title: string, message: string, callback?: (err: Error | null, info: any) => void): void;
|
|
15
|
-
send(to: string, subject: string, text: string, html?: string | Buffer | Readable | AttachmentLike | undefined, callback?: (err: Error | null, info: any) => void): void;
|
|
16
|
-
}
|
package/dist/EmailService.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EmailService = void 0;
|
|
7
|
-
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
8
|
-
const nodemailer_smtp_transport_1 = __importDefault(require("nodemailer-smtp-transport"));
|
|
9
|
-
class EmailService {
|
|
10
|
-
constructor(host, username, username_from, password, error_title, error_recipients) {
|
|
11
|
-
this.host = host;
|
|
12
|
-
this.username = username;
|
|
13
|
-
this.username_from = username_from;
|
|
14
|
-
this.password = password;
|
|
15
|
-
this.error_title = error_title;
|
|
16
|
-
this.error_recipients = error_recipients;
|
|
17
|
-
}
|
|
18
|
-
sendExeption(error, meta, callback) {
|
|
19
|
-
let title = error.message;
|
|
20
|
-
let message = title;
|
|
21
|
-
if (meta)
|
|
22
|
-
message += "\r\n" + JSON.stringify(meta);
|
|
23
|
-
message += "\r\n" + error.stack;
|
|
24
|
-
this.sendError(title, message, callback);
|
|
25
|
-
}
|
|
26
|
-
sendError(title, message, callback) {
|
|
27
|
-
if (!title)
|
|
28
|
-
title = '';
|
|
29
|
-
let toks = this.error_recipients.split(',');
|
|
30
|
-
for (let i = 0; i < toks.length; i++) {
|
|
31
|
-
const email = toks[i];
|
|
32
|
-
this.send(email, this.error_title + " - " + title, message, undefined, callback);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
send(to, subject, text, html, callback) {
|
|
36
|
-
if (!this.username)
|
|
37
|
-
return;
|
|
38
|
-
if (!this.password)
|
|
39
|
-
return;
|
|
40
|
-
let transform = {};
|
|
41
|
-
if (this.host === 'gmail')
|
|
42
|
-
transform = (0, nodemailer_smtp_transport_1.default)({
|
|
43
|
-
service: 'gmail',
|
|
44
|
-
host: 'smtp.gmail.com',
|
|
45
|
-
auth: {
|
|
46
|
-
user: this.username,
|
|
47
|
-
pass: this.password
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
else
|
|
51
|
-
transform = {
|
|
52
|
-
host: this.host,
|
|
53
|
-
port: 465,
|
|
54
|
-
secure: true,
|
|
55
|
-
auth: {
|
|
56
|
-
user: this.username,
|
|
57
|
-
pass: this.password
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
let transporter = nodemailer_1.default.createTransport(transform);
|
|
61
|
-
let mailOptions = {
|
|
62
|
-
from: this.username_from,
|
|
63
|
-
to,
|
|
64
|
-
subject,
|
|
65
|
-
text,
|
|
66
|
-
html
|
|
67
|
-
};
|
|
68
|
-
if (html)
|
|
69
|
-
mailOptions.html = html;
|
|
70
|
-
transporter.sendMail(mailOptions, function (error, info) {
|
|
71
|
-
if (callback)
|
|
72
|
-
callback(error, info);
|
|
73
|
-
else {
|
|
74
|
-
if (error)
|
|
75
|
-
console.log(error);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.EmailService = EmailService;
|
|
81
|
-
//# sourceMappingURL=EmailService.js.map
|
package/dist/EmailService.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmailService.js","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":"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"}
|
package/dist/EnvService.d.ts
DELETED
package/dist/EnvService.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvService = void 0;
|
|
4
|
-
const namirasoft_core_1 = require("namirasoft-core");
|
|
5
|
-
class EnvService extends namirasoft_core_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
|
package/dist/EnvService.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnvService.js","sourceRoot":"","sources":["../src/EnvService.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAEjD,MAAa,UAAW,SAAQ,gCAAc;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/src/EnvService.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ConvertService } from "namirasoft-core";
|
|
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
|
-
}
|