@opra/elastic 1.5.0 → 1.5.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.
|
@@ -72,8 +72,11 @@ class ElasticEntityService extends elastic_service_js_1.ElasticService {
|
|
|
72
72
|
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
73
73
|
*/
|
|
74
74
|
get dataType() {
|
|
75
|
+
if (this._dataType && this._dataTypeScope !== this.scope)
|
|
76
|
+
this._dataType = undefined;
|
|
75
77
|
if (!this._dataType)
|
|
76
78
|
this._dataType = this.context.documentNode.getComplexType(this._dataType_);
|
|
79
|
+
this._dataTypeScope = this.scope;
|
|
77
80
|
return this._dataType;
|
|
78
81
|
}
|
|
79
82
|
/**
|
|
@@ -299,7 +302,10 @@ class ElasticEntityService extends elastic_service_js_1.ElasticService {
|
|
|
299
302
|
let validator = this._inputCodecs[operation];
|
|
300
303
|
if (validator)
|
|
301
304
|
return validator;
|
|
302
|
-
const options = {
|
|
305
|
+
const options = {
|
|
306
|
+
projection: '*',
|
|
307
|
+
scope: this._dataTypeScope,
|
|
308
|
+
};
|
|
303
309
|
if (operation === 'update')
|
|
304
310
|
options.partial = 'deep';
|
|
305
311
|
const dataType = this.dataType;
|
|
@@ -317,6 +323,7 @@ class ElasticEntityService extends elastic_service_js_1.ElasticService {
|
|
|
317
323
|
const options = {
|
|
318
324
|
projection: '*',
|
|
319
325
|
partial: 'deep',
|
|
326
|
+
scope: this._dataTypeScope,
|
|
320
327
|
};
|
|
321
328
|
const dataType = this.dataType;
|
|
322
329
|
validator = dataType.generateCodec('decode', options);
|
|
@@ -69,8 +69,11 @@ export class ElasticEntityService extends ElasticService {
|
|
|
69
69
|
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
70
70
|
*/
|
|
71
71
|
get dataType() {
|
|
72
|
+
if (this._dataType && this._dataTypeScope !== this.scope)
|
|
73
|
+
this._dataType = undefined;
|
|
72
74
|
if (!this._dataType)
|
|
73
75
|
this._dataType = this.context.documentNode.getComplexType(this._dataType_);
|
|
76
|
+
this._dataTypeScope = this.scope;
|
|
74
77
|
return this._dataType;
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
@@ -296,7 +299,10 @@ export class ElasticEntityService extends ElasticService {
|
|
|
296
299
|
let validator = this._inputCodecs[operation];
|
|
297
300
|
if (validator)
|
|
298
301
|
return validator;
|
|
299
|
-
const options = {
|
|
302
|
+
const options = {
|
|
303
|
+
projection: '*',
|
|
304
|
+
scope: this._dataTypeScope,
|
|
305
|
+
};
|
|
300
306
|
if (operation === 'update')
|
|
301
307
|
options.partial = 'deep';
|
|
302
308
|
const dataType = this.dataType;
|
|
@@ -314,6 +320,7 @@ export class ElasticEntityService extends ElasticService {
|
|
|
314
320
|
const options = {
|
|
315
321
|
projection: '*',
|
|
316
322
|
partial: 'deep',
|
|
323
|
+
scope: this._dataTypeScope,
|
|
317
324
|
};
|
|
318
325
|
const dataType = this.dataType;
|
|
319
326
|
validator = dataType.generateCodec('decode', options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/elastic",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Opra Elastic Search adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@elastic/elasticsearch": ">=8.7.0",
|
|
14
|
-
"@opra/common": "^1.5.
|
|
15
|
-
"@opra/core": "^1.5.
|
|
14
|
+
"@opra/common": "^1.5.2",
|
|
15
|
+
"@opra/core": "^1.5.2"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"exports": {
|
|
@@ -20,6 +20,7 @@ export declare namespace ElasticEntityService {
|
|
|
20
20
|
indexName?: ElasticEntityService['indexName'];
|
|
21
21
|
resourceName?: ElasticEntityService['resourceName'];
|
|
22
22
|
idGenerator?: ElasticEntityService['idGenerator'];
|
|
23
|
+
scope?: ElasticEntityService['scope'];
|
|
23
24
|
}
|
|
24
25
|
interface CommandInfo extends ElasticService.CommandInfo {
|
|
25
26
|
}
|
|
@@ -141,10 +142,15 @@ export declare namespace ElasticEntityService {
|
|
|
141
142
|
* @template T - The type of the documents in the collection.
|
|
142
143
|
*/
|
|
143
144
|
export declare class ElasticEntityService<T extends object = any> extends ElasticService {
|
|
145
|
+
protected _dataTypeScope?: string;
|
|
144
146
|
protected _dataType_: Type | string;
|
|
145
147
|
protected _dataType?: ComplexType;
|
|
146
148
|
protected _inputCodecs: Record<string, IsObject.Validator<T>>;
|
|
147
149
|
protected _outputCodecs: Record<string, IsObject.Validator<T>>;
|
|
150
|
+
/**
|
|
151
|
+
* Defines comma delimited scopes for api document
|
|
152
|
+
*/
|
|
153
|
+
scope?: string;
|
|
148
154
|
/**
|
|
149
155
|
* Represents the name of a index in ElasticDB
|
|
150
156
|
*/
|