fhir-runtime 0.2.0 → 0.3.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,44 @@ 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.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.0] - 2026-03-07
9
+
10
+ ### Added
11
+
12
+ #### Provider Abstraction Layer (STAGE-1)
13
+
14
+ - **New module: `src/provider/`** — Provider abstraction interfaces and default implementations
15
+ - `TerminologyProvider` interface — `validateCode()`, `expandValueSet()`, `lookupCode()`
16
+ - `ReferenceResolver` interface — `resolve()`, `exists()`
17
+ - `NoOpTerminologyProvider` — default implementation, accepts all codes
18
+ - `NoOpReferenceResolver` — default implementation, assumes all references exist
19
+ - `OperationOutcomeBuilder` — converts `ValidationResult`, `ParseResult`, `SnapshotResult` to FHIR R4 OperationOutcome
20
+ - `OperationOutcome`, `OperationOutcomeIssue`, `OperationOutcomeIssueType` types
21
+
22
+ - **Validator integration** — `ValidationOptions` extended with optional `terminologyProvider` and `referenceResolver` fields (backward compatible)
23
+
24
+ - **New exports in `src/index.ts`** — 12 type exports + 5 value exports from provider module
25
+
26
+ #### Testing
27
+
28
+ - 97 new tests across 6 test files in `src/provider/__tests__/`
29
+ - `noop-terminology-provider.test.ts` (16 tests)
30
+ - `noop-reference-resolver.test.ts` (11 tests)
31
+ - `terminology-provider-interface.test.ts` (8 tests)
32
+ - `reference-resolver-interface.test.ts` (10 tests)
33
+ - `operation-outcome-builder.test.ts` (33 tests — 18 validation + 7 parse + 8 snapshot)
34
+ - `validator-provider-integration.test.ts` (19 tests)
35
+ - All v0.2.0 tests remain 100% passing (backward compatibility verified)
36
+
37
+ ### Notes
38
+
39
+ - This release enables `fhir-server` to begin development using NoOp providers as placeholders
40
+ - Provider interfaces use `Promise`-based async API; actual terminology validation will be implemented in STAGE-2 (v0.4.0)
41
+ - OperationOutcome types are self-contained in `src/provider/types.ts`, not added to the model module
42
+ - This release remains backward compatible with v0.2.0 because all provider integration points are optional
43
+
44
+ ---
45
+
8
46
  ## [0.2.0] - 2026-03-04
9
47
 
10
48
  ### Changed
@@ -158,6 +196,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158
196
 
159
197
  ## Release Notes
160
198
 
199
+ ### v0.3.0 Highlights
200
+
201
+ This release focuses on **provider abstraction and integration readiness** for downstream services:
202
+
203
+ - ✅ **Provider contracts released** — `TerminologyProvider` and `ReferenceResolver` are now public APIs
204
+ - ✅ **NoOp defaults included** — Higher-level projects can integrate immediately without live terminology or persistence backends
205
+ - ✅ **OperationOutcome builders added** — Engine result objects can now be translated into FHIR-native response payloads
206
+ - ✅ **Validator hooks prepared** — Optional provider fields are available without breaking existing validation flows
207
+ - ✅ **Ready for STAGE-2** — Terminology binding validation can now build on stable provider abstractions
208
+
161
209
  ### v0.2.0 Highlights
162
210
 
163
211
  This release focuses on **production readiness** through extensive testing and documentation improvements:
@@ -174,7 +222,7 @@ Initial release providing complete FHIR R4 structural capabilities:
174
222
 
175
223
  - ✅ **Parsing** — Full FHIR R4 JSON support
176
224
  - ✅ **Validation** — 9 structural rules + FHIRPath invariants
177
- - ✅ **Snapshot generation** — HAPI-equivalent differential expansion
225
+ - ✅ **Snapshot generation** — HAPI-semantically-equivalent differential expansion
178
226
  - ✅ **FHIRPath** — 60+ functions with Pratt parser
