fhir-persistence 0.8.0 → 0.9.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/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/dist/cjs/index.cjs +27 -20
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/esm/index.mjs +27 -20
- package/dist/esm/index.mjs.map +2 -2
- package/dist/lib/search/where-builder.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -5212,31 +5212,38 @@ function buildTokenColumnFragmentV2(impl, param, dialect) {
|
|
|
5212
5212
|
if (param.modifier === "text") {
|
|
5213
5213
|
return buildLikeFragmentV2(sortCol, param.values, "", "%");
|
|
5214
5214
|
}
|
|
5215
|
-
const
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
for (const value of param.values) {
|
|
5215
|
+
const exactValues = [];
|
|
5216
|
+
const likePatterns = [];
|
|
5217
|
+
for (const value of param.values) {
|
|
5218
|
+
if (value.includes("|")) {
|
|
5220
5219
|
if (value.endsWith("|")) {
|
|
5221
|
-
|
|
5222
|
-
conds.push(frag.sql);
|
|
5223
|
-
vals.push(...frag.values);
|
|
5220
|
+
likePatterns.push(value + "%");
|
|
5224
5221
|
} else {
|
|
5225
|
-
|
|
5226
|
-
const frag = arrayContainsV2(textCol, [resolved], dialect);
|
|
5227
|
-
conds.push(frag.sql);
|
|
5228
|
-
vals.push(...frag.values);
|
|
5222
|
+
exactValues.push(value);
|
|
5229
5223
|
}
|
|
5224
|
+
} else {
|
|
5225
|
+
likePatterns.push(`%|${value}`);
|
|
5230
5226
|
}
|
|
5231
|
-
const inner = conds.length === 1 ? conds[0] : `(${conds.join(" OR ")})`;
|
|
5232
|
-
const sql = param.modifier === "not" ? `NOT (${inner})` : inner;
|
|
5233
|
-
return { sql, values: vals };
|
|
5234
5227
|
}
|
|
5235
|
-
const
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5228
|
+
const conds = [];
|
|
5229
|
+
const vals = [];
|
|
5230
|
+
if (exactValues.length > 0) {
|
|
5231
|
+
const frag = param.modifier === "not" ? arrayNotContainsV2(textCol, exactValues, dialect) : arrayContainsV2(textCol, exactValues, dialect);
|
|
5232
|
+
conds.push(frag.sql);
|
|
5233
|
+
vals.push(...frag.values);
|
|
5234
|
+
}
|
|
5235
|
+
for (const pattern of likePatterns) {
|
|
5236
|
+
const frag = arrayContainsLikeV2(textCol, pattern, dialect);
|
|
5237
|
+
const sql = param.modifier === "not" ? `NOT (${frag.sql})` : frag.sql;
|
|
5238
|
+
conds.push(sql);
|
|
5239
|
+
vals.push(...frag.values);
|
|
5240
|
+
}
|
|
5241
|
+
if (conds.length === 0) {
|
|
5242
|
+
return { sql: "1=1", values: [] };
|
|
5243
|
+
}
|
|
5244
|
+
const joiner = param.modifier === "not" ? " AND " : " OR ";
|
|
5245
|
+
const inner = conds.length === 1 ? conds[0] : `(${conds.join(joiner)})`;
|
|
5246
|
+
return { sql: inner, values: vals };
|
|
5240
5247
|
}
|
|
5241
5248
|
function buildDefaultFragmentV2(impl, param) {
|
|
5242
5249
|
const col = quoteColumn(impl.columnName);
|