@travetto/model-elasticsearch 2.2.0 → 2.2.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@travetto/model-elasticsearch",
3
3
  "displayName": "Elasticsearch Model Source",
4
- "version": "2.2.0",
4
+ "version": "2.2.3",
5
5
  "description": "Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.",
6
6
  "keywords": [
7
7
  "elasticsearch",
@@ -29,12 +29,12 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@elastic/elasticsearch": "^7.17.0",
32
- "@travetto/config": "^2.2.0",
33
- "@travetto/model": "^2.2.0",
34
- "@travetto/model-query": "2.2.0"
32
+ "@travetto/config": "^2.2.3",
33
+ "@travetto/model": "^2.2.3",
34
+ "@travetto/model-query": "2.2.3"
35
35
  },
36
36
  "devDependencies": {
37
- "@travetto/app": "^2.2.0"
37
+ "@travetto/app": "^2.2.3"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
@@ -324,8 +324,8 @@ export class ElasticsearchQueryUtil {
324
324
  for (const r of results.body.hits.hits) {
325
325
  const obj = r._source;
326
326
  if (includeId) {
327
- // @ts-ignore
328
- obj._id = r._id;
327
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
328
+ (obj as unknown as { _id: string })._id = r._id;
329
329
  }
330
330
  out.push(obj);
331
331
  }
package/src/service.ts CHANGED
@@ -11,7 +11,7 @@ import { SchemaChange, DeepPartial } from '@travetto/schema';
11
11
  import { Injectable } from '@travetto/di';
12
12
  import {
13
13
  ModelQuery, ModelQueryCrudSupport, ModelQueryFacetSupport,
14
- ModelQuerySupport, PageableModelQuery, Query, ValidStringFields
14
+ ModelQuerySupport, PageableModelQuery, Query, SelectClause, ValidStringFields
15
15
  } from '@travetto/model-query';
16
16
 
17
17
  import { ModelCrudUtil } from '@travetto/model/src/internal/service/crud';
@@ -298,7 +298,7 @@ export class ElasticsearchModelService implements
298
298
 
299
299
  for (let i = 0; i < res.items.length; i++) {
300
300
  const item = res.items[i];
301
- const [k] = Util.getKeys<Count | 'create' | 'index'>(item);
301
+ const [k] = Object.keys<Record<Count | 'create' | 'index', unknown>>(item);
302
302
  const v = item[k]!;
303
303
  if (v.error) {
304
304
  out.errors.push(v.error);
@@ -456,9 +456,11 @@ export class ElasticsearchModelService implements
456
456
  }
457
457
 
458
458
  async suggestValues<T extends ModelType>(cls: Class<T>, field: ValidStringFields<T>, prefix?: string, query?: PageableModelQuery<T>): Promise<string[]> {
459
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
460
+ const select: SelectClause<T> = { [field]: 1 } as SelectClause<T>;
461
+
459
462
  const q = ModelQuerySuggestUtil.getSuggestQuery(cls, field, prefix, {
460
- // @ts-ignore
461
- select: { [field]: 1 },
463
+ select,
462
464
  ...query
463
465
  });
464
466
  const search = ElasticsearchQueryUtil.getSearchObject(cls, q);