Comparing version 0.9.9 to 0.9.10
@@ -7,3 +7,3 @@ | ||
const Plugin = PluginFactory(({ namespace='DAO', data={} }) => | ||
(req, res, next) => { | ||
(req, res, next) => { | ||
if (!req[namespace]) req[namespace] = MemoryStore(data) | ||
@@ -10,0 +10,0 @@ |
@@ -26,3 +26,3 @@ | ||
/*eslint max-statements: ["error", 21]*/ | ||
module.exports = function MemoryStore(data_set) { | ||
@@ -29,0 +29,0 @@ |
@@ -30,4 +30,3 @@ | ||
// getIndexList :: ElasticsearchClient -> Promise List String | ||
const getIndexList = (client) => { | ||
return client.indices.stats({ index: '_all' }) | ||
const getIndexList = (client) => client.indices.stats({ index: '_all' }) | ||
.then(R.compose( | ||
@@ -37,10 +36,7 @@ R.keys | ||
)) | ||
} | ||
// hasIndex :: ElasticsearchClient -> String -> Promise Boolean | ||
const hasIndex = R.curry((client, name) => { | ||
return getIndexList(client) | ||
.then(R.contains(name)) | ||
}) | ||
const hasIndex = R.curry((client, name) => getIndexList(client) | ||
.then(R.contains(name))) | ||
@@ -50,4 +46,3 @@ | ||
// -> Promise ESResponse | Promise null | ||
const addIndex = R.curry((client, name, definition) => { | ||
return hasIndex(client)(name) | ||
const addIndex = R.curry((client, name, definition) => hasIndex(client)(name) | ||
.then((has_index) => { | ||
@@ -62,4 +57,3 @@ if (has_index) { | ||
}) | ||
}) | ||
}) | ||
})) | ||
@@ -69,4 +63,3 @@ | ||
// ElasticsearchClient -> String -> Promise ESResponse | Promise null | ||
const dropIndex = R.curry((client, name) => { | ||
return hasIndex(client)(name) | ||
const dropIndex = R.curry((client, name) => hasIndex(client)(name) | ||
.then((has_index) => { | ||
@@ -80,4 +73,3 @@ if (!has_index) { | ||
}) | ||
}) | ||
}) | ||
})) | ||
@@ -117,23 +109,18 @@ | ||
/* eslint-disable max-len */ | ||
// getMappings :: ElasticsearchClient | ||
// -> ( String -> String ) -> Promise Mapping | Promise null | ||
const getMappings = R.curry((client, index, type) => { | ||
return client.indices.getMapping({ "index": index }) | ||
const getMappings = R.curry((client, index, type) => client.indices.getMapping({ "index": index }) | ||
.then(R.pathOr(null, [index, 'mappings', type, 'properties'])) | ||
.catch(() => null) | ||
}) | ||
.catch(() => null)) | ||
// updateMappings :: ElasticsearchClient -> String | ||
// -> ( String, Mapping, ESMappingOption ) -> Promise ESResponse | ||
const updateMappings = R.curry((client, index, type, mappings, options) => { | ||
return addIndex(client)(index, null) | ||
.then(() => _addMappingsToIndex(client)(index, type, mappings, options)) | ||
}) | ||
const updateMappings = R.curry((client, index, type, mappings, options) => addIndex(client)(index, null) | ||
.then(() => _addMappingsToIndex(client)(index, type, mappings, options))) | ||
// canMigrate :: String -> String -> Promise Boolean | ||
const canMigrate = R.curry((client, index, type) => { | ||
return getMappings(client)(index, type) | ||
.then(R.compose(R.not, R.isNil)) | ||
}) | ||
const canMigrate = R.curry((client, index, type) => getMappings(client)(index, type) | ||
.then(R.compose(R.not, R.isNil))) | ||
@@ -140,0 +127,0 @@ |
{ | ||
"name": "kuss", | ||
"version": "0.9.9", | ||
"version": "0.9.10", | ||
"description": "Kombined Universal Storage Service", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "make test" | ||
"test": "make test", | ||
"lint": "eslint ./ --fix", | ||
"pretest": "npm run lint" | ||
}, | ||
@@ -26,12 +28,2 @@ "repository": { | ||
"homepage": "https://github.com/influentialpublishers/kuss#readme", | ||
"eslintConfig": { | ||
"extends": "influential", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"node": true | ||
} | ||
}, | ||
"dependencies": { | ||
@@ -52,5 +44,11 @@ "amqplib": "^0.5.1", | ||
"devDependencies": { | ||
"babel-eslint": "^7.2.3", | ||
"chai": "^3.5.0", | ||
"eslint": "^3.5.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-influential": "^1.1.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"istanbul": "^0.4.5", | ||
@@ -57,0 +55,0 @@ "mocha": "^3.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
241701
49
4995
13