@samuelaj1/eazisend-service-kit 1.0.5 → 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 CHANGED
@@ -70,7 +70,7 @@ var Config = class {
70
70
  constructor() {
71
71
  this.API_GATEWAY_URL = process.env.API_GATEWAY_URL || "";
72
72
  this.GATEWAY_TOKEN = process.env.GATEWAY_TOKEN || "";
73
- this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL || "";
73
+ this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL?.trim() || "";
74
74
  this.PORT = process.env.PORT || "";
75
75
  }
76
76
  };
@@ -128,11 +128,13 @@ var LoggerRepo = class {
128
128
  }
129
129
  }
130
130
  };
131
- const esTransport = new import_winston_elasticsearch.ElasticsearchTransport(options.elasticsearch);
132
131
  this.logger = import_winston.default.createLogger({
133
132
  exitOnError: false,
134
133
  defaultMeta: { service: identifier },
135
- transports: [new import_winston.default.transports.Console(options.console), esTransport]
134
+ transports: [
135
+ new import_winston.default.transports.Console(options.console),
136
+ ...elasticsearchNode ? [new import_winston_elasticsearch.ElasticsearchTransport(options.elasticsearch)] : []
137
+ ]
136
138
  });
137
139
  return this;
138
140
  };
@@ -172,12 +174,14 @@ var ElasticsearchRepo = class {
172
174
  elasticSearchClient;
173
175
  /** Creates an Elasticsearch client using the configured cluster URL. */
174
176
  constructor() {
177
+ if (!libConfig.ELASTIC_SEARCH_NODE_URL) return;
175
178
  this.elasticSearchClient = new import_elasticsearch.Client({
176
179
  node: libConfig.ELASTIC_SEARCH_NODE_URL
177
180
  });
178
181
  }
179
182
  /** Elasticsearch connection is established. */
180
183
  async establishElasticSearchConnection(args) {
184
+ if (!this.elasticSearchClient) return;
181
185
  let isConnected = false;
182
186
  while (!isConnected) {
183
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
@@ -23,7 +23,7 @@ var Config = class {
23
23
  constructor() {
24
24
  this.API_GATEWAY_URL = process.env.API_GATEWAY_URL || "";
25
25
  this.GATEWAY_TOKEN = process.env.GATEWAY_TOKEN || "";
26
- this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL || "";
26
+ this.ELASTIC_SEARCH_NODE_URL = process.env.ELASTIC_SEARCH_NODE_URL?.trim() || "";
27
27
  this.PORT = process.env.PORT || "";
28
28
  }
29
29
  };
@@ -81,11 +81,13 @@ var LoggerRepo = class {
81
81
  }
82
82
  }
83
83
  };
84
- const esTransport = new ElasticsearchTransport(options.elasticsearch);
85
84
  this.logger = winston.createLogger({
86
85
  exitOnError: false,
87
86
  defaultMeta: { service: identifier },
88
- transports: [new winston.transports.Console(options.console), esTransport]
87
+ transports: [
88
+ new winston.transports.Console(options.console),
89
+ ...elasticsearchNode ? [new ElasticsearchTransport(options.elasticsearch)] : []
90
+ ]
89
91
  });
90
92
  return this;
91
93
  };
@@ -125,12 +127,14 @@ var ElasticsearchRepo = class {
125
127
  elasticSearchClient;
126
128
  /** Creates an Elasticsearch client using the configured cluster URL. */
127
129
  constructor() {
130
+ if (!libConfig.ELASTIC_SEARCH_NODE_URL) return;
128
131
  this.elasticSearchClient = new Client({
129
132
  node: libConfig.ELASTIC_SEARCH_NODE_URL
130
133
  });
131
134
  }
132
135
  /** Elasticsearch connection is established. */
133
136
  async establishElasticSearchConnection(args) {
137
+ if (!this.elasticSearchClient) return;
134
138
  let isConnected = false;
135
139
  while (!isConnected) {
136
140
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samuelaj1/eazisend-service-kit",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "scripts": {
5
5
  "build": "tsup"
6
6
  },