@metriport/fhir-sdk 1.6.1 → 1.6.3
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/dist/__tests__/type-guards.test.js +50 -130
- package/dist/__tests__/type-guards.test.js.map +1 -1
- package/dist/type-guards.d.ts +134 -105
- package/dist/type-guards.d.ts.map +1 -1
- package/dist/type-guards.js +268 -1
- package/dist/type-guards.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,162 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
3
7
|
const fhir_bundle_sdk_1 = require("../fhir-bundle-sdk");
|
|
4
8
|
const type_guards_1 = require("../type-guards");
|
|
5
9
|
describe("Type Guards", () => {
|
|
6
|
-
describe("
|
|
7
|
-
test("
|
|
8
|
-
const resources = [
|
|
9
|
-
{ resourceType: "Patient", id: "patient-1" },
|
|
10
|
-
{ resourceType: "Observation", id: "obs-1", status: "final", code: { text: "test" } },
|
|
11
|
-
{ resourceType: "Patient", id: "patient-2" },
|
|
12
|
-
{
|
|
13
|
-
resourceType: "DiagnosticReport",
|
|
14
|
-
id: "report-1",
|
|
15
|
-
status: "final",
|
|
16
|
-
code: { text: "test" },
|
|
17
|
-
},
|
|
18
|
-
{ resourceType: "Observation", id: "obs-2", status: "final", code: { text: "test" } },
|
|
19
|
-
];
|
|
20
|
-
const patients = resources.filter(type_guards_1.isPatient);
|
|
21
|
-
const observations = resources.filter(type_guards_1.isObservation);
|
|
22
|
-
const reports = resources.filter(type_guards_1.isDiagnosticReport);
|
|
23
|
-
// Type assertions validate TypeScript properly inferred the types
|
|
24
|
-
expect(patients).toHaveLength(2);
|
|
25
|
-
expect(observations).toHaveLength(2);
|
|
26
|
-
expect(reports).toHaveLength(1);
|
|
27
|
-
// TypeScript knows these are Patients, so we can access Patient-specific fields
|
|
28
|
-
patients.forEach(patient => {
|
|
29
|
-
expect(patient.resourceType).toBe("Patient");
|
|
30
|
-
// This wouldn't compile if TypeScript didn't narrow the type
|
|
31
|
-
void patient.name; // Patient-specific field accessible due to type narrowing
|
|
32
|
-
});
|
|
33
|
-
// TypeScript knows these are Observations
|
|
34
|
-
observations.forEach(obs => {
|
|
35
|
-
expect(obs.resourceType).toBe("Observation");
|
|
36
|
-
expect(obs.status).toBe("final"); // Observation-specific field accessible
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe("Type guards with Smart resources", () => {
|
|
41
|
-
test("filters Smart resources with proper type inference", async () => {
|
|
10
|
+
describe("Type guards work with Smart resources from SDK", () => {
|
|
11
|
+
test("type guards work with chained method calls like getDiagnosticReports().getPerformers()", () => {
|
|
42
12
|
const bundle = {
|
|
43
13
|
resourceType: "Bundle",
|
|
44
14
|
type: "collection",
|
|
45
15
|
entry: [
|
|
46
|
-
{ resource: { resourceType: "Patient", id: "patient-1" } },
|
|
47
16
|
{
|
|
48
17
|
resource: {
|
|
49
|
-
resourceType: "
|
|
50
|
-
id: "
|
|
51
|
-
|
|
52
|
-
code: { text: "test" },
|
|
53
|
-
subject: { reference: "Patient/patient-1" },
|
|
18
|
+
resourceType: "Practitioner",
|
|
19
|
+
id: "prac-1",
|
|
20
|
+
name: [{ given: ["John"], family: "Smith" }],
|
|
54
21
|
},
|
|
55
22
|
},
|
|
56
|
-
{ resource: { resourceType: "Patient", id: "patient-2" } },
|
|
57
23
|
{
|
|
58
24
|
resource: {
|
|
59
|
-
resourceType: "
|
|
60
|
-
id: "
|
|
61
|
-
|
|
62
|
-
class: { code: "test" },
|
|
25
|
+
resourceType: "Organization",
|
|
26
|
+
id: "org-1",
|
|
27
|
+
name: "Test Lab",
|
|
63
28
|
},
|
|
64
29
|
},
|
|
65
30
|
{
|
|
66
31
|
resource: {
|
|
67
|
-
resourceType: "
|
|
68
|
-
id: "
|
|
32
|
+
resourceType: "DiagnosticReport",
|
|
33
|
+
id: "report-1",
|
|
69
34
|
status: "final",
|
|
70
|
-
code: { text: "
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const sdk = await fhir_bundle_sdk_1.FhirBundleSdk.create(bundle);
|
|
76
|
-
// Test filtering observations directly - this is the main use case
|
|
77
|
-
const allObservations = sdk.getObservations();
|
|
78
|
-
expect(allObservations).toHaveLength(2);
|
|
79
|
-
allObservations.forEach(obs => {
|
|
80
|
-
expect(obs.resourceType).toBe("Observation");
|
|
81
|
-
expect(obs.__isSmartResource).toBe(true);
|
|
82
|
-
// Type guard confirms it's an Observation, so we can access observation-specific fields
|
|
83
|
-
if ((0, type_guards_1.isObservation)(obs)) {
|
|
84
|
-
const subject = obs.getSubject();
|
|
85
|
-
void subject;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
// Test filtering patients
|
|
89
|
-
const allPatients = sdk.getPatients();
|
|
90
|
-
expect(allPatients).toHaveLength(2);
|
|
91
|
-
allPatients.forEach(patient => {
|
|
92
|
-
expect(patient.resourceType).toBe("Patient");
|
|
93
|
-
expect(patient.__isSmartResource).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
test("type guards work in conditional blocks with Smart resources", async () => {
|
|
97
|
-
const bundle = {
|
|
98
|
-
resourceType: "Bundle",
|
|
99
|
-
type: "collection",
|
|
100
|
-
entry: [
|
|
101
|
-
{
|
|
102
|
-
resource: {
|
|
103
|
-
resourceType: "Patient",
|
|
104
|
-
id: "patient-1",
|
|
105
|
-
name: [{ given: ["Jane"], family: "Doe" }],
|
|
35
|
+
code: { text: "Blood Test" },
|
|
36
|
+
performer: [
|
|
37
|
+
{ reference: "Practitioner/prac-1" },
|
|
38
|
+
{ reference: "Organization/org-1" },
|
|
39
|
+
],
|
|
106
40
|
},
|
|
107
41
|
},
|
|
108
42
|
{
|
|
109
43
|
resource: {
|
|
110
|
-
resourceType: "
|
|
111
|
-
id: "
|
|
44
|
+
resourceType: "DiagnosticReport",
|
|
45
|
+
id: "report-2",
|
|
112
46
|
status: "final",
|
|
113
|
-
code: { text: "
|
|
114
|
-
|
|
47
|
+
code: { text: "X-Ray" },
|
|
48
|
+
performer: [{ reference: "Practitioner/prac-1" }],
|
|
115
49
|
},
|
|
116
50
|
},
|
|
117
51
|
],
|
|
118
52
|
};
|
|
119
|
-
const sdk =
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
undefined,
|
|
147
|
-
];
|
|
148
|
-
const patients = resources.filter(type_guards_1.isPatient);
|
|
149
|
-
const observations = resources.filter(type_guards_1.isObservation);
|
|
150
|
-
expect(patients).toHaveLength(1);
|
|
151
|
-
expect(observations).toHaveLength(1);
|
|
152
|
-
});
|
|
153
|
-
test("returns empty array when no matches found", () => {
|
|
154
|
-
const resources = [
|
|
155
|
-
{ resourceType: "Patient", id: "1" },
|
|
156
|
-
{ resourceType: "Patient", id: "2" },
|
|
157
|
-
];
|
|
158
|
-
const observations = resources.filter(type_guards_1.isObservation);
|
|
159
|
-
expect(observations).toHaveLength(0);
|
|
53
|
+
const sdk = fhir_bundle_sdk_1.FhirBundleSdk.createSync(bundle);
|
|
54
|
+
// Test chained method calls with type guards on Smart resources
|
|
55
|
+
const performers = sdk.getDiagnosticReports().flatMap(report => report.getPerformers());
|
|
56
|
+
const practitioners = performers.filter(type_guards_1.isPractitioner);
|
|
57
|
+
// Type-level verification: These lines will only compile if type narrowing works
|
|
58
|
+
// If narrowing fails, TypeScript will error because these properties don't exist on the union type
|
|
59
|
+
const firstPractitionerName = practitioners[0]?.name; // 'name' is specific to Practitioner
|
|
60
|
+
const firstPractitionerQualification = practitioners[0]?.qualification; // 'qualification' is also Practitioner-specific
|
|
61
|
+
// Two diagnostic reports both reference the same practitioner, so we get 2 instances
|
|
62
|
+
expect(practitioners).toHaveLength(2);
|
|
63
|
+
expect(practitioners[0]?.id).toBe("prac-1");
|
|
64
|
+
expect(practitioners[1]?.id).toBe("prac-1");
|
|
65
|
+
expect(firstPractitionerName).toBeDefined();
|
|
66
|
+
expect(firstPractitionerName?.[0]?.family).toBe("Smith");
|
|
67
|
+
expect(practitioners[0]?.resourceType).toBe("Practitioner");
|
|
68
|
+
// The fact that we can access qualification without TypeScript error proves narrowing works
|
|
69
|
+
// (even though it's undefined in this test data)
|
|
70
|
+
expect(firstPractitionerQualification).toBeUndefined();
|
|
71
|
+
// Test filtering plain FHIR resources using plain type guards
|
|
72
|
+
const plainResources = lodash_1.default.compact(bundle.entry?.map(entry => entry.resource)) ?? [];
|
|
73
|
+
const plainPractitioners = plainResources.filter(type_guards_1.isPlainPractitioner);
|
|
74
|
+
// Type-level verification for plain resources
|
|
75
|
+
const plainPractitionerName = plainPractitioners[0]?.name;
|
|
76
|
+
expect(plainPractitioners).toHaveLength(1);
|
|
77
|
+
expect(plainPractitioners[0]?.id).toBe("prac-1");
|
|
78
|
+
expect(plainPractitionerName).toBeDefined();
|
|
79
|
+
expect(plainPractitionerName?.[0]?.family).toBe("Smith");
|
|
160
80
|
});
|
|
161
81
|
});
|
|
162
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-guards.test.js","sourceRoot":"","sources":["../../src/__tests__/type-guards.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-guards.test.js","sourceRoot":"","sources":["../../src/__tests__/type-guards.test.ts"],"names":[],"m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MAAM,qBAAqB,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;YAE1D,MAAM,CAAC,kBAAkB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjD,MAAM,CAAC,qBAAqB,CAAC,CAAC,WAAW,EAAE,CAAC;YAC5C,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/type-guards.d.ts
CHANGED
|
@@ -1,183 +1,212 @@
|
|
|
1
|
-
import { Resource, Patient, Observation, DiagnosticReport, Encounter, Practitioner, PractitionerRole, Organization, Location, AllergyIntolerance, Condition, Composition, Coverage, DocumentReference, FamilyMemberHistory, Immunization, Medication, MedicationAdministration, MedicationDispense, MedicationRequest, MedicationStatement, Procedure, RelatedPerson, RiskAssessment, ServiceRequest, CarePlan, Bundle } from "@medplum/fhirtypes";
|
|
2
|
-
import { Smart } from "./types/smart-resources";
|
|
3
|
-
import { SmartPatient, SmartObservation, SmartDiagnosticReport, SmartEncounter, SmartPractitioner, SmartOrganization, SmartLocation, SmartAllergyIntolerance, SmartCondition, SmartComposition, SmartCoverage, SmartDocumentReference, SmartFamilyMemberHistory, SmartImmunization, SmartMedication, SmartMedicationAdministration, SmartMedicationDispense, SmartMedicationRequest, SmartMedicationStatement, SmartProcedure, SmartRelatedPerson, SmartRiskAssessment, SmartServiceRequest, SmartCarePlan } from "./types/coding-fields";
|
|
1
|
+
import type { Resource, Patient, Observation, DiagnosticReport, Encounter, Practitioner, PractitionerRole, Organization, Location, AllergyIntolerance, Condition, Composition, Coverage, DocumentReference, FamilyMemberHistory, Immunization, Medication, MedicationAdministration, MedicationDispense, MedicationRequest, MedicationStatement, Procedure, RelatedPerson, RiskAssessment, ServiceRequest, CarePlan, Bundle } from "@medplum/fhirtypes";
|
|
2
|
+
import type { Smart } from "./types/smart-resources";
|
|
3
|
+
import type { SmartPatient, SmartObservation, SmartDiagnosticReport, SmartEncounter, SmartPractitioner, SmartPractitionerRole, SmartOrganization, SmartLocation, SmartAllergyIntolerance, SmartCondition, SmartComposition, SmartCoverage, SmartDocumentReference, SmartFamilyMemberHistory, SmartImmunization, SmartMedication, SmartMedicationAdministration, SmartMedicationDispense, SmartMedicationRequest, SmartMedicationStatement, SmartProcedure, SmartRelatedPerson, SmartRiskAssessment, SmartServiceRequest, SmartCarePlan } from "./types/coding-fields";
|
|
4
4
|
/**
|
|
5
|
-
* Patient type guard
|
|
6
|
-
* Returns SmartPatient when used with Smart resources to provide full TypeScript support
|
|
7
|
-
* for coding utilities
|
|
5
|
+
* Patient type guard for Smart resources
|
|
8
6
|
*/
|
|
9
7
|
export declare function isPatient(resource: Smart<Resource> | undefined): resource is SmartPatient;
|
|
10
|
-
export declare function isPatient(resource: Resource | undefined): resource is Patient;
|
|
11
8
|
/**
|
|
12
|
-
* Observation type guard
|
|
13
|
-
* Returns SmartObservation when used with Smart resources to provide full TypeScript support
|
|
14
|
-
* for coding utilities
|
|
9
|
+
* Observation type guard for Smart resources
|
|
15
10
|
*/
|
|
16
11
|
export declare function isObservation(resource: Smart<Resource> | undefined): resource is SmartObservation;
|
|
17
|
-
export declare function isObservation(resource: Resource | undefined): resource is Observation;
|
|
18
12
|
/**
|
|
19
|
-
* DiagnosticReport type guard
|
|
20
|
-
* Returns SmartDiagnosticReport when used with Smart resources to provide full TypeScript support
|
|
21
|
-
* for coding utilities
|
|
13
|
+
* DiagnosticReport type guard for Smart resources
|
|
22
14
|
*/
|
|
23
15
|
export declare function isDiagnosticReport(resource: Smart<Resource> | undefined): resource is SmartDiagnosticReport;
|
|
24
|
-
export declare function isDiagnosticReport(resource: Resource | undefined): resource is DiagnosticReport;
|
|
25
16
|
/**
|
|
26
|
-
* Encounter type guard
|
|
27
|
-
* Returns SmartEncounter when used with Smart resources to provide full TypeScript support
|
|
28
|
-
* for coding utilities
|
|
17
|
+
* Encounter type guard for Smart resources
|
|
29
18
|
*/
|
|
30
19
|
export declare function isEncounter(resource: Smart<Resource> | undefined): resource is SmartEncounter;
|
|
31
|
-
export declare function isEncounter(resource: Resource | undefined): resource is Encounter;
|
|
32
20
|
/**
|
|
33
|
-
* Practitioner type guard
|
|
34
|
-
* Returns SmartPractitioner when used with Smart resources to provide full TypeScript support
|
|
35
|
-
* for coding utilities
|
|
21
|
+
* Practitioner type guard for Smart resources
|
|
36
22
|
*/
|
|
37
23
|
export declare function isPractitioner(resource: Smart<Resource> | undefined): resource is SmartPractitioner;
|
|
38
|
-
export declare function isPractitioner(resource: Resource | undefined): resource is Practitioner;
|
|
39
24
|
/**
|
|
40
|
-
* PractitionerRole type guard
|
|
41
|
-
* Note: PractitionerRole doesn't have specific coding fields, so it uses the generic Smart type
|
|
25
|
+
* PractitionerRole type guard for Smart resources
|
|
42
26
|
*/
|
|
43
|
-
export declare function isPractitionerRole(resource: Smart<Resource> | undefined): resource is
|
|
44
|
-
export declare function isPractitionerRole(resource: Resource | undefined): resource is PractitionerRole;
|
|
27
|
+
export declare function isPractitionerRole(resource: Smart<Resource> | undefined): resource is SmartPractitionerRole;
|
|
45
28
|
/**
|
|
46
|
-
* Organization type guard
|
|
47
|
-
* Returns SmartOrganization when used with Smart resources to provide full TypeScript support
|
|
48
|
-
* for coding utilities
|
|
29
|
+
* Organization type guard for Smart resources
|
|
49
30
|
*/
|
|
50
31
|
export declare function isOrganization(resource: Smart<Resource> | undefined): resource is SmartOrganization;
|
|
51
|
-
export declare function isOrganization(resource: Resource | undefined): resource is Organization;
|
|
52
32
|
/**
|
|
53
|
-
* Location type guard
|
|
54
|
-
* Returns SmartLocation when used with Smart resources to provide full TypeScript support
|
|
55
|
-
* for coding utilities
|
|
33
|
+
* Location type guard for Smart resources
|
|
56
34
|
*/
|
|
57
35
|
export declare function isLocation(resource: Smart<Resource> | undefined): resource is SmartLocation;
|
|
58
|
-
export declare function isLocation(resource: Resource | undefined): resource is Location;
|
|
59
36
|
/**
|
|
60
|
-
* AllergyIntolerance type guard
|
|
61
|
-
* Returns SmartAllergyIntolerance when used with Smart resources to provide full TypeScript support
|
|
62
|
-
* for coding utilities
|
|
37
|
+
* AllergyIntolerance type guard for Smart resources
|
|
63
38
|
*/
|
|
64
39
|
export declare function isAllergyIntolerance(resource: Smart<Resource> | undefined): resource is SmartAllergyIntolerance;
|
|
65
|
-
export declare function isAllergyIntolerance(resource: Resource | undefined): resource is AllergyIntolerance;
|
|
66
40
|
/**
|
|
67
|
-
* Condition type guard
|
|
68
|
-
* Returns SmartCondition when used with Smart resources to provide full TypeScript support
|
|
69
|
-
* for coding utilities
|
|
41
|
+
* Condition type guard for Smart resources
|
|
70
42
|
*/
|
|
71
43
|
export declare function isCondition(resource: Smart<Resource> | undefined): resource is SmartCondition;
|
|
72
|
-
export declare function isCondition(resource: Resource | undefined): resource is Condition;
|
|
73
44
|
/**
|
|
74
|
-
* Composition type guard
|
|
75
|
-
* Returns SmartComposition when used with Smart resources to provide full TypeScript support
|
|
76
|
-
* for coding utilities
|
|
45
|
+
* Composition type guard for Smart resources
|
|
77
46
|
*/
|
|
78
47
|
export declare function isComposition(resource: Smart<Resource> | undefined): resource is SmartComposition;
|
|
79
|
-
export declare function isComposition(resource: Resource | undefined): resource is Composition;
|
|
80
48
|
/**
|
|
81
|
-
* Coverage type guard
|
|
82
|
-
* Returns SmartCoverage when used with Smart resources to provide full TypeScript support
|
|
83
|
-
* for coding utilities
|
|
49
|
+
* Coverage type guard for Smart resources
|
|
84
50
|
*/
|
|
85
51
|
export declare function isCoverage(resource: Smart<Resource> | undefined): resource is SmartCoverage;
|
|
86
|
-
export declare function isCoverage(resource: Resource | undefined): resource is Coverage;
|
|
87
52
|
/**
|
|
88
|
-
* DocumentReference type guard
|
|
89
|
-
* Returns SmartDocumentReference when used with Smart resources to provide full TypeScript support
|
|
90
|
-
* for coding utilities
|
|
53
|
+
* DocumentReference type guard for Smart resources
|
|
91
54
|
*/
|
|
92
55
|
export declare function isDocumentReference(resource: Smart<Resource> | undefined): resource is SmartDocumentReference;
|
|
93
|
-
export declare function isDocumentReference(resource: Resource | undefined): resource is DocumentReference;
|
|
94
56
|
/**
|
|
95
|
-
* FamilyMemberHistory type guard
|
|
96
|
-
* Returns SmartFamilyMemberHistory when used with Smart resources to provide full TypeScript support
|
|
97
|
-
* for coding utilities
|
|
57
|
+
* FamilyMemberHistory type guard for Smart resources
|
|
98
58
|
*/
|
|
99
59
|
export declare function isFamilyMemberHistory(resource: Smart<Resource> | undefined): resource is SmartFamilyMemberHistory;
|
|
100
|
-
export declare function isFamilyMemberHistory(resource: Resource | undefined): resource is FamilyMemberHistory;
|
|
101
60
|
/**
|
|
102
|
-
* Immunization type guard
|
|
103
|
-
* Returns SmartImmunization when used with Smart resources to provide full TypeScript support
|
|
104
|
-
* for coding utilities
|
|
61
|
+
* Immunization type guard for Smart resources
|
|
105
62
|
*/
|
|
106
63
|
export declare function isImmunization(resource: Smart<Resource> | undefined): resource is SmartImmunization;
|
|
107
|
-
export declare function isImmunization(resource: Resource | undefined): resource is Immunization;
|
|
108
64
|
/**
|
|
109
|
-
* Medication type guard
|
|
110
|
-
* Returns SmartMedication when used with Smart resources to provide full TypeScript support
|
|
111
|
-
* for coding utilities
|
|
65
|
+
* Medication type guard for Smart resources
|
|
112
66
|
*/
|
|
113
67
|
export declare function isMedication(resource: Smart<Resource> | undefined): resource is SmartMedication;
|
|
114
|
-
export declare function isMedication(resource: Resource | undefined): resource is Medication;
|
|
115
68
|
/**
|
|
116
|
-
* MedicationAdministration type guard
|
|
117
|
-
* Returns SmartMedicationAdministration when used with Smart resources to provide full TypeScript support
|
|
118
|
-
* for coding utilities
|
|
69
|
+
* MedicationAdministration type guard for Smart resources
|
|
119
70
|
*/
|
|
120
71
|
export declare function isMedicationAdministration(resource: Smart<Resource> | undefined): resource is SmartMedicationAdministration;
|
|
121
|
-
export declare function isMedicationAdministration(resource: Resource | undefined): resource is MedicationAdministration;
|
|
122
72
|
/**
|
|
123
|
-
* MedicationDispense type guard
|
|
124
|
-
* Returns SmartMedicationDispense when used with Smart resources to provide full TypeScript support
|
|
125
|
-
* for coding utilities
|
|
73
|
+
* MedicationDispense type guard for Smart resources
|
|
126
74
|
*/
|
|
127
75
|
export declare function isMedicationDispense(resource: Smart<Resource> | undefined): resource is SmartMedicationDispense;
|
|
128
|
-
export declare function isMedicationDispense(resource: Resource | undefined): resource is MedicationDispense;
|
|
129
76
|
/**
|
|
130
|
-
* MedicationRequest type guard
|
|
131
|
-
* Returns SmartMedicationRequest when used with Smart resources to provide full TypeScript support
|
|
132
|
-
* for coding utilities
|
|
77
|
+
* MedicationRequest type guard for Smart resources
|
|
133
78
|
*/
|
|
134
79
|
export declare function isMedicationRequest(resource: Smart<Resource> | undefined): resource is SmartMedicationRequest;
|
|
135
|
-
export declare function isMedicationRequest(resource: Resource | undefined): resource is MedicationRequest;
|
|
136
80
|
/**
|
|
137
|
-
* MedicationStatement type guard
|
|
138
|
-
* Returns SmartMedicationStatement when used with Smart resources to provide full TypeScript support
|
|
139
|
-
* for coding utilities
|
|
81
|
+
* MedicationStatement type guard for Smart resources
|
|
140
82
|
*/
|
|
141
83
|
export declare function isMedicationStatement(resource: Smart<Resource> | undefined): resource is SmartMedicationStatement;
|
|
142
|
-
export declare function isMedicationStatement(resource: Resource | undefined): resource is MedicationStatement;
|
|
143
84
|
/**
|
|
144
|
-
* Procedure type guard
|
|
145
|
-
* Returns SmartProcedure when used with Smart resources to provide full TypeScript support
|
|
146
|
-
* for coding utilities
|
|
85
|
+
* Procedure type guard for Smart resources
|
|
147
86
|
*/
|
|
148
87
|
export declare function isProcedure(resource: Smart<Resource> | undefined): resource is SmartProcedure;
|
|
149
|
-
export declare function isProcedure(resource: Resource | undefined): resource is Procedure;
|
|
150
88
|
/**
|
|
151
|
-
* RelatedPerson type guard
|
|
152
|
-
* Returns SmartRelatedPerson when used with Smart resources to provide full TypeScript support
|
|
153
|
-
* for coding utilities
|
|
89
|
+
* RelatedPerson type guard for Smart resources
|
|
154
90
|
*/
|
|
155
91
|
export declare function isRelatedPerson(resource: Smart<Resource> | undefined): resource is SmartRelatedPerson;
|
|
156
|
-
export declare function isRelatedPerson(resource: Resource | undefined): resource is RelatedPerson;
|
|
157
92
|
/**
|
|
158
|
-
* RiskAssessment type guard
|
|
159
|
-
* Returns SmartRiskAssessment when used with Smart resources to provide full TypeScript support
|
|
160
|
-
* for coding utilities
|
|
93
|
+
* RiskAssessment type guard for Smart resources
|
|
161
94
|
*/
|
|
162
95
|
export declare function isRiskAssessment(resource: Smart<Resource> | undefined): resource is SmartRiskAssessment;
|
|
163
|
-
export declare function isRiskAssessment(resource: Resource | undefined): resource is RiskAssessment;
|
|
164
96
|
/**
|
|
165
|
-
* ServiceRequest type guard
|
|
166
|
-
* Returns SmartServiceRequest when used with Smart resources to provide full TypeScript support
|
|
167
|
-
* for coding utilities
|
|
97
|
+
* ServiceRequest type guard for Smart resources
|
|
168
98
|
*/
|
|
169
99
|
export declare function isServiceRequest(resource: Smart<Resource> | undefined): resource is SmartServiceRequest;
|
|
170
|
-
export declare function isServiceRequest(resource: Resource | undefined): resource is ServiceRequest;
|
|
171
100
|
/**
|
|
172
|
-
* CarePlan type guard
|
|
173
|
-
* Returns SmartCarePlan when used with Smart resources to provide full TypeScript support
|
|
174
|
-
* for coding utilities
|
|
101
|
+
* CarePlan type guard for Smart resources
|
|
175
102
|
*/
|
|
176
103
|
export declare function isCarePlan(resource: Smart<Resource> | undefined): resource is SmartCarePlan;
|
|
177
|
-
export declare function isCarePlan(resource: Resource | undefined): resource is CarePlan;
|
|
178
104
|
/**
|
|
179
|
-
* Bundle type guard
|
|
105
|
+
* Bundle type guard for Smart resources
|
|
180
106
|
*/
|
|
181
107
|
export declare function isBundle(resource: Smart<Resource> | undefined): resource is Smart<Bundle>;
|
|
182
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Patient type guard for plain FHIR resources
|
|
110
|
+
*/
|
|
111
|
+
export declare function isPlainPatient(resource: Resource | undefined): resource is Patient;
|
|
112
|
+
/**
|
|
113
|
+
* Observation type guard for plain FHIR resources
|
|
114
|
+
*/
|
|
115
|
+
export declare function isPlainObservation(resource: Resource | undefined): resource is Observation;
|
|
116
|
+
/**
|
|
117
|
+
* DiagnosticReport type guard for plain FHIR resources
|
|
118
|
+
*/
|
|
119
|
+
export declare function isPlainDiagnosticReport(resource: Resource | undefined): resource is DiagnosticReport;
|
|
120
|
+
/**
|
|
121
|
+
* Encounter type guard for plain FHIR resources
|
|
122
|
+
*/
|
|
123
|
+
export declare function isPlainEncounter(resource: Resource | undefined): resource is Encounter;
|
|
124
|
+
/**
|
|
125
|
+
* Practitioner type guard for plain FHIR resources
|
|
126
|
+
*/
|
|
127
|
+
export declare function isPlainPractitioner(resource: Resource | undefined): resource is Practitioner;
|
|
128
|
+
/**
|
|
129
|
+
* PractitionerRole type guard for plain FHIR resources
|
|
130
|
+
*/
|
|
131
|
+
export declare function isPlainPractitionerRole(resource: Resource | undefined): resource is PractitionerRole;
|
|
132
|
+
/**
|
|
133
|
+
* Organization type guard for plain FHIR resources
|
|
134
|
+
*/
|
|
135
|
+
export declare function isPlainOrganization(resource: Resource | undefined): resource is Organization;
|
|
136
|
+
/**
|
|
137
|
+
* Location type guard for plain FHIR resources
|
|
138
|
+
*/
|
|
139
|
+
export declare function isPlainLocation(resource: Resource | undefined): resource is Location;
|
|
140
|
+
/**
|
|
141
|
+
* AllergyIntolerance type guard for plain FHIR resources
|
|
142
|
+
*/
|
|
143
|
+
export declare function isPlainAllergyIntolerance(resource: Resource | undefined): resource is AllergyIntolerance;
|
|
144
|
+
/**
|
|
145
|
+
* Condition type guard for plain FHIR resources
|
|
146
|
+
*/
|
|
147
|
+
export declare function isPlainCondition(resource: Resource | undefined): resource is Condition;
|
|
148
|
+
/**
|
|
149
|
+
* Composition type guard for plain FHIR resources
|
|
150
|
+
*/
|
|
151
|
+
export declare function isPlainComposition(resource: Resource | undefined): resource is Composition;
|
|
152
|
+
/**
|
|
153
|
+
* Coverage type guard for plain FHIR resources
|
|
154
|
+
*/
|
|
155
|
+
export declare function isPlainCoverage(resource: Resource | undefined): resource is Coverage;
|
|
156
|
+
/**
|
|
157
|
+
* DocumentReference type guard for plain FHIR resources
|
|
158
|
+
*/
|
|
159
|
+
export declare function isPlainDocumentReference(resource: Resource | undefined): resource is DocumentReference;
|
|
160
|
+
/**
|
|
161
|
+
* FamilyMemberHistory type guard for plain FHIR resources
|
|
162
|
+
*/
|
|
163
|
+
export declare function isPlainFamilyMemberHistory(resource: Resource | undefined): resource is FamilyMemberHistory;
|
|
164
|
+
/**
|
|
165
|
+
* Immunization type guard for plain FHIR resources
|
|
166
|
+
*/
|
|
167
|
+
export declare function isPlainImmunization(resource: Resource | undefined): resource is Immunization;
|
|
168
|
+
/**
|
|
169
|
+
* Medication type guard for plain FHIR resources
|
|
170
|
+
*/
|
|
171
|
+
export declare function isPlainMedication(resource: Resource | undefined): resource is Medication;
|
|
172
|
+
/**
|
|
173
|
+
* MedicationAdministration type guard for plain FHIR resources
|
|
174
|
+
*/
|
|
175
|
+
export declare function isPlainMedicationAdministration(resource: Resource | undefined): resource is MedicationAdministration;
|
|
176
|
+
/**
|
|
177
|
+
* MedicationDispense type guard for plain FHIR resources
|
|
178
|
+
*/
|
|
179
|
+
export declare function isPlainMedicationDispense(resource: Resource | undefined): resource is MedicationDispense;
|
|
180
|
+
/**
|
|
181
|
+
* MedicationRequest type guard for plain FHIR resources
|
|
182
|
+
*/
|
|
183
|
+
export declare function isPlainMedicationRequest(resource: Resource | undefined): resource is MedicationRequest;
|
|
184
|
+
/**
|
|
185
|
+
* MedicationStatement type guard for plain FHIR resources
|
|
186
|
+
*/
|
|
187
|
+
export declare function isPlainMedicationStatement(resource: Resource | undefined): resource is MedicationStatement;
|
|
188
|
+
/**
|
|
189
|
+
* Procedure type guard for plain FHIR resources
|
|
190
|
+
*/
|
|
191
|
+
export declare function isPlainProcedure(resource: Resource | undefined): resource is Procedure;
|
|
192
|
+
/**
|
|
193
|
+
* RelatedPerson type guard for plain FHIR resources
|
|
194
|
+
*/
|
|
195
|
+
export declare function isPlainRelatedPerson(resource: Resource | undefined): resource is RelatedPerson;
|
|
196
|
+
/**
|
|
197
|
+
* RiskAssessment type guard for plain FHIR resources
|
|
198
|
+
*/
|
|
199
|
+
export declare function isPlainRiskAssessment(resource: Resource | undefined): resource is RiskAssessment;
|
|
200
|
+
/**
|
|
201
|
+
* ServiceRequest type guard for plain FHIR resources
|
|
202
|
+
*/
|
|
203
|
+
export declare function isPlainServiceRequest(resource: Resource | undefined): resource is ServiceRequest;
|
|
204
|
+
/**
|
|
205
|
+
* CarePlan type guard for plain FHIR resources
|
|
206
|
+
*/
|
|
207
|
+
export declare function isPlainCarePlan(resource: Resource | undefined): resource is CarePlan;
|
|
208
|
+
/**
|
|
209
|
+
* Bundle type guard for plain FHIR resources
|
|
210
|
+
*/
|
|
211
|
+
export declare function isPlainBundle(resource: Resource | undefined): resource is Bundle;
|
|
183
212
|
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,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AQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,cAAc,CAEhG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,cAAc,CAEhG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAEpF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,MAAM,CAEhF"}
|
package/dist/type-guards.js
CHANGED
|
@@ -1,108 +1,375 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBundle = exports.isCarePlan = exports.isServiceRequest = exports.isRiskAssessment = exports.isRelatedPerson = exports.isProcedure = exports.isMedicationStatement = exports.isMedicationRequest = exports.isMedicationDispense = exports.isMedicationAdministration = exports.isMedication = exports.isImmunization = exports.isFamilyMemberHistory = exports.isDocumentReference = exports.isCoverage = exports.isComposition = exports.isCondition = exports.isAllergyIntolerance = exports.isLocation = exports.isOrganization = exports.isPractitionerRole = exports.isPractitioner = exports.isEncounter = exports.isDiagnosticReport = exports.isObservation = exports.isPatient = void 0;
|
|
3
|
+
exports.isPlainServiceRequest = exports.isPlainRiskAssessment = exports.isPlainRelatedPerson = exports.isPlainProcedure = exports.isPlainMedicationStatement = exports.isPlainMedicationRequest = exports.isPlainMedicationDispense = exports.isPlainMedicationAdministration = exports.isPlainMedication = exports.isPlainImmunization = exports.isPlainFamilyMemberHistory = exports.isPlainDocumentReference = exports.isPlainCoverage = exports.isPlainComposition = exports.isPlainCondition = exports.isPlainAllergyIntolerance = exports.isPlainLocation = exports.isPlainOrganization = exports.isPlainPractitionerRole = exports.isPlainPractitioner = exports.isPlainEncounter = exports.isPlainDiagnosticReport = exports.isPlainObservation = exports.isPlainPatient = exports.isBundle = exports.isCarePlan = exports.isServiceRequest = exports.isRiskAssessment = exports.isRelatedPerson = exports.isProcedure = exports.isMedicationStatement = exports.isMedicationRequest = exports.isMedicationDispense = exports.isMedicationAdministration = exports.isMedication = exports.isImmunization = exports.isFamilyMemberHistory = exports.isDocumentReference = exports.isCoverage = exports.isComposition = exports.isCondition = exports.isAllergyIntolerance = exports.isLocation = exports.isOrganization = exports.isPractitionerRole = exports.isPractitioner = exports.isEncounter = exports.isDiagnosticReport = exports.isObservation = exports.isPatient = void 0;
|
|
4
|
+
exports.isPlainBundle = exports.isPlainCarePlan = void 0;
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Smart Resource Type Guards (for SDK resources)
|
|
7
|
+
// =============================================================================
|
|
8
|
+
/**
|
|
9
|
+
* Patient type guard for Smart resources
|
|
10
|
+
*/
|
|
4
11
|
function isPatient(resource) {
|
|
5
12
|
return resource?.resourceType === "Patient";
|
|
6
13
|
}
|
|
7
14
|
exports.isPatient = isPatient;
|
|
15
|
+
/**
|
|
16
|
+
* Observation type guard for Smart resources
|
|
17
|
+
*/
|
|
8
18
|
function isObservation(resource) {
|
|
9
19
|
return resource?.resourceType === "Observation";
|
|
10
20
|
}
|
|
11
21
|
exports.isObservation = isObservation;
|
|
22
|
+
/**
|
|
23
|
+
* DiagnosticReport type guard for Smart resources
|
|
24
|
+
*/
|
|
12
25
|
function isDiagnosticReport(resource) {
|
|
13
26
|
return resource?.resourceType === "DiagnosticReport";
|
|
14
27
|
}
|
|
15
28
|
exports.isDiagnosticReport = isDiagnosticReport;
|
|
29
|
+
/**
|
|
30
|
+
* Encounter type guard for Smart resources
|
|
31
|
+
*/
|
|
16
32
|
function isEncounter(resource) {
|
|
17
33
|
return resource?.resourceType === "Encounter";
|
|
18
34
|
}
|
|
19
35
|
exports.isEncounter = isEncounter;
|
|
36
|
+
/**
|
|
37
|
+
* Practitioner type guard for Smart resources
|
|
38
|
+
*/
|
|
20
39
|
function isPractitioner(resource) {
|
|
21
40
|
return resource?.resourceType === "Practitioner";
|
|
22
41
|
}
|
|
23
42
|
exports.isPractitioner = isPractitioner;
|
|
43
|
+
/**
|
|
44
|
+
* PractitionerRole type guard for Smart resources
|
|
45
|
+
*/
|
|
24
46
|
function isPractitionerRole(resource) {
|
|
25
47
|
return resource?.resourceType === "PractitionerRole";
|
|
26
48
|
}
|
|
27
49
|
exports.isPractitionerRole = isPractitionerRole;
|
|
50
|
+
/**
|
|
51
|
+
* Organization type guard for Smart resources
|
|
52
|
+
*/
|
|
28
53
|
function isOrganization(resource) {
|
|
29
54
|
return resource?.resourceType === "Organization";
|
|
30
55
|
}
|
|
31
56
|
exports.isOrganization = isOrganization;
|
|
57
|
+
/**
|
|
58
|
+
* Location type guard for Smart resources
|
|
59
|
+
*/
|
|
32
60
|
function isLocation(resource) {
|
|
33
61
|
return resource?.resourceType === "Location";
|
|
34
62
|
}
|
|
35
63
|
exports.isLocation = isLocation;
|
|
64
|
+
/**
|
|
65
|
+
* AllergyIntolerance type guard for Smart resources
|
|
66
|
+
*/
|
|
36
67
|
function isAllergyIntolerance(resource) {
|
|
37
68
|
return resource?.resourceType === "AllergyIntolerance";
|
|
38
69
|
}
|
|
39
70
|
exports.isAllergyIntolerance = isAllergyIntolerance;
|
|
71
|
+
/**
|
|
72
|
+
* Condition type guard for Smart resources
|
|
73
|
+
*/
|
|
40
74
|
function isCondition(resource) {
|
|
41
75
|
return resource?.resourceType === "Condition";
|
|
42
76
|
}
|
|
43
77
|
exports.isCondition = isCondition;
|
|
78
|
+
/**
|
|
79
|
+
* Composition type guard for Smart resources
|
|
80
|
+
*/
|
|
44
81
|
function isComposition(resource) {
|
|
45
82
|
return resource?.resourceType === "Composition";
|
|
46
83
|
}
|
|
47
84
|
exports.isComposition = isComposition;
|
|
85
|
+
/**
|
|
86
|
+
* Coverage type guard for Smart resources
|
|
87
|
+
*/
|
|
48
88
|
function isCoverage(resource) {
|
|
49
89
|
return resource?.resourceType === "Coverage";
|
|
50
90
|
}
|
|
51
91
|
exports.isCoverage = isCoverage;
|
|
92
|
+
/**
|
|
93
|
+
* DocumentReference type guard for Smart resources
|
|
94
|
+
*/
|
|
52
95
|
function isDocumentReference(resource) {
|
|
53
96
|
return resource?.resourceType === "DocumentReference";
|
|
54
97
|
}
|
|
55
98
|
exports.isDocumentReference = isDocumentReference;
|
|
99
|
+
/**
|
|
100
|
+
* FamilyMemberHistory type guard for Smart resources
|
|
101
|
+
*/
|
|
56
102
|
function isFamilyMemberHistory(resource) {
|
|
57
103
|
return resource?.resourceType === "FamilyMemberHistory";
|
|
58
104
|
}
|
|
59
105
|
exports.isFamilyMemberHistory = isFamilyMemberHistory;
|
|
106
|
+
/**
|
|
107
|
+
* Immunization type guard for Smart resources
|
|
108
|
+
*/
|
|
60
109
|
function isImmunization(resource) {
|
|
61
110
|
return resource?.resourceType === "Immunization";
|
|
62
111
|
}
|
|
63
112
|
exports.isImmunization = isImmunization;
|
|
113
|
+
/**
|
|
114
|
+
* Medication type guard for Smart resources
|
|
115
|
+
*/
|
|
64
116
|
function isMedication(resource) {
|
|
65
117
|
return resource?.resourceType === "Medication";
|
|
66
118
|
}
|
|
67
119
|
exports.isMedication = isMedication;
|
|
120
|
+
/**
|
|
121
|
+
* MedicationAdministration type guard for Smart resources
|
|
122
|
+
*/
|
|
68
123
|
function isMedicationAdministration(resource) {
|
|
69
124
|
return resource?.resourceType === "MedicationAdministration";
|
|
70
125
|
}
|
|
71
126
|
exports.isMedicationAdministration = isMedicationAdministration;
|
|
127
|
+
/**
|
|
128
|
+
* MedicationDispense type guard for Smart resources
|
|
129
|
+
*/
|
|
72
130
|
function isMedicationDispense(resource) {
|
|
73
131
|
return resource?.resourceType === "MedicationDispense";
|
|
74
132
|
}
|
|
75
133
|
exports.isMedicationDispense = isMedicationDispense;
|
|
134
|
+
/**
|
|
135
|
+
* MedicationRequest type guard for Smart resources
|
|
136
|
+
*/
|
|
76
137
|
function isMedicationRequest(resource) {
|
|
77
138
|
return resource?.resourceType === "MedicationRequest";
|
|
78
139
|
}
|
|
79
140
|
exports.isMedicationRequest = isMedicationRequest;
|
|
141
|
+
/**
|
|
142
|
+
* MedicationStatement type guard for Smart resources
|
|
143
|
+
*/
|
|
80
144
|
function isMedicationStatement(resource) {
|
|
81
145
|
return resource?.resourceType === "MedicationStatement";
|
|
82
146
|
}
|
|
83
147
|
exports.isMedicationStatement = isMedicationStatement;
|
|
148
|
+
/**
|
|
149
|
+
* Procedure type guard for Smart resources
|
|
150
|
+
*/
|
|
84
151
|
function isProcedure(resource) {
|
|
85
152
|
return resource?.resourceType === "Procedure";
|
|
86
153
|
}
|
|
87
154
|
exports.isProcedure = isProcedure;
|
|
155
|
+
/**
|
|
156
|
+
* RelatedPerson type guard for Smart resources
|
|
157
|
+
*/
|
|
88
158
|
function isRelatedPerson(resource) {
|
|
89
159
|
return resource?.resourceType === "RelatedPerson";
|
|
90
160
|
}
|
|
91
161
|
exports.isRelatedPerson = isRelatedPerson;
|
|
162
|
+
/**
|
|
163
|
+
* RiskAssessment type guard for Smart resources
|
|
164
|
+
*/
|
|
92
165
|
function isRiskAssessment(resource) {
|
|
93
166
|
return resource?.resourceType === "RiskAssessment";
|
|
94
167
|
}
|
|
95
168
|
exports.isRiskAssessment = isRiskAssessment;
|
|
169
|
+
/**
|
|
170
|
+
* ServiceRequest type guard for Smart resources
|
|
171
|
+
*/
|
|
96
172
|
function isServiceRequest(resource) {
|
|
97
173
|
return resource?.resourceType === "ServiceRequest";
|
|
98
174
|
}
|
|
99
175
|
exports.isServiceRequest = isServiceRequest;
|
|
176
|
+
/**
|
|
177
|
+
* CarePlan type guard for Smart resources
|
|
178
|
+
*/
|
|
100
179
|
function isCarePlan(resource) {
|
|
101
180
|
return resource?.resourceType === "CarePlan";
|
|
102
181
|
}
|
|
103
182
|
exports.isCarePlan = isCarePlan;
|
|
183
|
+
/**
|
|
184
|
+
* Bundle type guard for Smart resources
|
|
185
|
+
*/
|
|
104
186
|
function isBundle(resource) {
|
|
105
187
|
return resource?.resourceType === "Bundle";
|
|
106
188
|
}
|
|
107
189
|
exports.isBundle = isBundle;
|
|
190
|
+
// =============================================================================
|
|
191
|
+
// Plain FHIR Resource Type Guards
|
|
192
|
+
// =============================================================================
|
|
193
|
+
/**
|
|
194
|
+
* Patient type guard for plain FHIR resources
|
|
195
|
+
*/
|
|
196
|
+
function isPlainPatient(resource) {
|
|
197
|
+
return resource?.resourceType === "Patient";
|
|
198
|
+
}
|
|
199
|
+
exports.isPlainPatient = isPlainPatient;
|
|
200
|
+
/**
|
|
201
|
+
* Observation type guard for plain FHIR resources
|
|
202
|
+
*/
|
|
203
|
+
function isPlainObservation(resource) {
|
|
204
|
+
return resource?.resourceType === "Observation";
|
|
205
|
+
}
|
|
206
|
+
exports.isPlainObservation = isPlainObservation;
|
|
207
|
+
/**
|
|
208
|
+
* DiagnosticReport type guard for plain FHIR resources
|
|
209
|
+
*/
|
|
210
|
+
function isPlainDiagnosticReport(resource) {
|
|
211
|
+
return resource?.resourceType === "DiagnosticReport";
|
|
212
|
+
}
|
|
213
|
+
exports.isPlainDiagnosticReport = isPlainDiagnosticReport;
|
|
214
|
+
/**
|
|
215
|
+
* Encounter type guard for plain FHIR resources
|
|
216
|
+
*/
|
|
217
|
+
function isPlainEncounter(resource) {
|
|
218
|
+
return resource?.resourceType === "Encounter";
|
|
219
|
+
}
|
|
220
|
+
exports.isPlainEncounter = isPlainEncounter;
|
|
221
|
+
/**
|
|
222
|
+
* Practitioner type guard for plain FHIR resources
|
|
223
|
+
*/
|
|
224
|
+
function isPlainPractitioner(resource) {
|
|
225
|
+
return resource?.resourceType === "Practitioner";
|
|
226
|
+
}
|
|
227
|
+
exports.isPlainPractitioner = isPlainPractitioner;
|
|
228
|
+
/**
|
|
229
|
+
* PractitionerRole type guard for plain FHIR resources
|
|
230
|
+
*/
|
|
231
|
+
function isPlainPractitionerRole(resource) {
|
|
232
|
+
return resource?.resourceType === "PractitionerRole";
|
|
233
|
+
}
|
|
234
|
+
exports.isPlainPractitionerRole = isPlainPractitionerRole;
|
|
235
|
+
/**
|
|
236
|
+
* Organization type guard for plain FHIR resources
|
|
237
|
+
*/
|
|
238
|
+
function isPlainOrganization(resource) {
|
|
239
|
+
return resource?.resourceType === "Organization";
|
|
240
|
+
}
|
|
241
|
+
exports.isPlainOrganization = isPlainOrganization;
|
|
242
|
+
/**
|
|
243
|
+
* Location type guard for plain FHIR resources
|
|
244
|
+
*/
|
|
245
|
+
function isPlainLocation(resource) {
|
|
246
|
+
return resource?.resourceType === "Location";
|
|
247
|
+
}
|
|
248
|
+
exports.isPlainLocation = isPlainLocation;
|
|
249
|
+
/**
|
|
250
|
+
* AllergyIntolerance type guard for plain FHIR resources
|
|
251
|
+
*/
|
|
252
|
+
function isPlainAllergyIntolerance(resource) {
|
|
253
|
+
return resource?.resourceType === "AllergyIntolerance";
|
|
254
|
+
}
|
|
255
|
+
exports.isPlainAllergyIntolerance = isPlainAllergyIntolerance;
|
|
256
|
+
/**
|
|
257
|
+
* Condition type guard for plain FHIR resources
|
|
258
|
+
*/
|
|
259
|
+
function isPlainCondition(resource) {
|
|
260
|
+
return resource?.resourceType === "Condition";
|
|
261
|
+
}
|
|
262
|
+
exports.isPlainCondition = isPlainCondition;
|
|
263
|
+
/**
|
|
264
|
+
* Composition type guard for plain FHIR resources
|
|
265
|
+
*/
|
|
266
|
+
function isPlainComposition(resource) {
|
|
267
|
+
return resource?.resourceType === "Composition";
|
|
268
|
+
}
|
|
269
|
+
exports.isPlainComposition = isPlainComposition;
|
|
270
|
+
/**
|
|
271
|
+
* Coverage type guard for plain FHIR resources
|
|
272
|
+
*/
|
|
273
|
+
function isPlainCoverage(resource) {
|
|
274
|
+
return resource?.resourceType === "Coverage";
|
|
275
|
+
}
|
|
276
|
+
exports.isPlainCoverage = isPlainCoverage;
|
|
277
|
+
/**
|
|
278
|
+
* DocumentReference type guard for plain FHIR resources
|
|
279
|
+
*/
|
|
280
|
+
function isPlainDocumentReference(resource) {
|
|
281
|
+
return resource?.resourceType === "DocumentReference";
|
|
282
|
+
}
|
|
283
|
+
exports.isPlainDocumentReference = isPlainDocumentReference;
|
|
284
|
+
/**
|
|
285
|
+
* FamilyMemberHistory type guard for plain FHIR resources
|
|
286
|
+
*/
|
|
287
|
+
function isPlainFamilyMemberHistory(resource) {
|
|
288
|
+
return resource?.resourceType === "FamilyMemberHistory";
|
|
289
|
+
}
|
|
290
|
+
exports.isPlainFamilyMemberHistory = isPlainFamilyMemberHistory;
|
|
291
|
+
/**
|
|
292
|
+
* Immunization type guard for plain FHIR resources
|
|
293
|
+
*/
|
|
294
|
+
function isPlainImmunization(resource) {
|
|
295
|
+
return resource?.resourceType === "Immunization";
|
|
296
|
+
}
|
|
297
|
+
exports.isPlainImmunization = isPlainImmunization;
|
|
298
|
+
/**
|
|
299
|
+
* Medication type guard for plain FHIR resources
|
|
300
|
+
*/
|
|
301
|
+
function isPlainMedication(resource) {
|
|
302
|
+
return resource?.resourceType === "Medication";
|
|
303
|
+
}
|
|
304
|
+
exports.isPlainMedication = isPlainMedication;
|
|
305
|
+
/**
|
|
306
|
+
* MedicationAdministration type guard for plain FHIR resources
|
|
307
|
+
*/
|
|
308
|
+
function isPlainMedicationAdministration(resource) {
|
|
309
|
+
return resource?.resourceType === "MedicationAdministration";
|
|
310
|
+
}
|
|
311
|
+
exports.isPlainMedicationAdministration = isPlainMedicationAdministration;
|
|
312
|
+
/**
|
|
313
|
+
* MedicationDispense type guard for plain FHIR resources
|
|
314
|
+
*/
|
|
315
|
+
function isPlainMedicationDispense(resource) {
|
|
316
|
+
return resource?.resourceType === "MedicationDispense";
|
|
317
|
+
}
|
|
318
|
+
exports.isPlainMedicationDispense = isPlainMedicationDispense;
|
|
319
|
+
/**
|
|
320
|
+
* MedicationRequest type guard for plain FHIR resources
|
|
321
|
+
*/
|
|
322
|
+
function isPlainMedicationRequest(resource) {
|
|
323
|
+
return resource?.resourceType === "MedicationRequest";
|
|
324
|
+
}
|
|
325
|
+
exports.isPlainMedicationRequest = isPlainMedicationRequest;
|
|
326
|
+
/**
|
|
327
|
+
* MedicationStatement type guard for plain FHIR resources
|
|
328
|
+
*/
|
|
329
|
+
function isPlainMedicationStatement(resource) {
|
|
330
|
+
return resource?.resourceType === "MedicationStatement";
|
|
331
|
+
}
|
|
332
|
+
exports.isPlainMedicationStatement = isPlainMedicationStatement;
|
|
333
|
+
/**
|
|
334
|
+
* Procedure type guard for plain FHIR resources
|
|
335
|
+
*/
|
|
336
|
+
function isPlainProcedure(resource) {
|
|
337
|
+
return resource?.resourceType === "Procedure";
|
|
338
|
+
}
|
|
339
|
+
exports.isPlainProcedure = isPlainProcedure;
|
|
340
|
+
/**
|
|
341
|
+
* RelatedPerson type guard for plain FHIR resources
|
|
342
|
+
*/
|
|
343
|
+
function isPlainRelatedPerson(resource) {
|
|
344
|
+
return resource?.resourceType === "RelatedPerson";
|
|
345
|
+
}
|
|
346
|
+
exports.isPlainRelatedPerson = isPlainRelatedPerson;
|
|
347
|
+
/**
|
|
348
|
+
* RiskAssessment type guard for plain FHIR resources
|
|
349
|
+
*/
|
|
350
|
+
function isPlainRiskAssessment(resource) {
|
|
351
|
+
return resource?.resourceType === "RiskAssessment";
|
|
352
|
+
}
|
|
353
|
+
exports.isPlainRiskAssessment = isPlainRiskAssessment;
|
|
354
|
+
/**
|
|
355
|
+
* ServiceRequest type guard for plain FHIR resources
|
|
356
|
+
*/
|
|
357
|
+
function isPlainServiceRequest(resource) {
|
|
358
|
+
return resource?.resourceType === "ServiceRequest";
|
|
359
|
+
}
|
|
360
|
+
exports.isPlainServiceRequest = isPlainServiceRequest;
|
|
361
|
+
/**
|
|
362
|
+
* CarePlan type guard for plain FHIR resources
|
|
363
|
+
*/
|
|
364
|
+
function isPlainCarePlan(resource) {
|
|
365
|
+
return resource?.resourceType === "CarePlan";
|
|
366
|
+
}
|
|
367
|
+
exports.isPlainCarePlan = isPlainCarePlan;
|
|
368
|
+
/**
|
|
369
|
+
* Bundle type guard for plain FHIR resources
|
|
370
|
+
*/
|
|
371
|
+
function isPlainBundle(resource) {
|
|
372
|
+
return resource?.resourceType === "Bundle";
|
|
373
|
+
}
|
|
374
|
+
exports.isPlainBundle = isPlainBundle;
|
|
108
375
|
//# sourceMappingURL=type-guards.js.map
|
package/dist/type-guards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":";;;;AA0DA,gFAAgF;AAChF,iDAAiD;AACjD,gFAAgF;AAEhF;;GAEG;AACH,SAAgB,SAAS,CAAC,QAAqC;IAC7D,OAAO,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC;AAC9C,CAAC;AAFD,8BAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,QAAqC;IACjE,OAAO,QAAQ,EAAE,YAAY,KAAK,aAAa,CAAC;AAClD,CAAC;AAFD,sCAEC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAChC,QAAqC;IAErC,OAAO,QAAQ,EAAE,YAAY,KAAK,kBAAkB,CAAC;AACvD,CAAC;AAJD,gDAIC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,QAAqC;IAC/D,OAAO,QAAQ,EAAE,YAAY,KAAK,WAAW,CAAC;AAChD,CAAC;AAFD,kCAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAC5B,QAAqC;IAErC,OAAO,QAAQ,EAAE,YAAY,KAAK,cAAc,CAAC;AACnD,CAAC;AAJD,wCAIC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAChC,QAAqC;IAErC,OAAO,QAAQ,EAAE,YAAY,KAAK,kBAAkB,CAAC;AACvD,CAAC;AAJD,gDAIC;AAED;;GAEG;AACH,SAAgB,cAAc,CAC5B,QAAqC;IAErC,OAAO,QAAQ,EAAE,YAAY,KAAK,cAAc,CAAC;AACnD,CAAC;AA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AEC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,QAA8B;IACjE,OAAO,QAAQ,EAAE,YAAY,KAAK,eAAe,CAAC;AACpD,CAAC;AAFD,oDAEC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,QAA8B;IAClE,OAAO,QAAQ,EAAE,YAAY,KAAK,gBAAgB,CAAC;AACrD,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,QAA8B;IAClE,OAAO,QAAQ,EAAE,YAAY,KAAK,gBAAgB,CAAC;AACrD,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAA8B;IAC5D,OAAO,QAAQ,EAAE,YAAY,KAAK,UAAU,CAAC;AAC/C,CAAC;AAFD,0CAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,QAA8B;IAC1D,OAAO,QAAQ,EAAE,YAAY,KAAK,QAAQ,CAAC;AAC7C,CAAC;AAFD,sCAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metriport/fhir-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "FHIR Bundle SDK for parsing, querying, and manipulating FHIR bundles with reference resolution",
|
|
5
5
|
"author": "Metriport Inc. <contact@metriport.com>",
|
|
6
6
|
"homepage": "https://metriport.com/",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@medplum/fhirtypes": "^2.2.10",
|
|
53
|
-
"@metriport/shared": "
|
|
53
|
+
"@metriport/shared": "^0.27.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@metriport/eslint-rules": "file:packages/eslint-rules",
|