@xnestjs/elasticsearch 1.6.1 → 1.6.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.
|
@@ -18,7 +18,6 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
18
18
|
static forRoot(moduleOptions) {
|
|
19
19
|
const connectionOptions = (0, get_elasticsearch_config_js_1.getElasticsearchConfig)(moduleOptions.useValue || {}, moduleOptions.envPrefix);
|
|
20
20
|
return this._createDynamicModule(moduleOptions, {
|
|
21
|
-
global: moduleOptions.global,
|
|
22
21
|
providers: [
|
|
23
22
|
{
|
|
24
23
|
provide: constants_js_1.ELASTICSEARCH_CONNECTION_OPTIONS,
|
|
@@ -33,7 +32,6 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
33
32
|
static forRootAsync(asyncOptions) {
|
|
34
33
|
node_assert_1.default.ok(asyncOptions.useFactory, 'useFactory is required');
|
|
35
34
|
return this._createDynamicModule(asyncOptions, {
|
|
36
|
-
global: asyncOptions.global,
|
|
37
35
|
providers: [
|
|
38
36
|
{
|
|
39
37
|
provide: constants_js_1.ELASTICSEARCH_CONNECTION_OPTIONS,
|
|
@@ -46,9 +44,9 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
46
44
|
],
|
|
47
45
|
});
|
|
48
46
|
}
|
|
49
|
-
static _createDynamicModule(
|
|
50
|
-
const token =
|
|
51
|
-
const logger = typeof
|
|
47
|
+
static _createDynamicModule(moduleOptions, metadata) {
|
|
48
|
+
const token = moduleOptions.token ?? elasticsearch_1.ElasticsearchService;
|
|
49
|
+
const logger = typeof moduleOptions.logger === 'string' ? new common_1.Logger(moduleOptions.logger) : moduleOptions.logger;
|
|
52
50
|
const exports = [constants_js_1.ELASTICSEARCH_CONNECTION_OPTIONS, ...(metadata.exports ?? [])];
|
|
53
51
|
const providers = [
|
|
54
52
|
...(metadata.providers ?? []),
|
|
@@ -79,7 +77,7 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
79
77
|
return {
|
|
80
78
|
module: ElasticsearchCoreModule_1,
|
|
81
79
|
providers,
|
|
82
|
-
global:
|
|
80
|
+
global: moduleOptions.global,
|
|
83
81
|
imports: [
|
|
84
82
|
elasticsearch_1.ElasticsearchModule.registerAsync({
|
|
85
83
|
imports: [
|
|
@@ -15,7 +15,6 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
15
15
|
static forRoot(moduleOptions) {
|
|
16
16
|
const connectionOptions = getElasticsearchConfig(moduleOptions.useValue || {}, moduleOptions.envPrefix);
|
|
17
17
|
return this._createDynamicModule(moduleOptions, {
|
|
18
|
-
global: moduleOptions.global,
|
|
19
18
|
providers: [
|
|
20
19
|
{
|
|
21
20
|
provide: ELASTICSEARCH_CONNECTION_OPTIONS,
|
|
@@ -30,7 +29,6 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
30
29
|
static forRootAsync(asyncOptions) {
|
|
31
30
|
assert.ok(asyncOptions.useFactory, 'useFactory is required');
|
|
32
31
|
return this._createDynamicModule(asyncOptions, {
|
|
33
|
-
global: asyncOptions.global,
|
|
34
32
|
providers: [
|
|
35
33
|
{
|
|
36
34
|
provide: ELASTICSEARCH_CONNECTION_OPTIONS,
|
|
@@ -43,9 +41,9 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
43
41
|
],
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
|
-
static _createDynamicModule(
|
|
47
|
-
const token =
|
|
48
|
-
const logger = typeof
|
|
44
|
+
static _createDynamicModule(moduleOptions, metadata) {
|
|
45
|
+
const token = moduleOptions.token ?? ElasticsearchService;
|
|
46
|
+
const logger = typeof moduleOptions.logger === 'string' ? new Logger(moduleOptions.logger) : moduleOptions.logger;
|
|
49
47
|
const exports = [ELASTICSEARCH_CONNECTION_OPTIONS, ...(metadata.exports ?? [])];
|
|
50
48
|
const providers = [
|
|
51
49
|
...(metadata.providers ?? []),
|
|
@@ -76,7 +74,7 @@ let ElasticsearchCoreModule = ElasticsearchCoreModule_1 = class ElasticsearchCor
|
|
|
76
74
|
return {
|
|
77
75
|
module: ElasticsearchCoreModule_1,
|
|
78
76
|
providers,
|
|
79
|
-
global:
|
|
77
|
+
global: moduleOptions.global,
|
|
80
78
|
imports: [
|
|
81
79
|
ElasticsearchModule.registerAsync({
|
|
82
80
|
imports: [
|