@travetto/model-elasticsearch 5.0.3 → 5.0.5
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/package.json +5 -5
- package/src/service.ts +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-elasticsearch",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"elasticsearch",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@elastic/elasticsearch": "^8.15.0",
|
|
31
|
-
"@travetto/config": "^5.0.
|
|
32
|
-
"@travetto/model": "^5.0.
|
|
33
|
-
"@travetto/model-query": "^5.0.
|
|
31
|
+
"@travetto/config": "^5.0.5",
|
|
32
|
+
"@travetto/model": "^5.0.5",
|
|
33
|
+
"@travetto/model-query": "^5.0.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/command": "^5.0.
|
|
36
|
+
"@travetto/command": "^5.0.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@travetto/command": {
|
package/src/service.ts
CHANGED
|
@@ -413,10 +413,9 @@ export class ElasticsearchModelService implements
|
|
|
413
413
|
return Promise.all(items.map(m => this.postLoad(cls, m)));
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
async queryOne<T extends ModelType>(cls: Class<T>, query: ModelQuery<T>, failOnMany
|
|
417
|
-
await
|
|
418
|
-
|
|
419
|
-
return ModelQueryUtil.verifyGetSingleCounts(cls, await this.query<T>(cls, { ...query, limit: failOnMany ? 2 : 1 }));
|
|
416
|
+
async queryOne<T extends ModelType>(cls: Class<T>, query: ModelQuery<T>, failOnMany: boolean = true): Promise<T> {
|
|
417
|
+
const result = await this.query<T>(cls, { ...query, limit: failOnMany ? 2 : 1 });
|
|
418
|
+
return ModelQueryUtil.verifyGetSingleCounts<T>(cls, failOnMany, result, query.where);
|
|
420
419
|
}
|
|
421
420
|
|
|
422
421
|
async queryCount<T extends ModelType>(cls: Class<T>, query: Query<T>): Promise<number> {
|