@samuelaj1/eazisend-service-kit 1.0.4 → 1.0.6
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 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -60,6 +60,8 @@ var import_helmet = __toESM(require("helmet"), 1);
|
|
|
60
60
|
var import_cors = __toESM(require("cors"), 1);
|
|
61
61
|
|
|
62
62
|
// src/config.ts
|
|
63
|
+
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
64
|
+
import_dotenv.default.config({ quiet: true });
|
|
63
65
|
var Config = class {
|
|
64
66
|
API_GATEWAY_URL;
|
|
65
67
|
GATEWAY_TOKEN;
|
|
@@ -68,7 +70,7 @@ var Config = class {
|
|
|
68
70
|
constructor() {
|
|
69
71
|
this.API_GATEWAY_URL = process.env.API_GATEWAY_URL || "";
|
|
70
72
|
this.GATEWAY_TOKEN = process.env.GATEWAY_TOKEN || "";
|
|
71
|
-
this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL || "";
|
|
73
|
+
this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL?.trim() || "";
|
|
72
74
|
this.PORT = process.env.PORT || "";
|
|
73
75
|
}
|
|
74
76
|
};
|
|
@@ -126,11 +128,13 @@ var LoggerRepo = class {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
};
|
|
129
|
-
const esTransport = new import_winston_elasticsearch.ElasticsearchTransport(options.elasticsearch);
|
|
130
131
|
this.logger = import_winston.default.createLogger({
|
|
131
132
|
exitOnError: false,
|
|
132
133
|
defaultMeta: { service: identifier },
|
|
133
|
-
transports: [
|
|
134
|
+
transports: [
|
|
135
|
+
new import_winston.default.transports.Console(options.console),
|
|
136
|
+
...elasticsearchNode ? [new import_winston_elasticsearch.ElasticsearchTransport(options.elasticsearch)] : []
|
|
137
|
+
]
|
|
134
138
|
});
|
|
135
139
|
return this;
|
|
136
140
|
};
|
|
@@ -170,12 +174,14 @@ var ElasticsearchRepo = class {
|
|
|
170
174
|
elasticSearchClient;
|
|
171
175
|
/** Creates an Elasticsearch client using the configured cluster URL. */
|
|
172
176
|
constructor() {
|
|
177
|
+
if (!libConfig.ELASTIC_SEARCH_NODE_URL) return;
|
|
173
178
|
this.elasticSearchClient = new import_elasticsearch.Client({
|
|
174
179
|
node: libConfig.ELASTIC_SEARCH_NODE_URL
|
|
175
180
|
});
|
|
176
181
|
}
|
|
177
182
|
/** Elasticsearch connection is established. */
|
|
178
183
|
async establishElasticSearchConnection(args) {
|
|
184
|
+
if (!this.elasticSearchClient) return;
|
|
179
185
|
let isConnected = false;
|
|
180
186
|
while (!isConnected) {
|
|
181
187
|
try {
|
package/dist/index.d.cts
CHANGED
|
@@ -27,7 +27,7 @@ declare function runServer(app: Express): void;
|
|
|
27
27
|
|
|
28
28
|
/** Configured Elasticsearch cluster */
|
|
29
29
|
declare class ElasticsearchRepo {
|
|
30
|
-
private elasticSearchClient
|
|
30
|
+
private elasticSearchClient?;
|
|
31
31
|
/** Creates an Elasticsearch client using the configured cluster URL. */
|
|
32
32
|
constructor();
|
|
33
33
|
/** Elasticsearch connection is established. */
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare function runServer(app: Express): void;
|
|
|
27
27
|
|
|
28
28
|
/** Configured Elasticsearch cluster */
|
|
29
29
|
declare class ElasticsearchRepo {
|
|
30
|
-
private elasticSearchClient
|
|
30
|
+
private elasticSearchClient?;
|
|
31
31
|
/** Creates an Elasticsearch client using the configured cluster URL. */
|
|
32
32
|
constructor();
|
|
33
33
|
/** Elasticsearch connection is established. */
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,8 @@ import helmet from "helmet";
|
|
|
13
13
|
import cors from "cors";
|
|
14
14
|
|
|
15
15
|
// src/config.ts
|
|
16
|
+
import dotenv from "dotenv";
|
|
17
|
+
dotenv.config({ quiet: true });
|
|
16
18
|
var Config = class {
|
|
17
19
|
API_GATEWAY_URL;
|
|
18
20
|
GATEWAY_TOKEN;
|
|
@@ -21,7 +23,7 @@ var Config = class {
|
|
|
21
23
|
constructor() {
|
|
22
24
|
this.API_GATEWAY_URL = process.env.API_GATEWAY_URL || "";
|
|
23
25
|
this.GATEWAY_TOKEN = process.env.GATEWAY_TOKEN || "";
|
|
24
|
-
this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL || "";
|
|
26
|
+
this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL?.trim() || "";
|
|
25
27
|
this.PORT = process.env.PORT || "";
|
|
26
28
|
}
|
|
27
29
|
};
|
|
@@ -79,11 +81,13 @@ var LoggerRepo = class {
|
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
};
|
|
82
|
-
const esTransport = new ElasticsearchTransport(options.elasticsearch);
|
|
83
84
|
this.logger = winston.createLogger({
|
|
84
85
|
exitOnError: false,
|
|
85
86
|
defaultMeta: { service: identifier },
|
|
86
|
-
transports: [
|
|
87
|
+
transports: [
|
|
88
|
+
new winston.transports.Console(options.console),
|
|
89
|
+
...elasticsearchNode ? [new ElasticsearchTransport(options.elasticsearch)] : []
|
|
90
|
+
]
|
|
87
91
|
});
|
|
88
92
|
return this;
|
|
89
93
|
};
|
|
@@ -123,12 +127,14 @@ var ElasticsearchRepo = class {
|
|
|
123
127
|
elasticSearchClient;
|
|
124
128
|
/** Creates an Elasticsearch client using the configured cluster URL. */
|
|
125
129
|
constructor() {
|
|
130
|
+
if (!libConfig.ELASTIC_SEARCH_NODE_URL) return;
|
|
126
131
|
this.elasticSearchClient = new Client({
|
|
127
132
|
node: libConfig.ELASTIC_SEARCH_NODE_URL
|
|
128
133
|
});
|
|
129
134
|
}
|
|
130
135
|
/** Elasticsearch connection is established. */
|
|
131
136
|
async establishElasticSearchConnection(args) {
|
|
137
|
+
if (!this.elasticSearchClient) return;
|
|
132
138
|
let isConnected = false;
|
|
133
139
|
while (!isConnected) {
|
|
134
140
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samuelaj1/eazisend-service-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsup"
|
|
6
6
|
},
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
],
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/
|
|
24
|
+
"url": "git+https://github.com/eazisend/shared-services-lib"
|
|
25
25
|
},
|
|
26
|
-
"homepage": "https://github.com/
|
|
26
|
+
"homepage": "https://github.com/eazisend/shared-services-lib",
|
|
27
27
|
"keywords": [],
|
|
28
28
|
"author": "samuelaj1",
|
|
29
29
|
"license": "MIT",
|