fhir-persistence 0.5.0 → 0.6.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 CHANGED
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.0] - 2025-03-17
9
+
10
+ ### Added
11
+
12
+ #### Full-Text Search (SQLite FTS5 + PostgreSQL tsvector/GIN)
13
+
14
+ - **`table-schema-builder.ts`** — HumanName and Address lookup tables now include tsvector GIN expression indexes (`to_tsvector('simple'::regconfig, column)`) for PostgreSQL full-text search
15
+ - **`where-builder.ts`** — Lookup table string search supports FTS query paths: SQLite FTS5 MATCH and PostgreSQL `to_tsvector @@ plainto_tsquery` with automatic fallback to LIKE
16
+ - **`fhir-system.ts`** — `FhirSystemConfig.features.fullTextSearch` option to enable FTS query paths (default: `false` for backward compatibility)
17
+ - SQLite FTS5 virtual tables generated via `MigrationGenerator` for HumanName/Address lookup columns
18
+
19
+ #### Reindex Progress Callbacks
20
+
21
+ - **`cli/reindex.ts`** — `ReindexProgressCallbackV2` type with `onProgress` callback reporting `{ resourceType, processed, total }` per batch
22
+ - **`reindexResourceTypeV2`** and **`reindexAllV2`** accept optional `onProgress` parameter for CLI and UI progress display
23
+
24
+ #### Conditional Operations API
25
+
26
+ - **`store/conditional-service.ts`** — `ConditionalService` class with full FHIR R4 conditional semantics:
27
+ - `conditionalCreate`: 0 match → create, 1 match → return existing, 2+ → `PreconditionFailedError`
28
+ - `conditionalUpdate`: 0 match → create, 1 match → update, 2+ → `PreconditionFailedError`
29
+ - `conditionalDelete`: delete all matching resources, return count
30
+ - **`repo/errors.ts`** — `PreconditionFailedError` (HTTP 412) for multiple-match conditional operations
31
+ - All conditional operations execute within transactions (TOCTOU protection)
32
+
33
+ ### Changed
34
+
35
+ - **`table-schema-builder.ts`** — HumanName lookup table adds `pg_trgm` GIN indexes (`gin_trgm_ops`) alongside tsvector indexes for trigram fuzzy matching
36
+ - **`migration-generator.ts`** — Automatically creates `pg_trgm` and `btree_gin` extensions on PostgreSQL before GIN index generation
37
+
8
38
  ## [0.5.0] - 2025-03-16
9
39
 
10
40
  ### Fixed
package/README.md CHANGED
@@ -5,7 +5,7 @@ Embedded FHIR R4 persistence layer — CRUD, search, indexing, and schema migrat
5
5
  [![npm version](https://img.shields.io/npm/v/fhir-persistence)](https://www.npmjs.com/package/fhir-persistence)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
7
7
 
8
- > **v0.5.0** — PostgreSQL migration path complete: GIN extensions + lookup table fixes
8
+ > **v0.6.0** — Full-text search (SQLite FTS5 + PostgreSQL tsvector/GIN), reindex progress callbacks, conditional operations API
9
9
 
10
10
  ## Features
11
11
 
@@ -21,7 +21,9 @@ Embedded FHIR R4 persistence layer — CRUD, search, indexing, and schema migrat
21
21
  - **Two-phase SQL** — id-first query for large table performance
22
22
  - **IG-driven schema** — StructureDefinition + SearchParameter → DDL (SQLite + PostgreSQL dialects)
23
23
  - **Migration engine** — SchemaDiff → MigrationGenerator → MigrationRunnerV2
24
- - **Conditional operations** — conditionalCreate / conditionalUpdate / conditionalDelete
24
+ - **Full-text search** — SQLite FTS5 + PostgreSQL tsvector/GIN for string search parameters
25
+ - **Conditional operations** — conditionalCreate / conditionalUpdate / conditionalDelete via `ConditionalService`
26
+ - **Reindex progress** — `onProgress` callback for CLI and UI progress reporting
25
27
  - **Bundle processing** — transaction and batch bundle support
26
28
  - **Terminology** — TerminologyCodeRepo + ValueSetRepo
27
29
  - **FhirSystem orchestrator** — end-to-end startup flow for `fhir-engine` integration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-persistence",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Embedded FHIR R4 persistence layer — CRUD, search, indexing, schema migration over SQLite and PostgreSQL",
5
5
  "homepage": "https://github.com/medxaidev/fhir-persistence#readme",
6
6
  "license": "MIT",