@asymmetrik/fhir-qb-mongo
Advanced tools
Comparing version 0.10.5 to 0.11.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.11.0](https://github.com/Asymmetrik/phx-tools/compare/@asymmetrik/fhir-qb-mongo@0.10.5...@asymmetrik/fhir-qb-mongo@0.11.0) (2019-11-12) | ||
### Features | ||
* add token searching for psql ([#32](https://github.com/Asymmetrik/phx-tools/issues/32)) ([b9222d4](https://github.com/Asymmetrik/phx-tools/commit/b9222d4)) | ||
## [0.10.2](https://github.com/Asymmetrik/phx-tools/compare/@asymmetrik/fhir-qb-mongo@0.10.1...@asymmetrik/fhir-qb-mongo@0.10.2) (2019-05-03) | ||
@@ -8,0 +19,0 @@ |
43
index.js
@@ -29,2 +29,13 @@ let supportedSearchTransformations = { | ||
let buildTokenQuery = function({ systemPath, codePath, system, code }) { | ||
let queries = []; | ||
if (system) { | ||
queries.push(buildEqualToQuery({ field: systemPath, value: system })); | ||
} | ||
if (code) { | ||
queries.push(buildEqualToQuery({ field: codePath, value: code })); | ||
} | ||
return queries; | ||
}; | ||
/** | ||
@@ -156,2 +167,23 @@ * Builds query to get records where the value of the field is [<,<=,>,>=,!=] to the value. | ||
/** | ||
* For mongo, this can just be an Equals query | ||
*/ | ||
let buildTokenURIQuery = function({ field, value }) { | ||
return buildEqualToQuery({ field, value }); | ||
}; | ||
/** | ||
* For mongo, this can just be an Equals query | ||
*/ | ||
let buildTokenStringQuery = function({ field, value }) { | ||
return buildEqualToQuery({ field, value }); | ||
}; | ||
/** | ||
* For mongo, this can just be an Equals query | ||
*/ | ||
let buildTokenEqualToQuery = function({ field, value }) { | ||
return buildEqualToQuery({ field, value }); | ||
}; | ||
/** | ||
* Apply paging | ||
@@ -203,2 +235,3 @@ * @param query | ||
matchesToPerform, | ||
tokenMatches = [], | ||
searchResultTransformations, | ||
@@ -240,2 +273,5 @@ implementationParameters, | ||
// Construct the necessary queries for each match and add them the pipeline. | ||
// Token matches are treated like normal matches for Tokens | ||
matchesToPerform = matchesToPerform.concat(tokenMatches); | ||
if (matchesToPerform.length > 0) { | ||
@@ -246,4 +282,5 @@ let listOfOrs = []; | ||
match.push({}); | ||
} else { | ||
listOfOrs.push(buildOrQuery({ queries: match })); | ||
} | ||
listOfOrs.push(buildOrQuery({ queries: match })); | ||
} | ||
@@ -275,2 +312,6 @@ query.push({ $match: buildAndQuery(listOfOrs) }); | ||
buildEqualToQuery, | ||
buildTokenQuery, | ||
buildTokenURIQuery, | ||
buildTokenStringQuery, | ||
buildTokenEqualToQuery, | ||
buildExistsQuery, | ||
@@ -277,0 +318,0 @@ buildOrQuery, |
@@ -266,3 +266,3 @@ const mongoQB = require('./index'); | ||
const expectedResult = [ | ||
{ $match: { $and: [{ $or: [{}] }] } }, | ||
{ $match: { $and: [] } }, | ||
{ $match: { 'meta._isArchived': false } }, | ||
@@ -287,2 +287,3 @@ { | ||
matchesToPerform: [[]], | ||
tokenMatches: [], | ||
searchResultTransformations: {}, | ||
@@ -289,0 +290,0 @@ implementationParameters: { archivedParamPath: 'meta._isArchived' }, |
{ | ||
"name": "@asymmetrik/fhir-qb-mongo", | ||
"version": "0.10.5", | ||
"version": "0.11.0", | ||
"description": "FHIR query builder for Mongo DB", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "bfb404c148ebdd202140b44d0bf4bcdf76c8f08e" | ||
"gitHead": "55dfaff05c51d092b2400b8bad22f71f366621bd" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
25142
6
740
2