@metriport/fhir-sdk 1.3.7 → 1.4.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.
Files changed (58) hide show
  1. package/README.md +173 -8
  2. package/dist/__tests__/careplan.test.d.ts +2 -0
  3. package/dist/__tests__/careplan.test.d.ts.map +1 -0
  4. package/dist/__tests__/careplan.test.js +544 -0
  5. package/dist/__tests__/careplan.test.js.map +1 -0
  6. package/dist/__tests__/coding-utilities.test.d.ts +2 -0
  7. package/dist/__tests__/coding-utilities.test.d.ts.map +1 -0
  8. package/dist/__tests__/coding-utilities.test.js +450 -0
  9. package/dist/__tests__/coding-utilities.test.js.map +1 -0
  10. package/dist/__tests__/type-guards.test.d.ts +2 -0
  11. package/dist/__tests__/type-guards.test.d.ts.map +1 -0
  12. package/dist/__tests__/type-guards.test.js +163 -0
  13. package/dist/__tests__/type-guards.test.js.map +1 -0
  14. package/dist/demo-reverse-references.d.ts +7 -0
  15. package/dist/demo-reverse-references.d.ts.map +1 -0
  16. package/dist/demo-reverse-references.js +207 -0
  17. package/dist/demo-reverse-references.js.map +1 -0
  18. package/dist/fhir-bundle-sdk.d.ts +50 -47
  19. package/dist/fhir-bundle-sdk.d.ts.map +1 -1
  20. package/dist/fhir-bundle-sdk.js +10 -2
  21. package/dist/fhir-bundle-sdk.js.map +1 -1
  22. package/dist/index.d.ts +4 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +15 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal/coding-systems.d.ts +42 -0
  27. package/dist/internal/coding-systems.d.ts.map +1 -0
  28. package/dist/internal/coding-systems.js +47 -0
  29. package/dist/internal/coding-systems.js.map +1 -0
  30. package/dist/internal/coding-utilities.d.ts +11 -0
  31. package/dist/internal/coding-utilities.d.ts.map +1 -0
  32. package/dist/internal/coding-utilities.js +254 -0
  33. package/dist/internal/coding-utilities.js.map +1 -0
  34. package/dist/internal/graph-traversal.js +1 -1
  35. package/dist/internal/graph-traversal.js.map +1 -1
  36. package/dist/internal/llm-context.d.ts.map +1 -1
  37. package/dist/internal/llm-context.js +3 -1
  38. package/dist/internal/llm-context.js.map +1 -1
  39. package/dist/internal/reference-resolution.d.ts.map +1 -1
  40. package/dist/internal/reference-resolution.js +123 -11
  41. package/dist/internal/reference-resolution.js.map +1 -1
  42. package/dist/internal/transparent-proxy.d.ts +12 -0
  43. package/dist/internal/transparent-proxy.d.ts.map +1 -0
  44. package/dist/internal/transparent-proxy.js +105 -0
  45. package/dist/internal/transparent-proxy.js.map +1 -0
  46. package/dist/type-guards.d.ts +183 -0
  47. package/dist/type-guards.d.ts.map +1 -0
  48. package/dist/type-guards.js +108 -0
  49. package/dist/type-guards.js.map +1 -0
  50. package/dist/types/coding-fields.d.ts +292 -0
  51. package/dist/types/coding-fields.d.ts.map +1 -0
  52. package/dist/types/coding-fields.js +3 -0
  53. package/dist/types/coding-fields.js.map +1 -0
  54. package/dist/types/smart-resources.d.ts +152 -6
  55. package/dist/types/smart-resources.d.ts.map +1 -1
  56. package/dist/types/smart-resources.js +35 -3
  57. package/dist/types/smart-resources.js.map +1 -1
  58. package/package.json +2 -3
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTransparentProxy = void 0;
4
+ const coding_utilities_1 = require("./coding-utilities");
5
+ /**
6
+ * Cache for transparent proxy objects to maintain object identity
7
+ */
8
+ const transparentProxyCache = new WeakMap();
9
+ /**
10
+ * Type guard to check if a value is a CodeableConcept object
11
+ * Must check this BEFORE isCoding since both can have overlapping properties
12
+ */
13
+ function isCodeableConcept(value) {
14
+ return (typeof value === "object" &&
15
+ value !== null &&
16
+ !Array.isArray(value) &&
17
+ ("coding" in value || "text" in value) &&
18
+ // Exclude Reference objects which also have optional text
19
+ !("reference" in value));
20
+ }
21
+ /**
22
+ * Type guard to check if a value is a Coding object
23
+ * Check for Coding-specific properties and exclude CodeableConcept
24
+ */
25
+ function isCoding(value) {
26
+ return (typeof value === "object" &&
27
+ value !== null &&
28
+ !Array.isArray(value) &&
29
+ ("system" in value || "display" in value) &&
30
+ // Make sure it's not a CodeableConcept
31
+ !("coding" in value || "text" in value));
32
+ }
33
+ /**
34
+ * Create a transparent proxy that wraps plain objects to intercept property access.
35
+ * This enables deep access to Coding and CodeableConcept objects at any nesting level.
36
+ *
37
+ * Unlike SmartResource proxies, transparent proxies don't add methods - they just
38
+ * intercept property access to wrap Coding/CodeableConcept objects when accessed.
39
+ *
40
+ * @param obj - The plain object to wrap
41
+ * @returns A proxied object that wraps Coding/CodeableConcept on access
42
+ */
43
+ function createTransparentProxy(obj) {
44
+ // Check cache first to maintain object identity
45
+ const cached = transparentProxyCache.get(obj);
46
+ if (cached) {
47
+ return cached;
48
+ }
49
+ const proxy = new Proxy(obj, {
50
+ get: (target, prop, receiver) => {
51
+ const value = Reflect.get(target, prop, receiver);
52
+ // Don't wrap null or undefined
53
+ if (value === null || value === undefined) {
54
+ return value;
55
+ }
56
+ // Wrap CodeableConcept objects (check before Coding to avoid misidentification)
57
+ if (isCodeableConcept(value)) {
58
+ return (0, coding_utilities_1.createSmartCodeableConcept)(value);
59
+ }
60
+ // Wrap Coding objects
61
+ if (isCoding(value)) {
62
+ return (0, coding_utilities_1.createSmartCoding)(value);
63
+ }
64
+ // Handle arrays - wrap each element if needed
65
+ if (Array.isArray(value)) {
66
+ return value.map(item => {
67
+ if (item === null || item === undefined) {
68
+ return item;
69
+ }
70
+ // Check CodeableConcept before Coding
71
+ if (isCodeableConcept(item)) {
72
+ return (0, coding_utilities_1.createSmartCodeableConcept)(item);
73
+ }
74
+ if (isCoding(item)) {
75
+ return (0, coding_utilities_1.createSmartCoding)(item);
76
+ }
77
+ // Recursively wrap plain objects, not built-in types
78
+ if (typeof item === "object" && !Array.isArray(item) && item.constructor === Object) {
79
+ return createTransparentProxy(item);
80
+ }
81
+ return item;
82
+ });
83
+ }
84
+ // Recursively wrap plain objects (but not primitives, dates, etc.)
85
+ // Only wrap plain objects, not built-in types like Date, RegExp, etc.
86
+ if (typeof value === "object" && !Array.isArray(value) && value.constructor === Object) {
87
+ return createTransparentProxy(value);
88
+ }
89
+ // Return primitives, dates, and other built-in types as-is
90
+ return value;
91
+ },
92
+ // Handle Symbol.toStringTag for better console display
93
+ ownKeys: target => {
94
+ return Reflect.ownKeys(target);
95
+ },
96
+ getOwnPropertyDescriptor: (target, prop) => {
97
+ return Reflect.getOwnPropertyDescriptor(target, prop);
98
+ },
99
+ });
100
+ // Cache the proxy
101
+ transparentProxyCache.set(obj, proxy);
102
+ return proxy;
103
+ }
104
+ exports.createTransparentProxy = createTransparentProxy;
105
+ //# sourceMappingURL=transparent-proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transparent-proxy.js","sourceRoot":"","sources":["../../src/internal/transparent-proxy.ts"],"names":[],"mappings":";;;AACA,yDAAmF;AAEnF;;GAEG;AACH,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAkB,CAAC;AAE5D;;;GAGG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,CAAC,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;QACtC,0DAA0D;QAC1D,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,CACxB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,CAAC,QAAQ,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC;QACzC,uCAAuC;QACvC,CAAC,CAAC,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,CACx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AAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE;wBACnF,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;qBACrC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC;aACJ;YAED,mEAAmE;YACnE,sEAAsE;YACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,EAAE;gBACtF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;aACtC;YAED,2DAA2D;YAC3D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,uDAAuD;QACvD,OAAO,EAAE,MAAM,CAAC,EAAE;YAChB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,wBAAwB,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;YACzC,OAAO,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;KACF,CAAM,CAAC;IAER,kBAAkB;IAClB,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC;AACf,CAAC;AAvED,wDAuEC"}
@@ -0,0 +1,183 @@
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";
4
+ /**
5
+ * Patient type guard
6
+ * Returns SmartPatient when used with Smart resources to provide full TypeScript support
7
+ * for coding utilities
8
+ */
9
+ export declare function isPatient(resource: Smart<Resource> | undefined): resource is SmartPatient;
10
+ export declare function isPatient(resource: Resource | undefined): resource is Patient;
11
+ /**
12
+ * Observation type guard
13
+ * Returns SmartObservation when used with Smart resources to provide full TypeScript support
14
+ * for coding utilities
15
+ */
16
+ export declare function isObservation(resource: Smart<Resource> | undefined): resource is SmartObservation;
17
+ export declare function isObservation(resource: Resource | undefined): resource is Observation;
18
+ /**
19
+ * DiagnosticReport type guard
20
+ * Returns SmartDiagnosticReport when used with Smart resources to provide full TypeScript support
21
+ * for coding utilities
22
+ */
23
+ export declare function isDiagnosticReport(resource: Smart<Resource> | undefined): resource is SmartDiagnosticReport;
24
+ export declare function isDiagnosticReport(resource: Resource | undefined): resource is DiagnosticReport;
25
+ /**
26
+ * Encounter type guard
27
+ * Returns SmartEncounter when used with Smart resources to provide full TypeScript support
28
+ * for coding utilities
29
+ */
30
+ export declare function isEncounter(resource: Smart<Resource> | undefined): resource is SmartEncounter;
31
+ export declare function isEncounter(resource: Resource | undefined): resource is Encounter;
32
+ /**
33
+ * Practitioner type guard
34
+ * Returns SmartPractitioner when used with Smart resources to provide full TypeScript support
35
+ * for coding utilities
36
+ */
37
+ export declare function isPractitioner(resource: Smart<Resource> | undefined): resource is SmartPractitioner;
38
+ export declare function isPractitioner(resource: Resource | undefined): resource is Practitioner;
39
+ /**
40
+ * PractitionerRole type guard
41
+ * Note: PractitionerRole doesn't have specific coding fields, so it uses the generic Smart type
42
+ */
43
+ export declare function isPractitionerRole(resource: Smart<Resource> | undefined): resource is Smart<PractitionerRole>;
44
+ export declare function isPractitionerRole(resource: Resource | undefined): resource is PractitionerRole;
45
+ /**
46
+ * Organization type guard
47
+ * Returns SmartOrganization when used with Smart resources to provide full TypeScript support
48
+ * for coding utilities
49
+ */
50
+ export declare function isOrganization(resource: Smart<Resource> | undefined): resource is SmartOrganization;
51
+ export declare function isOrganization(resource: Resource | undefined): resource is Organization;
52
+ /**
53
+ * Location type guard
54
+ * Returns SmartLocation when used with Smart resources to provide full TypeScript support
55
+ * for coding utilities
56
+ */
57
+ export declare function isLocation(resource: Smart<Resource> | undefined): resource is SmartLocation;
58
+ export declare function isLocation(resource: Resource | undefined): resource is Location;
59
+ /**
60
+ * AllergyIntolerance type guard
61
+ * Returns SmartAllergyIntolerance when used with Smart resources to provide full TypeScript support
62
+ * for coding utilities
63
+ */
64
+ export declare function isAllergyIntolerance(resource: Smart<Resource> | undefined): resource is SmartAllergyIntolerance;
65
+ export declare function isAllergyIntolerance(resource: Resource | undefined): resource is AllergyIntolerance;
66
+ /**
67
+ * Condition type guard
68
+ * Returns SmartCondition when used with Smart resources to provide full TypeScript support
69
+ * for coding utilities
70
+ */
71
+ export declare function isCondition(resource: Smart<Resource> | undefined): resource is SmartCondition;
72
+ export declare function isCondition(resource: Resource | undefined): resource is Condition;
73
+ /**
74
+ * Composition type guard
75
+ * Returns SmartComposition when used with Smart resources to provide full TypeScript support
76
+ * for coding utilities
77
+ */
78
+ export declare function isComposition(resource: Smart<Resource> | undefined): resource is SmartComposition;
79
+ export declare function isComposition(resource: Resource | undefined): resource is Composition;
80
+ /**
81
+ * Coverage type guard
82
+ * Returns SmartCoverage when used with Smart resources to provide full TypeScript support
83
+ * for coding utilities
84
+ */
85
+ export declare function isCoverage(resource: Smart<Resource> | undefined): resource is SmartCoverage;
86
+ export declare function isCoverage(resource: Resource | undefined): resource is Coverage;
87
+ /**
88
+ * DocumentReference type guard
89
+ * Returns SmartDocumentReference when used with Smart resources to provide full TypeScript support
90
+ * for coding utilities
91
+ */
92
+ export declare function isDocumentReference(resource: Smart<Resource> | undefined): resource is SmartDocumentReference;
93
+ export declare function isDocumentReference(resource: Resource | undefined): resource is DocumentReference;
94
+ /**
95
+ * FamilyMemberHistory type guard
96
+ * Returns SmartFamilyMemberHistory when used with Smart resources to provide full TypeScript support
97
+ * for coding utilities
98
+ */
99
+ export declare function isFamilyMemberHistory(resource: Smart<Resource> | undefined): resource is SmartFamilyMemberHistory;
100
+ export declare function isFamilyMemberHistory(resource: Resource | undefined): resource is FamilyMemberHistory;
101
+ /**
102
+ * Immunization type guard
103
+ * Returns SmartImmunization when used with Smart resources to provide full TypeScript support
104
+ * for coding utilities
105
+ */
106
+ export declare function isImmunization(resource: Smart<Resource> | undefined): resource is SmartImmunization;
107
+ export declare function isImmunization(resource: Resource | undefined): resource is Immunization;
108
+ /**
109
+ * Medication type guard
110
+ * Returns SmartMedication when used with Smart resources to provide full TypeScript support
111
+ * for coding utilities
112
+ */
113
+ export declare function isMedication(resource: Smart<Resource> | undefined): resource is SmartMedication;
114
+ export declare function isMedication(resource: Resource | undefined): resource is Medication;
115
+ /**
116
+ * MedicationAdministration type guard
117
+ * Returns SmartMedicationAdministration when used with Smart resources to provide full TypeScript support
118
+ * for coding utilities
119
+ */
120
+ export declare function isMedicationAdministration(resource: Smart<Resource> | undefined): resource is SmartMedicationAdministration;
121
+ export declare function isMedicationAdministration(resource: Resource | undefined): resource is MedicationAdministration;
122
+ /**
123
+ * MedicationDispense type guard
124
+ * Returns SmartMedicationDispense when used with Smart resources to provide full TypeScript support
125
+ * for coding utilities
126
+ */
127
+ export declare function isMedicationDispense(resource: Smart<Resource> | undefined): resource is SmartMedicationDispense;
128
+ export declare function isMedicationDispense(resource: Resource | undefined): resource is MedicationDispense;
129
+ /**
130
+ * MedicationRequest type guard
131
+ * Returns SmartMedicationRequest when used with Smart resources to provide full TypeScript support
132
+ * for coding utilities
133
+ */
134
+ export declare function isMedicationRequest(resource: Smart<Resource> | undefined): resource is SmartMedicationRequest;
135
+ export declare function isMedicationRequest(resource: Resource | undefined): resource is MedicationRequest;
136
+ /**
137
+ * MedicationStatement type guard
138
+ * Returns SmartMedicationStatement when used with Smart resources to provide full TypeScript support
139
+ * for coding utilities
140
+ */
141
+ export declare function isMedicationStatement(resource: Smart<Resource> | undefined): resource is SmartMedicationStatement;
142
+ export declare function isMedicationStatement(resource: Resource | undefined): resource is MedicationStatement;
143
+ /**
144
+ * Procedure type guard
145
+ * Returns SmartProcedure when used with Smart resources to provide full TypeScript support
146
+ * for coding utilities
147
+ */
148
+ export declare function isProcedure(resource: Smart<Resource> | undefined): resource is SmartProcedure;
149
+ export declare function isProcedure(resource: Resource | undefined): resource is Procedure;
150
+ /**
151
+ * RelatedPerson type guard
152
+ * Returns SmartRelatedPerson when used with Smart resources to provide full TypeScript support
153
+ * for coding utilities
154
+ */
155
+ export declare function isRelatedPerson(resource: Smart<Resource> | undefined): resource is SmartRelatedPerson;
156
+ export declare function isRelatedPerson(resource: Resource | undefined): resource is RelatedPerson;
157
+ /**
158
+ * RiskAssessment type guard
159
+ * Returns SmartRiskAssessment when used with Smart resources to provide full TypeScript support
160
+ * for coding utilities
161
+ */
162
+ export declare function isRiskAssessment(resource: Smart<Resource> | undefined): resource is SmartRiskAssessment;
163
+ export declare function isRiskAssessment(resource: Resource | undefined): resource is RiskAssessment;
164
+ /**
165
+ * ServiceRequest type guard
166
+ * Returns SmartServiceRequest when used with Smart resources to provide full TypeScript support
167
+ * for coding utilities
168
+ */
169
+ export declare function isServiceRequest(resource: Smart<Resource> | undefined): resource is SmartServiceRequest;
170
+ export declare function isServiceRequest(resource: Resource | undefined): resource is ServiceRequest;
171
+ /**
172
+ * CarePlan type guard
173
+ * Returns SmartCarePlan when used with Smart resources to provide full TypeScript support
174
+ * for coding utilities
175
+ */
176
+ export declare function isCarePlan(resource: Smart<Resource> | undefined): resource is SmartCarePlan;
177
+ export declare function isCarePlan(resource: Resource | undefined): resource is CarePlan;
178
+ /**
179
+ * Bundle type guard
180
+ */
181
+ export declare function isBundle(resource: Smart<Resource> | undefined): resource is Smart<Bundle>;
182
+ export declare function isBundle(resource: Resource | undefined): resource is Bundle;
183
+ //# sourceMappingURL=type-guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,cAAc,EACd,cAAc,EACd,QAAQ,EACR,MAAM,EACP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,SAAS,GAAG,QAAQ,IAAI,YAAY,CAAC;AAC3F,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,OAAO,CAAC;AA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AAQ,CAAC,GAAG,SAAS,GACpC,QAAQ,IAAI,mBAAmB,CAAC;AACnC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,cAAc,CAAC;AAO7F;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,SAAS,GAAG,QAAQ,IAAI,aAAa,CAAC;AAC7F,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAAC;AAOjF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,SAAS,GAAG,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3F,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,IAAI,MAAM,CAAC"}
@@ -0,0 +1,108 @@
1
+ "use strict";
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;
4
+ function isPatient(resource) {
5
+ return resource?.resourceType === "Patient";
6
+ }
7
+ exports.isPatient = isPatient;
8
+ function isObservation(resource) {
9
+ return resource?.resourceType === "Observation";
10
+ }
11
+ exports.isObservation = isObservation;
12
+ function isDiagnosticReport(resource) {
13
+ return resource?.resourceType === "DiagnosticReport";
14
+ }
15
+ exports.isDiagnosticReport = isDiagnosticReport;
16
+ function isEncounter(resource) {
17
+ return resource?.resourceType === "Encounter";
18
+ }
19
+ exports.isEncounter = isEncounter;
20
+ function isPractitioner(resource) {
21
+ return resource?.resourceType === "Practitioner";
22
+ }
23
+ exports.isPractitioner = isPractitioner;
24
+ function isPractitionerRole(resource) {
25
+ return resource?.resourceType === "PractitionerRole";
26
+ }
27
+ exports.isPractitionerRole = isPractitionerRole;
28
+ function isOrganization(resource) {
29
+ return resource?.resourceType === "Organization";
30
+ }
31
+ exports.isOrganization = isOrganization;
32
+ function isLocation(resource) {
33
+ return resource?.resourceType === "Location";
34
+ }
35
+ exports.isLocation = isLocation;
36
+ function isAllergyIntolerance(resource) {
37
+ return resource?.resourceType === "AllergyIntolerance";
38
+ }
39
+ exports.isAllergyIntolerance = isAllergyIntolerance;
40
+ function isCondition(resource) {
41
+ return resource?.resourceType === "Condition";
42
+ }
43
+ exports.isCondition = isCondition;
44
+ function isComposition(resource) {
45
+ return resource?.resourceType === "Composition";
46
+ }
47
+ exports.isComposition = isComposition;
48
+ function isCoverage(resource) {
49
+ return resource?.resourceType === "Coverage";
50
+ }
51
+ exports.isCoverage = isCoverage;
52
+ function isDocumentReference(resource) {
53
+ return resource?.resourceType === "DocumentReference";
54
+ }
55
+ exports.isDocumentReference = isDocumentReference;
56
+ function isFamilyMemberHistory(resource) {
57
+ return resource?.resourceType === "FamilyMemberHistory";
58
+ }
59
+ exports.isFamilyMemberHistory = isFamilyMemberHistory;
60
+ function isImmunization(resource) {
61
+ return resource?.resourceType === "Immunization";
62
+ }
63
+ exports.isImmunization = isImmunization;
64
+ function isMedication(resource) {
65
+ return resource?.resourceType === "Medication";
66
+ }
67
+ exports.isMedication = isMedication;
68
+ function isMedicationAdministration(resource) {
69
+ return resource?.resourceType === "MedicationAdministration";
70
+ }
71
+ exports.isMedicationAdministration = isMedicationAdministration;
72
+ function isMedicationDispense(resource) {
73
+ return resource?.resourceType === "MedicationDispense";
74
+ }
75
+ exports.isMedicationDispense = isMedicationDispense;
76
+ function isMedicationRequest(resource) {
77
+ return resource?.resourceType === "MedicationRequest";
78
+ }
79
+ exports.isMedicationRequest = isMedicationRequest;
80
+ function isMedicationStatement(resource) {
81
+ return resource?.resourceType === "MedicationStatement";
82
+ }
83
+ exports.isMedicationStatement = isMedicationStatement;
84
+ function isProcedure(resource) {
85
+ return resource?.resourceType === "Procedure";
86
+ }
87
+ exports.isProcedure = isProcedure;
88
+ function isRelatedPerson(resource) {
89
+ return resource?.resourceType === "RelatedPerson";
90
+ }
91
+ exports.isRelatedPerson = isRelatedPerson;
92
+ function isRiskAssessment(resource) {
93
+ return resource?.resourceType === "RiskAssessment";
94
+ }
95
+ exports.isRiskAssessment = isRiskAssessment;
96
+ function isServiceRequest(resource) {
97
+ return resource?.resourceType === "ServiceRequest";
98
+ }
99
+ exports.isServiceRequest = isServiceRequest;
100
+ function isCarePlan(resource) {
101
+ return resource?.resourceType === "CarePlan";
102
+ }
103
+ exports.isCarePlan = isCarePlan;
104
+ function isBundle(resource) {
105
+ return resource?.resourceType === "Bundle";
106
+ }
107
+ exports.isBundle = isBundle;
108
+ //# sourceMappingURL=type-guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":";;;AAgEA,SAAgB,SAAS,CACvB,QAAgD;IAEhD,OAAO,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC;AAC9C,CAAC;AAJD,8BAIC;AASD,SAAgB,aAAa,CAC3B,QAAgD;IAEhD,OAAO,QAAQ,EAAE,YAAY,KAAK,aAAa,CAAC;AAClD,CAAC;AAJD,sCAIC;AAWD,SAAgB,kBAAkB,CAChC,QAAgD;IAEhD,OAAO,QAAQ,EAAE,YAAY,KAAK,kBAAkB,CAAC;AACvD,CAAC;AAJD,gDAIC;AASD,SAAgB,WAAW,CACzB,QAAgD;IAEhD,OAAO,QAAQ,EAAE,YAAY,KAAK,WAAW,CAAC;AAChD,CAAC;AAJD,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