@medplum/agent 2.1.6 → 2.1.8
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/cjs/index.cjs +447 -387
- package/package.json +1 -1
- package/src/main.test.ts +114 -9
- package/src/main.ts +136 -92
package/dist/cjs/index.cjs
CHANGED
|
@@ -1295,9 +1295,9 @@ var require_receiver = __commonJS({
|
|
|
1295
1295
|
}
|
|
1296
1296
|
this._fragments.push(buf);
|
|
1297
1297
|
}
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
return cb(
|
|
1298
|
+
const er = this.dataMessage();
|
|
1299
|
+
if (er)
|
|
1300
|
+
return cb(er);
|
|
1301
1301
|
this.startLoop(cb);
|
|
1302
1302
|
});
|
|
1303
1303
|
}
|
|
@@ -3523,7 +3523,7 @@ var require_websocket_server = __commonJS({
|
|
|
3523
3523
|
socket.once("finish", socket.destroy);
|
|
3524
3524
|
socket.end(
|
|
3525
3525
|
`HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
|
|
3526
|
-
` + Object.keys(headers).map((
|
|
3526
|
+
` + Object.keys(headers).map((h3) => `${h3}: ${headers[h3]}`).join("\r\n") + "\r\n\r\n" + message
|
|
3527
3527
|
);
|
|
3528
3528
|
}
|
|
3529
3529
|
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
@@ -3548,7 +3548,7 @@ __export(main_exports, {
|
|
|
3548
3548
|
module.exports = __toCommonJS(main_exports);
|
|
3549
3549
|
|
|
3550
3550
|
// ../core/dist/esm/index.mjs
|
|
3551
|
-
var
|
|
3551
|
+
var ge = class {
|
|
3552
3552
|
constructor(e, t) {
|
|
3553
3553
|
this.operator = e;
|
|
3554
3554
|
this.child = t;
|
|
@@ -3567,7 +3567,7 @@ var $ = class {
|
|
|
3567
3567
|
return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
|
|
3568
3568
|
}
|
|
3569
3569
|
};
|
|
3570
|
-
var
|
|
3570
|
+
var xe = class {
|
|
3571
3571
|
constructor() {
|
|
3572
3572
|
this.prefixParselets = {};
|
|
3573
3573
|
this.infixParselets = {};
|
|
@@ -3591,10 +3591,10 @@ var ye = class {
|
|
|
3591
3591
|
}, precedence: t });
|
|
3592
3592
|
}
|
|
3593
3593
|
construct(e) {
|
|
3594
|
-
return new
|
|
3594
|
+
return new rt(e, this.prefixParselets, this.infixParselets);
|
|
3595
3595
|
}
|
|
3596
3596
|
};
|
|
3597
|
-
var
|
|
3597
|
+
var rt = class {
|
|
3598
3598
|
constructor(e, t, n) {
|
|
3599
3599
|
this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
|
|
3600
3600
|
}
|
|
@@ -3646,42 +3646,43 @@ var et = class {
|
|
|
3646
3646
|
}
|
|
3647
3647
|
};
|
|
3648
3648
|
function K(r4) {
|
|
3649
|
-
let e =
|
|
3649
|
+
let e = se(r4), t = dn(r4);
|
|
3650
3650
|
return t === e ? { reference: e } : { reference: e, display: t };
|
|
3651
3651
|
}
|
|
3652
|
-
function
|
|
3653
|
-
return r4
|
|
3652
|
+
function se(r4) {
|
|
3653
|
+
return ae(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
|
|
3654
3654
|
}
|
|
3655
|
-
function
|
|
3656
|
-
|
|
3655
|
+
function Ht(r4) {
|
|
3656
|
+
if (r4)
|
|
3657
|
+
return ae(r4) ? r4.reference.split("/")[1] : r4.id;
|
|
3657
3658
|
}
|
|
3658
|
-
function
|
|
3659
|
+
function ln(r4) {
|
|
3659
3660
|
return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
|
|
3660
3661
|
}
|
|
3661
|
-
function
|
|
3662
|
-
if (
|
|
3663
|
-
let e =
|
|
3662
|
+
function dn(r4) {
|
|
3663
|
+
if (ln(r4)) {
|
|
3664
|
+
let e = pn(r4);
|
|
3664
3665
|
if (e)
|
|
3665
3666
|
return e;
|
|
3666
3667
|
}
|
|
3667
3668
|
if (r4.resourceType === "Device") {
|
|
3668
|
-
let e =
|
|
3669
|
+
let e = fn(r4);
|
|
3669
3670
|
if (e)
|
|
3670
3671
|
return e;
|
|
3671
3672
|
}
|
|
3672
|
-
return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name :
|
|
3673
|
+
return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : se(r4);
|
|
3673
3674
|
}
|
|
3674
|
-
function
|
|
3675
|
+
function pn(r4) {
|
|
3675
3676
|
let e = r4.name;
|
|
3676
3677
|
if (e && e.length > 0)
|
|
3677
|
-
return
|
|
3678
|
+
return Ee(e[0]);
|
|
3678
3679
|
}
|
|
3679
|
-
function
|
|
3680
|
+
function fn(r4) {
|
|
3680
3681
|
let e = r4.deviceName;
|
|
3681
3682
|
if (e && e.length > 0)
|
|
3682
3683
|
return e[0].name;
|
|
3683
3684
|
}
|
|
3684
|
-
function
|
|
3685
|
+
function Te(r4, e) {
|
|
3685
3686
|
let t = new Date(r4);
|
|
3686
3687
|
t.setUTCHours(0, 0, 0, 0);
|
|
3687
3688
|
let n = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
@@ -3690,37 +3691,37 @@ function ge(r4, e) {
|
|
|
3690
3691
|
(c2 < o || c2 === o && m2 < s) && p2--;
|
|
3691
3692
|
let q = a * 12 + c2 - (i2 * 12 + o);
|
|
3692
3693
|
m2 < s && q--;
|
|
3693
|
-
let
|
|
3694
|
-
return { years: p2, months: q, days:
|
|
3694
|
+
let un = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
|
|
3695
|
+
return { years: p2, months: q, days: un };
|
|
3695
3696
|
}
|
|
3696
|
-
function
|
|
3697
|
-
return JSON.stringify(r4,
|
|
3697
|
+
function Gt(r4, e) {
|
|
3698
|
+
return JSON.stringify(r4, mn, e ? 2 : void 0);
|
|
3698
3699
|
}
|
|
3699
|
-
function
|
|
3700
|
-
return !
|
|
3700
|
+
function mn(r4, e) {
|
|
3701
|
+
return !hn(r4) && R(e) ? void 0 : e;
|
|
3701
3702
|
}
|
|
3702
|
-
function
|
|
3703
|
+
function hn(r4) {
|
|
3703
3704
|
return !!/\d+$/.exec(r4);
|
|
3704
3705
|
}
|
|
3705
|
-
function
|
|
3706
|
+
function R(r4) {
|
|
3706
3707
|
if (r4 == null)
|
|
3707
3708
|
return true;
|
|
3708
3709
|
let e = typeof r4;
|
|
3709
3710
|
return e === "string" && r4 === "" || e === "object" && Object.keys(r4).length === 0;
|
|
3710
3711
|
}
|
|
3711
|
-
function
|
|
3712
|
+
function Kt(r4) {
|
|
3712
3713
|
return r4.every((e) => typeof e == "string");
|
|
3713
3714
|
}
|
|
3714
|
-
var
|
|
3715
|
+
var zt = [];
|
|
3715
3716
|
for (let r4 = 0; r4 < 256; r4++)
|
|
3716
|
-
|
|
3717
|
-
function
|
|
3717
|
+
zt.push(r4.toString(16).padStart(2, "0"));
|
|
3718
|
+
function Jt(r4) {
|
|
3718
3719
|
let e = new Uint8Array(r4), t = new Array(e.length);
|
|
3719
3720
|
for (let n = 0; n < e.length; n++)
|
|
3720
|
-
t[n] =
|
|
3721
|
+
t[n] = zt[e[n]];
|
|
3721
3722
|
return t.join("");
|
|
3722
3723
|
}
|
|
3723
|
-
function
|
|
3724
|
+
function Yt(r4) {
|
|
3724
3725
|
let e = new Uint8Array(r4), t = [];
|
|
3725
3726
|
for (let n = 0; n < e.length; n++)
|
|
3726
3727
|
t[n] = String.fromCharCode(e[n]);
|
|
@@ -3729,34 +3730,34 @@ function zt(r4) {
|
|
|
3729
3730
|
function A(r4) {
|
|
3730
3731
|
return r4.charAt(0).toUpperCase() + r4.substring(1);
|
|
3731
3732
|
}
|
|
3732
|
-
var
|
|
3733
|
+
var ot = (r4) => new Promise((e) => {
|
|
3733
3734
|
setTimeout(e, r4);
|
|
3734
3735
|
});
|
|
3735
|
-
function
|
|
3736
|
+
function Ee(r4, e) {
|
|
3736
3737
|
let t = [];
|
|
3737
3738
|
return r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.length === 0 && r4.text ? r4.text : t.join(" ").trim();
|
|
3738
3739
|
}
|
|
3739
|
-
function
|
|
3740
|
+
function Ln(r4) {
|
|
3740
3741
|
let e = r4.max && r4.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : r4.max;
|
|
3741
3742
|
return { path: "", description: "", type: r4.type ?? [], min: r4.min ?? 0, max: e ?? 1, isArray: !!e && e > 1, constraints: [] };
|
|
3742
3743
|
}
|
|
3743
|
-
function
|
|
3744
|
+
function tr(r4) {
|
|
3744
3745
|
let e = /* @__PURE__ */ Object.create(null);
|
|
3745
3746
|
for (let [t, n] of Object.entries(r4))
|
|
3746
|
-
e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2,
|
|
3747
|
+
e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Ln(o)])), constraints: [], innerTypes: [] };
|
|
3747
3748
|
return e;
|
|
3748
3749
|
}
|
|
3749
|
-
var er = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
|
|
3750
|
+
var rr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
|
|
3750
3751
|
function l(r4) {
|
|
3751
3752
|
return [{ type: u.boolean, value: r4 }];
|
|
3752
3753
|
}
|
|
3753
3754
|
function T(r4) {
|
|
3754
|
-
return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } :
|
|
3755
|
+
return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } : b(r4) ? { type: u.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: u.BackboneElement, value: r4 };
|
|
3755
3756
|
}
|
|
3756
3757
|
function N(r4) {
|
|
3757
3758
|
return r4.length === 0 ? false : !!r4[0].value;
|
|
3758
3759
|
}
|
|
3759
|
-
function
|
|
3760
|
+
function V(r4, e) {
|
|
3760
3761
|
if (r4.length !== 0) {
|
|
3761
3762
|
if (r4.length === 1 && (!e || r4[0].type === e))
|
|
3762
3763
|
return r4[0];
|
|
@@ -3766,10 +3767,10 @@ function D(r4, e) {
|
|
|
3766
3767
|
function w(r4, e) {
|
|
3767
3768
|
if (!r4.value)
|
|
3768
3769
|
return;
|
|
3769
|
-
let t =
|
|
3770
|
-
return t ?
|
|
3770
|
+
let t = Ce(r4.type, e);
|
|
3771
|
+
return t ? Nn(r4, e, t) : Mn(r4, e);
|
|
3771
3772
|
}
|
|
3772
|
-
function
|
|
3773
|
+
function Nn(r4, e, t) {
|
|
3773
3774
|
let n = t.type;
|
|
3774
3775
|
if (!n || n.length === 0)
|
|
3775
3776
|
return;
|
|
@@ -3785,13 +3786,13 @@ function Fn(r4, e, t) {
|
|
|
3785
3786
|
}
|
|
3786
3787
|
}
|
|
3787
3788
|
let s = r4.value["_" + e];
|
|
3788
|
-
if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ?
|
|
3789
|
-
return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) =>
|
|
3789
|
+
if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? sr(a ?? {}, s[c2]) : a) : i2 = sr(i2 ?? {}, s)), !R(i2))
|
|
3790
|
+
return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => nr(a, o)) : nr(i2, o);
|
|
3790
3791
|
}
|
|
3791
|
-
function
|
|
3792
|
-
return e === "Resource" &&
|
|
3792
|
+
function nr(r4, e) {
|
|
3793
|
+
return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
|
|
3793
3794
|
}
|
|
3794
|
-
function
|
|
3795
|
+
function Mn(r4, e) {
|
|
3795
3796
|
let t = r4.value;
|
|
3796
3797
|
if (!t || typeof t != "object")
|
|
3797
3798
|
return;
|
|
@@ -3806,15 +3807,15 @@ function Nn(r4, e) {
|
|
|
3806
3807
|
break;
|
|
3807
3808
|
}
|
|
3808
3809
|
}
|
|
3809
|
-
if (!
|
|
3810
|
+
if (!R(n))
|
|
3810
3811
|
return Array.isArray(n) ? n.map(T) : T(n);
|
|
3811
3812
|
}
|
|
3812
|
-
function
|
|
3813
|
+
function Ae(r4) {
|
|
3813
3814
|
let e = [];
|
|
3814
3815
|
for (let t of r4) {
|
|
3815
3816
|
let n = false;
|
|
3816
3817
|
for (let i2 of e)
|
|
3817
|
-
if (N(
|
|
3818
|
+
if (N(ar(t, i2))) {
|
|
3818
3819
|
n = true;
|
|
3819
3820
|
break;
|
|
3820
3821
|
}
|
|
@@ -3822,28 +3823,28 @@ function Re(r4) {
|
|
|
3822
3823
|
}
|
|
3823
3824
|
return e;
|
|
3824
3825
|
}
|
|
3825
|
-
function
|
|
3826
|
+
function ct(r4) {
|
|
3826
3827
|
return l(!N(r4));
|
|
3827
3828
|
}
|
|
3828
|
-
function
|
|
3829
|
-
return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? l(false) : l(r4.every((t, n) => N(
|
|
3829
|
+
function ut(r4, e) {
|
|
3830
|
+
return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? l(false) : l(r4.every((t, n) => N(ar(t, e[n]))));
|
|
3830
3831
|
}
|
|
3831
|
-
function
|
|
3832
|
+
function ar(r4, e) {
|
|
3832
3833
|
let t = r4.value?.valueOf(), n = e.value?.valueOf();
|
|
3833
|
-
return typeof t == "number" && typeof n == "number" ? l(Math.abs(t - n) < 1e-8) :
|
|
3834
|
+
return typeof t == "number" && typeof n == "number" ? l(Math.abs(t - n) < 1e-8) : b(t) && b(n) ? l(cr(t, n)) : l(typeof t == "object" && typeof n == "object" ? dt(r4, e) : t === n);
|
|
3834
3835
|
}
|
|
3835
|
-
function
|
|
3836
|
-
return r4.length === 0 && e.length === 0 ? l(true) : r4.length !== e.length ? l(false) : (r4.sort(
|
|
3836
|
+
function lt(r4, e) {
|
|
3837
|
+
return r4.length === 0 && e.length === 0 ? l(true) : r4.length !== e.length ? l(false) : (r4.sort(ir), e.sort(ir), l(r4.every((t, n) => N(Bn(t, e[n])))));
|
|
3837
3838
|
}
|
|
3838
|
-
function
|
|
3839
|
+
function Bn(r4, e) {
|
|
3839
3840
|
let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
|
|
3840
|
-
return typeof s == "number" && typeof a == "number" ? l(Math.abs(s - a) < 0.01) :
|
|
3841
|
+
return typeof s == "number" && typeof a == "number" ? l(Math.abs(s - a) < 0.01) : b(s) && b(a) ? l(cr(s, a)) : l(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? dt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
|
|
3841
3842
|
}
|
|
3842
|
-
function
|
|
3843
|
+
function ir(r4, e) {
|
|
3843
3844
|
let t = r4.value?.valueOf(), n = e.value?.valueOf();
|
|
3844
3845
|
return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
|
|
3845
3846
|
}
|
|
3846
|
-
function
|
|
3847
|
+
function Pe(r4, e) {
|
|
3847
3848
|
let { value: t } = r4;
|
|
3848
3849
|
if (t == null)
|
|
3849
3850
|
return false;
|
|
@@ -3860,106 +3861,106 @@ function Ee(r4, e) {
|
|
|
3860
3861
|
case "Time":
|
|
3861
3862
|
return typeof t == "string" && !!/^T\d/.exec(t);
|
|
3862
3863
|
case "Period":
|
|
3863
|
-
return
|
|
3864
|
+
return qn(t);
|
|
3864
3865
|
case "Quantity":
|
|
3865
|
-
return
|
|
3866
|
+
return b(t);
|
|
3866
3867
|
default:
|
|
3867
3868
|
return typeof t == "object" && t?.resourceType === e;
|
|
3868
3869
|
}
|
|
3869
3870
|
}
|
|
3870
|
-
function
|
|
3871
|
+
function qn(r4) {
|
|
3871
3872
|
return !!(r4 && typeof r4 == "object" && "start" in r4);
|
|
3872
3873
|
}
|
|
3873
|
-
function
|
|
3874
|
+
function b(r4) {
|
|
3874
3875
|
return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
|
|
3875
3876
|
}
|
|
3876
|
-
function
|
|
3877
|
+
function cr(r4, e) {
|
|
3877
3878
|
return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
|
|
3878
3879
|
}
|
|
3879
|
-
function
|
|
3880
|
+
function dt(r4, e) {
|
|
3880
3881
|
let t = Object.keys(r4), n = Object.keys(e);
|
|
3881
3882
|
if (t.length !== n.length)
|
|
3882
3883
|
return false;
|
|
3883
3884
|
for (let i2 of t) {
|
|
3884
3885
|
let o = r4[i2], s = e[i2];
|
|
3885
|
-
if (
|
|
3886
|
-
if (!
|
|
3886
|
+
if (or(o) && or(s)) {
|
|
3887
|
+
if (!dt(o, s))
|
|
3887
3888
|
return false;
|
|
3888
3889
|
} else if (o !== s)
|
|
3889
3890
|
return false;
|
|
3890
3891
|
}
|
|
3891
3892
|
return true;
|
|
3892
3893
|
}
|
|
3893
|
-
function
|
|
3894
|
+
function or(r4) {
|
|
3894
3895
|
return r4 !== null && typeof r4 == "object";
|
|
3895
3896
|
}
|
|
3896
|
-
function
|
|
3897
|
+
function sr(r4, e) {
|
|
3897
3898
|
return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
|
|
3898
3899
|
}
|
|
3899
|
-
var
|
|
3900
|
-
var
|
|
3901
|
-
var
|
|
3902
|
-
var
|
|
3903
|
-
var
|
|
3904
|
-
var
|
|
3905
|
-
function
|
|
3900
|
+
var pt = "ok";
|
|
3901
|
+
var we = "created";
|
|
3902
|
+
var mt = "not-modified";
|
|
3903
|
+
var ht = "not-found";
|
|
3904
|
+
var Ie = "accepted";
|
|
3905
|
+
var pr = { resourceType: "OperationOutcome", id: ht, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
|
|
3906
|
+
function U(r4, e) {
|
|
3906
3907
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
|
|
3907
3908
|
}
|
|
3908
3909
|
function h(r4) {
|
|
3909
3910
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
|
|
3910
3911
|
}
|
|
3911
|
-
function
|
|
3912
|
+
function ke(r4) {
|
|
3912
3913
|
return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
|
|
3913
3914
|
}
|
|
3914
|
-
function
|
|
3915
|
-
return r4.id ===
|
|
3915
|
+
function yt(r4) {
|
|
3916
|
+
return r4.id === pt || r4.id === we || r4.id === mt || r4.id === Ie;
|
|
3916
3917
|
}
|
|
3917
3918
|
var d = class extends Error {
|
|
3918
3919
|
constructor(t, n) {
|
|
3919
|
-
super(
|
|
3920
|
+
super(mr(t));
|
|
3920
3921
|
this.outcome = t, this.cause = n;
|
|
3921
3922
|
}
|
|
3922
3923
|
};
|
|
3923
|
-
function
|
|
3924
|
-
return r4 instanceof d ? r4.outcome :
|
|
3924
|
+
function gt(r4) {
|
|
3925
|
+
return r4 instanceof d ? r4.outcome : ke(r4) ? r4 : U($n(r4));
|
|
3925
3926
|
}
|
|
3926
|
-
function
|
|
3927
|
-
return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message :
|
|
3927
|
+
function $n(r4) {
|
|
3928
|
+
return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ke(r4) ? mr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
|
|
3928
3929
|
}
|
|
3929
|
-
function
|
|
3930
|
-
let e = r4.issue?.map(
|
|
3930
|
+
function mr(r4) {
|
|
3931
|
+
let e = r4.issue?.map(jn) ?? [];
|
|
3931
3932
|
return e.length > 0 ? e.join("; ") : "Unknown error";
|
|
3932
3933
|
}
|
|
3933
|
-
function
|
|
3934
|
+
function jn(r4) {
|
|
3934
3935
|
let e;
|
|
3935
3936
|
return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
|
|
3936
3937
|
}
|
|
3937
|
-
function
|
|
3938
|
-
return new
|
|
3938
|
+
function Rt(r4) {
|
|
3939
|
+
return new vt(r4).parse();
|
|
3939
3940
|
}
|
|
3940
|
-
var H =
|
|
3941
|
-
function
|
|
3941
|
+
var H = tr(rr);
|
|
3942
|
+
function vr(r4) {
|
|
3942
3943
|
let e = Array.isArray(r4) ? r4 : r4.entry?.map((t) => t.resource) ?? [];
|
|
3943
3944
|
for (let t of e)
|
|
3944
|
-
|
|
3945
|
+
Hn(t);
|
|
3945
3946
|
}
|
|
3946
|
-
function
|
|
3947
|
+
function Hn(r4) {
|
|
3947
3948
|
if (!r4?.name)
|
|
3948
3949
|
throw new Error("Failed loading StructureDefinition from bundle");
|
|
3949
3950
|
if (r4.resourceType !== "StructureDefinition")
|
|
3950
3951
|
return;
|
|
3951
|
-
let e =
|
|
3952
|
+
let e = Rt(r4);
|
|
3952
3953
|
H[r4.name] = e;
|
|
3953
3954
|
for (let t of e.innerTypes)
|
|
3954
3955
|
t.parentType = e, H[t.name] = t;
|
|
3955
3956
|
}
|
|
3956
|
-
function
|
|
3957
|
+
function Rr(r4) {
|
|
3957
3958
|
return !!H[r4];
|
|
3958
3959
|
}
|
|
3959
|
-
function
|
|
3960
|
+
function br(r4) {
|
|
3960
3961
|
return H[r4];
|
|
3961
3962
|
}
|
|
3962
|
-
var
|
|
3963
|
+
var vt = class {
|
|
3963
3964
|
constructor(e) {
|
|
3964
3965
|
if (!e.snapshot?.element || e.snapshot.element.length === 0)
|
|
3965
3966
|
throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
|
|
@@ -3972,7 +3973,7 @@ var xt = class {
|
|
|
3972
3973
|
this.parseSliceStart(e);
|
|
3973
3974
|
else if (e.id?.includes(":")) {
|
|
3974
3975
|
if (this.slicingContext?.current) {
|
|
3975
|
-
let t =
|
|
3976
|
+
let t = Tt(e, this.slicingContext.path);
|
|
3976
3977
|
this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
|
|
3977
3978
|
}
|
|
3978
3979
|
} else {
|
|
@@ -3981,13 +3982,13 @@ var xt = class {
|
|
|
3981
3982
|
let n = this.backboneContext;
|
|
3982
3983
|
for (; n; ) {
|
|
3983
3984
|
if (e.path?.startsWith(n.path + ".")) {
|
|
3984
|
-
n.type.elements[
|
|
3985
|
+
n.type.elements[Tt(e, n.path)] = t;
|
|
3985
3986
|
break;
|
|
3986
3987
|
}
|
|
3987
3988
|
n = n.parent;
|
|
3988
3989
|
}
|
|
3989
3990
|
if (!n) {
|
|
3990
|
-
let i2 =
|
|
3991
|
+
let i2 = Tt(e, this.root.path);
|
|
3991
3992
|
e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
|
|
3992
3993
|
}
|
|
3993
3994
|
this.checkFieldExit(e);
|
|
@@ -4002,10 +4003,10 @@ var xt = class {
|
|
|
4002
4003
|
enterInnerType(e) {
|
|
4003
4004
|
for (; this.backboneContext && !ee(this.backboneContext?.path, e.path); )
|
|
4004
4005
|
this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
|
|
4005
|
-
this.backboneContext = { type: { name:
|
|
4006
|
+
this.backboneContext = { type: { name: St(e), description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ee(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
|
|
4006
4007
|
}
|
|
4007
4008
|
enterSlice(e, t) {
|
|
4008
|
-
|
|
4009
|
+
Gn(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
|
|
4009
4010
|
if (n.type !== "value" && n.type !== "pattern" && n.type !== "type")
|
|
4010
4011
|
throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
|
|
4011
4012
|
return { path: n.path, type: n.type };
|
|
@@ -4046,51 +4047,54 @@ var xt = class {
|
|
|
4046
4047
|
this.slicingContext.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext.current = { name: e.sliceName ?? "", type: e.type?.map((t) => ({ code: t.code ?? "", targetProfile: t.targetProfile })), elements: {}, min: e.min ?? 0, max: e.max === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(e.max, 10) };
|
|
4047
4048
|
}
|
|
4048
4049
|
parseElementDefinition(e) {
|
|
4049
|
-
let t =
|
|
4050
|
-
return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: (e.type ?? []).map((o) => ({ code: ["BackboneElement", "Element"].includes(o.code) ?
|
|
4050
|
+
let t = xr(e.max), n = e.base?.max ? xr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
|
|
4051
|
+
return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: (e.type ?? []).map((o) => ({ code: ["BackboneElement", "Element"].includes(o.code) ? St(e) : o.code ?? "", targetProfile: o.targetProfile })), fixed: Tr(w(i2, "fixed")), pattern: Tr(w(i2, "pattern")), binding: e.binding };
|
|
4051
4052
|
}
|
|
4052
4053
|
};
|
|
4053
|
-
function
|
|
4054
|
+
function xr(r4) {
|
|
4054
4055
|
return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
|
|
4055
4056
|
}
|
|
4056
|
-
function
|
|
4057
|
-
return
|
|
4057
|
+
function Tt(r4, e = "") {
|
|
4058
|
+
return Wn(r4.path, e);
|
|
4058
4059
|
}
|
|
4059
|
-
function
|
|
4060
|
+
function Wn(r4, e) {
|
|
4060
4061
|
return r4 ? e && r4.startsWith(e) ? r4.substring(e.length + 1) : r4 : "";
|
|
4061
4062
|
}
|
|
4062
4063
|
function ee(r4, e) {
|
|
4063
4064
|
return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
|
|
4064
4065
|
}
|
|
4065
|
-
function
|
|
4066
|
-
return Array.isArray(r4) && r4.length > 0 ? r4[0] :
|
|
4066
|
+
function Tr(r4) {
|
|
4067
|
+
return Array.isArray(r4) && r4.length > 0 ? r4[0] : R(r4) ? void 0 : r4;
|
|
4067
4068
|
}
|
|
4068
|
-
function
|
|
4069
|
+
function Gn(r4) {
|
|
4069
4070
|
let e = r4.slicing?.discriminator;
|
|
4070
4071
|
return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
|
|
4071
4072
|
}
|
|
4072
4073
|
var u = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
|
|
4073
|
-
function
|
|
4074
|
+
function Et(r4) {
|
|
4074
4075
|
for (let e of r4.base ?? []) {
|
|
4075
4076
|
let t = I.types[e];
|
|
4076
4077
|
t || (t = { searchParamsDetails: {} }, I.types[e] = t), t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r4.code] = r4;
|
|
4077
4078
|
}
|
|
4078
4079
|
}
|
|
4079
|
-
function
|
|
4080
|
+
function St(r4) {
|
|
4080
4081
|
let e = r4.type?.[0]?.code;
|
|
4081
|
-
return e === "BackboneElement" || e === "Element" ?
|
|
4082
|
+
return e === "BackboneElement" || e === "Element" ? Kn((r4.base?.path ?? r4.path)?.split(".")) : e;
|
|
4082
4083
|
}
|
|
4083
|
-
function
|
|
4084
|
+
function Kn(r4) {
|
|
4084
4085
|
return r4.length === 1 ? r4[0] : r4.map(A).join("");
|
|
4085
4086
|
}
|
|
4086
|
-
function
|
|
4087
|
-
let t =
|
|
4087
|
+
function Ce(r4, e) {
|
|
4088
|
+
let t = br(r4);
|
|
4088
4089
|
if (t)
|
|
4089
4090
|
return t.elements[e] ?? t.elements[e + "[x]"];
|
|
4090
4091
|
}
|
|
4091
|
-
function
|
|
4092
|
+
function _(r4) {
|
|
4092
4093
|
return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
|
|
4093
4094
|
}
|
|
4095
|
+
function ae(r4) {
|
|
4096
|
+
return !!(r4 && typeof r4 == "object" && "reference" in r4);
|
|
4097
|
+
}
|
|
4094
4098
|
var I = { types: {} };
|
|
4095
4099
|
function re(r4) {
|
|
4096
4100
|
if (r4.startsWith("T"))
|
|
@@ -4103,7 +4107,7 @@ function re(r4) {
|
|
|
4103
4107
|
return r4;
|
|
4104
4108
|
}
|
|
4105
4109
|
}
|
|
4106
|
-
var
|
|
4110
|
+
var ce = () => [];
|
|
4107
4111
|
var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.filter((n) => N(t.eval(r4, [n]))).length > 0) : l(e.length > 0), all: (r4, e, t) => l(e.every((n) => N(t.eval(r4, [n])))), allTrue: (r4, e) => {
|
|
4108
4112
|
for (let t of e)
|
|
4109
4113
|
if (!t.value)
|
|
@@ -4124,12 +4128,12 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4124
4128
|
if (!t.value)
|
|
4125
4129
|
return l(true);
|
|
4126
4130
|
return l(false);
|
|
4127
|
-
}, subsetOf:
|
|
4131
|
+
}, subsetOf: ce, supersetOf: ce, count: (r4, e) => [{ type: u.integer, value: e.length }], distinct: (r4, e) => {
|
|
4128
4132
|
let t = [];
|
|
4129
4133
|
for (let n of e)
|
|
4130
4134
|
t.some((i2) => i2.value === n.value) || t.push(n);
|
|
4131
4135
|
return t;
|
|
4132
|
-
}, isDistinct: (r4, e) => l(e.length === S.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => N(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat:
|
|
4136
|
+
}, isDistinct: (r4, e) => l(e.length === S.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => N(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: ce, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
|
|
4133
4137
|
if (e.length > 1)
|
|
4134
4138
|
throw new Error("Expected input length one for single()");
|
|
4135
4139
|
return e.length === 0 ? [] : e.slice(0, 1);
|
|
@@ -4161,7 +4165,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4161
4165
|
if (!t)
|
|
4162
4166
|
return e;
|
|
4163
4167
|
let n = t.eval(r4, e);
|
|
4164
|
-
return
|
|
4168
|
+
return Ae([...e, ...n]);
|
|
4165
4169
|
}, combine: (r4, e, t) => {
|
|
4166
4170
|
if (!t)
|
|
4167
4171
|
return e;
|
|
@@ -4175,7 +4179,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4175
4179
|
}, toBoolean: (r4, e) => {
|
|
4176
4180
|
if (e.length === 0)
|
|
4177
4181
|
return [];
|
|
4178
|
-
let [{ value: t }] =
|
|
4182
|
+
let [{ value: t }] = F(e, 1);
|
|
4179
4183
|
if (typeof t == "boolean")
|
|
4180
4184
|
return [{ type: u.boolean, value: t }];
|
|
4181
4185
|
if (typeof t == "number" && (t === 0 || t === 1))
|
|
@@ -4191,37 +4195,37 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4191
4195
|
}, convertsToBoolean: (r4, e) => e.length === 0 ? [] : l(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
|
|
4192
4196
|
if (e.length === 0)
|
|
4193
4197
|
return [];
|
|
4194
|
-
let [{ value: t }] =
|
|
4198
|
+
let [{ value: t }] = F(e, 1);
|
|
4195
4199
|
return typeof t == "number" ? [{ type: u.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: u.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: u.integer, value: t ? 1 : 0 }] : [];
|
|
4196
4200
|
}, convertsToInteger: (r4, e) => e.length === 0 ? [] : l(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
|
|
4197
4201
|
if (e.length === 0)
|
|
4198
4202
|
return [];
|
|
4199
|
-
let [{ value: t }] =
|
|
4203
|
+
let [{ value: t }] = F(e, 1);
|
|
4200
4204
|
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: u.date, value: re(t) }] : [];
|
|
4201
4205
|
}, convertsToDate: (r4, e) => e.length === 0 ? [] : l(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
|
|
4202
4206
|
if (e.length === 0)
|
|
4203
4207
|
return [];
|
|
4204
|
-
let [{ value: t }] =
|
|
4208
|
+
let [{ value: t }] = F(e, 1);
|
|
4205
4209
|
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: u.dateTime, value: re(t) }] : [];
|
|
4206
4210
|
}, convertsToDateTime: (r4, e) => e.length === 0 ? [] : l(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
|
|
4207
4211
|
if (e.length === 0)
|
|
4208
4212
|
return [];
|
|
4209
|
-
let [{ value: t }] =
|
|
4213
|
+
let [{ value: t }] = F(e, 1);
|
|
4210
4214
|
return typeof t == "number" ? [{ type: u.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: u.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: u.decimal, value: t ? 1 : 0 }] : [];
|
|
4211
4215
|
}, convertsToDecimal: (r4, e) => e.length === 0 ? [] : l(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
|
|
4212
4216
|
if (e.length === 0)
|
|
4213
4217
|
return [];
|
|
4214
|
-
let [{ value: t }] =
|
|
4215
|
-
return
|
|
4218
|
+
let [{ value: t }] = F(e, 1);
|
|
4219
|
+
return b(t) ? [{ type: u.Quantity, value: t }] : typeof t == "number" ? [{ type: u.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: u.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: u.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
|
|
4216
4220
|
}, convertsToQuantity: (r4, e) => e.length === 0 ? [] : l(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
|
|
4217
4221
|
if (e.length === 0)
|
|
4218
4222
|
return [];
|
|
4219
|
-
let [{ value: t }] =
|
|
4220
|
-
return t == null ? [] :
|
|
4223
|
+
let [{ value: t }] = F(e, 1);
|
|
4224
|
+
return t == null ? [] : b(t) ? [{ type: u.string, value: `${t.value} '${t.unit}'` }] : [{ type: u.string, value: t.toString() }];
|
|
4221
4225
|
}, convertsToString: (r4, e) => e.length === 0 ? [] : l(S.toString(r4, e).length === 1), toTime: (r4, e) => {
|
|
4222
4226
|
if (e.length === 0)
|
|
4223
4227
|
return [];
|
|
4224
|
-
let [{ value: t }] =
|
|
4228
|
+
let [{ value: t }] = F(e, 1);
|
|
4225
4229
|
if (typeof t == "string") {
|
|
4226
4230
|
let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
|
|
4227
4231
|
if (n)
|
|
@@ -4231,7 +4235,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4231
4235
|
}, convertsToTime: (r4, e) => e.length === 0 ? [] : l(S.toTime(r4, e).length === 1), indexOf: (r4, e, t) => P((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => P((i2, o, s) => {
|
|
4232
4236
|
let a = o, c2 = s ? a + s : i2.length;
|
|
4233
4237
|
return a < 0 || a >= i2.length ? void 0 : i2.substring(a, c2);
|
|
4234
|
-
}, r4, e, t, n), startsWith: (r4, e, t) => P((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => P((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => P((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => P((t) => t.toUpperCase(), r4, e), lower: (r4, e) => P((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => P((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => P((t) => t.length, r4, e), toChars: (r4, e) => P((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) =>
|
|
4238
|
+
}, r4, e, t, n), startsWith: (r4, e, t) => P((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => P((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => P((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => P((t) => t.toUpperCase(), r4, e), lower: (r4, e) => P((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => P((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => P((t) => t.length, r4, e), toChars: (r4, e) => P((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: ce, descendants: ce, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: u.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: u.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: u.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
|
|
4235
4239
|
let o = S.toDateTime(r4, t.eval(r4, e));
|
|
4236
4240
|
if (o.length === 0)
|
|
4237
4241
|
throw new Error("Invalid start date");
|
|
@@ -4241,11 +4245,11 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4241
4245
|
let a = i2.eval(r4, e)[0]?.value;
|
|
4242
4246
|
if (a !== "years" && a !== "months" && a !== "days")
|
|
4243
4247
|
throw new Error("Invalid units");
|
|
4244
|
-
let c2 =
|
|
4248
|
+
let c2 = Te(o[0].value, s[0].value);
|
|
4245
4249
|
return [{ type: u.Quantity, value: { value: c2[a], unit: a } }];
|
|
4246
4250
|
}, is: (r4, e, t) => {
|
|
4247
4251
|
let n = "";
|
|
4248
|
-
return t instanceof M ? n = t.name : t instanceof Q && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: u.boolean, value:
|
|
4252
|
+
return t instanceof M ? n = t.name : t instanceof Q && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: u.boolean, value: Pe(i2, n) })) : [];
|
|
4249
4253
|
}, not: (r4, e) => S.toBoolean(r4, e).map((t) => ({ type: u.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
|
|
4250
4254
|
let n = t.value, i2;
|
|
4251
4255
|
if (typeof n == "string")
|
|
@@ -4265,7 +4269,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4265
4269
|
return { type: o, value: { resourceType: o, id: s } };
|
|
4266
4270
|
}
|
|
4267
4271
|
return { type: u.BackboneElement, value: void 0 };
|
|
4268
|
-
}).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: u.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: u.BackboneElement, value: { namespace: "System", name: "Integer" } } :
|
|
4272
|
+
}).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: u.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: u.BackboneElement, value: { namespace: "System", name: "Integer" } } : _(t) ? { type: u.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: u.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
|
|
4269
4273
|
let n = t.eval(r4, e)[0].value;
|
|
4270
4274
|
if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
|
|
4271
4275
|
throw new Error("Expected a StructureDefinition URL");
|
|
@@ -4275,22 +4279,22 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
|
|
|
4275
4279
|
function P(r4, e, t, ...n) {
|
|
4276
4280
|
if (t.length === 0)
|
|
4277
4281
|
return [];
|
|
4278
|
-
let [{ value: i2 }] =
|
|
4282
|
+
let [{ value: i2 }] = F(t, 1);
|
|
4279
4283
|
if (typeof i2 != "string")
|
|
4280
4284
|
throw new Error("String function cannot be called with non-string");
|
|
4281
4285
|
let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
|
|
4282
4286
|
return o === void 0 ? [] : Array.isArray(o) ? o.map(T) : [T(o)];
|
|
4283
4287
|
}
|
|
4284
|
-
function
|
|
4288
|
+
function L(r4, e, t, ...n) {
|
|
4285
4289
|
if (t.length === 0)
|
|
4286
4290
|
return [];
|
|
4287
|
-
let [{ value: i2 }] =
|
|
4291
|
+
let [{ value: i2 }] = F(t, 1), o = b(i2), s = o ? i2.value : i2;
|
|
4288
4292
|
if (typeof s != "number")
|
|
4289
4293
|
throw new Error("Math function cannot be called with non-number");
|
|
4290
4294
|
let a = r4(s, ...n.map((p2) => p2.eval(e, t)[0]?.value)), c2 = o ? u.Quantity : t[0].type, m2 = o ? { ...i2, value: a } : a;
|
|
4291
4295
|
return [{ type: c2, value: m2 }];
|
|
4292
4296
|
}
|
|
4293
|
-
function
|
|
4297
|
+
function F(r4, e) {
|
|
4294
4298
|
if (r4.length !== e)
|
|
4295
4299
|
throw new Error(`Expected ${e} arguments`);
|
|
4296
4300
|
for (let t of r4)
|
|
@@ -4328,13 +4332,13 @@ var M = class {
|
|
|
4328
4332
|
evalValue(e) {
|
|
4329
4333
|
let t = e.value;
|
|
4330
4334
|
if (!(!t || typeof t != "object"))
|
|
4331
|
-
return
|
|
4335
|
+
return _(t) && t.resourceType === this.name ? e : w(e, this.name);
|
|
4332
4336
|
}
|
|
4333
4337
|
toString() {
|
|
4334
4338
|
return this.name;
|
|
4335
4339
|
}
|
|
4336
4340
|
};
|
|
4337
|
-
var
|
|
4341
|
+
var De = class {
|
|
4338
4342
|
eval() {
|
|
4339
4343
|
return [];
|
|
4340
4344
|
}
|
|
@@ -4342,7 +4346,7 @@ var ke = class {
|
|
|
4342
4346
|
return "{}";
|
|
4343
4347
|
}
|
|
4344
4348
|
};
|
|
4345
|
-
var
|
|
4349
|
+
var Ve = class extends ge {
|
|
4346
4350
|
constructor(t, n, i2) {
|
|
4347
4351
|
super(t, n);
|
|
4348
4352
|
this.impl = i2;
|
|
@@ -4376,11 +4380,11 @@ var E = class extends v {
|
|
|
4376
4380
|
let o = this.right.eval(t, n);
|
|
4377
4381
|
if (o.length !== 1)
|
|
4378
4382
|
return [];
|
|
4379
|
-
let s = i2[0].value, a = o[0].value, c2 =
|
|
4380
|
-
return typeof p2 == "boolean" ? l(p2) :
|
|
4383
|
+
let s = i2[0].value, a = o[0].value, c2 = b(s) ? s.value : s, m2 = b(a) ? a.value : a, p2 = this.impl(c2, m2);
|
|
4384
|
+
return typeof p2 == "boolean" ? l(p2) : b(s) ? [{ type: u.Quantity, value: { ...s, value: p2 } }] : [T(p2)];
|
|
4381
4385
|
}
|
|
4382
4386
|
};
|
|
4383
|
-
var
|
|
4387
|
+
var _e = class extends $ {
|
|
4384
4388
|
constructor(e, t) {
|
|
4385
4389
|
super("&", e, t);
|
|
4386
4390
|
}
|
|
@@ -4389,7 +4393,7 @@ var De = class extends $ {
|
|
|
4389
4393
|
return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: u.string, value: o.map((s) => s.value).join("") }] : o;
|
|
4390
4394
|
}
|
|
4391
4395
|
};
|
|
4392
|
-
var
|
|
4396
|
+
var Ue = class extends v {
|
|
4393
4397
|
constructor(e, t) {
|
|
4394
4398
|
super("contains", e, t);
|
|
4395
4399
|
}
|
|
@@ -4398,12 +4402,12 @@ var Ve = class extends v {
|
|
|
4398
4402
|
return l(n.some((o) => o.value === i2[0].value));
|
|
4399
4403
|
}
|
|
4400
4404
|
};
|
|
4401
|
-
var
|
|
4405
|
+
var Le = class extends v {
|
|
4402
4406
|
constructor(e, t) {
|
|
4403
4407
|
super("in", e, t);
|
|
4404
4408
|
}
|
|
4405
4409
|
eval(e, t) {
|
|
4406
|
-
let n =
|
|
4410
|
+
let n = V(this.left.eval(e, t)), i2 = this.right.eval(e, t);
|
|
4407
4411
|
return n ? l(i2.some((o) => o.value === n.value)) : [];
|
|
4408
4412
|
}
|
|
4409
4413
|
};
|
|
@@ -4424,43 +4428,43 @@ var ne = class extends $ {
|
|
|
4424
4428
|
}
|
|
4425
4429
|
eval(e, t) {
|
|
4426
4430
|
let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
|
|
4427
|
-
return
|
|
4431
|
+
return Ae([...n, ...i2]);
|
|
4428
4432
|
}
|
|
4429
4433
|
};
|
|
4430
|
-
var
|
|
4434
|
+
var Fe = class extends v {
|
|
4431
4435
|
constructor(e, t) {
|
|
4432
4436
|
super("=", e, t);
|
|
4433
4437
|
}
|
|
4434
4438
|
eval(e, t) {
|
|
4435
4439
|
let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
|
|
4436
|
-
return
|
|
4440
|
+
return ut(n, i2);
|
|
4437
4441
|
}
|
|
4438
4442
|
};
|
|
4439
|
-
var
|
|
4443
|
+
var Ne = class extends v {
|
|
4440
4444
|
constructor(e, t) {
|
|
4441
4445
|
super("!=", e, t);
|
|
4442
4446
|
}
|
|
4443
4447
|
eval(e, t) {
|
|
4444
4448
|
let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
|
|
4445
|
-
return
|
|
4449
|
+
return ct(ut(n, i2));
|
|
4446
4450
|
}
|
|
4447
4451
|
};
|
|
4448
|
-
var
|
|
4452
|
+
var Me = class extends v {
|
|
4449
4453
|
constructor(e, t) {
|
|
4450
4454
|
super("~", e, t);
|
|
4451
4455
|
}
|
|
4452
4456
|
eval(e, t) {
|
|
4453
4457
|
let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
|
|
4454
|
-
return
|
|
4458
|
+
return lt(n, i2);
|
|
4455
4459
|
}
|
|
4456
4460
|
};
|
|
4457
|
-
var
|
|
4461
|
+
var Be = class extends v {
|
|
4458
4462
|
constructor(e, t) {
|
|
4459
4463
|
super("!~", e, t);
|
|
4460
4464
|
}
|
|
4461
4465
|
eval(e, t) {
|
|
4462
4466
|
let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
|
|
4463
|
-
return
|
|
4467
|
+
return ct(lt(n, i2));
|
|
4464
4468
|
}
|
|
4465
4469
|
};
|
|
4466
4470
|
var Y = class extends v {
|
|
@@ -4472,42 +4476,42 @@ var Y = class extends v {
|
|
|
4472
4476
|
if (n.length !== 1)
|
|
4473
4477
|
return [];
|
|
4474
4478
|
let i2 = this.right.name;
|
|
4475
|
-
return l(
|
|
4479
|
+
return l(Pe(n[0], i2));
|
|
4476
4480
|
}
|
|
4477
4481
|
};
|
|
4478
|
-
var
|
|
4482
|
+
var qe = class extends v {
|
|
4479
4483
|
constructor(e, t) {
|
|
4480
4484
|
super("and", e, t);
|
|
4481
4485
|
}
|
|
4482
4486
|
eval(e, t) {
|
|
4483
|
-
let n =
|
|
4487
|
+
let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
|
|
4484
4488
|
return n?.value === true && i2?.value === true ? l(true) : n?.value === false || i2?.value === false ? l(false) : [];
|
|
4485
4489
|
}
|
|
4486
4490
|
};
|
|
4487
|
-
var
|
|
4491
|
+
var $e = class extends v {
|
|
4488
4492
|
constructor(e, t) {
|
|
4489
4493
|
super("or", e, t);
|
|
4490
4494
|
}
|
|
4491
4495
|
eval(e, t) {
|
|
4492
|
-
let n =
|
|
4496
|
+
let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
|
|
4493
4497
|
return n?.value === false && i2?.value === false ? l(false) : n?.value || i2?.value ? l(true) : [];
|
|
4494
4498
|
}
|
|
4495
4499
|
};
|
|
4496
|
-
var
|
|
4500
|
+
var je = class extends v {
|
|
4497
4501
|
constructor(e, t) {
|
|
4498
4502
|
super("xor", e, t);
|
|
4499
4503
|
}
|
|
4500
4504
|
eval(e, t) {
|
|
4501
|
-
let n =
|
|
4505
|
+
let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
|
|
4502
4506
|
return !n || !i2 ? [] : l(n.value !== i2.value);
|
|
4503
4507
|
}
|
|
4504
4508
|
};
|
|
4505
|
-
var
|
|
4509
|
+
var He = class extends v {
|
|
4506
4510
|
constructor(e, t) {
|
|
4507
4511
|
super("implies", e, t);
|
|
4508
4512
|
}
|
|
4509
4513
|
eval(e, t) {
|
|
4510
|
-
let n =
|
|
4514
|
+
let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
|
|
4511
4515
|
return i2?.value === true || n?.value === false ? l(true) : !n || !i2 ? [] : l(false);
|
|
4512
4516
|
}
|
|
4513
4517
|
};
|
|
@@ -4545,21 +4549,21 @@ var X = class {
|
|
|
4545
4549
|
return `${this.left.toString()}[${this.expr.toString()}]`;
|
|
4546
4550
|
}
|
|
4547
4551
|
};
|
|
4548
|
-
var
|
|
4552
|
+
var le = ["!=", "!~", "<=", ">=", "{}", "->"];
|
|
4549
4553
|
var f = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
|
|
4550
|
-
var
|
|
4554
|
+
var Zn = { parse(r4) {
|
|
4551
4555
|
let e = r4.consumeAndParse();
|
|
4552
4556
|
if (!r4.match(")"))
|
|
4553
4557
|
throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
|
|
4554
4558
|
return e;
|
|
4555
4559
|
} };
|
|
4556
|
-
var
|
|
4560
|
+
var ei = { parse(r4, e) {
|
|
4557
4561
|
let t = r4.consumeAndParse();
|
|
4558
4562
|
if (!r4.match("]"))
|
|
4559
4563
|
throw new Error("Parse error: expected `]`");
|
|
4560
4564
|
return new X(e, t);
|
|
4561
4565
|
}, precedence: f.Indexer };
|
|
4562
|
-
var
|
|
4566
|
+
var ti = { parse(r4, e) {
|
|
4563
4567
|
if (!(e instanceof M))
|
|
4564
4568
|
throw new Error("Unexpected parentheses");
|
|
4565
4569
|
let t = [];
|
|
@@ -4567,45 +4571,45 @@ var ei = { parse(r4, e) {
|
|
|
4567
4571
|
t.push(r4.consumeAndParse()), r4.match(",");
|
|
4568
4572
|
return new B(e.name, t);
|
|
4569
4573
|
}, precedence: f.FunctionCall };
|
|
4570
|
-
function
|
|
4574
|
+
function ri(r4) {
|
|
4571
4575
|
let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
|
|
4572
4576
|
return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
|
|
4573
4577
|
}
|
|
4574
|
-
function
|
|
4575
|
-
return new
|
|
4578
|
+
function de() {
|
|
4579
|
+
return new xe().registerPrefix("String", { parse: (r4, e) => new k({ type: u.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: u.dateTime, value: re(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: u.Quantity, value: ri(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: u.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: u.boolean, value: true }) }).registerPrefix("false", { parse: () => new k({ type: u.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new De() }).registerPrefix("(", Zn).registerInfix("[", ei).registerInfix("(", ti).prefix("+", f.UnaryAdd, (r4, e) => new Ve("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new Q(r4, t)).infixLeft("/", f.Divide, (r4, e, t) => new E("/", r4, t, (n, i2) => n / i2)).infixLeft("*", f.Multiply, (r4, e, t) => new E("*", r4, t, (n, i2) => n * i2)).infixLeft("+", f.Add, (r4, e, t) => new E("+", r4, t, (n, i2) => n + i2)).infixLeft("-", f.Subtract, (r4, e, t) => new E("-", r4, t, (n, i2) => n - i2)).infixLeft("|", f.Union, (r4, e, t) => new ne(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Fe(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Ne(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Me(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Be(r4, t)).infixLeft("<", f.LessThan, (r4, e, t) => new E("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", f.LessThanOrEquals, (r4, e, t) => new E("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", f.GreaterThan, (r4, e, t) => new E(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", f.GreaterThanOrEquals, (r4, e, t) => new E(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", f.Ampersand, (r4, e, t) => new _e(r4, t)).infixLeft("and", f.And, (r4, e, t) => new qe(r4, t)).infixLeft("as", f.As, (r4, e, t) => new J(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new Ue(r4, t)).infixLeft("div", f.Divide, (r4, e, t) => new E("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", f.In, (r4, e, t) => new Le(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new Y(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new $e(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new je(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new He(r4, t));
|
|
4576
4580
|
}
|
|
4577
|
-
var
|
|
4578
|
-
var
|
|
4579
|
-
var
|
|
4580
|
-
var
|
|
4581
|
-
function
|
|
4581
|
+
var ni = de();
|
|
4582
|
+
var wr = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(wr || {});
|
|
4583
|
+
var li = ((g2) => (g2.EQUALS = "eq", g2.NOT_EQUALS = "ne", g2.GREATER_THAN = "gt", g2.LESS_THAN = "lt", g2.GREATER_THAN_OR_EQUALS = "ge", g2.LESS_THAN_OR_EQUALS = "le", g2.STARTS_AFTER = "sa", g2.ENDS_BEFORE = "eb", g2.APPROXIMATELY = "ap", g2.CONTAINS = "contains", g2.EXACT = "exact", g2.TEXT = "text", g2.NOT = "not", g2.ABOVE = "above", g2.BELOW = "below", g2.IN = "in", g2.NOT_IN = "not-in", g2.OF_TYPE = "of-type", g2.MISSING = "missing", g2.IDENTIFIER = "identifier", g2.ITERATE = "iterate", g2))(li || {});
|
|
4584
|
+
var Oi = ((x) => (x.READ = "read", x.VREAD = "vread", x.UPDATE = "update", x.PATCH = "patch", x.DELETE = "delete", x.HISTORY = "history", x.HISTORY_INSTANCE = "history-instance", x.HISTORY_TYPE = "history-type", x.HISTORY_SYSTEM = "history-system", x.CREATE = "create", x.SEARCH = "search", x.SEARCH_TYPE = "search-type", x.SEARCH_SYSTEM = "search-system", x.SEARCH_COMPARTMENT = "search-compartment", x.CAPABILITIES = "capabilities", x.TRANSACTION = "transaction", x.BATCH = "batch", x.OPERATION = "operation", x))(Oi || {});
|
|
4585
|
+
function Br(r4) {
|
|
4582
4586
|
if (typeof window < "u")
|
|
4583
4587
|
return window.atob(r4);
|
|
4584
4588
|
if (typeof Buffer < "u")
|
|
4585
4589
|
return Buffer.from(r4, "base64").toString("binary");
|
|
4586
4590
|
throw new Error("Unable to decode base64");
|
|
4587
4591
|
}
|
|
4588
|
-
function
|
|
4592
|
+
function qr(r4) {
|
|
4589
4593
|
if (typeof window < "u")
|
|
4590
4594
|
return window.btoa(r4);
|
|
4591
4595
|
if (typeof Buffer < "u")
|
|
4592
4596
|
return Buffer.from(r4, "binary").toString("base64");
|
|
4593
4597
|
throw new Error("Unable to encode base64");
|
|
4594
4598
|
}
|
|
4595
|
-
function
|
|
4599
|
+
function Ot() {
|
|
4596
4600
|
let r4 = new Uint32Array(28);
|
|
4597
|
-
return crypto.getRandomValues(r4),
|
|
4601
|
+
return crypto.getRandomValues(r4), Jt(r4.buffer);
|
|
4598
4602
|
}
|
|
4599
|
-
async function
|
|
4603
|
+
async function $r(r4) {
|
|
4600
4604
|
return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
|
|
4601
4605
|
}
|
|
4602
|
-
function
|
|
4606
|
+
function me() {
|
|
4603
4607
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r4) => {
|
|
4604
4608
|
let e = Math.random() * 16 | 0;
|
|
4605
4609
|
return (r4 === "x" ? e : e & 3 | 8).toString(16);
|
|
4606
4610
|
});
|
|
4607
4611
|
}
|
|
4608
|
-
var
|
|
4612
|
+
var Ge = class {
|
|
4609
4613
|
constructor(e = 10) {
|
|
4610
4614
|
this.max = e, this.cache = /* @__PURE__ */ new Map();
|
|
4611
4615
|
}
|
|
@@ -4629,8 +4633,8 @@ var Qe = class {
|
|
|
4629
4633
|
return this.cache.keys().next().value;
|
|
4630
4634
|
}
|
|
4631
4635
|
};
|
|
4632
|
-
var
|
|
4633
|
-
var
|
|
4636
|
+
var O = { CSS: "text/css", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript" };
|
|
4637
|
+
var he = class {
|
|
4634
4638
|
constructor() {
|
|
4635
4639
|
this.listeners = {};
|
|
4636
4640
|
}
|
|
@@ -4655,9 +4659,9 @@ var fe = class {
|
|
|
4655
4659
|
return !e.defaultPrevented;
|
|
4656
4660
|
}
|
|
4657
4661
|
};
|
|
4658
|
-
var
|
|
4662
|
+
var Ke = class {
|
|
4659
4663
|
constructor() {
|
|
4660
|
-
this.emitter = new
|
|
4664
|
+
this.emitter = new he();
|
|
4661
4665
|
}
|
|
4662
4666
|
dispatchEvent(e) {
|
|
4663
4667
|
this.emitter.dispatchEvent(e);
|
|
@@ -4669,35 +4673,35 @@ var We = class {
|
|
|
4669
4673
|
this.emitter.removeEventListener(e, t);
|
|
4670
4674
|
}
|
|
4671
4675
|
};
|
|
4672
|
-
var
|
|
4673
|
-
var
|
|
4674
|
-
var
|
|
4675
|
-
var
|
|
4676
|
-
function
|
|
4677
|
-
return
|
|
4676
|
+
var Dt = { "patient-open": "patient-open", "patient-close": "patient-close", "imagingstudy-open": "imagingstudy-open", "imagingstudy-close": "imagingstudy-close" };
|
|
4677
|
+
var Bi = ["Patient", "Encounter", "ImagingStudy"];
|
|
4678
|
+
var qi = { "patient-open": ["Patient"], "patient-close": ["Patient"], "imagingstudy-open": ["Patient", "ImagingStudy"], "imagingstudy-close": ["Patient", "ImagingStudy"] };
|
|
4679
|
+
var $i = { "patient-open": ["Encounter"], "patient-close": ["Encounter"], "imagingstudy-open": [], "imagingstudy-close": [] };
|
|
4680
|
+
function ji(r4) {
|
|
4681
|
+
return Bi.includes(r4);
|
|
4678
4682
|
}
|
|
4679
|
-
var
|
|
4680
|
-
function
|
|
4683
|
+
var Hi = { ImagingStudy: "study", Patient: "patient", Encounter: "encounter" };
|
|
4684
|
+
function Hr(r4) {
|
|
4681
4685
|
return !!r4.endpoint;
|
|
4682
4686
|
}
|
|
4683
|
-
function
|
|
4684
|
-
if (!
|
|
4687
|
+
function Vt(r4) {
|
|
4688
|
+
if (!Je(r4))
|
|
4685
4689
|
throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
|
|
4686
4690
|
let { channelType: e, mode: t, topic: n, events: i2 } = r4, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
|
|
4687
|
-
return
|
|
4691
|
+
return Hr(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
|
|
4688
4692
|
}
|
|
4689
|
-
function
|
|
4693
|
+
function Je(r4) {
|
|
4690
4694
|
if (typeof r4 != "object")
|
|
4691
4695
|
return false;
|
|
4692
4696
|
let { channelType: e, mode: t, topic: n, events: i2 } = r4;
|
|
4693
4697
|
if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
|
|
4694
4698
|
return false;
|
|
4695
4699
|
for (let o of i2)
|
|
4696
|
-
if (!
|
|
4700
|
+
if (!Dt[o])
|
|
4697
4701
|
return false;
|
|
4698
|
-
return !(
|
|
4702
|
+
return !(Hr(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
|
|
4699
4703
|
}
|
|
4700
|
-
function
|
|
4704
|
+
function Qi(r4, e, t, n) {
|
|
4701
4705
|
if (!(e.key && typeof e.key == "string"))
|
|
4702
4706
|
throw new d(h(`context[${t}] is invalid. Context must contain a key.`));
|
|
4703
4707
|
if (n.has(e.key))
|
|
@@ -4709,36 +4713,36 @@ function Hi(r4, e, t, n) {
|
|
|
4709
4713
|
if (!e.resource.resourceType)
|
|
4710
4714
|
throw new d(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
|
|
4711
4715
|
let i2 = e.resource.resourceType;
|
|
4712
|
-
if (
|
|
4716
|
+
if (!ji(i2))
|
|
4713
4717
|
throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
|
|
4714
|
-
let o =
|
|
4718
|
+
let o = qi[r4], s = $i[r4], a;
|
|
4715
4719
|
if (t < o.length ? a = o[t] : t - o.length < s.length && (a = s[t - o.length]), a && i2 !== a)
|
|
4716
4720
|
throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${a}.`));
|
|
4717
|
-
let c2 =
|
|
4721
|
+
let c2 = Hi[i2];
|
|
4718
4722
|
if (c2 !== e.key)
|
|
4719
4723
|
throw new d(h(`context[${t}] is invalid. Context key for type ${i2} must be ${c2}.`));
|
|
4720
4724
|
}
|
|
4721
|
-
function
|
|
4725
|
+
function Wi(r4, e) {
|
|
4722
4726
|
let t = /* @__PURE__ */ new Set();
|
|
4723
4727
|
for (let n = 0; n < e.length; n++)
|
|
4724
|
-
|
|
4728
|
+
Qi(r4, e[n], n, t);
|
|
4725
4729
|
}
|
|
4726
|
-
function
|
|
4730
|
+
function Qr(r4, e, t) {
|
|
4727
4731
|
if (!(r4 && typeof r4 == "string"))
|
|
4728
4732
|
throw new d(h("Must provide a topic."));
|
|
4729
|
-
if (!
|
|
4730
|
-
throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(
|
|
4733
|
+
if (!Dt[e])
|
|
4734
|
+
throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Dt).join(", ")}`));
|
|
4731
4735
|
if (typeof t != "object")
|
|
4732
4736
|
throw new d(h("context must be a context object or array of context objects."));
|
|
4733
4737
|
let n = Array.isArray(t) ? t : [t];
|
|
4734
|
-
return
|
|
4738
|
+
return Wi(e, n), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: me(), event: { "hub.topic": r4, "hub.event": e, context: n } };
|
|
4735
4739
|
}
|
|
4736
|
-
var
|
|
4740
|
+
var ze = class extends Ke {
|
|
4737
4741
|
constructor(t) {
|
|
4738
4742
|
super();
|
|
4739
4743
|
if (this.subRequest = t, !t.endpoint)
|
|
4740
4744
|
throw new d(h("Subscription request should contain an endpoint."));
|
|
4741
|
-
if (!
|
|
4745
|
+
if (!Je(t))
|
|
4742
4746
|
throw new d(h("Subscription request failed validation."));
|
|
4743
4747
|
let n = new WebSocket(t.endpoint);
|
|
4744
4748
|
n.addEventListener("open", () => {
|
|
@@ -4757,31 +4761,31 @@ var Ge = class extends We {
|
|
|
4757
4761
|
this.websocket.close();
|
|
4758
4762
|
}
|
|
4759
4763
|
};
|
|
4760
|
-
function
|
|
4761
|
-
let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t =
|
|
4764
|
+
function Gi(r4) {
|
|
4765
|
+
let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Br(e), n = Array.from(t).reduce((o, s) => {
|
|
4762
4766
|
let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
|
|
4763
4767
|
return `${o}%${a}`;
|
|
4764
4768
|
}, ""), i2 = decodeURIComponent(n);
|
|
4765
4769
|
return JSON.parse(i2);
|
|
4766
4770
|
}
|
|
4767
|
-
function
|
|
4771
|
+
function Wr(r4) {
|
|
4768
4772
|
return r4.split(".").length === 3;
|
|
4769
4773
|
}
|
|
4770
|
-
function
|
|
4774
|
+
function _t(r4) {
|
|
4771
4775
|
let [e, t, n] = r4.split(".");
|
|
4772
|
-
return
|
|
4776
|
+
return Gi(t);
|
|
4773
4777
|
}
|
|
4774
|
-
function
|
|
4778
|
+
function Gr(r4) {
|
|
4775
4779
|
try {
|
|
4776
|
-
return typeof
|
|
4780
|
+
return typeof _t(r4).login_id == "string";
|
|
4777
4781
|
} catch {
|
|
4778
4782
|
return false;
|
|
4779
4783
|
}
|
|
4780
4784
|
}
|
|
4781
|
-
var
|
|
4785
|
+
var Ki;
|
|
4782
4786
|
var C = class {
|
|
4783
4787
|
constructor(e) {
|
|
4784
|
-
this[
|
|
4788
|
+
this[Ki] = "ReadablePromise";
|
|
4785
4789
|
this.status = "pending";
|
|
4786
4790
|
this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
|
|
4787
4791
|
throw this.status = "error", this.error = t, t;
|
|
@@ -4813,10 +4817,10 @@ var C = class {
|
|
|
4813
4817
|
return this.suspender.finally(e);
|
|
4814
4818
|
}
|
|
4815
4819
|
};
|
|
4816
|
-
|
|
4817
|
-
var
|
|
4820
|
+
Ki = Symbol.toStringTag;
|
|
4821
|
+
var Ye = class {
|
|
4818
4822
|
constructor() {
|
|
4819
|
-
this.storage = typeof localStorage < "u" ? localStorage : new
|
|
4823
|
+
this.storage = typeof localStorage < "u" ? localStorage : new Ut();
|
|
4820
4824
|
}
|
|
4821
4825
|
clear() {
|
|
4822
4826
|
this.storage.clear();
|
|
@@ -4832,10 +4836,10 @@ var ze = class {
|
|
|
4832
4836
|
return t ? JSON.parse(t) : void 0;
|
|
4833
4837
|
}
|
|
4834
4838
|
setObject(e, t) {
|
|
4835
|
-
this.setString(e, t ?
|
|
4839
|
+
this.setString(e, t ? Gt(t) : void 0);
|
|
4836
4840
|
}
|
|
4837
4841
|
};
|
|
4838
|
-
var
|
|
4842
|
+
var Ut = class {
|
|
4839
4843
|
constructor() {
|
|
4840
4844
|
this.data = /* @__PURE__ */ new Map();
|
|
4841
4845
|
}
|
|
@@ -4858,20 +4862,21 @@ var Vt = class {
|
|
|
4858
4862
|
return Array.from(this.data.keys())[e];
|
|
4859
4863
|
}
|
|
4860
4864
|
};
|
|
4861
|
-
var
|
|
4862
|
-
var
|
|
4863
|
-
var
|
|
4864
|
-
var
|
|
4865
|
-
var Kr =
|
|
4866
|
-
var
|
|
4867
|
-
var
|
|
4868
|
-
var
|
|
4869
|
-
var
|
|
4865
|
+
var zi = O.FHIR_JSON + ", */*; q=0.1";
|
|
4866
|
+
var Ji = "https://api.medplum.com/";
|
|
4867
|
+
var Yi = 1e3;
|
|
4868
|
+
var Xi = 6e4;
|
|
4869
|
+
var Kr = "Binary/";
|
|
4870
|
+
var zr = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
|
|
4871
|
+
var Zi = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(Zi || {});
|
|
4872
|
+
var eo = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(eo || {});
|
|
4873
|
+
var to = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(to || {});
|
|
4874
|
+
var Jr = class extends he {
|
|
4870
4875
|
constructor(t) {
|
|
4871
4876
|
super();
|
|
4872
4877
|
if (t?.baseUrl && !t.baseUrl.startsWith("http"))
|
|
4873
4878
|
throw new Error("Base URL must start with http or https");
|
|
4874
|
-
if (this.options = t ?? {}, this.fetch = t?.fetch ??
|
|
4879
|
+
if (this.options = t ?? {}, this.fetch = t?.fetch ?? ro(), this.storage = t?.storage ?? new Ye(), this.createPdfImpl = t?.createPdf, this.baseUrl = Xr(t?.baseUrl ?? Ji), this.fhirBaseUrl = Xr(Xe(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = Xe(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = Xe(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = Xe(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Xi, this.cacheTime > 0 ? this.requestCache = new Ge(t?.resourceCacheSize ?? Yi) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
|
|
4875
4880
|
this.setAccessToken(t.accessToken);
|
|
4876
4881
|
else {
|
|
4877
4882
|
let n = this.getActiveLogin();
|
|
@@ -4928,7 +4933,7 @@ var zr = class extends fe {
|
|
|
4928
4933
|
return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
|
|
4929
4934
|
}
|
|
4930
4935
|
patch(t, n, i2 = {}) {
|
|
4931
|
-
return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2,
|
|
4936
|
+
return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, O.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
|
|
4932
4937
|
}
|
|
4933
4938
|
delete(t, n) {
|
|
4934
4939
|
return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
|
|
@@ -5016,7 +5021,7 @@ var zr = class extends fe {
|
|
|
5016
5021
|
let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
|
|
5017
5022
|
if (a)
|
|
5018
5023
|
return a.value;
|
|
5019
|
-
let c2 = new C(this.search(t, n, i2).then(
|
|
5024
|
+
let c2 = new C(this.search(t, n, i2).then(en));
|
|
5020
5025
|
return this.setCacheEntry(s, c2), c2;
|
|
5021
5026
|
}
|
|
5022
5027
|
async *searchResourcePages(t, n, i2) {
|
|
@@ -5025,7 +5030,7 @@ var zr = class extends fe {
|
|
|
5025
5030
|
let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((m2) => m2.relation === "next");
|
|
5026
5031
|
if (!a.entry?.length && !c2)
|
|
5027
5032
|
break;
|
|
5028
|
-
yield
|
|
5033
|
+
yield en(a), o = c2?.url ? new URL(c2.url) : void 0;
|
|
5029
5034
|
}
|
|
5030
5035
|
}
|
|
5031
5036
|
searchValueSet(t, n, i2) {
|
|
@@ -5041,7 +5046,7 @@ var zr = class extends fe {
|
|
|
5041
5046
|
if (!n)
|
|
5042
5047
|
return;
|
|
5043
5048
|
if (n === "system")
|
|
5044
|
-
return
|
|
5049
|
+
return zr;
|
|
5045
5050
|
let [i2, o] = n.split("/");
|
|
5046
5051
|
if (!(!i2 || !o))
|
|
5047
5052
|
return this.getCached(i2, o);
|
|
@@ -5054,12 +5059,12 @@ var zr = class extends fe {
|
|
|
5054
5059
|
if (!i2)
|
|
5055
5060
|
return new C(Promise.reject(new Error("Missing reference")));
|
|
5056
5061
|
if (i2 === "system")
|
|
5057
|
-
return new C(Promise.resolve(
|
|
5062
|
+
return new C(Promise.resolve(zr));
|
|
5058
5063
|
let [o, s] = i2.split("/");
|
|
5059
5064
|
return !o || !s ? new C(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
|
|
5060
5065
|
}
|
|
5061
5066
|
requestSchema(t) {
|
|
5062
|
-
if (
|
|
5067
|
+
if (Rr(t))
|
|
5063
5068
|
return Promise.resolve();
|
|
5064
5069
|
let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
|
|
5065
5070
|
if (i2)
|
|
@@ -5103,9 +5108,9 @@ var zr = class extends fe {
|
|
|
5103
5108
|
target
|
|
5104
5109
|
}
|
|
5105
5110
|
}`.replace(/\s+/g, " "), a = await this.graphql(s);
|
|
5106
|
-
|
|
5111
|
+
vr(a.data.StructureDefinitionList);
|
|
5107
5112
|
for (let c2 of a.data.SearchParameterList)
|
|
5108
|
-
|
|
5113
|
+
Et(c2);
|
|
5109
5114
|
})());
|
|
5110
5115
|
return this.setCacheEntry(n, o), o;
|
|
5111
5116
|
}
|
|
@@ -5185,28 +5190,28 @@ var zr = class extends fe {
|
|
|
5185
5190
|
return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
|
|
5186
5191
|
}
|
|
5187
5192
|
sendEmail(t, n) {
|
|
5188
|
-
return this.post("email/v1/send", t,
|
|
5193
|
+
return this.post("email/v1/send", t, O.JSON, n);
|
|
5189
5194
|
}
|
|
5190
5195
|
graphql(t, n, i2, o) {
|
|
5191
|
-
return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 },
|
|
5196
|
+
return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, O.JSON, o);
|
|
5192
5197
|
}
|
|
5193
5198
|
readResourceGraph(t, n, i2, o) {
|
|
5194
5199
|
return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
|
|
5195
5200
|
}
|
|
5196
|
-
pushToAgent(t, n, i2, o) {
|
|
5197
|
-
return this.post(this.fhirUrl("Agent", t
|
|
5201
|
+
pushToAgent(t, n, i2, o, s) {
|
|
5202
|
+
return this.post(this.fhirUrl("Agent", Ht(t), "$push"), { destination: se(n), body: i2, contentType: o }, O.FHIR_JSON, s);
|
|
5198
5203
|
}
|
|
5199
5204
|
getActiveLogin() {
|
|
5200
5205
|
return this.storage.getObject("activeLogin");
|
|
5201
5206
|
}
|
|
5202
5207
|
async setActiveLogin(t) {
|
|
5203
|
-
this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
|
|
5208
|
+
(!this.sessionDetails?.profile || se(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
|
|
5204
5209
|
}
|
|
5205
5210
|
getAccessToken() {
|
|
5206
5211
|
return this.accessToken;
|
|
5207
5212
|
}
|
|
5208
5213
|
setAccessToken(t, n) {
|
|
5209
|
-
this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer =
|
|
5214
|
+
this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Gr(t);
|
|
5210
5215
|
}
|
|
5211
5216
|
getLogins() {
|
|
5212
5217
|
return this.storage.getObject("logins") ?? [];
|
|
@@ -5218,7 +5223,9 @@ var zr = class extends fe {
|
|
|
5218
5223
|
async refreshProfile() {
|
|
5219
5224
|
return this.medplumServer ? (this.profilePromise = new Promise((t, n) => {
|
|
5220
5225
|
this.get("auth/me").then((i2) => {
|
|
5221
|
-
this.profilePromise = void 0
|
|
5226
|
+
this.profilePromise = void 0;
|
|
5227
|
+
let o = this.sessionDetails?.profile?.id !== i2.profile.id;
|
|
5228
|
+
this.sessionDetails = i2, o && this.dispatchEvent({ type: "change" }), t(i2.profile);
|
|
5222
5229
|
}).catch(n);
|
|
5223
5230
|
}), this.profilePromise) : Promise.resolve(void 0);
|
|
5224
5231
|
}
|
|
@@ -5252,11 +5259,11 @@ var zr = class extends fe {
|
|
|
5252
5259
|
async download(t, n = {}) {
|
|
5253
5260
|
this.refreshPromise && await this.refreshPromise;
|
|
5254
5261
|
let i2 = t.toString();
|
|
5255
|
-
return i2.startsWith(
|
|
5262
|
+
return i2.startsWith(Kr) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
|
|
5256
5263
|
}
|
|
5257
5264
|
async uploadMedia(t, n, i2, o, s) {
|
|
5258
5265
|
let a = await this.createBinary(t, i2, n);
|
|
5259
|
-
return this.createResource({
|
|
5266
|
+
return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: Kr + a.id, title: i2 }, ...o }, s);
|
|
5260
5267
|
}
|
|
5261
5268
|
async bulkExport(t = "", n, i2, o) {
|
|
5262
5269
|
let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
|
|
@@ -5268,7 +5275,7 @@ var zr = class extends fe {
|
|
|
5268
5275
|
i2.Prefer = "respond-async";
|
|
5269
5276
|
let o = await this.fetchWithRetry(t, n);
|
|
5270
5277
|
if (o.status === 202) {
|
|
5271
|
-
let s = await
|
|
5278
|
+
let s = await Zr(o);
|
|
5272
5279
|
if (s)
|
|
5273
5280
|
return this.pollStatus(s);
|
|
5274
5281
|
}
|
|
@@ -5302,7 +5309,7 @@ var zr = class extends fe {
|
|
|
5302
5309
|
return;
|
|
5303
5310
|
let a = t.headers.get("content-type")?.includes("json");
|
|
5304
5311
|
if (t.status === 404 && !a)
|
|
5305
|
-
throw new d(
|
|
5312
|
+
throw new d(pr);
|
|
5306
5313
|
let c2 = t.headers.get("content-location"), m2 = o.redirect ?? this.options.redirect;
|
|
5307
5314
|
if (t.status === 201 && c2 && m2 === "follow")
|
|
5308
5315
|
return this.request("GET", c2, { ...o, body: void 0 });
|
|
@@ -5316,7 +5323,7 @@ var zr = class extends fe {
|
|
|
5316
5323
|
else
|
|
5317
5324
|
p2 = await t.text();
|
|
5318
5325
|
if (t.status >= 400)
|
|
5319
|
-
throw new d(
|
|
5326
|
+
throw new d(gt(p2));
|
|
5320
5327
|
return p2;
|
|
5321
5328
|
}
|
|
5322
5329
|
async fetchWithRetry(t, n) {
|
|
@@ -5329,7 +5336,7 @@ var zr = class extends fe {
|
|
|
5329
5336
|
} catch (c2) {
|
|
5330
5337
|
this.retryCatch(a, i2, c2);
|
|
5331
5338
|
}
|
|
5332
|
-
await
|
|
5339
|
+
await ot(o);
|
|
5333
5340
|
}
|
|
5334
5341
|
return s;
|
|
5335
5342
|
}
|
|
@@ -5350,10 +5357,10 @@ var zr = class extends fe {
|
|
|
5350
5357
|
this.addFetchOptionsDefaults(s);
|
|
5351
5358
|
let a = await this.fetchWithRetry(t, s);
|
|
5352
5359
|
if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
|
|
5353
|
-
let c2 = await
|
|
5360
|
+
let c2 = await Zr(a);
|
|
5354
5361
|
c2 && (i2 = await this.fetchWithRetry(c2, s));
|
|
5355
5362
|
}
|
|
5356
|
-
await
|
|
5363
|
+
await ot(o);
|
|
5357
5364
|
}
|
|
5358
5365
|
return this.parseResponse(i2, "POST", t);
|
|
5359
5366
|
}
|
|
@@ -5364,19 +5371,19 @@ var zr = class extends fe {
|
|
|
5364
5371
|
try {
|
|
5365
5372
|
o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
|
|
5366
5373
|
} catch (s) {
|
|
5367
|
-
o.reject(new d(
|
|
5374
|
+
o.reject(new d(gt(s)));
|
|
5368
5375
|
}
|
|
5369
5376
|
return;
|
|
5370
5377
|
}
|
|
5371
5378
|
let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
|
|
5372
5379
|
for (let o = 0; o < t.length; o++) {
|
|
5373
5380
|
let s = t[o], a = i2.entry?.[o];
|
|
5374
|
-
a?.response?.outcome && !
|
|
5381
|
+
a?.response?.outcome && !yt(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
|
|
5375
5382
|
}
|
|
5376
5383
|
}
|
|
5377
5384
|
addFetchOptionsDefaults(t) {
|
|
5378
5385
|
let n = t.headers;
|
|
5379
|
-
n || (n = {}, t.headers = n), n.Accept =
|
|
5386
|
+
n || (n = {}, t.headers = n), n.Accept || (n.Accept = zi), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = O.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
|
|
5380
5387
|
}
|
|
5381
5388
|
setRequestContentType(t, n) {
|
|
5382
5389
|
t.headers || (t.headers = {});
|
|
@@ -5390,20 +5397,20 @@ var zr = class extends fe {
|
|
|
5390
5397
|
return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
|
|
5391
5398
|
}
|
|
5392
5399
|
async startPkce() {
|
|
5393
|
-
let t =
|
|
5400
|
+
let t = Ot();
|
|
5394
5401
|
sessionStorage.setItem("pkceState", t);
|
|
5395
|
-
let n =
|
|
5402
|
+
let n = Ot();
|
|
5396
5403
|
sessionStorage.setItem("codeVerifier", n);
|
|
5397
|
-
let i2 = await
|
|
5404
|
+
let i2 = await $r(n), o = Yt(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
|
|
5398
5405
|
return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
|
|
5399
5406
|
}
|
|
5400
5407
|
async requestAuthorization(t) {
|
|
5401
5408
|
let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
|
|
5402
|
-
i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ??
|
|
5409
|
+
i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Yr()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
|
|
5403
5410
|
}
|
|
5404
5411
|
processCode(t, n) {
|
|
5405
5412
|
let i2 = new URLSearchParams();
|
|
5406
|
-
if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ??
|
|
5413
|
+
if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Yr()), typeof sessionStorage < "u") {
|
|
5407
5414
|
let o = sessionStorage.getItem("codeVerifier");
|
|
5408
5415
|
o && i2.set("code_verifier", o);
|
|
5409
5416
|
}
|
|
@@ -5434,45 +5441,45 @@ var zr = class extends fe {
|
|
|
5434
5441
|
return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
|
|
5435
5442
|
}
|
|
5436
5443
|
setBasicAuth(t, n) {
|
|
5437
|
-
this.clientId = t, this.clientSecret = n, this.basicAuth =
|
|
5444
|
+
this.clientId = t, this.clientSecret = n, this.basicAuth = qr(t + ":" + n);
|
|
5438
5445
|
}
|
|
5439
5446
|
async fhircastSubscribe(t, n) {
|
|
5440
5447
|
if (!(typeof t == "string" && t !== ""))
|
|
5441
5448
|
throw new d(h("Invalid topic provided. Topic must be a valid string."));
|
|
5442
5449
|
if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
|
|
5443
5450
|
throw new d(h("Invalid events provided. Events must be an array of event names containing at least one event."));
|
|
5444
|
-
let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU2",
|
|
5451
|
+
let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU2", Vt(i2), O.FORM_URL_ENCODED))["hub.channel.endpoint"];
|
|
5445
5452
|
if (!s)
|
|
5446
5453
|
throw new Error("Invalid response!");
|
|
5447
5454
|
return i2.endpoint = s, i2;
|
|
5448
5455
|
}
|
|
5449
5456
|
async fhircastUnsubscribe(t) {
|
|
5450
|
-
if (!
|
|
5457
|
+
if (!Je(t))
|
|
5451
5458
|
throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
|
|
5452
5459
|
if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
|
|
5453
5460
|
throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
|
|
5454
|
-
t.mode = "unsubscribe", await this.post("/fhircast/STU2",
|
|
5461
|
+
t.mode = "unsubscribe", await this.post("/fhircast/STU2", Vt(t), O.FORM_URL_ENCODED);
|
|
5455
5462
|
}
|
|
5456
5463
|
fhircastConnect(t) {
|
|
5457
|
-
return new
|
|
5464
|
+
return new ze(t);
|
|
5458
5465
|
}
|
|
5459
5466
|
async fhircastPublish(t, n, i2) {
|
|
5460
|
-
return this.post(`/fhircast/STU2/${t}`,
|
|
5467
|
+
return this.post(`/fhircast/STU2/${t}`, Qr(t, n, i2), O.JSON);
|
|
5461
5468
|
}
|
|
5462
5469
|
async invite(t, n) {
|
|
5463
5470
|
return this.post("admin/projects/" + t + "/invite", n);
|
|
5464
5471
|
}
|
|
5465
5472
|
async fetchTokens(t) {
|
|
5466
|
-
let n = { method: "POST", headers: { "Content-Type":
|
|
5473
|
+
let n = { method: "POST", headers: { "Content-Type": O.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
|
|
5467
5474
|
this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
|
|
5468
5475
|
let o = await this.fetchWithRetry(this.tokenUrl, n);
|
|
5469
5476
|
if (!o.ok) {
|
|
5470
5477
|
this.clearActiveLogin();
|
|
5471
5478
|
try {
|
|
5472
5479
|
let a = await o.json();
|
|
5473
|
-
throw new d(
|
|
5480
|
+
throw new d(U(a.error_description));
|
|
5474
5481
|
} catch (a) {
|
|
5475
|
-
throw new d(
|
|
5482
|
+
throw new d(U("Failed to fetch tokens"), a);
|
|
5476
5483
|
}
|
|
5477
5484
|
}
|
|
5478
5485
|
let s = await o.json();
|
|
@@ -5480,8 +5487,8 @@ var zr = class extends fe {
|
|
|
5480
5487
|
}
|
|
5481
5488
|
async verifyTokens(t) {
|
|
5482
5489
|
let n = t.access_token;
|
|
5483
|
-
if (
|
|
5484
|
-
let i2 =
|
|
5490
|
+
if (Wr(n)) {
|
|
5491
|
+
let i2 = _t(n);
|
|
5485
5492
|
if (Date.now() >= i2.exp * 1e3)
|
|
5486
5493
|
throw this.clearActiveLogin(), new Error("Token expired");
|
|
5487
5494
|
if (i2.cid) {
|
|
@@ -5505,21 +5512,21 @@ var zr = class extends fe {
|
|
|
5505
5512
|
throw i2;
|
|
5506
5513
|
}
|
|
5507
5514
|
};
|
|
5508
|
-
function
|
|
5515
|
+
function ro() {
|
|
5509
5516
|
if (!globalThis.fetch)
|
|
5510
5517
|
throw new Error("Fetch not available in this environment");
|
|
5511
5518
|
return globalThis.fetch.bind(globalThis);
|
|
5512
5519
|
}
|
|
5513
|
-
function
|
|
5520
|
+
function Yr() {
|
|
5514
5521
|
return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
|
|
5515
5522
|
}
|
|
5516
|
-
function
|
|
5523
|
+
function Xr(r4) {
|
|
5517
5524
|
return r4.endsWith("/") ? r4 : r4 + "/";
|
|
5518
5525
|
}
|
|
5519
|
-
function
|
|
5526
|
+
function Xe(r4, e) {
|
|
5520
5527
|
return new URL(e, r4).toString();
|
|
5521
5528
|
}
|
|
5522
|
-
async function
|
|
5529
|
+
async function Zr(r4) {
|
|
5523
5530
|
let e = r4.headers.get("content-location");
|
|
5524
5531
|
if (e)
|
|
5525
5532
|
return e;
|
|
@@ -5527,17 +5534,17 @@ async function Xr(r4) {
|
|
|
5527
5534
|
if (t)
|
|
5528
5535
|
return t;
|
|
5529
5536
|
let n = await r4.json();
|
|
5530
|
-
if (
|
|
5537
|
+
if (ke(n) && n.issue?.[0]?.diagnostics)
|
|
5531
5538
|
return n.issue[0].diagnostics;
|
|
5532
5539
|
}
|
|
5533
|
-
function
|
|
5540
|
+
function en(r4) {
|
|
5534
5541
|
let e = r4.entry?.map((t) => t.resource) ?? [];
|
|
5535
5542
|
return Object.assign(e, { bundle: r4 });
|
|
5536
5543
|
}
|
|
5537
|
-
var
|
|
5538
|
-
var
|
|
5539
|
-
var
|
|
5540
|
-
var
|
|
5544
|
+
var no = [...le, "->", "<<", ">>"];
|
|
5545
|
+
var io = de().registerInfix("->", { precedence: f.Arrow }).registerInfix(";", { precedence: f.Semicolon });
|
|
5546
|
+
var oo = [...le, "eq", "ne", "co"];
|
|
5547
|
+
var co = de();
|
|
5541
5548
|
var G = class {
|
|
5542
5549
|
constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
|
|
5543
5550
|
this.segmentSeparator = e;
|
|
@@ -5554,7 +5561,7 @@ var G = class {
|
|
|
5554
5561
|
return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
|
|
5555
5562
|
}
|
|
5556
5563
|
};
|
|
5557
|
-
var
|
|
5564
|
+
var on = class r {
|
|
5558
5565
|
constructor(e, t = new G()) {
|
|
5559
5566
|
this.context = t, this.segments = e;
|
|
5560
5567
|
}
|
|
@@ -5578,7 +5585,7 @@ var nn = class r {
|
|
|
5578
5585
|
}
|
|
5579
5586
|
buildAck() {
|
|
5580
5587
|
let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i2 = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a = t?.getField(10)?.toString() ?? "", c2 = t?.getField(12)?.toString() ?? "2.5.1";
|
|
5581
|
-
return new r([new
|
|
5588
|
+
return new r([new ye(["MSH", this.context.getMsh2(), o, s, n, i2, lo(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new ye(["MSA", "AA", a, "OK"], this.context)]);
|
|
5582
5589
|
}
|
|
5583
5590
|
buildAckMessageType(e) {
|
|
5584
5591
|
let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
|
|
@@ -5590,12 +5597,12 @@ var nn = class r {
|
|
|
5590
5597
|
throw n.type = "entity.parse.failed", n;
|
|
5591
5598
|
}
|
|
5592
5599
|
let t = new G("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
|
|
5593
|
-
return new r(e.split(/[\r\n]+/).map((n) =>
|
|
5600
|
+
return new r(e.split(/[\r\n]+/).map((n) => ye.parse(n, t)), t);
|
|
5594
5601
|
}
|
|
5595
5602
|
};
|
|
5596
|
-
var
|
|
5603
|
+
var ye = class r2 {
|
|
5597
5604
|
constructor(e, t = new G()) {
|
|
5598
|
-
this.context = t,
|
|
5605
|
+
this.context = t, Kt(e) ? this.fields = e.map((n) => oe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
|
|
5599
5606
|
}
|
|
5600
5607
|
get(e) {
|
|
5601
5608
|
return this.fields[e];
|
|
@@ -5639,13 +5646,14 @@ var oe = class r3 {
|
|
|
5639
5646
|
return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
|
|
5640
5647
|
}
|
|
5641
5648
|
};
|
|
5642
|
-
function
|
|
5649
|
+
function lo(r4) {
|
|
5643
5650
|
let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
|
|
5644
5651
|
return i2 > 0 && (n += "." + i2.toString()), n;
|
|
5645
5652
|
}
|
|
5646
5653
|
|
|
5647
5654
|
// ../hl7/dist/esm/index.mjs
|
|
5648
|
-
var import_net =
|
|
5655
|
+
var import_net = require("net");
|
|
5656
|
+
var import_net2 = __toESM(require("net"), 1);
|
|
5649
5657
|
var i = class extends EventTarget {
|
|
5650
5658
|
addEventListener(n, e, t) {
|
|
5651
5659
|
super.addEventListener(n, e, t);
|
|
@@ -5679,7 +5687,7 @@ var c = class extends i {
|
|
|
5679
5687
|
e.on("data", (s) => {
|
|
5680
5688
|
try {
|
|
5681
5689
|
if (o += s.toString(), o.endsWith(p + v2)) {
|
|
5682
|
-
let r4 =
|
|
5690
|
+
let r4 = on.parse(o.substring(1, o.length - 2));
|
|
5683
5691
|
this.dispatchEvent(new d2(this, r4)), o = "";
|
|
5684
5692
|
}
|
|
5685
5693
|
} catch (r4) {
|
|
@@ -5705,12 +5713,34 @@ var c = class extends i {
|
|
|
5705
5713
|
this.socket.end(), this.socket.destroy();
|
|
5706
5714
|
}
|
|
5707
5715
|
};
|
|
5716
|
+
var h2 = class extends i {
|
|
5717
|
+
constructor(e) {
|
|
5718
|
+
super();
|
|
5719
|
+
this.options = e, this.host = this.options.host, this.port = this.options.port;
|
|
5720
|
+
}
|
|
5721
|
+
connect() {
|
|
5722
|
+
return this.connection ? Promise.resolve(this.connection) : new Promise((e) => {
|
|
5723
|
+
let t = (0, import_net.connect)({ host: this.host, port: this.port }, () => {
|
|
5724
|
+
this.connection = new c(t), e(this.connection);
|
|
5725
|
+
});
|
|
5726
|
+
});
|
|
5727
|
+
}
|
|
5728
|
+
async send(e) {
|
|
5729
|
+
return (await this.connect()).send(e);
|
|
5730
|
+
}
|
|
5731
|
+
async sendAndWait(e) {
|
|
5732
|
+
return (await this.connect()).sendAndWait(e);
|
|
5733
|
+
}
|
|
5734
|
+
close() {
|
|
5735
|
+
this.connection && (this.connection.close(), delete this.connection);
|
|
5736
|
+
}
|
|
5737
|
+
};
|
|
5708
5738
|
var E2 = class {
|
|
5709
5739
|
constructor(n) {
|
|
5710
5740
|
this.handler = n;
|
|
5711
5741
|
}
|
|
5712
5742
|
start(n, e) {
|
|
5713
|
-
let t =
|
|
5743
|
+
let t = import_net2.default.createServer((o) => {
|
|
5714
5744
|
let s = new c(o, e);
|
|
5715
5745
|
this.handler(s);
|
|
5716
5746
|
});
|
|
@@ -5734,80 +5764,28 @@ var App = class {
|
|
|
5734
5764
|
constructor(medplum, agentId) {
|
|
5735
5765
|
this.medplum = medplum;
|
|
5736
5766
|
this.agentId = agentId;
|
|
5767
|
+
this.webSocketQueue = [];
|
|
5768
|
+
this.channels = /* @__PURE__ */ new Map();
|
|
5769
|
+
this.hl7Queue = [];
|
|
5770
|
+
this.live = false;
|
|
5737
5771
|
this.log = {
|
|
5738
5772
|
info: console.log,
|
|
5739
5773
|
warn: console.warn,
|
|
5740
5774
|
error: console.error
|
|
5741
5775
|
};
|
|
5742
|
-
this.channels = [];
|
|
5743
|
-
}
|
|
5744
|
-
async start() {
|
|
5745
|
-
this.log.info("Medplum service starting...");
|
|
5746
|
-
const agent = await this.medplum.readResource("Agent", this.agentId);
|
|
5747
|
-
for (const definition of agent.channel) {
|
|
5748
|
-
const endpoint = await this.medplum.readReference(definition.endpoint);
|
|
5749
|
-
const channel = new AgentHl7Channel(this, definition, endpoint);
|
|
5750
|
-
channel.start();
|
|
5751
|
-
this.channels.push(channel);
|
|
5752
|
-
}
|
|
5753
|
-
this.log.info("Medplum service started successfully");
|
|
5754
|
-
}
|
|
5755
|
-
stop() {
|
|
5756
|
-
this.log.info("Medplum service stopping...");
|
|
5757
|
-
this.channels.forEach((channel) => channel.stop());
|
|
5758
|
-
this.log.info("Medplum service stopped successfully");
|
|
5759
|
-
}
|
|
5760
|
-
};
|
|
5761
|
-
var AgentHl7Channel = class {
|
|
5762
|
-
constructor(app, definition, endpoint) {
|
|
5763
|
-
this.app = app;
|
|
5764
|
-
this.definition = definition;
|
|
5765
|
-
this.endpoint = endpoint;
|
|
5766
|
-
this.connections = [];
|
|
5767
|
-
this.server = new E2((connection) => {
|
|
5768
|
-
this.app.log.info("HL7 connection established");
|
|
5769
|
-
this.connections.push(new AgentHl7ChannelConnection(this, connection));
|
|
5770
|
-
});
|
|
5771
|
-
}
|
|
5772
|
-
start() {
|
|
5773
|
-
const address = new URL(this.endpoint.address);
|
|
5774
|
-
this.app.log.info(`Channel starting on ${address}`);
|
|
5775
|
-
this.server.start(parseInt(address.port, 10));
|
|
5776
|
-
this.app.log.info("Channel started successfully");
|
|
5777
|
-
}
|
|
5778
|
-
stop() {
|
|
5779
|
-
this.app.log.info("Channel stopping...");
|
|
5780
|
-
for (const connection of this.connections) {
|
|
5781
|
-
connection.close();
|
|
5782
|
-
}
|
|
5783
|
-
this.server.stop();
|
|
5784
|
-
this.app.log.info("Channel stopped successfully");
|
|
5785
|
-
}
|
|
5786
|
-
};
|
|
5787
|
-
var AgentHl7ChannelConnection = class {
|
|
5788
|
-
constructor(channel, hl7Connection) {
|
|
5789
|
-
this.channel = channel;
|
|
5790
|
-
this.hl7Connection = hl7Connection;
|
|
5791
|
-
this.webSocketQueue = [];
|
|
5792
|
-
this.hl7ConnectionQueue = [];
|
|
5793
|
-
this.live = false;
|
|
5794
|
-
const app = channel.app;
|
|
5795
|
-
const medplum = app.medplum;
|
|
5796
|
-
this.hl7Connection.addEventListener("message", (event) => this.handler(event));
|
|
5797
5776
|
const webSocketUrl = new URL(medplum.getBaseUrl());
|
|
5798
5777
|
webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
5799
5778
|
webSocketUrl.pathname = "/ws/agent";
|
|
5800
|
-
|
|
5779
|
+
this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
|
|
5801
5780
|
this.webSocket = new wrapper_default(webSocketUrl);
|
|
5802
5781
|
this.webSocket.binaryType = "nodebuffer";
|
|
5803
|
-
this.webSocket.addEventListener("error",
|
|
5782
|
+
this.webSocket.addEventListener("error", (err) => this.log.error(err.message));
|
|
5804
5783
|
this.webSocket.addEventListener("open", () => {
|
|
5805
5784
|
this.webSocket.send(
|
|
5806
5785
|
JSON.stringify({
|
|
5807
5786
|
type: "connect",
|
|
5808
5787
|
accessToken: medplum.getAccessToken(),
|
|
5809
|
-
agentId
|
|
5810
|
-
botId: So(channel.definition.targetReference)
|
|
5788
|
+
agentId
|
|
5811
5789
|
})
|
|
5812
5790
|
);
|
|
5813
5791
|
});
|
|
@@ -5815,7 +5793,7 @@ var AgentHl7ChannelConnection = class {
|
|
|
5815
5793
|
try {
|
|
5816
5794
|
const data = e.data;
|
|
5817
5795
|
const str = data.toString("utf8");
|
|
5818
|
-
|
|
5796
|
+
this.log.info(`Received from WebSocket: ${str.replaceAll("\r", "\n")}`);
|
|
5819
5797
|
const command = JSON.parse(str);
|
|
5820
5798
|
switch (command.type) {
|
|
5821
5799
|
case "connected":
|
|
@@ -5823,24 +5801,40 @@ var AgentHl7ChannelConnection = class {
|
|
|
5823
5801
|
this.trySendToWebSocket();
|
|
5824
5802
|
break;
|
|
5825
5803
|
case "transmit":
|
|
5826
|
-
this.
|
|
5827
|
-
|
|
5804
|
+
this.addToHl7Queue(command);
|
|
5805
|
+
break;
|
|
5806
|
+
case "push":
|
|
5807
|
+
this.pushMessage(command);
|
|
5828
5808
|
break;
|
|
5829
5809
|
}
|
|
5830
5810
|
} catch (err) {
|
|
5831
|
-
|
|
5811
|
+
this.log.error(`WebSocket error: ${$n(err)}`);
|
|
5832
5812
|
}
|
|
5833
5813
|
});
|
|
5834
5814
|
}
|
|
5835
|
-
async
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
this.
|
|
5840
|
-
this
|
|
5841
|
-
|
|
5842
|
-
|
|
5815
|
+
async start() {
|
|
5816
|
+
this.log.info("Medplum service starting...");
|
|
5817
|
+
const agent = await this.medplum.readResource("Agent", this.agentId);
|
|
5818
|
+
for (const definition of agent.channel) {
|
|
5819
|
+
const endpoint = await this.medplum.readReference(definition.endpoint);
|
|
5820
|
+
const channel = new AgentHl7Channel(this, definition, endpoint);
|
|
5821
|
+
channel.start();
|
|
5822
|
+
this.channels.set(definition.name, channel);
|
|
5843
5823
|
}
|
|
5824
|
+
this.log.info("Medplum service started successfully");
|
|
5825
|
+
}
|
|
5826
|
+
stop() {
|
|
5827
|
+
this.log.info("Medplum service stopping...");
|
|
5828
|
+
this.channels.forEach((channel) => channel.stop());
|
|
5829
|
+
this.log.info("Medplum service stopped successfully");
|
|
5830
|
+
}
|
|
5831
|
+
addToWebSocketQueue(message) {
|
|
5832
|
+
this.webSocketQueue.push(message);
|
|
5833
|
+
this.trySendToWebSocket();
|
|
5834
|
+
}
|
|
5835
|
+
addToHl7Queue(message) {
|
|
5836
|
+
this.hl7Queue.push(message);
|
|
5837
|
+
this.trySendToHl7Connection();
|
|
5844
5838
|
}
|
|
5845
5839
|
trySendToWebSocket() {
|
|
5846
5840
|
if (this.live) {
|
|
@@ -5850,8 +5844,8 @@ var AgentHl7ChannelConnection = class {
|
|
|
5850
5844
|
this.webSocket.send(
|
|
5851
5845
|
JSON.stringify({
|
|
5852
5846
|
type: "transmit",
|
|
5853
|
-
|
|
5854
|
-
|
|
5847
|
+
accessToken: this.medplum.getAccessToken(),
|
|
5848
|
+
...msg
|
|
5855
5849
|
})
|
|
5856
5850
|
);
|
|
5857
5851
|
}
|
|
@@ -5859,16 +5853,82 @@ var AgentHl7ChannelConnection = class {
|
|
|
5859
5853
|
}
|
|
5860
5854
|
}
|
|
5861
5855
|
trySendToHl7Connection() {
|
|
5862
|
-
while (this.
|
|
5863
|
-
const msg = this.
|
|
5856
|
+
while (this.hl7Queue.length > 0) {
|
|
5857
|
+
const msg = this.hl7Queue.shift();
|
|
5864
5858
|
if (msg) {
|
|
5865
|
-
this.
|
|
5859
|
+
const channel = this.channels.get(msg.channel);
|
|
5860
|
+
if (channel) {
|
|
5861
|
+
const connection = channel.connections.get(msg.remote);
|
|
5862
|
+
if (connection) {
|
|
5863
|
+
connection.hl7Connection.send(on.parse(msg.body));
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
5866
|
}
|
|
5867
5867
|
}
|
|
5868
5868
|
}
|
|
5869
|
+
pushMessage(message) {
|
|
5870
|
+
const address = new URL(message.remote);
|
|
5871
|
+
const client = new h2({
|
|
5872
|
+
host: address.hostname,
|
|
5873
|
+
port: parseInt(address.port, 10)
|
|
5874
|
+
});
|
|
5875
|
+
client.sendAndWait(on.parse(message.body)).then((response) => {
|
|
5876
|
+
this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
|
|
5877
|
+
}).catch((err) => {
|
|
5878
|
+
this.log.error(`HL7 error: ${$n(err)}`);
|
|
5879
|
+
}).finally(() => {
|
|
5880
|
+
client.close();
|
|
5881
|
+
});
|
|
5882
|
+
}
|
|
5883
|
+
};
|
|
5884
|
+
var AgentHl7Channel = class {
|
|
5885
|
+
constructor(app, definition, endpoint) {
|
|
5886
|
+
this.app = app;
|
|
5887
|
+
this.definition = definition;
|
|
5888
|
+
this.endpoint = endpoint;
|
|
5889
|
+
this.connections = /* @__PURE__ */ new Map();
|
|
5890
|
+
this.server = new E2((connection) => this.handleNewConnection(connection));
|
|
5891
|
+
}
|
|
5892
|
+
start() {
|
|
5893
|
+
const address = new URL(this.endpoint.address);
|
|
5894
|
+
this.app.log.info(`Channel starting on ${address}`);
|
|
5895
|
+
this.server.start(parseInt(address.port, 10));
|
|
5896
|
+
this.app.log.info("Channel started successfully");
|
|
5897
|
+
}
|
|
5898
|
+
stop() {
|
|
5899
|
+
this.app.log.info("Channel stopping...");
|
|
5900
|
+
this.connections.forEach((connection) => connection.close());
|
|
5901
|
+
this.server.stop();
|
|
5902
|
+
this.app.log.info("Channel stopped successfully");
|
|
5903
|
+
}
|
|
5904
|
+
handleNewConnection(connection) {
|
|
5905
|
+
const c2 = new AgentHl7ChannelConnection(this, connection);
|
|
5906
|
+
this.app.log.info(`HL7 connection established: ${c2.remote}`);
|
|
5907
|
+
this.connections.set(c2.remote, c2);
|
|
5908
|
+
}
|
|
5909
|
+
};
|
|
5910
|
+
var AgentHl7ChannelConnection = class {
|
|
5911
|
+
constructor(channel, hl7Connection) {
|
|
5912
|
+
this.channel = channel;
|
|
5913
|
+
this.hl7Connection = hl7Connection;
|
|
5914
|
+
this.remote = `${hl7Connection.socket.remoteAddress}:${hl7Connection.socket.remotePort}`;
|
|
5915
|
+
this.hl7Connection.addEventListener("message", (event) => this.handler(event));
|
|
5916
|
+
}
|
|
5917
|
+
async handler(event) {
|
|
5918
|
+
try {
|
|
5919
|
+
this.channel.app.log.info("Received:");
|
|
5920
|
+
this.channel.app.log.info(event.message.toString().replaceAll("\r", "\n"));
|
|
5921
|
+
this.channel.app.addToWebSocketQueue({
|
|
5922
|
+
channel: this.channel.definition.name,
|
|
5923
|
+
remote: this.remote,
|
|
5924
|
+
body: event.message.toString()
|
|
5925
|
+
});
|
|
5926
|
+
} catch (err) {
|
|
5927
|
+
this.channel.app.log.error(`HL7 error: ${$n(err)}`);
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5869
5930
|
close() {
|
|
5870
5931
|
this.hl7Connection.close();
|
|
5871
|
-
this.webSocket.close();
|
|
5872
5932
|
}
|
|
5873
5933
|
};
|
|
5874
5934
|
if (typeof require !== "undefined" && require.main === module) {
|
|
@@ -5877,7 +5937,7 @@ if (typeof require !== "undefined" && require.main === module) {
|
|
|
5877
5937
|
process.exit(1);
|
|
5878
5938
|
}
|
|
5879
5939
|
const [_node, _script, baseUrl, clientId, clientSecret, agentId] = process.argv;
|
|
5880
|
-
const medplum = new
|
|
5940
|
+
const medplum = new Jr({ baseUrl, clientId });
|
|
5881
5941
|
medplum.startClientLogin(clientId, clientSecret).then(() => new App(medplum, agentId).start()).catch(console.error);
|
|
5882
5942
|
}
|
|
5883
5943
|
// Annotate the CommonJS export names for ESM import in node:
|