@xnestjs/elasticsearch 1.6.2 → 1.6.3
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/cjs/elasticsearch-core.module.js +10 -10
- package/esm/elasticsearch-core.module.js +10 -10
- package/package.json +1 -1
- package/types/types.d.ts +1 -0
|
@@ -106,16 +106,16 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
106
106
|
this.connectionOptions = connectionOptions;
|
|
107
107
|
}
|
|
108
108
|
async onApplicationBootstrap() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
109
|
+
const options = this.connectionOptions;
|
|
110
|
+
if (options.lazyConnect)
|
|
111
|
+
return;
|
|
112
|
+
const nodes = options.node || options.nodes;
|
|
113
|
+
this.logger?.log(`Connecting to ElasticSearch at ${colors.blue(String(nodes))}`);
|
|
114
|
+
common_1.Logger.flush();
|
|
115
|
+
await this.client.ping({}).catch(e => {
|
|
116
|
+
this.logger.error('ElasticSearch connection failed: ' + e.message);
|
|
117
|
+
throw e;
|
|
118
|
+
});
|
|
119
119
|
}
|
|
120
120
|
onApplicationShutdown() {
|
|
121
121
|
return this.client.close();
|
|
@@ -103,16 +103,16 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
103
103
|
this.connectionOptions = connectionOptions;
|
|
104
104
|
}
|
|
105
105
|
async onApplicationBootstrap() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
106
|
+
const options = this.connectionOptions;
|
|
107
|
+
if (options.lazyConnect)
|
|
108
|
+
return;
|
|
109
|
+
const nodes = options.node || options.nodes;
|
|
110
|
+
this.logger?.log(`Connecting to ElasticSearch at ${colors.blue(String(nodes))}`);
|
|
111
|
+
Logger.flush();
|
|
112
|
+
await this.client.ping({}).catch(e => {
|
|
113
|
+
this.logger.error('ElasticSearch connection failed: ' + e.message);
|
|
114
|
+
throw e;
|
|
115
|
+
});
|
|
116
116
|
}
|
|
117
117
|
onApplicationShutdown() {
|
|
118
118
|
return this.client.close();
|
package/package.json
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Logger } from '@nestjs/common';
|
|
|
3
3
|
import type { ModuleMetadata } from '@nestjs/common/interfaces';
|
|
4
4
|
import type { InjectionToken } from '@nestjs/common/interfaces/modules/injection-token.interface';
|
|
5
5
|
export interface ElasticsearchConnectionOptions extends ClientOptions {
|
|
6
|
+
lazyConnect?: boolean;
|
|
6
7
|
}
|
|
7
8
|
interface BaseModuleOptions {
|
|
8
9
|
token?: InjectionToken;
|