@travetto/model-elasticsearch 2.0.0 → 2.1.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-elasticsearch",
|
|
3
3
|
"displayName": "Elasticsearch Model Source",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"description": "Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"elasticsearch",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"directory": "module/model-elasticsearch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elastic/elasticsearch": "^7.
|
|
32
|
-
"@travetto/config": "^2.
|
|
33
|
-
"@travetto/model": "^2.
|
|
34
|
-
"@travetto/model-query": "2.
|
|
31
|
+
"@elastic/elasticsearch": "^7.17.0",
|
|
32
|
+
"@travetto/config": "^2.1.0",
|
|
33
|
+
"@travetto/model": "^2.1.0",
|
|
34
|
+
"@travetto/model-query": "2.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@travetto/app": "^2.
|
|
37
|
+
"@travetto/app": "^2.1.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
package/src/internal/query.ts
CHANGED
package/src/internal/schema.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { version as VERSION } from '@elastic/elasticsearch/package.json';
|
|
2
|
-
|
|
3
1
|
import { Class, Util } from '@travetto/base';
|
|
4
2
|
import { ModelRegistry } from '@travetto/model';
|
|
5
3
|
import { PointImpl } from '@travetto/model-query/src/internal/model/point';
|
|
@@ -7,6 +5,8 @@ import { SchemaRegistry } from '@travetto/schema';
|
|
|
7
5
|
|
|
8
6
|
import { EsSchemaConfig } from './types';
|
|
9
7
|
|
|
8
|
+
const { version: VERSION } = require(require.resolve('@elastic/elasticsearch').replace('index.js', 'package.json'));
|
|
9
|
+
|
|
10
10
|
|
|
11
11
|
type FieldType = {
|
|
12
12
|
type?: string;
|
package/src/service.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Index, Update, Search, DeleteByQuery } from '@elastic/elasticsearch/api
|
|
|
4
4
|
import {
|
|
5
5
|
ModelCrudSupport, BulkOp, BulkResponse, ModelBulkSupport, ModelExpirySupport,
|
|
6
6
|
ModelIndexedSupport, ModelType, ModelStorageSupport, NotFoundError, ModelRegistry,
|
|
7
|
-
|
|
7
|
+
OptionalId
|
|
8
8
|
} from '@travetto/model';
|
|
9
9
|
import { Class, Util, ShutdownManager, AppError } from '@travetto/base';
|
|
10
10
|
import { SchemaChange, DeepPartial } from '@travetto/schema';
|
|
@@ -119,9 +119,7 @@ export class ElasticsearchModelService implements
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
async delete<T extends ModelType>(cls: Class<T>, id: string) {
|
|
122
|
-
|
|
123
|
-
throw new SubTypeNotSupportedError(cls);
|
|
124
|
-
}
|
|
122
|
+
ModelCrudUtil.ensureNotSubType(cls);
|
|
125
123
|
|
|
126
124
|
try {
|
|
127
125
|
const { body: res } = await this.client.delete({
|
|
@@ -160,9 +158,7 @@ export class ElasticsearchModelService implements
|
|
|
160
158
|
}
|
|
161
159
|
|
|
162
160
|
async update<T extends ModelType>(cls: Class<T>, o: T): Promise<T> {
|
|
163
|
-
|
|
164
|
-
throw new SubTypeNotSupportedError(cls);
|
|
165
|
-
}
|
|
161
|
+
ModelCrudUtil.ensureNotSubType(cls);
|
|
166
162
|
|
|
167
163
|
o = await ModelCrudUtil.preStore(cls, o, this);
|
|
168
164
|
|
|
@@ -185,9 +181,7 @@ export class ElasticsearchModelService implements
|
|
|
185
181
|
}
|
|
186
182
|
|
|
187
183
|
async upsert<T extends ModelType>(cls: Class<T>, o: OptionalId<T>) {
|
|
188
|
-
|
|
189
|
-
throw new SubTypeNotSupportedError(cls);
|
|
190
|
-
}
|
|
184
|
+
ModelCrudUtil.ensureNotSubType(cls);
|
|
191
185
|
|
|
192
186
|
const item = await ModelCrudUtil.preStore(cls, o, this);
|
|
193
187
|
|
|
@@ -205,9 +199,7 @@ export class ElasticsearchModelService implements
|
|
|
205
199
|
}
|
|
206
200
|
|
|
207
201
|
async updatePartial<T extends ModelType>(cls: Class<T>, data: Partial<T> & { id: string }) {
|
|
208
|
-
|
|
209
|
-
throw new SubTypeNotSupportedError(cls);
|
|
210
|
-
}
|
|
202
|
+
ModelCrudUtil.ensureNotSubType(cls);
|
|
211
203
|
|
|
212
204
|
const script = ElasticsearchSchemaUtil.generateUpdateScript(data);
|
|
213
205
|
const id = data.id;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { version } from '@elastic/elasticsearch/package.json';
|
|
2
1
|
import type { Service } from '@travetto/command/bin/lib/service';
|
|
3
2
|
|
|
3
|
+
const { version } = require(require.resolve('@elastic/elasticsearch').replace('index.js', 'package.json'));
|
|
4
|
+
|
|
4
5
|
const port = 9200;
|
|
5
6
|
|
|
6
7
|
export const service: Service = {
|