179
227
  - ✅ **Context management** — Registry, loaders, inheritance resolution
180
228
 
@@ -182,12 +230,13 @@ Initial release providing complete FHIR R4 structural capabilities:
182
230
 
183
231
  ## Roadmap
184
232
 
185
- ### Planned for v0.3.0
233
+ ### Planned for v0.4.0
186
234
 
187
- - Terminology service integration (ValueSet expansion, code validation)
188
- - Additional IG support (more Implementation Guides verified)
189
- - Performance optimizations
190
- - Enhanced error messages
235
+ - Binding strength validation (`required`, `extensible`, `preferred`, `example`)
236
+ - In-memory terminology provider for tests and embedded scenarios
237
+ - CodeSystem / ValueSet registry support in context
238
+ - Inline ValueSet membership checks
239
+ - US Core terminology integration tests
191
240
 
192
241
  ### Planned for v1.0.0
193
242
 
@@ -200,12 +249,13 @@ Initial release providing complete FHIR R4 structural capabilities:
200
249
 
201
250
  ## Links
202
251
 
203
- - **Repository**: https://github.com/medxaidev/medxai
204
- - **Issues**: https://github.com/medxaidev/medxai/issues
252
+ - **Repository**: https://github.com/medxaidev/fhir-runtime
253
+ - **Issues**: https://github.com/medxaidev/fhir-runtime/issues
205
254
  - **Documentation**: [docs/](docs/)
206
255
  - **License**: [MIT](LICENSE)
207
256
 
208
257
  ---
209
258
 
