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 +60 -10
- package/README.md +66 -34
- package/dist/cjs/index.cjs +189 -1
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/index.d.ts +347 -0
- package/dist/esm/index.d.ts +347 -0
- package/dist/esm/index.mjs +184 -1
- package/dist/esm/index.mjs.map +3 -3
- package/dist/index.d.ts +347 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/provider/index.d.ts +18 -0
- package/dist/lib/provider/index.d.ts.map +1 -0
- package/dist/lib/provider/noop-reference-resolver.d.ts +47 -0
- package/dist/lib/provider/noop-reference-resolver.d.ts.map +1 -0
- package/dist/lib/provider/noop-terminology-provider.d.ts +50 -0
- package/dist/lib/provider/noop-terminology-provider.d.ts.map +1 -0
- package/dist/lib/provider/operation-outcome-builder.d.ts +71 -0
- package/dist/lib/provider/operation-outcome-builder.d.ts.map +1 -0
- package/dist/lib/provider/types.d.ts +210 -0
- package/dist/lib/provider/types.d.ts.map +1 -0
- package/dist/lib/validator/types.d.ts +21 -0
- package/dist/lib/validator/types.d.ts.map +1 -1
- package/package.json +22 -10
package/dist/index.d.ts
CHANGED
|
@@ -182,6 +182,64 @@ export declare function buildCanonicalProfile(sd: StructureDefinition): Canonica
|
|
|
182
182
|
*/
|
|
183
183
|
export declare function buildInvariants(constraints: readonly ElementDefinitionConstraint[] | undefined): Invariant[];
|
|
184
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Build a FHIR OperationOutcome from a {@link ValidationResult}.
|
|
187
|
+
*
|
|
188
|
+
* Maps each {@link ValidationIssue} to an OperationOutcome.issue entry
|
|
189
|
+
* with appropriate severity, issue type code, details, and expression.
|
|
190
|
+
*
|
|
191
|
+
* If the validation result has no issues, returns an OperationOutcome
|
|
192
|
+
* with a single informational issue indicating success.
|
|
193
|
+
*
|
|
194
|
+
* @param result - The validation result to convert.
|
|
195
|
+
* @returns A FHIR R4 OperationOutcome resource.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const result = validator.validate(patient, patientProfile);
|
|
200
|
+
* const outcome = buildOperationOutcome(result);
|
|
201
|
+
* // outcome.resourceType === 'OperationOutcome'
|
|
202
|
+
* // outcome.issue.length >= 1
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export declare function buildOperationOutcome(result: ValidationResult): OperationOutcome;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Build a FHIR OperationOutcome from a {@link ParseResult}.
|
|
209
|
+
*
|
|
210
|
+
* Maps each {@link ParseIssue} to an OperationOutcome.issue entry.
|
|
211
|
+
* If the parse result is successful with no issues, returns an
|
|
212
|
+
* OperationOutcome with a single informational success message.
|
|
213
|
+
*
|
|
214
|
+
* @param result - The parse result to convert.
|
|
215
|
+
* @returns A FHIR R4 OperationOutcome resource.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* const result = parseFhirJson(jsonString);
|
|
220
|
+
* const outcome = buildOperationOutcomeFromParse(result);
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare function buildOperationOutcomeFromParse(result: ParseResult<unknown>): OperationOutcome;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Build a FHIR OperationOutcome from a {@link SnapshotResult}.
|
|
227
|
+
*
|
|
228
|
+
* Maps each {@link SnapshotIssue} to an OperationOutcome.issue entry.
|
|
229
|
+
* If the snapshot result is successful with no issues, returns an
|
|
230
|
+
* OperationOutcome with a single informational success message.
|
|
231
|
+
*
|
|
232
|
+
* @param result - The snapshot result to convert.
|
|
233
|
+
* @returns A FHIR R4 OperationOutcome resource.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* const result = await generator.generate(sd);
|
|
238
|
+
* const outcome = buildOperationOutcomeFromSnapshot(result);
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
export declare function buildOperationOutcomeFromSnapshot(result: SnapshotResult): OperationOutcome;
|
|
242
|
+
|
|
185
243
|
/**
|
|
186
244
|
* Convert ElementDefinitionSlicing to SlicingDefinition.
|
|
187
245
|
*
|
|
@@ -1441,6 +1499,20 @@ export declare function evalFhirPathString(expression: string | FhirPathAtom, in
|
|
|
1441
1499
|
*/
|
|
1442
1500
|
export declare function evalFhirPathTyped(expression: string | FhirPathAtom, input: TypedValue[], variables?: Record<string, TypedValue>): TypedValue[];
|
|
1443
1501
|
|
|
1502
|
+
/**
|
|
1503
|
+
* Parameters for expanding a ValueSet.
|
|
1504
|
+
*/
|
|
1505
|
+
export declare interface ExpandValueSetParams {
|
|
1506
|
+
/** The ValueSet URL to expand. */
|
|
1507
|
+
readonly url: string;
|
|
1508
|
+
/** Optional text filter to narrow the expansion. */
|
|
1509
|
+
readonly filter?: string;
|
|
1510
|
+
/** Optional offset for pagination. */
|
|
1511
|
+
readonly offset?: number;
|
|
1512
|
+
/** Optional count limit for pagination. */
|
|
1513
|
+
readonly count?: number;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1444
1516
|
/**
|
|
1445
1517
|
* An Extension: additional information that is not part of the basic
|
|
1446
1518
|
* definition of the resource.
|
|
@@ -2406,6 +2478,28 @@ export declare interface FhirContext {
|
|
|
2406
2478
|
retryCount?: number;
|
|
2407
2479
|
}
|
|
2408
2480
|
|
|
2481
|
+
/**
|
|
2482
|
+
* Parameters for looking up a code in a CodeSystem.
|
|
2483
|
+
*/
|
|
2484
|
+
export declare interface LookupCodeParams {
|
|
2485
|
+
/** The CodeSystem URL. */
|
|
2486
|
+
readonly system: string;
|
|
2487
|
+
/** The code to look up. */
|
|
2488
|
+
readonly code: string;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* Result of a code lookup operation.
|
|
2493
|
+
*/
|
|
2494
|
+
export declare interface LookupCodeResult {
|
|
2495
|
+
/** Whether the code was found in the CodeSystem. */
|
|
2496
|
+
readonly found: boolean;
|
|
2497
|
+
/** The display string for the code (if found). */
|
|
2498
|
+
readonly display?: string;
|
|
2499
|
+
/** The definition of the code (if found). */
|
|
2500
|
+
readonly definition?: string;
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2409
2503
|
/**
|
|
2410
2504
|
* Generate the default slicing definition for extension elements.
|
|
2411
2505
|
*
|
|
@@ -2591,6 +2685,118 @@ export declare interface FhirContext {
|
|
|
2591
2685
|
*/
|
|
2592
2686
|
export declare type NarrativeStatus = 'generated' | 'extensions' | 'additional' | 'empty';
|
|
2593
2687
|
|
|
2688
|
+
/**
|
|
2689
|
+
* A no-operation reference resolver that assumes all references exist.
|
|
2690
|
+
*
|
|
2691
|
+
* Use this as a default resolver when no resource store is available.
|
|
2692
|
+
* All references are assumed to exist, but no actual resources are returned.
|
|
2693
|
+
*
|
|
2694
|
+
* @example
|
|
2695
|
+
* ```typescript
|
|
2696
|
+
* const resolver = new NoOpReferenceResolver();
|
|
2697
|
+
* const exists = await resolver.exists('Patient/123');
|
|
2698
|
+
* console.log(exists); // true
|
|
2699
|
+
*
|
|
2700
|
+
* const resource = await resolver.resolve('Patient/123');
|
|
2701
|
+
* console.log(resource); // undefined
|
|
2702
|
+
* ```
|
|
2703
|
+
*/
|
|
2704
|
+
export declare class NoOpReferenceResolver implements ReferenceResolver {
|
|
2705
|
+
/**
|
|
2706
|
+
* Always returns `undefined`.
|
|
2707
|
+
*
|
|
2708
|
+
* No actual reference resolution is performed.
|
|
2709
|
+
*/
|
|
2710
|
+
resolve(_reference: string): Promise<Resource | undefined>;
|
|
2711
|
+
/**
|
|
2712
|
+
* Always returns `true`.
|
|
2713
|
+
*
|
|
2714
|
+
* Assumes all reference targets exist without checking.
|
|
2715
|
+
*/
|
|
2716
|
+
exists(_reference: string): Promise<boolean>;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* A no-operation terminology provider that accepts all codes.
|
|
2721
|
+
*
|
|
2722
|
+
* Use this as a default provider when no terminology server is available.
|
|
2723
|
+
* All codes are considered valid, no ValueSet expansions are returned,
|
|
2724
|
+
* and code lookups always report "not found".
|
|
2725
|
+
*
|
|
2726
|
+
* @example
|
|
2727
|
+
* ```typescript
|
|
2728
|
+
* const provider = new NoOpTerminologyProvider();
|
|
2729
|
+
* const result = await provider.validateCode({ system: 'http://loinc.org', code: '12345-6' });
|
|
2730
|
+
* console.log(result.result); // true
|
|
2731
|
+
* ```
|
|
2732
|
+
*/
|
|
2733
|
+
export declare class NoOpTerminologyProvider implements TerminologyProvider {
|
|
2734
|
+
/**
|
|
2735
|
+
* Always returns `{ result: true }`.
|
|
2736
|
+
*
|
|
2737
|
+
* No actual code validation is performed.
|
|
2738
|
+
*/
|
|
2739
|
+
validateCode(_params: ValidateCodeParams): Promise<ValidateCodeResult>;
|
|
2740
|
+
/**
|
|
2741
|
+
* Always returns an empty expansion `{ contains: [] }`.
|
|
2742
|
+
*
|
|
2743
|
+
* No actual ValueSet expansion is performed.
|
|
2744
|
+
*/
|
|
2745
|
+
expandValueSet(_params: ExpandValueSetParams): Promise<ValueSetExpansion>;
|
|
2746
|
+
/**
|
|
2747
|
+
* Always returns `{ found: false }`.
|
|
2748
|
+
*
|
|
2749
|
+
* No actual code lookup is performed.
|
|
2750
|
+
*/
|
|
2751
|
+
lookupCode(_params: LookupCodeParams): Promise<LookupCodeResult>;
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
/**
|
|
2755
|
+
* FHIR OperationOutcome resource.
|
|
2756
|
+
*
|
|
2757
|
+
* Represents the outcome of an operation, containing a list of issues
|
|
2758
|
+
* (errors, warnings, information) encountered during processing.
|
|
2759
|
+
*
|
|
2760
|
+
* @see https://hl7.org/fhir/R4/operationoutcome.html
|
|
2761
|
+
*/
|
|
2762
|
+
export declare interface OperationOutcome {
|
|
2763
|
+
/** Fixed value: `'OperationOutcome'`. */
|
|
2764
|
+
readonly resourceType: 'OperationOutcome';
|
|
2765
|
+
/** The list of issues. */
|
|
2766
|
+
readonly issue: readonly OperationOutcomeIssue[];
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
/**
|
|
2770
|
+
* A single issue within an OperationOutcome.
|
|
2771
|
+
*
|
|
2772
|
+
* @see https://hl7.org/fhir/R4/operationoutcome-definitions.html#OperationOutcome.issue
|
|
2773
|
+
*/
|
|
2774
|
+
export declare interface OperationOutcomeIssue {
|
|
2775
|
+
/** Severity of the issue. */
|
|
2776
|
+
readonly severity: 'fatal' | 'error' | 'warning' | 'information';
|
|
2777
|
+
/**
|
|
2778
|
+
* Issue type code.
|
|
2779
|
+
* @see https://hl7.org/fhir/R4/valueset-issue-type.html
|
|
2780
|
+
*/
|
|
2781
|
+
readonly code: OperationOutcomeIssueType;
|
|
2782
|
+
/** Additional diagnostic information. */
|
|
2783
|
+
readonly diagnostics?: string;
|
|
2784
|
+
/** Additional details about the issue. */
|
|
2785
|
+
readonly details?: {
|
|
2786
|
+
readonly text?: string;
|
|
2787
|
+
};
|
|
2788
|
+
/** FHIRPath expression(s) pointing to the problematic element(s). */
|
|
2789
|
+
readonly expression?: readonly string[];
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
/**
|
|
2793
|
+
* FHIR OperationOutcome issue type codes.
|
|
2794
|
+
*
|
|
2795
|
+
* Subset of codes from https://hl7.org/fhir/R4/valueset-issue-type.html
|
|
2796
|
+
* relevant to structural validation, parsing, and snapshot generation.
|
|
2797
|
+
*/
|
|
2798
|
+
export declare type OperationOutcomeIssueType = 'invalid' | 'structure' | 'required' | 'value' | 'invariant' | 'processing' | 'not-supported' | 'not-found' | 'business-rule' | 'informational';
|
|
2799
|
+
|
|
2594
2800
|
/**
|
|
2595
2801
|
* Get the parent path (everything before the last `.`).
|
|
2596
2802
|
*
|
|
@@ -2951,6 +3157,39 @@ export declare interface FhirContext {
|
|
|
2951
3157
|
display?: FhirString;
|
|
2952
3158
|
}
|
|
2953
3159
|
|
|
3160
|
+
/**
|
|
3161
|
+
* Abstract interface for resolving FHIR References.
|
|
3162
|
+
*
|
|
3163
|
+
* Implementations may resolve references against a local store,
|
|
3164
|
+
* a remote FHIR server, or a bundle's contained resources.
|
|
3165
|
+
*
|
|
3166
|
+
* The runtime provides {@link NoOpReferenceResolver} as a default
|
|
3167
|
+
* implementation.
|
|
3168
|
+
*
|
|
3169
|
+
* @example
|
|
3170
|
+
* ```typescript
|
|
3171
|
+
* const resolver: ReferenceResolver = new NoOpReferenceResolver();
|
|
3172
|
+
* const exists = await resolver.exists('Patient/123');
|
|
3173
|
+
* console.log(exists); // true (NoOp always returns true)
|
|
3174
|
+
* ```
|
|
3175
|
+
*/
|
|
3176
|
+
export declare interface ReferenceResolver {
|
|
3177
|
+
/**
|
|
3178
|
+
* Resolve a FHIR reference to its target resource.
|
|
3179
|
+
*
|
|
3180
|
+
* @param reference - The reference string (e.g., `'Patient/123'`).
|
|
3181
|
+
* @returns The resolved resource, or `undefined` if not found.
|
|
3182
|
+
*/
|
|
3183
|
+
resolve(reference: string): Promise<Resource | undefined>;
|
|
3184
|
+
/**
|
|
3185
|
+
* Check whether a FHIR reference target exists.
|
|
3186
|
+
*
|
|
3187
|
+
* @param reference - The reference string (e.g., `'Patient/123'`).
|
|
3188
|
+
* @returns `true` if the referenced resource exists.
|
|
3189
|
+
*/
|
|
3190
|
+
exists(reference: string): Promise<boolean>;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
2954
3193
|
/**
|
|
2955
3194
|
* Whether all resource references need to be version-specific.
|
|
2956
3195
|
* @see https://hl7.org/fhir/R4/valueset-reference-version-rules.html
|
|
@@ -3812,6 +4051,46 @@ export declare interface FhirContext {
|
|
|
3812
4051
|
*/
|
|
3813
4052
|
export declare function tailSegment(path: string): string;
|
|
3814
4053
|
|
|
4054
|
+
/**
|
|
4055
|
+
* Abstract interface for terminology operations.
|
|
4056
|
+
*
|
|
4057
|
+
* Implementations may connect to a remote FHIR terminology server,
|
|
4058
|
+
* an in-memory CodeSystem/ValueSet registry, or any other source.
|
|
4059
|
+
*
|
|
4060
|
+
* The runtime provides {@link NoOpTerminologyProvider} as a default
|
|
4061
|
+
* implementation that accepts all codes without validation.
|
|
4062
|
+
*
|
|
4063
|
+
* @example
|
|
4064
|
+
* ```typescript
|
|
4065
|
+
* const provider: TerminologyProvider = new NoOpTerminologyProvider();
|
|
4066
|
+
* const result = await provider.validateCode({ system: 'http://loinc.org', code: '12345-6' });
|
|
4067
|
+
* console.log(result.result); // true (NoOp always passes)
|
|
4068
|
+
* ```
|
|
4069
|
+
*/
|
|
4070
|
+
export declare interface TerminologyProvider {
|
|
4071
|
+
/**
|
|
4072
|
+
* Validate a code against a CodeSystem or ValueSet.
|
|
4073
|
+
*
|
|
4074
|
+
* @param params - Validation parameters (system, code, optional valueSetUrl).
|
|
4075
|
+
* @returns Validation result indicating whether the code is valid.
|
|
4076
|
+
*/
|
|
4077
|
+
validateCode(params: ValidateCodeParams): Promise<ValidateCodeResult>;
|
|
4078
|
+
/**
|
|
4079
|
+
* Expand a ValueSet to enumerate its contained codes.
|
|
4080
|
+
*
|
|
4081
|
+
* @param params - Expansion parameters (url, optional filter/pagination).
|
|
4082
|
+
* @returns The expanded ValueSet contents.
|
|
4083
|
+
*/
|
|
4084
|
+
expandValueSet(params: ExpandValueSetParams): Promise<ValueSetExpansion>;
|
|
4085
|
+
/**
|
|
4086
|
+
* Look up a code in a CodeSystem to retrieve its display and definition.
|
|
4087
|
+
*
|
|
4088
|
+
* @param params - Lookup parameters (system, code).
|
|
4089
|
+
* @returns Lookup result with display and definition (if found).
|
|
4090
|
+
*/
|
|
4091
|
+
lookupCode(params: LookupCodeParams): Promise<LookupCodeResult>;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
3815
4094
|
/**
|
|
3816
4095
|
* Cursor-based scope for base-driven traversal.
|
|
3817
4096
|
*
|
|
@@ -3945,6 +4224,32 @@ export declare interface FhirContext {
|
|
|
3945
4224
|
value?: unknown;
|
|
3946
4225
|
}
|
|
3947
4226
|
|
|
4227
|
+
/**
|
|
4228
|
+
* Parameters for validating a code against a CodeSystem or ValueSet.
|
|
4229
|
+
*/
|
|
4230
|
+
export declare interface ValidateCodeParams {
|
|
4231
|
+
/** The CodeSystem URL (e.g., `'http://loinc.org'`). */
|
|
4232
|
+
readonly system: string;
|
|
4233
|
+
/** The code to validate. */
|
|
4234
|
+
readonly code: string;
|
|
4235
|
+
/** Optional ValueSet URL to validate the code against. */
|
|
4236
|
+
readonly valueSetUrl?: string;
|
|
4237
|
+
/** Optional display string to validate. */
|
|
4238
|
+
readonly display?: string;
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
/**
|
|
4242
|
+
* Result of a code validation operation.
|
|
4243
|
+
*/
|
|
4244
|
+
export declare interface ValidateCodeResult {
|
|
4245
|
+
/** Whether the code is valid in the given system/ValueSet. */
|
|
4246
|
+
readonly result: boolean;
|
|
4247
|
+
/** Optional message explaining the validation outcome. */
|
|
4248
|
+
readonly message?: string;
|
|
4249
|
+
/** The preferred display for the code (if known). */
|
|
4250
|
+
readonly display?: string;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
3948
4253
|
/**
|
|
3949
4254
|
* Validate that snapshot elements are in correct order.
|
|
3950
4255
|
*
|
|
@@ -4161,6 +4466,26 @@ export declare interface FhirContext {
|
|
|
4161
4466
|
* @default false
|
|
4162
4467
|
*/
|
|
4163
4468
|
readonly skipInvariants?: boolean;
|
|
4469
|
+
/**
|
|
4470
|
+
* Optional terminology provider for binding validation.
|
|
4471
|
+
*
|
|
4472
|
+
* When provided, the validator will invoke the provider to check
|
|
4473
|
+
* coded values against their declared bindings. When absent,
|
|
4474
|
+
* binding validation is skipped (with a warning for required bindings).
|
|
4475
|
+
*
|
|
4476
|
+
* @default undefined
|
|
4477
|
+
*/
|
|
4478
|
+
readonly terminologyProvider?: TerminologyProvider;
|
|
4479
|
+
/**
|
|
4480
|
+
* Optional reference resolver for reference existence checks.
|
|
4481
|
+
*
|
|
4482
|
+
* When provided, the validator may use it for additional reference
|
|
4483
|
+
* validation beyond structural checks. When absent, reference
|
|
4484
|
+
* existence is not verified.
|
|
4485
|
+
*
|
|
4486
|
+
* @default undefined
|
|
4487
|
+
*/
|
|
4488
|
+
readonly referenceResolver?: ReferenceResolver;
|
|
4164
4489
|
}
|
|
4165
4490
|
|
|
4166
4491
|
/**
|
|
@@ -4221,4 +4546,26 @@ export declare interface FhirContext {
|
|
|
4221
4546
|
constructor(message: string, options?: ErrorOptions);
|
|
4222
4547
|
}
|
|
4223
4548
|
|
|
4549
|
+
/**
|
|
4550
|
+
* Result of a ValueSet expansion operation.
|
|
4551
|
+
*/
|
|
4552
|
+
export declare interface ValueSetExpansion {
|
|
4553
|
+
/** Total number of concepts in the expansion (before pagination). */
|
|
4554
|
+
readonly total?: number;
|
|
4555
|
+
/** The expanded concepts. */
|
|
4556
|
+
readonly contains: readonly ValueSetExpansionContains[];
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
/**
|
|
4560
|
+
* A single concept in a ValueSet expansion.
|
|
4561
|
+
*/
|
|
4562
|
+
export declare interface ValueSetExpansionContains {
|
|
4563
|
+
/** The CodeSystem URL this concept belongs to. */
|
|
4564
|
+
readonly system: string;
|
|
4565
|
+
/** The code value. */
|
|
4566
|
+
readonly code: string;
|
|
4567
|
+
/** Optional human-readable display for the code. */
|
|
4568
|
+
readonly display?: string;
|
|
4569
|
+
}
|
|
4570
|
+
|
|
4224
4571
|
export { }
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -21,4 +21,6 @@ export { SnapshotGenerator, buildCanonicalProfile, buildCanonicalElement, buildT
|
|
|
21
21
|
export type { ValidationOptions, ValidationResult, ValidationIssue, ValidationIssueCode, } from './validator/index.js';
|
|
22
22
|
export { StructureValidator, createValidationIssue, resolveValidationOptions, hasValidationErrors, extractValues, ProfileNotFoundError, ValidationFailedError, } from './validator/index.js';
|
|
23
23
|
export { evalFhirPath, evalFhirPathBoolean, evalFhirPathTyped, evalFhirPathString, } from './fhirpath/index.js';
|
|
24
|
+
export type { TerminologyProvider, ValidateCodeParams, ValidateCodeResult, ExpandValueSetParams, ValueSetExpansion, ValueSetExpansionContains, LookupCodeParams, LookupCodeResult, ReferenceResolver, OperationOutcome, OperationOutcomeIssue, OperationOutcomeIssueType, } from './provider/index.js';
|
|
25
|
+
export { NoOpTerminologyProvider, NoOpReferenceResolver, buildOperationOutcome, buildOperationOutcomeFromParse, buildOperationOutcomeFromSnapshot, } from './provider/index.js';
|
|
24
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAEV,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,eAAe,EACf,eAAe,EACf,QAAQ,EACR,SAAS,EAGT,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,E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oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EAGtB,YAAY,EACZ,+BAA+B,EAC/B,iBAAiB,EACjB,wBAAwB,EACxB,2BAA2B,EAG3B,mBAAmB,EACnB,iBAAiB,EAGjB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAGhB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAGhB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EAGX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EAGb,oBAAoB,EACpB,gBAAgB,EAChB,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,YAAY,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GACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fhir-provider — Barrel Exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all public types, interfaces, and implementations from
|
|
5
|
+
* the FHIR provider module.
|
|
6
|
+
*
|
|
7
|
+
* Public surface:
|
|
8
|
+
* - Types: TerminologyProvider, ReferenceResolver, OperationOutcome, etc.
|
|
9
|
+
* - NoOp implementations: NoOpTerminologyProvider, NoOpReferenceResolver
|
|
10
|
+
* - Builders: buildOperationOutcome, buildOperationOutcomeFromParse, buildOperationOutcomeFromSnapshot
|
|
11
|
+
*
|
|
12
|
+
* @module fhir-provider
|
|
13
|
+
*/
|
|
14
|
+
export type { TerminologyProvider, ValidateCodeParams, ValidateCodeResult, ExpandValueSetParams, ValueSetExpansion, ValueSetExpansionContains, LookupCodeParams, LookupCodeResult, ReferenceResolver, OperationOutcome, OperationOutcomeIssue, OperationOutcomeIssueType, } from './types.js';
|
|
15
|
+
export { NoOpTerminologyProvider } from './noop-terminology-provider.js';
|
|
16
|
+
export { NoOpReferenceResolver } from './noop-reference-resolver.js';
|
|
17
|
+
export { buildOperationOutcome, buildOperationOutcomeFromParse, buildOperationOutcomeFromSnapshot, } from './operation-outcome-builder.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fhir-provider — NoOp Reference Resolver
|
|
3
|
+
*
|
|
4
|
+
* Default implementation of {@link ReferenceResolver} that treats all
|
|
5
|
+
* references as existing without performing any actual resolution.
|
|
6
|
+
* This allows the runtime to function standalone without a FHIR server
|
|
7
|
+
* or resource store.
|
|
8
|
+
*
|
|
9
|
+
* Behavior:
|
|
10
|
+
* - `resolve()` → always returns `undefined` (no resource available)
|
|
11
|
+
* - `exists()` → always returns `true` (assume reference target exists)
|
|
12
|
+
*
|
|
13
|
+
* @module fhir-provider
|
|
14
|
+
*/
|
|
15
|
+
import type { Resource } from '../model/index.js';
|
|
16
|
+
import type { ReferenceResolver } from './types.js';
|
|
17
|
+
/**
|
|
18
|
+
* A no-operation reference resolver that assumes all references exist.
|
|
19
|
+
*
|
|
20
|
+
* Use this as a default resolver when no resource store is available.
|
|
21
|
+
* All references are assumed to exist, but no actual resources are returned.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const resolver = new NoOpReferenceResolver();
|
|
26
|
+
* const exists = await resolver.exists('Patient/123');
|
|
27
|
+
* console.log(exists); // true
|
|
28
|
+
*
|
|
29
|
+
* const resource = await resolver.resolve('Patient/123');
|
|
30
|
+
* console.log(resource); // undefined
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class NoOpReferenceResolver implements ReferenceResolver {
|
|
34
|
+
/**
|
|
35
|
+
* Always returns `undefined`.
|
|
36
|
+
*
|
|
37
|
+
* No actual reference resolution is performed.
|
|
38
|
+
*/
|
|
39
|
+
resolve(_reference: string): Promise<Resource | undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* Always returns `true`.
|
|
42
|
+
*
|
|
43
|
+
* Assumes all reference targets exist without checking.
|
|
44
|
+
*/
|
|
45
|
+
exists(_reference: string): Promise<boolean>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=noop-reference-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-reference-resolver.d.ts","sourceRoot":"","sources":["../../../src/provider/noop-reference-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D;;;;OAIG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAIhE;;;;OAIG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGnD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fhir-provider — NoOp Terminology Provider
|
|
3
|
+
*
|
|
4
|
+
* Default implementation of {@link TerminologyProvider} that accepts all
|
|
5
|
+
* codes without performing any actual terminology validation. This allows
|
|
6
|
+
* the runtime to function standalone without a terminology server.
|
|
7
|
+
*
|
|
8
|
+
* Behavior:
|
|
9
|
+
* - `validateCode()` → always returns `{ result: true }`
|
|
10
|
+
* - `expandValueSet()` → always returns empty expansion `{ contains: [] }`
|
|
11
|
+
* - `lookupCode()` → always returns `{ found: false }`
|
|
12
|
+
*
|
|
13
|
+
* @module fhir-provider
|
|
14
|
+
*/
|
|
15
|
+
import type { TerminologyProvider, ValidateCodeParams, ValidateCodeResult, ExpandValueSetParams, ValueSetExpansion, LookupCodeParams, LookupCodeResult } from './types.js';
|
|
16
|
+
/**
|
|
17
|
+
* A no-operation terminology provider that accepts all codes.
|
|
18
|
+
*
|
|
19
|
+
* Use this as a default provider when no terminology server is available.
|
|
20
|
+
* All codes are considered valid, no ValueSet expansions are returned,
|
|
21
|
+
* and code lookups always report "not found".
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const provider = new NoOpTerminologyProvider();
|
|
26
|
+
* const result = await provider.validateCode({ system: 'http://loinc.org', code: '12345-6' });
|
|
27
|
+
* console.log(result.result); // true
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class NoOpTerminologyProvider implements TerminologyProvider {
|
|
31
|
+
/**
|
|
32
|
+
* Always returns `{ result: true }`.
|
|
33
|
+
*
|
|
34
|
+
* No actual code validation is performed.
|
|
35
|
+
*/
|
|
36
|
+
validateCode(_params: ValidateCodeParams): Promise<ValidateCodeResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Always returns an empty expansion `{ contains: [] }`.
|
|
39
|
+
*
|
|
40
|
+
* No actual ValueSet expansion is performed.
|
|
41
|
+
*/
|
|
42
|
+
expandValueSet(_params: ExpandValueSetParams): Promise<ValueSetExpansion>;
|
|
43
|
+
/**
|
|
44
|
+
* Always returns `{ found: false }`.
|
|
45
|
+
*
|
|
46
|
+
* No actual code lookup is performed.
|
|
47
|
+
*/
|
|
48
|
+
lookupCode(_params: LookupCodeParams): Promise<LookupCodeResult>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=noop-terminology-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-terminology-provider.d.ts","sourceRoot":"","sources":["../../../src/provider/noop-terminology-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;GAaG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI5E;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI/E;;;;OAIG;IACG,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGvE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fhir-provider — OperationOutcome Builder
|
|
3
|
+
*
|
|
4
|
+
* Converts internal result types ({@link ValidationResult}, {@link ParseResult},
|
|
5
|
+
* {@link SnapshotResult}) into standard FHIR R4 OperationOutcome resources.
|
|
6
|
+
*
|
|
7
|
+
* This is essential for fhir-server integration, where REST API responses
|
|
8
|
+
* must include OperationOutcome resources to communicate processing results.
|
|
9
|
+
*
|
|
10
|
+
* @module fhir-provider
|
|
11
|
+
*/
|
|
12
|
+
import type { ValidationResult } from '../validator/types.js';
|
|
13
|
+
import type { ParseResult } from '../parser/parse-error.js';
|
|
14
|
+
import type { SnapshotResult } from '../profile/types.js';
|
|
15
|
+
import type { OperationOutcome } from './types.js';
|
|
16
|
+
/**
|
|
17
|
+
* Build a FHIR OperationOutcome from a {@link ValidationResult}.
|
|
18
|
+
*
|
|
19
|
+
* Maps each {@link ValidationIssue} to an OperationOutcome.issue entry
|
|
20
|
+
* with appropriate severity, issue type code, details, and expression.
|
|
21
|
+
*
|
|
22
|
+
* If the validation result has no issues, returns an OperationOutcome
|
|
23
|
+
* with a single informational issue indicating success.
|
|
24
|
+
*
|
|
25
|
+
* @param result - The validation result to convert.
|
|
26
|
+
* @returns A FHIR R4 OperationOutcome resource.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const result = validator.validate(patient, patientProfile);
|
|
31
|
+
* const outcome = buildOperationOutcome(result);
|
|
32
|
+
* // outcome.resourceType === 'OperationOutcome'
|
|
33
|
+
* // outcome.issue.length >= 1
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildOperationOutcome(result: ValidationResult): OperationOutcome;
|
|
37
|
+
/**
|
|
38
|
+
* Build a FHIR OperationOutcome from a {@link ParseResult}.
|
|
39
|
+
*
|
|
40
|
+
* Maps each {@link ParseIssue} to an OperationOutcome.issue entry.
|
|
41
|
+
* If the parse result is successful with no issues, returns an
|
|
42
|
+
* OperationOutcome with a single informational success message.
|
|
43
|
+
*
|
|
44
|
+
* @param result - The parse result to convert.
|
|
45
|
+
* @returns A FHIR R4 OperationOutcome resource.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const result = parseFhirJson(jsonString);
|
|
50
|
+
* const outcome = buildOperationOutcomeFromParse(result);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildOperationOutcomeFromParse(result: ParseResult<unknown>): OperationOutcome;
|
|
54
|
+
/**
|
|
55
|
+
* Build a FHIR OperationOutcome from a {@link SnapshotResult}.
|
|
56
|
+
*
|
|
57
|
+
* Maps each {@link SnapshotIssue} to an OperationOutcome.issue entry.
|
|
58
|
+
* If the snapshot result is successful with no issues, returns an
|
|
59
|
+
* OperationOutcome with a single informational success message.
|
|
60
|
+
*
|
|
61
|
+
* @param result - The snapshot result to convert.
|
|
62
|
+
* @returns A FHIR R4 OperationOutcome resource.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const result = await generator.generate(sd);
|
|
67
|
+
* const outcome = buildOperationOutcomeFromSnapshot(result);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildOperationOutcomeFromSnapshot(result: SnapshotResult): OperationOutcome;
|
|
71
|
+
//# sourceMappingURL=operation-outcome-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-outcome-builder.d.ts","sourceRoot":"","sources":["../../../src/provider/operation-outcome-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAwC,MAAM,uBAAuB,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAA8B,MAAM,0BAA0B,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,qBAAqB,CAAC;AAC5F,OAAO,KAAK,EAAE,gBAAgB,EAAoD,MAAM,YAAY,CAAC;AA8CrG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAkBhF;AAkCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAkB7F;AAoCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAkB1F"}
|