fhir-persistence 0.7.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 +46 -0
- package/README.md +1 -1
- package/dist/cjs/index.cjs +28 -21
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.mjs +28 -21
- package/dist/esm/index.mjs.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/lib/registry/search-parameter-registry.d.ts +1 -1
- package/dist/lib/search/where-builder.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -2970,7 +2970,7 @@ declare interface SearchStats {
|
|
|
2970
2970
|
* Physical storage strategy for a search parameter.
|
|
2971
2971
|
*
|
|
2972
2972
|
* - `column` — single column in the main table
|
|
2973
|
-
* - `token-column` —
|
|
2973
|
+
* - `token-column` — two columns: TEXT (JSON array of "system|code"), TEXT (sort/display)
|
|
2974
2974
|
* - `lookup-table` — separate lookup table; only a sort column in main table
|
|
2975
2975
|
*/
|
|
2976
2976
|
export declare type SearchStrategy = 'column' | 'token-column' | 'lookup-table';
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2970,7 +2970,7 @@ declare interface SearchStats {
|
|
|
2970
2970
|
* Physical storage strategy for a search parameter.
|
|
2971
2971
|
*
|
|
2972
2972
|
* - `column` — single column in the main table
|
|
2973
|
-
* - `token-column` —
|
|
2973
|
+
* - `token-column` — two columns: TEXT (JSON array of "system|code"), TEXT (sort/display)
|
|
2974
2974
|
* - `lookup-table` — separate lookup table; only a sort column in main table
|
|
2975
2975
|
*/
|
|
2976
2976
|
export declare type SearchStrategy = 'column' | 'token-column' | 'lookup-table';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5207,36 +5207,43 @@ function buildUriFragmentV2(impl, param, dialect) {
|
|
|
5207
5207
|
return buildOrFragmentV2(col, "=", param.values);
|
|
5208
5208
|
}
|
|
5209
5209
|
function buildTokenColumnFragmentV2(impl, param, dialect) {
|
|
5210
|
-
const textCol = quoteColumn(`__${impl.columnName}
|
|
5210
|
+
const textCol = quoteColumn(`__${impl.columnName}`);
|
|
5211
5211
|
const sortCol = quoteColumn(`__${impl.columnName}Sort`);
|
|
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);
|