210
- [0.2.0]: https://github.com/medxaidev/medxai/compare/v0.1.0...v0.2.0
211
- [0.1.0]: https://github.com/medxaidev/medxai/releases/tag/v0.1.0
259
+ [0.3.0]: https://github.com/medxaidev/fhir-runtime/compare/v0.2.0...v0.3.0
260
+ [0.2.0]: https://github.com/medxaidev/fhir-runtime/compare/v0.1.0...v0.2.0
261
+ [0.1.0]: https://github.com/medxaidev/fhir-runtime/releases/tag/v0.1.0
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue)](https://www.typescriptlang.org/)
7
7
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-green)](https://nodejs.org/)
8
- [![Tests](https://img.shields.io/badge/Tests-2400%2B%20passing-brightgreen)]()
8
+ [![Tests](https://img.shields.io/badge/Tests-2847%20passing-brightgreen)]()
9
9
 
10
10
  `fhir-runtime` is a **structural FHIR R4 engine** that provides comprehensive capabilities for parsing, validating, and manipulating FHIR resources — without requiring a running FHIR server, database, or external terminology service.
11
11
 
@@ -13,26 +13,28 @@ Designed as a pure runtime layer with **zero dependencies**, it's suitable for e
13
13
 
14
14
  ---
15
15
 
16
- ## Features
16
+ ## Features
17
17
 
18
18
  ### Core Capabilities
19
19
 
20
- - **🔍 FHIR R4 JSON Parsing** — Full support for primitives, choice types, extensions
21
- - **✅ Profile-Based Validation** — 9 structural validation rules + FHIRPath invariants
22
- - **📸 Snapshot Generation**HAPI-equivalent differential expansion
23
- - **🧮 FHIRPath Engine** 60+ functions, Pratt parser with AST caching
24
- - **📦 Bundle Loading** Load FHIR specification bundles and IGs
25
- - **🔄 Context Management** Registry, loaders, inheritance resolution
26
- - **🎯 InnerType Extraction** BackboneElement schema for UI/validation
20
+ - FHIR R4 JSON Parsing — Full support for primitives, choice types, extensions
21
+ - Profile-Based Validation — 9 structural validation rules + FHIRPath invariants
22
+ - Provider Abstraction Layer (STAGE-1) Terminology and reference contracts with default NoOp implementations
23
+ - Snapshot GenerationHAPI-equivalent differential expansion
24
+ - FHIRPath Engine60+ functions, Pratt parser with AST caching
25
+ - Bundle LoadingLoad FHIR specification bundles and IGs
26
+ - Context ManagementRegistry, loaders, inheritance resolution
27
+ - InnerType Extraction — BackboneElement schema for UI/validation
28
+ - OperationOutcomeBuilder — Convert validation, parse, and snapshot results to FHIR R4 `OperationOutcome`
27
29
 
28
30
  ### Quality & Testing
29
31
 
30
- - **2,400+ tests** across 45 test files — 100% passing
31
- - **US Core IG verified** — 70 StructureDefinitions, 55 profiles validated
32
- - **HAPI-equivalent** — 35/35 snapshot fixtures match HAPI output
33
- - **Stress tested** — Malformed input, deep nesting, large payloads, concurrency
34
- - **Zero dependencies** — Pure TypeScript, no external runtime deps
35
- - **Type-safe** — Full TypeScript definitions for all FHIR R4 types
32
+ - 2,847 tests across 51 test files — 100% passing
33
+ - US Core IG verified — 70 StructureDefinitions, 55 profiles validated
34
+ - HAPI-equivalent — 35/35 snapshot fixtures match HAPI output
35
+ - Stress tested — Malformed input, deep nesting, large payloads, concurrency
36
+ - Zero dependencies — Pure TypeScript, no external runtime deps
37
+ - Type-safe — Full TypeScript definitions for all FHIR R4 types
36
38
 
37
39
  ---
38
40
 
@@ -49,6 +51,21 @@ npm install fhir-runtime
49
51
 
50
52
  ---
51
53
 
54
+ ## 🎮 Try it Online
55
+
56
+ **[FHIR Runtime Playground](https://medxai.com.cn/fhir-runtime-playground/)** — Interactive browser-based playground to experiment with fhir-runtime capabilities:
57
+
58
+ - 🔍 **Parse FHIR Resources** — Test JSON parsing with real-time feedback
59
+ - ✅ **Validate Resources** — Validate against profiles and see detailed issues
60
+ - 📸 **Generate Snapshots** — Visualize differential expansion
61
+ - 🧮 **Evaluate FHIRPath** — Interactive FHIRPath expression testing
62
+ - 📚 **Example Library** — Pre-loaded examples and profiles
63
+ - 💾 **Share & Export** — Save and share your experiments
64
+
65
+ **Playground Repository:** [github.com/medxaidev/fhir-runtime-playground](https://github.com/medxaidev/fhir-runtime-playground)
66
+
67
+ ---
68
+
52
69
  ## 🚀 Quick Start
53
70
 
54
71
  ### Parse a FHIR Resource
@@ -132,8 +149,9 @@ const hasOfficial = evalFhirPathBoolean(
132
149
  ## 📚 Documentation
133
150
 
134
151
  - **[Technical Overview](docs/overview/fhir-runtime-overview.md)** — Architecture, design principles, capabilities
135
- - **[API Reference](docs/api/fhir-runtime-api-v0.2.md)** — Complete API documentation (211 exports)
136
- - **[Capability Contract](docs/specs/engine-capability-contract-v0.2.md)** — Behavioral guarantees, error semantics
152
+ - **[API Reference](docs/api/fhir-runtime-api-v0.3.md)** — Public API reference for the v0.3.0 release surface
153
+ - **[Capability Contract](docs/specs/engine-capability-contract-v0.3.md)** — Behavioral guarantees and release contract for v0.3.0
154
+ - **[STAGE-1 Provider Abstraction](devdocs/stage/STAGE-1-provider-abstraction.md)** — Completed v0.3.0 provider abstraction delivery plan
137
155
 
138
156
  ---
139
157
 
@@ -142,9 +160,19 @@ const hasOfficial = evalFhirPathBoolean(
142
160
  ### Test Coverage
143
161
 
144
162
  ```
145
- ✅ 2,400+ tests across 45 test files
163
+ ✅ 2,847 tests across 51 test files
146
164
  ✅ 100% pass rate on HAPI snapshot fixtures (35/35)
147
- ✅ All 6 modules fully tested (parser, context, profile, validator, fhirpath, model)
165
+ ✅ All 7 modules fully tested (model, parser, context, profile, validator, fhirpath, provider)
166
+ ```
167
+
168
+ ### v0.3.0 Provider Abstraction Coverage
169
+
170
+ ```
171
+ ✅ 97 new tests across 6 provider-focused test files
172
+ ✅ TerminologyProvider and ReferenceResolver interface contracts verified
173
+ ✅ NoOp providers validated for backward-compatible default behavior
174
+ ✅ OperationOutcomeBuilder conversions covered for validation, parse, and snapshot flows
175
+ ✅ Validator integration verified with optional provider hooks
148
176
  ```
149
177
 
150
178
  ### US Core IG Verification
@@ -182,7 +210,8 @@ src/
182
210
  ├── context/ ← SD registry, loaders, inheritance resolution, bundle loading
183
211
  ├── profile/ ← Snapshot generation, canonical builder, constraint merging
184
212
  ├── validator/ ← Structural validation (9 rules + FHIRPath invariants)
185
- └── fhirpath/ ← FHIRPath expression engine (Pratt parser, 60+ functions)
213
+ ├── fhirpath/ ← FHIRPath expression engine (Pratt parser, 60+ functions)
214
+ └── provider/ ← Terminology/reference abstractions, NoOp providers, OperationOutcomeBuilder
186
215
  ```
187
216
 
188
217
  ### HAPI FHIR Equivalence
@@ -200,6 +229,7 @@ src/
200
229
  ## 🎯 Use Cases
201
230
 
202
231
  - **FHIR Servers** — Validation layer for REST operations
232
+ - **FHIR Server Foundations** — Start `fhir-server` development with NoOp providers before terminology is implemented
203
233
  - **CLI Tools** — Parse, validate, generate snapshots, evaluate FHIRPath
204
234
  - **Web Applications** — Client-side FHIR processing without server dependency
205
235
  - **IG Publishers** — Profile validation and snapshot generation
@@ -214,35 +244,37 @@ MIT License - see [LICENSE](LICENSE) file for details.
214
244
 
215
245
  ---
216
246
 
217
- ## 🤝 Contributing
218
-
219
- Contributions are welcome! This project maintains:
220
-
221
- - **Zero runtime dependencies** — Keep it that way
222
- - **100% test pass rate** — All tests must pass
223
- - **Type safety** — Full TypeScript coverage
224
- - **HAPI equivalence** — Snapshot generation must match HAPI output
225
-
226
- ---
227
-
228
247
  ## 📊 Package Details
229
248
 
230
249
  | Property | Value |
231
250
  | ------------------------ | ------------------------------- |
232
251
  | Package name | `fhir-runtime` |
233
- | Version | 0.2.0 |
252
+ | Version | 0.3.0 |
234
253
  | License | MIT |
235
254
  | FHIR Version | R4 (4.0.1) |
236
255
  | Module formats | ESM + CJS |
237
256
  | Runtime dependencies | None (zero dependencies) |
238
257
  | Bundled core definitions | 73 FHIR R4 StructureDefinitions |
239
- | Public exports | 211 symbols across 6 modules |
240
- | Test coverage | 2,400+ tests across 45 files |
258
+ | Public exports | 228+ symbols across 7 modules |
259
+ | Test coverage | 2,847 tests across 51 files |
260
+
261
+ ---
262
+
263
+ ## 🆕 Release Highlights
264
+
265
+ ### v0.3.0
266
+
267
+ - **Provider Abstraction Layer landed** — `TerminologyProvider` and `ReferenceResolver` are now part of the public API
268
+ - **Default NoOp implementations** — Safe placeholders for higher-level services and integration work
269
+ - **OperationOutcomeBuilder support** — Convert structured engine results into FHIR-native error payloads
270
+ - **Backward compatible** — Existing validation flows continue to work with optional provider hooks
271
+ - **Ready for STAGE-2** — Terminology binding validation can now build on the released provider contracts
241
272
 
242
273
  ---
243
274
 
244
275
  ## 🔗 Related Projects
245
276
 
277
+ - **[FHIR Runtime Playground](https://medxai.com.cn/fhir-runtime-playground/)** — Interactive online playground ([GitHub](https://github.com/medxaidev/fhir-runtime-playground))
246
278
  - **[HAPI FHIR](https://hapifhir.io/)** — Reference Java implementation
247
279
  - **[HL7 FHIR Specification](https://hl7.org/fhir/R4/)** — Official FHIR R4 spec
248
280
  - **[US Core IG](https://www.hl7.org/fhir/us/core/)** — US Core Implementation Guide
@@ -34,6 +34,8 @@ __export(index_exports, {
34
34
  InvalidStructureDefinitionError: () => InvalidStructureDefinitionError,
35
35
  LoaderError: () => LoaderError,
36
36
  MemoryLoader: () => MemoryLoader,
37
+ NoOpReferenceResolver: () => NoOpReferenceResolver,
38
+ NoOpTerminologyProvider: () => NoOpTerminologyProvider,
37
39
  PRIMITIVE_TYPES: () => PRIMITIVE_TYPES,
38
40
  ProfileError: () => ProfileError,
39
41
  ProfileNotFoundError: () => ProfileNotFoundError,
@@ -47,6 +49,9 @@ __export(index_exports, {
47
49
  buildCanonicalElement: () => buildCanonicalElement,
48
50
  buildCanonicalProfile: () => buildCanonicalProfile,
49
51
  buildInvariants: () => buildInvariants,
52
+ buildOperationOutcome: () => buildOperationOutcome,
53
+ buildOperationOutcomeFromParse: () => buildOperationOutcomeFromParse,
54
+ buildOperationOutcomeFromSnapshot: () => buildOperationOutcomeFromSnapshot,
50
55
  buildSlicingDefinition: () => buildSlicingDefinition,
51
56
  buildTypeConstraints: () => buildTypeConstraints,
52
57
  buildTypeName: () => buildTypeName,
@@ -4285,7 +4290,9 @@ function resolveValidationOptions(options) {
4285
4290
  validateFixed: options?.validateFixed ?? true,
4286
4291
  maxDepth: options?.maxDepth ?? 50,
4287
4292
  failFast: options?.failFast ?? false,
4288
- skipInvariants: options?.skipInvariants ?? false
4293
+ skipInvariants: options?.skipInvariants ?? false,
4294
+ terminologyProvider: options?.terminologyProvider ?? void 0,
4295
+ referenceResolver: options?.referenceResolver ?? void 0
4289
4296
  };
4290
4297
  }
4291
4298
  function hasValidationErrors(issues) {
@@ -7271,6 +7278,182 @@ var StructureValidator = class {
7271
7278
  }
7272
7279
  }
7273
7280
  };
7281
+
7282
+ // src/provider/noop-terminology-provider.ts
7283
+ var NoOpTerminologyProvider = class {
7284
+ /**
7285
+ * Always returns `{ result: true }`.
7286
+ *
7287
+ * No actual code validation is performed.
7288
+ */
7289
+ async validateCode(_params) {
7290
+ return { result: true };
7291
+ }
7292
+ /**
7293
+ * Always returns an empty expansion `{ contains: [] }`.
7294
+ *
7295
+ * No actual ValueSet expansion is performed.
7296
+ */
7297
+ async expandValueSet(_params) {
7298
+ return { contains: [] };
7299
+ }
7300
+ /**
7301
+ * Always returns `{ found: false }`.
7302
+ *
7303
+ * No actual code lookup is performed.
7304
+ */
7305
+ async lookupCode(_params) {
7306
+ return { found: false };
7307
+ }
7308
+ };
7309
+
7310
+ // src/provider/noop-reference-resolver.ts
7311
+ var NoOpReferenceResolver = class {
7312
+ /**
7313
+ * Always returns `undefined`.
7314
+ *
7315
+ * No actual reference resolution is performed.
7316
+ */
7317
+ async resolve(_reference) {
7318
+ return void 0;
7319
+ }
7320
+ /**
7321
+ * Always returns `true`.
7322
+ *
7323
+ * Assumes all reference targets exist without checking.
7324
+ */
7325
+ async exists(_reference) {
7326
+ return true;
7327
+ }
7328
+ };
7329
+
7330
+ // src/provider/operation-outcome-builder.ts
7331
+ var VALIDATION_ISSUE_TYPE_MAP = {
7332
+ CARDINALITY_MIN_VIOLATION: "structure",
7333
+ CARDINALITY_MAX_VIOLATION: "structure",
7334
+ TYPE_MISMATCH: "value",
7335
+ INVALID_CHOICE_TYPE: "value",
7336
+ REQUIRED_ELEMENT_MISSING: "required",
7337
+ FIXED_VALUE_MISMATCH: "value",
7338
+ PATTERN_VALUE_MISMATCH: "value",
7339
+ SLICING_NO_MATCH: "structure",
7340
+ SLICING_CARDINALITY_VIOLATION: "structure",
7341
+ SLICING_ORDER_VIOLATION: "structure",
7342
+ REFERENCE_TARGET_MISMATCH: "value",
7343
+ PROFILE_NOT_FOUND: "not-found",
7344
+ RESOURCE_TYPE_MISMATCH: "invalid",
7345
+ UNKNOWN_ELEMENT: "structure",
7346
+ INVARIANT_NOT_EVALUATED: "not-supported",
7347
+ INVARIANT_VIOLATION: "invariant",
7348
+ INVARIANT_EVALUATION_ERROR: "processing",
7349
+ INTERNAL_ERROR: "processing"
7350
+ };
7351
+ function validationIssueToOutcomeIssue(issue) {
7352
+ const outcomeIssue = {
7353
+ severity: issue.severity,
7354
+ code: VALIDATION_ISSUE_TYPE_MAP[issue.code] ?? "processing",
7355
+ details: { text: `[${issue.code}] ${issue.message}` },
7356
+ ...issue.diagnostics !== void 0 ? { diagnostics: issue.diagnostics } : {},
7357
+ ...issue.path !== void 0 || issue.expression !== void 0 ? { expression: [issue.expression ?? issue.path] } : {}
7358
+ };
7359
+ return outcomeIssue;
7360
+ }
7361
+ function buildOperationOutcome(result) {
7362
+ if (result.issues.length === 0) {
7363
+ return {
7364
+ resourceType: "OperationOutcome",
7365
+ issue: [
7366
+ {
7367
+ severity: "information",
7368
+ code: "informational",
7369
+ details: { text: "Validation successful" }
7370
+ }
7371
+ ]
7372
+ };
7373
+ }
7374
+ return {
7375
+ resourceType: "OperationOutcome",
7376
+ issue: result.issues.map(validationIssueToOutcomeIssue)
7377
+ };
7378
+ }
7379
+ var PARSE_ISSUE_TYPE_MAP = {
7380
+ INVALID_JSON: "structure",
7381
+ MISSING_RESOURCE_TYPE: "required",
7382
+ UNKNOWN_RESOURCE_TYPE: "not-found",
7383
+ INVALID_PRIMITIVE: "value",
7384
+ INVALID_STRUCTURE: "structure",
7385
+ INVALID_CHOICE_TYPE: "value",
7386
+ MULTIPLE_CHOICE_VALUES: "structure",
7387
+ ARRAY_MISMATCH: "structure",
7388
+ UNEXPECTED_NULL: "value",
7389
+ UNEXPECTED_PROPERTY: "informational"
7390
+ };
7391
+ function parseIssueToOutcomeIssue(issue) {
7392
+ return {
7393
+ severity: issue.severity === "error" ? "error" : "warning",
7394
+ code: PARSE_ISSUE_TYPE_MAP[issue.code] ?? "processing",
7395
+ details: { text: `[${issue.code}] ${issue.message}` },
7396
+ expression: [issue.path]
7397
+ };
7398
+ }
7399
+ function buildOperationOutcomeFromParse(result) {
7400
+ if (result.issues.length === 0) {
7401
+ return {
7402
+ resourceType: "OperationOutcome",
7403
+ issue: [
7404
+ {
7405
+ severity: "information",
7406
+ code: "informational",
7407
+ details: { text: "Parsing successful" }
7408
+ }
7409
+ ]
7410
+ };
7411
+ }
7412
+ return {
7413
+ resourceType: "OperationOutcome",
7414
+ issue: result.issues.map(parseIssueToOutcomeIssue)
7415
+ };
7416
+ }
7417
+ var SNAPSHOT_ISSUE_TYPE_MAP = {
7418
+ CIRCULAR_DEPENDENCY: "processing",
7419
+ BASE_NOT_FOUND: "not-found",
7420
+ BASE_MISSING_SNAPSHOT: "not-found",
7421
+ DIFFERENTIAL_NOT_CONSUMED: "structure",
7422
+ CARDINALITY_VIOLATION: "business-rule",
7423
+ TYPE_INCOMPATIBLE: "value",
7424
+ BINDING_VIOLATION: "business-rule",
7425
+ SLICING_ERROR: "structure",
7426
+ PATH_NOT_FOUND: "not-found",
7427
+ INVALID_CONSTRAINT: "business-rule",
7428
+ INTERNAL_ERROR: "processing"
7429
+ };
7430
+ function snapshotIssueToOutcomeIssue(issue) {
7431
+ return {
7432
+ severity: issue.severity,
7433
+ code: SNAPSHOT_ISSUE_TYPE_MAP[issue.code] ?? "processing",
7434
+ details: { text: `[${issue.code}] ${issue.message}` },
7435
+ ...issue.details !== void 0 ? { diagnostics: issue.details } : {},
7436
+ ...issue.path !== void 0 ? { expression: [issue.path] } : {}
7437
+ };
7438
+ }
7439
+ function buildOperationOutcomeFromSnapshot(result) {
7440
+ if (result.issues.length === 0) {
7441
+ return {
7442
+ resourceType: "OperationOutcome",
7443
+ issue: [
7444
+ {
7445
+ severity: "information",
7446
+ code: "informational",
7447
+ details: { text: "Snapshot generation successful" }
7448
+ }
7449
+ ]
7450
+ };
7451
+ }
7452
+ return {
7453
+ resourceType: "OperationOutcome",
7454
+ issue: result.issues.map(snapshotIssueToOutcomeIssue)
7455
+ };
7456
+ }
7274
7457
  // Annotate the CommonJS export names for ESM import in node:
7275
7458
  0 && (module.exports = {
7276
7459
  ALL_CORE_DEFINITIONS,
@@ -7287,6 +7470,8 @@ var StructureValidator = class {
7287
7470
  InvalidStructureDefinitionError,
7288
7471
  LoaderError,
7289
7472
  MemoryLoader,
7473
+ NoOpReferenceResolver,
7474
+ NoOpTerminologyProvider,
7290
7475
  PRIMITIVE_TYPES,
7291
7476
  ProfileError,
7292
7477
  ProfileNotFoundError,
@@ -7300,6 +7485,9 @@ var StructureValidator = class {
7300
7485
  buildCanonicalElement,
7301
7486
  buildCanonicalProfile,
7302
7487
  buildInvariants,
7488
+ buildOperationOutcome,
7489
+ buildOperationOutcomeFromParse,
7490
+ buildOperationOutcomeFromSnapshot,
7303
7491
  buildSlicingDefinition,
7304
7492
  buildTypeConstraints,
7305
7493
  buildTypeName,