feathers-elasticsearch
Advanced tools
Comparing version 3.1.0 to 3.1.1-0
# Change Log | ||
## [v3.1.0](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/tree/v3.1.0) (2019-10-07) | ||
[Full Changelog](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/compare/v3.0.0...v3.1.0) | ||
**Closed issues:** | ||
- An in-range update of @feathersjs/adapter-tests is breaking the build 🚨 [\#96](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/issues/96) | ||
- An in-range update of @feathersjs/commons is breaking the build 🚨 [\#95](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/issues/95) | ||
- An in-range update of dtslint is breaking the build 🚨 [\#93](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/issues/93) | ||
**Merged pull requests:** | ||
- Update all dependencies [\#97](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/pull/97) ([daffl](https://github.com/daffl)) | ||
- Update dtslint to the latest version 🚀 [\#92](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/pull/92) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
- Drop support for elasticsearch 2.4 [\#91](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/pull/91) ([jciolek](https://github.com/jciolek)) | ||
## [v3.0.0](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/tree/v3.0.0) (2019-07-06) | ||
@@ -4,0 +19,0 @@ [Full Changelog](https://github.com/feathersjs-ecosystem/feathers-elasticsearch/compare/v2.1.0...v3.0.0) |
@@ -16,3 +16,3 @@ 'use strict'; | ||
.then(results => { | ||
const created = mapBulk(results.items, service.id, service.meta, service.join); | ||
const created = mapBulk(results.body.items, service.id, service.meta, service.join); | ||
// We are fetching only items which have been correctly created. | ||
@@ -19,0 +19,0 @@ const docs = created |
@@ -24,5 +24,5 @@ 'use strict'; | ||
return service.Model[method](createParams) | ||
.then(result => get(service, result._id, getParams)); | ||
.then(({ body: result }) => get(service, result._id, getParams)); | ||
} | ||
module.exports = createCore; |
@@ -16,3 +16,3 @@ 'use strict'; | ||
return service.Model.mget(bulkGetParams) | ||
.then(fetched => fetched.docs.map(item => | ||
.then(fetched => fetched.body.docs.map(item => | ||
mapGet(item, service.id, service.meta, service.join)) | ||
@@ -19,0 +19,0 @@ ); |
@@ -44,5 +44,5 @@ 'use strict'; | ||
return service.Model.get(getParams) | ||
.then(result => mapGet(result, service.id, service.meta, service.join)); | ||
.then(({ body: result }) => mapGet(result, service.id, service.meta, service.join)); | ||
} | ||
module.exports = get; |
@@ -50,5 +50,6 @@ 'use strict'; | ||
return service.Model.bulk(bulkUpdateParams) | ||
.then(result => | ||
mapBulk(result.items, service.id, service.meta, service.join) | ||
); | ||
.then(result => { | ||
const items = result.body ? result.body.items : result; | ||
return mapBulk(items, service.id, service.meta, service.join); | ||
}); | ||
}); | ||
@@ -55,0 +56,0 @@ } |
@@ -26,5 +26,5 @@ 'use strict'; | ||
.then(() => service.Model.update(updateParams)) | ||
.then(result => mapPatch(result, service.id, service.meta, service.join)); | ||
.then(({ body: result }) => mapPatch(result, service.id, service.meta, service.join)); | ||
} | ||
module.exports = patch; |
@@ -26,6 +26,8 @@ 'use strict'; | ||
return service.Model.bulk(bulkRemoveParams) | ||
.then(results => results.items | ||
.map((item, index) => item.delete.status === 200 ? found[index] : false) | ||
.filter(item => !!item) | ||
); | ||
.then(results => { | ||
const items = results.body ? results.body.items : (results.items || []); | ||
return items | ||
.map((item, index) => (item.delete && item.delete.status === 200) ? found[index] : false) | ||
.filter(item => !!item); | ||
}); | ||
}); | ||
@@ -32,0 +34,0 @@ } |
@@ -13,3 +13,3 @@ 'use strict'; | ||
return service.Model.index(updateParams) | ||
.then(result => get(service, result._id, removeProps(params, 'upsert'))); | ||
.then(({ body: result }) => get(service, result._id, removeProps(params, 'upsert'))); | ||
} | ||
@@ -16,0 +16,0 @@ |
@@ -170,2 +170,3 @@ 'use strict'; | ||
console.log(error.stack); | ||
throw new errors.GeneralError(error.message, error); | ||
@@ -172,0 +173,0 @@ } |
@@ -13,9 +13,10 @@ 'use strict'; | ||
function mapFind (results, idProp, metaProp, joinProp, filters, hasPagination) { | ||
const data = results.hits.hits | ||
.map(result => mapGet(result, idProp, metaProp, joinProp)); | ||
const { hits = [] } = results.body ? results.body.hits : results.hits; | ||
const data = hits.map(result => mapGet(result, idProp, metaProp, joinProp)); | ||
if (hasPagination) { | ||
const total = typeof results.hits.total === 'object' | ||
? results.hits.total.value | ||
: results.hits.total; | ||
const { hits } = results.body || results; | ||
const total = typeof hits.total === 'object' | ||
? hits.total.value | ||
: hits.total; | ||
@@ -45,3 +46,4 @@ return { | ||
function mapBulk (items, idProp, metaProp, joinProp) { | ||
function mapBulk (_items, idProp, metaProp, joinProp) { | ||
const items = Array.isArray(_items) ? _items : _items.items; | ||
return items | ||
@@ -48,0 +50,0 @@ .map(item => { |
{ | ||
"name": "feathers-elasticsearch", | ||
"description": "Elasticsearch adapter for FeathersJs", | ||
"version": "3.1.0", | ||
"version": "3.1.1-0", | ||
"homepage": "https://github.com/feathersjs-ecosystem/feathers-elasticsearch", | ||
@@ -34,6 +34,7 @@ "main": "lib/", | ||
"release:major": "npm version major && npm publish", | ||
"release:pre": "npm version prerelease && npm publish --tag pre --access public", | ||
"changelog": "github_changelog_generator && git add CHANGELOG.md && git commit -am \"Updating changelog\"", | ||
"lint": "eslint --fix .", | ||
"dtslint": "dtslint types", | ||
"mocha": "mocha --opts mocha.opts", | ||
"mocha": "mocha --recursive test/", | ||
"coverage": "nyc npm run mocha", | ||
@@ -46,22 +47,21 @@ "test": "npm run lint && npm run dtslint && npm run coverage" | ||
"dependencies": { | ||
"@feathersjs/adapter-commons": "^4.3.6", | ||
"@feathersjs/commons": "^4.3.0", | ||
"@feathersjs/errors": "^4.3.4", | ||
"debug": "^4.1.1" | ||
"@feathersjs/adapter-commons": "^4.5.11", | ||
"@feathersjs/commons": "^4.5.11", | ||
"@feathersjs/errors": "^4.5.11", | ||
"debug": "^4.3.2" | ||
}, | ||
"devDependencies": { | ||
"@feathersjs/adapter-tests": "^4.3.4", | ||
"@feathersjs/express": "^4.3.5", | ||
"@feathersjs/feathers": "^4.3.4", | ||
"@feathersjs/socketio": "^4.3.5", | ||
"@types/elasticsearch": "^5.0.35", | ||
"chai": "^4.2.0", | ||
"dtslint": "^0.9.8", | ||
"elasticsearch": "^16.4.0", | ||
"eslint": "^6.5.1", | ||
"mocha": "^6.2.1", | ||
"nyc": "^14.1.1", | ||
"semistandard": "^14.2.0", | ||
"sinon": "^7.5.0" | ||
"@elastic/elasticsearch": "^7.14.1", | ||
"@feathersjs/adapter-tests": "^4.5.11", | ||
"@feathersjs/express": "^4.5.11", | ||
"@feathersjs/feathers": "^4.5.11", | ||
"@feathersjs/socketio": "^4.5.11", | ||
"chai": "^4.3.4", | ||
"dtslint": "^4.1.6", | ||
"eslint": "^7.32.0", | ||
"mocha": "^9.1.1", | ||
"nyc": "^15.1.0", | ||
"semistandard": "^16.0.1", | ||
"sinon": "^11.1.2" | ||
} | ||
} |
@@ -11,5 +11,6 @@ # feathers-elasticsearch | ||
To install the prerelease run: | ||
```bash | ||
$ npm install --save elasticsearch feathers-elasticsearch | ||
$ npm install --save @elastic/elasticsearch feathers-elasticsearch@pre | ||
``` | ||
@@ -25,3 +26,3 @@ | ||
const feathers = require('@feathersjs/feathers'); | ||
const elasticsearch = require('elasticsearch'); | ||
const elasticsearch = require('@elastic/elasticsearch'); | ||
const service = require('feathers-elasticsearch'); | ||
@@ -31,4 +32,3 @@ | ||
Model: new elasticsearch.Client({ | ||
host: 'localhost:9200', | ||
apiVersion: '5.0' | ||
node: 'http://localhost:9200' | ||
}), | ||
@@ -67,8 +67,7 @@ elasticsearch: { | ||
const service = require('feathers-elasticsearch'); | ||
const elasticsearch = require('elasticsearch'); | ||
const elasticsearch = require('@elastic/elasticsearch'); | ||
const messageService = service({ | ||
Model: new elasticsearch.Client({ | ||
host: 'localhost:9200', | ||
apiVersion: '6.0' | ||
node: 'http://localhost:9200' | ||
}), | ||
@@ -357,12 +356,10 @@ paginate: { | ||
mappings: { | ||
doc: { | ||
properties: { | ||
text: { | ||
type: 'text' | ||
}, | ||
my_join_field: { | ||
type: 'join', | ||
relations: { | ||
post: 'comment' | ||
} | ||
properties: { | ||
text: { | ||
type: 'text' | ||
}, | ||
my_join_field: { | ||
type: 'join', | ||
relations: { | ||
post: 'comment' | ||
} | ||
@@ -369,0 +366,0 @@ } |
@@ -1,2 +0,2 @@ | ||
const elasticsearch = require('elasticsearch'); | ||
const elasticsearch = require('@elastic/elasticsearch'); | ||
const { getCompatVersion, getCompatProp } = require('../lib/utils/core'); | ||
@@ -39,3 +39,3 @@ | ||
if (!apiVersion) { | ||
const esVersion = process.env.ES_VERSION || '5.0.0'; | ||
const esVersion = process.env.ES_VERSION || '7.0.0'; | ||
const [major, minor] = esVersion.split('.').slice(0, 2); | ||
@@ -53,4 +53,3 @@ | ||
client = new elasticsearch.Client({ | ||
host: 'localhost:9200', | ||
apiVersion: getApiVersion() | ||
node: 'http://localhost:9200' | ||
}); | ||
@@ -66,3 +65,3 @@ } | ||
return getClient().indices.delete({ index }) | ||
.catch((err) => err.status !== 404 && Promise.reject(err)); | ||
.catch((err) => err.statusCode !== 404 && Promise.reject(err)); | ||
} | ||
@@ -69,0 +68,0 @@ |
// TypeScript Version: 3.0 | ||
import { Params, Paginated, Id, NullableId, Query, Hook } from '@feathersjs/feathers'; | ||
import { AdapterService, ServiceOptions, InternalServiceMethods } from '@feathersjs/adapter-commons'; | ||
import { Client } from 'elasticsearch'; | ||
import { Client } from '@elastic/elasticsearch'; | ||
@@ -6,0 +6,0 @@ export interface ElasticsearchServiceOptions extends ServiceOptions { |
import { default as service } from 'feathers-elasticsearch'; | ||
import * as elasticsearch from 'elasticsearch'; | ||
import * as elasticsearch from '@elastic/elasticsearch'; | ||
const messageService = service({ | ||
Model: new elasticsearch.Client({ | ||
host: 'localhost:9200', | ||
apiVersion: '6.0' | ||
node: 'http://localhost:9200' | ||
}), | ||
@@ -9,0 +8,0 @@ paginate: { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
129086
12
1212
1
489
Updated@feathersjs/commons@^4.5.11
Updated@feathersjs/errors@^4.5.11
Updateddebug@^4.3.2