@travetto/model-elasticsearch 4.1.3 → 5.0.0-rc.0
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/LICENSE +1 -1
- package/package.json +6 -6
- package/src/internal/query.ts +4 -4
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-elasticsearch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
4
4
|
"description": "Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"elasticsearch",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"directory": "module/model-elasticsearch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@elastic/elasticsearch": "^8.
|
|
31
|
-
"@travetto/config": "^
|
|
32
|
-
"@travetto/model": "^
|
|
33
|
-
"@travetto/model-query": "^
|
|
30
|
+
"@elastic/elasticsearch": "^8.14.0",
|
|
31
|
+
"@travetto/config": "^5.0.0-rc.0",
|
|
32
|
+
"@travetto/model": "^5.0.0-rc.0",
|
|
33
|
+
"@travetto/model-query": "^5.0.0-rc.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/command": "^
|
|
36
|
+
"@travetto/command": "^5.0.0-rc.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@travetto/command": {
|
package/src/internal/query.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryDslQueryContainer, SearchRequest, SearchResponse, Sort, SortOptions } from '@elastic/elasticsearch/lib/api/types';
|
|
2
2
|
|
|
3
|
-
import { Class
|
|
3
|
+
import { Class } from '@travetto/base';
|
|
4
4
|
import { WhereClause, SelectClause, SortClause, Query } from '@travetto/model-query';
|
|
5
5
|
import { QueryLanguageParser } from '@travetto/model-query/src/internal/query/parser';
|
|
6
6
|
import { QueryVerifier } from '@travetto/model-query/src/internal/query/verifier';
|
|
@@ -35,7 +35,7 @@ export class ElasticsearchQueryUtil {
|
|
|
35
35
|
for (const key of keys) {
|
|
36
36
|
const subPath = `${path}${key}`;
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
38
|
-
if (
|
|
38
|
+
if (DataUtil.isPlainObject(sub[key]) && !Object.keys(sub[key] as Record<string, unknown>)[0].startsWith('$')) {
|
|
39
39
|
Object.assign(out, this.extractSimple(sub[key], `${subPath}.`));
|
|
40
40
|
} else {
|
|
41
41
|
out[subPath] = sub[key];
|
|
@@ -93,7 +93,7 @@ export class ElasticsearchQueryUtil {
|
|
|
93
93
|
((key === 'id' && !path) ? '_id' : `${path}${key}`) :
|
|
94
94
|
`${path}${key}`;
|
|
95
95
|
|
|
96
|
-
if (
|
|
96
|
+
if (DataUtil.isPlainObject(top)) {
|
|
97
97
|
const subKey = Object.keys(top)[0];
|
|
98
98
|
if (!subKey.startsWith('$')) {
|
|
99
99
|
const inner = this.extractWhereTermQuery(declaredType, top, config, `${sPath}.`);
|
|
@@ -321,7 +321,7 @@ export class ElasticsearchQueryUtil {
|
|
|
321
321
|
const obj = r._source!;
|
|
322
322
|
if (includeId) {
|
|
323
323
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
324
|
-
(obj as unknown as { _id: string })._id = r._id
|
|
324
|
+
(obj as unknown as { _id: string })._id = r._id!;
|
|
325
325
|
}
|
|
326
326
|
out.push(obj);
|
|
327
327
|
}
|