@medplum/agent 5.1.29 → 5.1.30
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 +428 -427
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -4528,8 +4528,8 @@ var require_lt = __commonJS({
|
|
|
4528
4528
|
"node_modules/semver/functions/lt.js"(exports2, module2) {
|
|
4529
4529
|
"use strict";
|
|
4530
4530
|
var compare = require_compare();
|
|
4531
|
-
var
|
|
4532
|
-
module2.exports =
|
|
4531
|
+
var lt3 = (a, b2, loose) => compare(a, b2, loose) < 0;
|
|
4532
|
+
module2.exports = lt3;
|
|
4533
4533
|
}
|
|
4534
4534
|
});
|
|
4535
4535
|
|
|
@@ -4581,7 +4581,7 @@ var require_cmp = __commonJS({
|
|
|
4581
4581
|
var neq = require_neq();
|
|
4582
4582
|
var gt2 = require_gt();
|
|
4583
4583
|
var gte = require_gte();
|
|
4584
|
-
var
|
|
4584
|
+
var lt3 = require_lt();
|
|
4585
4585
|
var lte = require_lte();
|
|
4586
4586
|
var cmp = (a, op, b2, loose) => {
|
|
4587
4587
|
switch (op) {
|
|
@@ -4612,7 +4612,7 @@ var require_cmp = __commonJS({
|
|
|
4612
4612
|
case ">=":
|
|
4613
4613
|
return gte(a, b2, loose);
|
|
4614
4614
|
case "<":
|
|
4615
|
-
return
|
|
4615
|
+
return lt3(a, b2, loose);
|
|
4616
4616
|
case "<=":
|
|
4617
4617
|
return lte(a, b2, loose);
|
|
4618
4618
|
default:
|
|
@@ -5416,7 +5416,7 @@ var require_outside = __commonJS({
|
|
|
5416
5416
|
var Range = require_range();
|
|
5417
5417
|
var satisfies = require_satisfies();
|
|
5418
5418
|
var gt2 = require_gt();
|
|
5419
|
-
var
|
|
5419
|
+
var lt3 = require_lt();
|
|
5420
5420
|
var lte = require_lte();
|
|
5421
5421
|
var gte = require_gte();
|
|
5422
5422
|
var outside = (version, range, hilo, options) => {
|
|
@@ -5427,12 +5427,12 @@ var require_outside = __commonJS({
|
|
|
5427
5427
|
case ">":
|
|
5428
5428
|
gtfn = gt2;
|
|
5429
5429
|
ltefn = lte;
|
|
5430
|
-
ltfn =
|
|
5430
|
+
ltfn = lt3;
|
|
5431
5431
|
comp = ">";
|
|
5432
5432
|
ecomp = ">=";
|
|
5433
5433
|
break;
|
|
5434
5434
|
case "<":
|
|
5435
|
-
gtfn =
|
|
5435
|
+
gtfn = lt3;
|
|
5436
5436
|
ltefn = gte;
|
|
5437
5437
|
ltfn = gt2;
|
|
5438
5438
|
comp = "<";
|
|
@@ -5612,12 +5612,12 @@ var require_subset = __commonJS({
|
|
|
5612
5612
|
}
|
|
5613
5613
|
}
|
|
5614
5614
|
const eqSet = /* @__PURE__ */ new Set();
|
|
5615
|
-
let gt2,
|
|
5615
|
+
let gt2, lt3;
|
|
5616
5616
|
for (const c2 of sub2) {
|
|
5617
5617
|
if (c2.operator === ">" || c2.operator === ">=") {
|
|
5618
5618
|
gt2 = higherGT(gt2, c2, options);
|
|
5619
5619
|
} else if (c2.operator === "<" || c2.operator === "<=") {
|
|
5620
|
-
|
|
5620
|
+
lt3 = lowerLT(lt3, c2, options);
|
|
5621
5621
|
} else {
|
|
5622
5622
|
eqSet.add(c2.semver);
|
|
5623
5623
|
}
|
|
@@ -5626,11 +5626,11 @@ var require_subset = __commonJS({
|
|
|
5626
5626
|
return null;
|
|
5627
5627
|
}
|
|
5628
5628
|
let gtltComp;
|
|
5629
|
-
if (gt2 &&
|
|
5630
|
-
gtltComp = compare(gt2.semver,
|
|
5629
|
+
if (gt2 && lt3) {
|
|
5630
|
+
gtltComp = compare(gt2.semver, lt3.semver, options);
|
|
5631
5631
|
if (gtltComp > 0) {
|
|
5632
5632
|
return null;
|
|
5633
|
-
} else if (gtltComp === 0 && (gt2.operator !== ">=" ||
|
|
5633
|
+
} else if (gtltComp === 0 && (gt2.operator !== ">=" || lt3.operator !== "<=")) {
|
|
5634
5634
|
return null;
|
|
5635
5635
|
}
|
|
5636
5636
|
}
|
|
@@ -5638,7 +5638,7 @@ var require_subset = __commonJS({
|
|
|
5638
5638
|
if (gt2 && !satisfies(eq, String(gt2), options)) {
|
|
5639
5639
|
return null;
|
|
5640
5640
|
}
|
|
5641
|
-
if (
|
|
5641
|
+
if (lt3 && !satisfies(eq, String(lt3), options)) {
|
|
5642
5642
|
return null;
|
|
5643
5643
|
}
|
|
5644
5644
|
for (const c2 of dom) {
|
|
@@ -5650,9 +5650,9 @@ var require_subset = __commonJS({
|
|
|
5650
5650
|
}
|
|
5651
5651
|
let higher, lower;
|
|
5652
5652
|
let hasDomLT, hasDomGT;
|
|
5653
|
-
let needDomLTPre =
|
|
5653
|
+
let needDomLTPre = lt3 && !options.includePrerelease && lt3.semver.prerelease.length ? lt3.semver : false;
|
|
5654
5654
|
let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false;
|
|
5655
|
-
if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
|
|
5655
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt3.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
5656
5656
|
needDomLTPre = false;
|
|
5657
5657
|
}
|
|
5658
5658
|
for (const c2 of dom) {
|
|
@@ -5673,29 +5673,29 @@ var require_subset = __commonJS({
|
|
|
5673
5673
|
return false;
|
|
5674
5674
|
}
|
|
5675
5675
|
}
|
|
5676
|
-
if (
|
|
5676
|
+
if (lt3) {
|
|
5677
5677
|
if (needDomLTPre) {
|
|
5678
5678
|
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
|
|
5679
5679
|
needDomLTPre = false;
|
|
5680
5680
|
}
|
|
5681
5681
|
}
|
|
5682
5682
|
if (c2.operator === "<" || c2.operator === "<=") {
|
|
5683
|
-
lower = lowerLT(
|
|
5684
|
-
if (lower === c2 && lower !==
|
|
5683
|
+
lower = lowerLT(lt3, c2, options);
|
|
5684
|
+
if (lower === c2 && lower !== lt3) {
|
|
5685
5685
|
return false;
|
|
5686
5686
|
}
|
|
5687
|
-
} else if (
|
|
5687
|
+
} else if (lt3.operator === "<=" && !c2.test(lt3.semver)) {
|
|
5688
5688
|
return false;
|
|
5689
5689
|
}
|
|
5690
5690
|
}
|
|
5691
|
-
if (!c2.operator && (
|
|
5691
|
+
if (!c2.operator && (lt3 || gt2) && gtltComp !== 0) {
|
|
5692
5692
|
return false;
|
|
5693
5693
|
}
|
|
5694
5694
|
}
|
|
5695
|
-
if (gt2 && hasDomLT && !
|
|
5695
|
+
if (gt2 && hasDomLT && !lt3 && gtltComp !== 0) {
|
|
5696
5696
|
return false;
|
|
5697
5697
|
}
|
|
5698
|
-
if (
|
|
5698
|
+
if (lt3 && hasDomGT && !gt2 && gtltComp !== 0) {
|
|
5699
5699
|
return false;
|
|
5700
5700
|
}
|
|
5701
5701
|
if (needDomGTPre || needDomLTPre) {
|
|
@@ -5745,7 +5745,7 @@ var require_semver2 = __commonJS({
|
|
|
5745
5745
|
var sort = require_sort();
|
|
5746
5746
|
var rsort = require_rsort();
|
|
5747
5747
|
var gt2 = require_gt();
|
|
5748
|
-
var
|
|
5748
|
+
var lt3 = require_lt();
|
|
5749
5749
|
var eq = require_eq();
|
|
5750
5750
|
var neq = require_neq();
|
|
5751
5751
|
var gte = require_gte();
|
|
@@ -5784,7 +5784,7 @@ var require_semver2 = __commonJS({
|
|
|
5784
5784
|
sort,
|
|
5785
5785
|
rsort,
|
|
5786
5786
|
gt: gt2,
|
|
5787
|
-
lt:
|
|
5787
|
+
lt: lt3,
|
|
5788
5788
|
eq,
|
|
5789
5789
|
neq,
|
|
5790
5790
|
gte,
|
|
@@ -24450,7 +24450,7 @@ var require_dcmjs = __commonJS({
|
|
|
24450
24450
|
* @param {Number[6]} iop - ImageOrientationPatient
|
|
24451
24451
|
* @returns {Number[6]} The transformed ImageOrientationPatient
|
|
24452
24452
|
*/
|
|
24453
|
-
hv: function
|
|
24453
|
+
hv: function hv3(iop) {
|
|
24454
24454
|
return [-iop[0], -iop[1], -iop[2], -iop[3], -iop[4], -iop[5]];
|
|
24455
24455
|
}
|
|
24456
24456
|
};
|
|
@@ -31276,7 +31276,7 @@ var require_dcmjs = __commonJS({
|
|
|
31276
31276
|
__proto__: null,
|
|
31277
31277
|
Comprehensive3DSR: Comprehensive3DSR3
|
|
31278
31278
|
});
|
|
31279
|
-
var
|
|
31279
|
+
var sr3 = {
|
|
31280
31280
|
coding: coding2,
|
|
31281
31281
|
contentItems: contentItems2,
|
|
31282
31282
|
documents: documents2,
|
|
@@ -31593,7 +31593,7 @@ var require_dcmjs = __commonJS({
|
|
|
31593
31593
|
data: data3,
|
|
31594
31594
|
derivations: derivations2,
|
|
31595
31595
|
normalizers: normalizers2,
|
|
31596
|
-
sr:
|
|
31596
|
+
sr: sr3,
|
|
31597
31597
|
utilities: utilities2,
|
|
31598
31598
|
log: log3,
|
|
31599
31599
|
anonymizer: anonymizer2,
|
|
@@ -31613,7 +31613,7 @@ var require_dcmjs = __commonJS({
|
|
|
31613
31613
|
exports3.derivations = derivations2;
|
|
31614
31614
|
exports3.log = log3;
|
|
31615
31615
|
exports3.normalizers = normalizers2;
|
|
31616
|
-
exports3.sr =
|
|
31616
|
+
exports3.sr = sr3;
|
|
31617
31617
|
exports3.utilities = utilities2;
|
|
31618
31618
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
31619
31619
|
}));
|
|
@@ -46120,7 +46120,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
46120
46120
|
* @param {Number[6]} iop - ImageOrientationPatient
|
|
46121
46121
|
* @returns {Number[6]} The transformed ImageOrientationPatient
|
|
46122
46122
|
*/
|
|
46123
|
-
hv: function
|
|
46123
|
+
hv: function hv3(iop) {
|
|
46124
46124
|
return [-iop[0], -iop[1], -iop[2], -iop[3], -iop[4], -iop[5]];
|
|
46125
46125
|
}
|
|
46126
46126
|
};
|
|
@@ -52946,7 +52946,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
52946
52946
|
__proto__: null,
|
|
52947
52947
|
Comprehensive3DSR: Comprehensive3DSR3
|
|
52948
52948
|
});
|
|
52949
|
-
var
|
|
52949
|
+
var sr3 = {
|
|
52950
52950
|
coding: coding2,
|
|
52951
52951
|
contentItems: contentItems2,
|
|
52952
52952
|
documents: documents2,
|
|
@@ -53263,7 +53263,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
53263
53263
|
data: data3,
|
|
53264
53264
|
derivations: derivations2,
|
|
53265
53265
|
normalizers: normalizers2,
|
|
53266
|
-
sr:
|
|
53266
|
+
sr: sr3,
|
|
53267
53267
|
utilities: utilities2,
|
|
53268
53268
|
log: log3,
|
|
53269
53269
|
anonymizer: anonymizer2,
|
|
@@ -53283,7 +53283,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
53283
53283
|
exports3.derivations = derivations2;
|
|
53284
53284
|
exports3.log = log3;
|
|
53285
53285
|
exports3.normalizers = normalizers2;
|
|
53286
|
-
exports3.sr =
|
|
53286
|
+
exports3.sr = sr3;
|
|
53287
53287
|
exports3.utilities = utilities2;
|
|
53288
53288
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
53289
53289
|
}));
|
|
@@ -74475,7 +74475,7 @@ var ee = class {
|
|
|
74475
74475
|
return this.cache.keys().next().value;
|
|
74476
74476
|
}
|
|
74477
74477
|
};
|
|
74478
|
-
var
|
|
74478
|
+
var wt = class {
|
|
74479
74479
|
constructor(e, r) {
|
|
74480
74480
|
c(this, "operator");
|
|
74481
74481
|
c(this, "child");
|
|
@@ -74496,7 +74496,7 @@ var A = class {
|
|
|
74496
74496
|
return `(${this.left.toString()} ${this.operator} ${this.right.toString()})`;
|
|
74497
74497
|
}
|
|
74498
74498
|
};
|
|
74499
|
-
var
|
|
74499
|
+
var Ot = class {
|
|
74500
74500
|
constructor() {
|
|
74501
74501
|
c(this, "prefixParselets", {});
|
|
74502
74502
|
c(this, "infixParselets", {});
|
|
@@ -74577,13 +74577,13 @@ var Dr = class {
|
|
|
74577
74577
|
function te(t6) {
|
|
74578
74578
|
if (t6 !== void 0) return Array.isArray(t6) ? t6 : [t6];
|
|
74579
74579
|
}
|
|
74580
|
-
var
|
|
74581
|
-
var
|
|
74582
|
-
var
|
|
74580
|
+
var It = "http://hl7.org";
|
|
74581
|
+
var kt = "ok";
|
|
74582
|
+
var Mt = "created";
|
|
74583
74583
|
var _r = "not-modified";
|
|
74584
74584
|
var Nr = "not-found";
|
|
74585
74585
|
var Ur = "unauthorized";
|
|
74586
|
-
var
|
|
74586
|
+
var Dt = "accepted";
|
|
74587
74587
|
var mi = { resourceType: "OperationOutcome", id: Nr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
|
|
74588
74588
|
var Je = { resourceType: "OperationOutcome", id: Ur, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
|
|
74589
74589
|
var hi = { ...Je, issue: [...Je.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
|
|
@@ -74597,11 +74597,11 @@ function T(t6, e, r, n) {
|
|
|
74597
74597
|
function qr(t6) {
|
|
74598
74598
|
return !t6 || typeof t6 != "object" ? false : t6 instanceof Error || typeof DOMException < "u" && t6 instanceof DOMException ? true : Object.prototype.toString.call(t6) === "[object Error]";
|
|
74599
74599
|
}
|
|
74600
|
-
function
|
|
74600
|
+
function ut(t6) {
|
|
74601
74601
|
return typeof t6 == "object" && t6 !== null && t6.resourceType === "OperationOutcome";
|
|
74602
74602
|
}
|
|
74603
74603
|
function Wr(t6) {
|
|
74604
|
-
return t6.id ===
|
|
74604
|
+
return t6.id === kt || t6.id === Mt || t6.id === _r || t6.id === Dt;
|
|
74605
74605
|
}
|
|
74606
74606
|
var m = class extends Error {
|
|
74607
74607
|
constructor(r, n) {
|
|
@@ -74610,11 +74610,11 @@ var m = class extends Error {
|
|
|
74610
74610
|
this.name = "OperationOutcomeError", this.outcome = r;
|
|
74611
74611
|
}
|
|
74612
74612
|
};
|
|
74613
|
-
function
|
|
74614
|
-
return t6 instanceof m ? t6.outcome :
|
|
74613
|
+
function Vt(t6) {
|
|
74614
|
+
return t6 instanceof m ? t6.outcome : ut(t6) ? t6 : w(Ve(t6));
|
|
74615
74615
|
}
|
|
74616
74616
|
function Ve(t6) {
|
|
74617
|
-
return t6 ? typeof t6 == "string" ? t6 : qr(t6) ? t6.message :
|
|
74617
|
+
return t6 ? typeof t6 == "string" ? t6 : qr(t6) ? t6.message : ut(t6) ? gi(t6) : typeof t6 == "object" && "code" in t6 && typeof t6.code == "string" ? t6.code : JSON.stringify(t6) : "Unknown error";
|
|
74618
74618
|
}
|
|
74619
74619
|
function gi(t6) {
|
|
74620
74620
|
let e = t6.issue?.map(Ps) ?? [];
|
|
@@ -74802,7 +74802,7 @@ function _s(t6, e, r) {
|
|
|
74802
74802
|
return t6 === void 0 ? { type: "undefined", value: void 0, path: `${n}${r}` } : Array.isArray(t6) ? t6.map((i, o2) => ({ ...i, path: `${n}${r}[${o2}]` })) : { ...t6, path: `${n}${r}` };
|
|
74803
74803
|
}
|
|
74804
74804
|
var Ls = new ee(1e3);
|
|
74805
|
-
var
|
|
74805
|
+
var Nt = { canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\r\n\t\u0020-\uFFFF]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\r\n\t\u0020-\uFFFF]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
|
|
74806
74806
|
function y(t6) {
|
|
74807
74807
|
return [{ type: p.boolean, value: t6 }];
|
|
74808
74808
|
}
|
|
@@ -74823,7 +74823,7 @@ function N(t6, e) {
|
|
|
74823
74823
|
}
|
|
74824
74824
|
function _(t6, e, r) {
|
|
74825
74825
|
if (!t6.value) return;
|
|
74826
|
-
let n =
|
|
74826
|
+
let n = qt(t6.type, e, r?.profileUrl);
|
|
74827
74827
|
return n ? Gs(t6, e, n) : Qs(t6, e);
|
|
74828
74828
|
}
|
|
74829
74829
|
function Gs(t6, e, r) {
|
|
@@ -74873,11 +74873,11 @@ function Qs(t6, e) {
|
|
|
74873
74873
|
} else if (O(n)) return;
|
|
74874
74874
|
return n;
|
|
74875
74875
|
}
|
|
74876
|
-
function
|
|
74876
|
+
function Ut(t6) {
|
|
74877
74877
|
let e = [];
|
|
74878
74878
|
for (let r of t6) {
|
|
74879
74879
|
let n = false;
|
|
74880
|
-
for (let i of e) if (H(
|
|
74880
|
+
for (let i of e) if (H(dt(r, i))) {
|
|
74881
74881
|
n = true;
|
|
74882
74882
|
break;
|
|
74883
74883
|
}
|
|
@@ -74889,12 +74889,12 @@ function Vi(t6) {
|
|
|
74889
74889
|
return y(!H(t6));
|
|
74890
74890
|
}
|
|
74891
74891
|
function _i(t6, e) {
|
|
74892
|
-
return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(false) : y(t6.every((r, n) => H(
|
|
74892
|
+
return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(false) : y(t6.every((r, n) => H(dt(r, e[n]))));
|
|
74893
74893
|
}
|
|
74894
74894
|
function Li(t6, e) {
|
|
74895
|
-
return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(true) : y(t6.some((r, n) => !H(
|
|
74895
|
+
return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(true) : y(t6.some((r, n) => !H(dt(r, e[n]))));
|
|
74896
74896
|
}
|
|
74897
|
-
function
|
|
74897
|
+
function dt(t6, e) {
|
|
74898
74898
|
let r = t6.value?.valueOf(), n = e.value?.valueOf();
|
|
74899
74899
|
return typeof r == "number" && typeof n == "number" ? y(Math.abs(r - n) < 1e-8) : L(r) && L(n) ? y(Ui(r, n)) : y(typeof r == "object" && typeof n == "object" ? cn(t6, e) : r === n);
|
|
74900
74900
|
}
|
|
@@ -74934,10 +74934,10 @@ function et(t6, e) {
|
|
|
74934
74934
|
}
|
|
74935
74935
|
}
|
|
74936
74936
|
function Ni(t6) {
|
|
74937
|
-
return typeof t6 == "string" && !!
|
|
74937
|
+
return typeof t6 == "string" && !!Nt.date.exec(t6);
|
|
74938
74938
|
}
|
|
74939
74939
|
function Ze(t6) {
|
|
74940
|
-
return typeof t6 == "string" && !!
|
|
74940
|
+
return typeof t6 == "string" && !!Nt.dateTime.exec(t6);
|
|
74941
74941
|
}
|
|
74942
74942
|
function Fi(t6) {
|
|
74943
74943
|
return !!(t6 && typeof t6 == "object" && ("start" in t6 && Ze(t6.start) || "end" in t6 && Ze(t6.end)));
|
|
@@ -74972,7 +74972,7 @@ function sn(t6, e) {
|
|
|
74972
74972
|
function Js(t6, e) {
|
|
74973
74973
|
return delete e.__proto__, delete e.constructor, Object.assign(t6, e);
|
|
74974
74974
|
}
|
|
74975
|
-
function
|
|
74975
|
+
function pt(t6, e) {
|
|
74976
74976
|
return D(t6, e) && "id" in t6 && typeof t6.id == "string";
|
|
74977
74977
|
}
|
|
74978
74978
|
function ie(t6) {
|
|
@@ -74981,7 +74981,7 @@ function ie(t6) {
|
|
|
74981
74981
|
}
|
|
74982
74982
|
function I(t6) {
|
|
74983
74983
|
if (Y(t6)) return t6.reference;
|
|
74984
|
-
if (
|
|
74984
|
+
if (pt(t6)) return `${t6.resourceType}/${t6.id}`;
|
|
74985
74985
|
}
|
|
74986
74986
|
function X(t6) {
|
|
74987
74987
|
if (t6) return Y(t6) ? t6.reference.split("/")[1] : t6.id;
|
|
@@ -75018,13 +75018,13 @@ function Ys(t6) {
|
|
|
75018
75018
|
}
|
|
75019
75019
|
function Xs(t6) {
|
|
75020
75020
|
let e = t6.name;
|
|
75021
|
-
if (e && e.length > 0) return
|
|
75021
|
+
if (e && e.length > 0) return ft(e[0]);
|
|
75022
75022
|
}
|
|
75023
75023
|
function Zs(t6) {
|
|
75024
75024
|
let e = t6.deviceName;
|
|
75025
75025
|
if (e && e.length > 0) return e[0].name;
|
|
75026
75026
|
}
|
|
75027
|
-
function
|
|
75027
|
+
function Wt(t6, e) {
|
|
75028
75028
|
let r = new Date(t6);
|
|
75029
75029
|
r.setUTCHours(0, 0, 0, 0);
|
|
75030
75030
|
let n = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
@@ -75041,7 +75041,7 @@ function de(t6, ...e) {
|
|
|
75041
75041
|
for (let n = 0; n < e.length && r; n++) r = r?.extension?.find((i) => i.url === e[n]);
|
|
75042
75042
|
return r;
|
|
75043
75043
|
}
|
|
75044
|
-
function
|
|
75044
|
+
function jt(t6, e) {
|
|
75045
75045
|
let r = mn(t6);
|
|
75046
75046
|
return JSON.stringify(r, null, e ? 2 : void 0) ?? "";
|
|
75047
75047
|
}
|
|
@@ -75141,7 +75141,7 @@ function rt(t6, e, r) {
|
|
|
75141
75141
|
}
|
|
75142
75142
|
return n.push(t6), n;
|
|
75143
75143
|
}
|
|
75144
|
-
function
|
|
75144
|
+
function Ht(t6) {
|
|
75145
75145
|
return t6.sort((e, r) => e.localeCompare(r));
|
|
75146
75146
|
}
|
|
75147
75147
|
function yn(t6) {
|
|
@@ -75160,11 +75160,11 @@ function Yi(t6) {
|
|
|
75160
75160
|
return typeof t6 == "object" && !Array.isArray(t6) && !(t6 instanceof URLSearchParams) && (t6 = Object.fromEntries(Object.entries(t6).filter((e) => e[1] !== void 0))), new URLSearchParams(t6).toString();
|
|
75161
75161
|
}
|
|
75162
75162
|
var ha = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
|
|
75163
|
-
function
|
|
75163
|
+
function Hp(t6) {
|
|
75164
75164
|
return ha.test(t6);
|
|
75165
75165
|
}
|
|
75166
75166
|
var v = Object.freeze([]);
|
|
75167
|
-
function
|
|
75167
|
+
function ft(t6, e) {
|
|
75168
75168
|
if (!t6) return "";
|
|
75169
75169
|
let r = [];
|
|
75170
75170
|
if (t6.prefix && e?.prefix !== false && r.push(...t6.prefix), t6.given && r.push(...t6.given), t6.family && r.push(t6.family), t6.suffix && e?.suffix !== false && r.push(...t6.suffix), t6.use && (e?.all || e?.use) && r.push("[" + t6.use + "]"), r.length === 0) {
|
|
@@ -75173,13 +75173,13 @@ function pt(t6, e) {
|
|
|
75173
75173
|
}
|
|
75174
75174
|
return r.join(" ").trim();
|
|
75175
75175
|
}
|
|
75176
|
-
function
|
|
75176
|
+
function Qt(t6) {
|
|
75177
75177
|
return t6 instanceof Date && !Number.isNaN(t6.getTime());
|
|
75178
75178
|
}
|
|
75179
75179
|
function tt(t6, e, r) {
|
|
75180
75180
|
if (!t6) return "";
|
|
75181
75181
|
let n = new Date(t6);
|
|
75182
|
-
return
|
|
75182
|
+
return Qt(n) ? n.toLocaleString(e, r) : "";
|
|
75183
75183
|
}
|
|
75184
75184
|
function be(t6) {
|
|
75185
75185
|
if (!t6) return "";
|
|
@@ -75229,7 +75229,7 @@ function Kr(t6) {
|
|
|
75229
75229
|
function Aa() {
|
|
75230
75230
|
return Object.values(Pi()).filter(Kr).map((t6) => t6.name);
|
|
75231
75231
|
}
|
|
75232
|
-
function
|
|
75232
|
+
function qt(t6, e, r) {
|
|
75233
75233
|
let n = Ne(t6, r);
|
|
75234
75234
|
if (n) return no(n.elements, e);
|
|
75235
75235
|
}
|
|
@@ -75261,7 +75261,7 @@ function nt(t6) {
|
|
|
75261
75261
|
}
|
|
75262
75262
|
}
|
|
75263
75263
|
var he = () => [];
|
|
75264
|
-
function
|
|
75264
|
+
function mt(t6) {
|
|
75265
75265
|
return t6 instanceof U ? t6.name : t6 instanceof ae && t6.left instanceof U && t6.right instanceof U ? t6.left.name + "." + t6.right.name : "";
|
|
75266
75266
|
}
|
|
75267
75267
|
var F = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) => y(e.length !== 0), exists: (t6, e, r) => r ? y(e.some((n) => H(r.eval(t6, [n])))) : y(e.length > 0 && e.every((n) => !O(n.value))), all: (t6, e, r) => y(e.every((n) => H(r.eval(t6, [n])))), allTrue: (t6, e) => {
|
|
@@ -75288,7 +75288,7 @@ var F = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
|
|
|
75288
75288
|
for (let n of e) r.some((i) => i.value === n.value) || r.push(n);
|
|
75289
75289
|
return r;
|
|
75290
75290
|
}, isDistinct: (t6, e) => y(e.length === F.distinct(t6, e).length), where: (t6, e, r) => e.filter((n) => H(r.eval(t6, [n]))), select: (t6, e, r) => e.flatMap((n) => r.eval({ parent: t6, variables: { $this: n } }, [n])), repeat: he, ofType: (t6, e, r) => {
|
|
75291
|
-
let n =
|
|
75291
|
+
let n = mt(r);
|
|
75292
75292
|
return n ? e.filter((i) => et(i, n)) : [];
|
|
75293
75293
|
}, single: (t6, e) => {
|
|
75294
75294
|
if (e.length > 1) throw new Error("Expected input length one for single()");
|
|
@@ -75314,7 +75314,7 @@ var F = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
|
|
|
75314
75314
|
}, union: (t6, e, r) => {
|
|
75315
75315
|
if (!r) return e;
|
|
75316
75316
|
let n = r.eval(t6, Be(t6));
|
|
75317
|
-
return
|
|
75317
|
+
return Ut([...e, ...n]);
|
|
75318
75318
|
}, combine: (t6, e, r) => {
|
|
75319
75319
|
if (!r) return e;
|
|
75320
75320
|
let n = r.eval(t6, Be(t6));
|
|
@@ -75384,10 +75384,10 @@ var F = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
|
|
|
75384
75384
|
if (s.length === 0) throw new Error("Invalid end date");
|
|
75385
75385
|
let a = i.eval(t6, e)[0]?.value;
|
|
75386
75386
|
if (a !== "years" && a !== "months" && a !== "days") throw new Error("Invalid units");
|
|
75387
|
-
let u =
|
|
75387
|
+
let u = Wt(o2[0].value, s[0].value);
|
|
75388
75388
|
return [{ type: p.Quantity, value: { value: u[a], unit: a } }];
|
|
75389
75389
|
}, is: (t6, e, r) => {
|
|
75390
|
-
let n =
|
|
75390
|
+
let n = mt(r);
|
|
75391
75391
|
return n ? e.map((i) => ({ type: p.boolean, value: et(i, n) })) : [];
|
|
75392
75392
|
}, not: (t6, e) => F.toBoolean(t6, e).map((r) => ({ type: p.boolean, value: !r.value })), resolve: (t6, e) => e.map((r) => {
|
|
75393
75393
|
let n = r.value, i;
|
|
@@ -75407,7 +75407,7 @@ var F = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
|
|
|
75407
75407
|
}
|
|
75408
75408
|
return { type: p.BackboneElement, value: void 0 };
|
|
75409
75409
|
}).filter((r) => !!r.value), as: (t6, e, r) => {
|
|
75410
|
-
let n =
|
|
75410
|
+
let n = mt(r);
|
|
75411
75411
|
if (!n) throw new Error(`Expected a valid type identifier as the right operand of 'as', but found ${r.toString()}`);
|
|
75412
75412
|
let i = N(e);
|
|
75413
75413
|
return i && et(i, n) ? [i] : [];
|
|
@@ -75417,10 +75417,10 @@ var F = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
|
|
|
75417
75417
|
let i = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
|
|
75418
75418
|
return e.map((o2) => ({ type: p.boolean, value: o2.value?.resourceType === i }));
|
|
75419
75419
|
}, getResourceKey: (t6, e) => {
|
|
75420
|
-
let r = e[0]
|
|
75420
|
+
let r = e[0]?.value;
|
|
75421
75421
|
return r?.id ? [{ type: p.id, value: r.id }] : [];
|
|
75422
75422
|
}, getReferenceKey: (t6, e, r) => {
|
|
75423
|
-
let n = e[0]
|
|
75423
|
+
let n = e[0]?.value;
|
|
75424
75424
|
if (!n?.reference) return [];
|
|
75425
75425
|
let i = "";
|
|
75426
75426
|
return r instanceof U && (i = r.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: p.id, value: X(n) }];
|
|
@@ -75494,7 +75494,7 @@ var U = class {
|
|
|
75494
75494
|
return this.name;
|
|
75495
75495
|
}
|
|
75496
75496
|
};
|
|
75497
|
-
var
|
|
75497
|
+
var zt = class {
|
|
75498
75498
|
eval() {
|
|
75499
75499
|
return [];
|
|
75500
75500
|
}
|
|
@@ -75502,7 +75502,7 @@ var Qt = class {
|
|
|
75502
75502
|
return "{}";
|
|
75503
75503
|
}
|
|
75504
75504
|
};
|
|
75505
|
-
var
|
|
75505
|
+
var Jt = class extends wt {
|
|
75506
75506
|
constructor(r, n, i) {
|
|
75507
75507
|
super(r, n);
|
|
75508
75508
|
c(this, "impl");
|
|
@@ -75537,7 +75537,7 @@ var q = class extends A {
|
|
|
75537
75537
|
}
|
|
75538
75538
|
};
|
|
75539
75539
|
var so = Object.freeze({ type: "string", value: "" });
|
|
75540
|
-
var
|
|
75540
|
+
var Kt = class extends A {
|
|
75541
75541
|
constructor(e, r) {
|
|
75542
75542
|
super("&", e, r);
|
|
75543
75543
|
}
|
|
@@ -75548,7 +75548,7 @@ var Jt = class extends A {
|
|
|
75548
75548
|
return [{ type: p.string, value: n.value + i.value }];
|
|
75549
75549
|
}
|
|
75550
75550
|
};
|
|
75551
|
-
var
|
|
75551
|
+
var Yt = class extends A {
|
|
75552
75552
|
constructor(e, r) {
|
|
75553
75553
|
super("contains", e, r);
|
|
75554
75554
|
}
|
|
@@ -75557,13 +75557,13 @@ var Kt = class extends A {
|
|
|
75557
75557
|
return y(n.some((o2) => o2.value === i[0].value));
|
|
75558
75558
|
}
|
|
75559
75559
|
};
|
|
75560
|
-
var
|
|
75560
|
+
var Xt = class extends A {
|
|
75561
75561
|
constructor(e, r) {
|
|
75562
75562
|
super("in", e, r);
|
|
75563
75563
|
}
|
|
75564
75564
|
eval(e, r) {
|
|
75565
75565
|
let n = N(this.left.eval(e, r)), i = this.right.eval(e, r);
|
|
75566
|
-
return n ? y(i.some((o2) =>
|
|
75566
|
+
return n ? y(i.some((o2) => dt(n, o2)[0].value)) : [];
|
|
75567
75567
|
}
|
|
75568
75568
|
};
|
|
75569
75569
|
var ae = class extends A {
|
|
@@ -75583,10 +75583,10 @@ var qe = class extends A {
|
|
|
75583
75583
|
}
|
|
75584
75584
|
eval(e, r) {
|
|
75585
75585
|
let n = this.left.eval(e, r), i = this.right.eval(e, r);
|
|
75586
|
-
return
|
|
75586
|
+
return Ut([...n, ...i]);
|
|
75587
75587
|
}
|
|
75588
75588
|
};
|
|
75589
|
-
var
|
|
75589
|
+
var Zt = class extends A {
|
|
75590
75590
|
constructor(e, r) {
|
|
75591
75591
|
super("=", e, r);
|
|
75592
75592
|
}
|
|
@@ -75595,7 +75595,7 @@ var Xt = class extends A {
|
|
|
75595
75595
|
return _i(n, i);
|
|
75596
75596
|
}
|
|
75597
75597
|
};
|
|
75598
|
-
var
|
|
75598
|
+
var er = class extends A {
|
|
75599
75599
|
constructor(e, r) {
|
|
75600
75600
|
super("!=", e, r);
|
|
75601
75601
|
}
|
|
@@ -75604,7 +75604,7 @@ var Zt = class extends A {
|
|
|
75604
75604
|
return Li(n, i);
|
|
75605
75605
|
}
|
|
75606
75606
|
};
|
|
75607
|
-
var
|
|
75607
|
+
var tr = class extends A {
|
|
75608
75608
|
constructor(e, r) {
|
|
75609
75609
|
super("~", e, r);
|
|
75610
75610
|
}
|
|
@@ -75613,7 +75613,7 @@ var er = class extends A {
|
|
|
75613
75613
|
return an(n, i);
|
|
75614
75614
|
}
|
|
75615
75615
|
};
|
|
75616
|
-
var
|
|
75616
|
+
var rr = class extends A {
|
|
75617
75617
|
constructor(e, r) {
|
|
75618
75618
|
super("!~", e, r);
|
|
75619
75619
|
}
|
|
@@ -75629,11 +75629,11 @@ var We = class extends A {
|
|
|
75629
75629
|
eval(e, r) {
|
|
75630
75630
|
let n = this.left.eval(e, r);
|
|
75631
75631
|
if (n.length !== 1) return [];
|
|
75632
|
-
let i =
|
|
75632
|
+
let i = mt(this.right);
|
|
75633
75633
|
return i ? y(et(n[0], i)) : [];
|
|
75634
75634
|
}
|
|
75635
75635
|
};
|
|
75636
|
-
var
|
|
75636
|
+
var nr = class extends A {
|
|
75637
75637
|
constructor(e, r) {
|
|
75638
75638
|
super("and", e, r);
|
|
75639
75639
|
}
|
|
@@ -75642,7 +75642,7 @@ var rr = class extends A {
|
|
|
75642
75642
|
return n?.value === true && i?.value === true ? y(true) : n?.value === false || i?.value === false ? y(false) : [];
|
|
75643
75643
|
}
|
|
75644
75644
|
};
|
|
75645
|
-
var
|
|
75645
|
+
var ir = class extends A {
|
|
75646
75646
|
constructor(e, r) {
|
|
75647
75647
|
super("or", e, r);
|
|
75648
75648
|
}
|
|
@@ -75651,7 +75651,7 @@ var nr = class extends A {
|
|
|
75651
75651
|
return n?.value === false && i?.value === false ? y(false) : n?.value || i?.value ? y(true) : [];
|
|
75652
75652
|
}
|
|
75653
75653
|
};
|
|
75654
|
-
var
|
|
75654
|
+
var or = class extends A {
|
|
75655
75655
|
constructor(e, r) {
|
|
75656
75656
|
super("xor", e, r);
|
|
75657
75657
|
}
|
|
@@ -75660,7 +75660,7 @@ var ir = class extends A {
|
|
|
75660
75660
|
return !n || !i ? [] : y(n.value !== i.value);
|
|
75661
75661
|
}
|
|
75662
75662
|
};
|
|
75663
|
-
var
|
|
75663
|
+
var sr = class extends A {
|
|
75664
75664
|
constructor(e, r) {
|
|
75665
75665
|
super("implies", e, r);
|
|
75666
75666
|
}
|
|
@@ -75702,7 +75702,7 @@ var $e = class {
|
|
|
75702
75702
|
return `${this.left.toString()}[${this.expr.toString()}]`;
|
|
75703
75703
|
}
|
|
75704
75704
|
};
|
|
75705
|
-
var
|
|
75705
|
+
var gt = ["!=", "!~", "<=", ">=", "{}", "->"];
|
|
75706
75706
|
var S = { 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 };
|
|
75707
75707
|
var _a = { parse(t6) {
|
|
75708
75708
|
let e = t6.consumeAndParse();
|
|
@@ -75724,10 +75724,10 @@ function Fa(t6) {
|
|
|
75724
75724
|
let e = t6.split(" "), r = Number.parseFloat(e[0]), n = e[1];
|
|
75725
75725
|
return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: r, unit: n };
|
|
75726
75726
|
}
|
|
75727
|
-
function
|
|
75728
|
-
return new
|
|
75727
|
+
function yt() {
|
|
75728
|
+
return new Ot().registerPrefix("String", { parse: (t6, e) => new z({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (t6, e) => new z({ type: p.dateTime, value: nt(e.value) }) }).registerPrefix("Quantity", { parse: (t6, e) => new z({ type: p.Quantity, value: Fa(e.value) }) }).registerPrefix("Number", { parse: (t6, e) => new z({ type: e.value.includes(".") ? p.decimal : p.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new z({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new z({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (t6, e) => new U(e.value) }).registerPrefix("{}", { parse: () => new zt() }).registerPrefix("(", _a).registerInfix("[", La).registerInfix("(", Na).prefix("+", S.UnaryAdd, (t6, e) => new Jt("+", e, (r) => r)).prefix("-", S.UnarySubtract, (t6, e) => new q("-", e, e, (r, n) => -n)).infixLeft(".", S.Dot, (t6, e, r) => new ae(t6, r)).infixLeft("/", S.Divide, (t6, e, r) => new q("/", t6, r, (n, i) => n / i)).infixLeft("*", S.Multiply, (t6, e, r) => new q("*", t6, r, (n, i) => n * i)).infixLeft("+", S.Add, (t6, e, r) => new q("+", t6, r, (n, i) => n + i)).infixLeft("-", S.Subtract, (t6, e, r) => new q("-", t6, r, (n, i) => n - i)).infixLeft("|", S.Union, (t6, e, r) => new qe(t6, r)).infixLeft("=", S.Equals, (t6, e, r) => new Zt(t6, r)).infixLeft("!=", S.NotEquals, (t6, e, r) => new er(t6, r)).infixLeft("~", S.Equivalent, (t6, e, r) => new tr(t6, r)).infixLeft("!~", S.NotEquivalent, (t6, e, r) => new rr(t6, r)).infixLeft("<", S.LessThan, (t6, e, r) => new q("<", t6, r, (n, i) => n < i)).infixLeft("<=", S.LessThanOrEquals, (t6, e, r) => new q("<=", t6, r, (n, i) => n <= i)).infixLeft(">", S.GreaterThan, (t6, e, r) => new q(">", t6, r, (n, i) => n > i)).infixLeft(">=", S.GreaterThanOrEquals, (t6, e, r) => new q(">=", t6, r, (n, i) => n >= i)).infixLeft("&", S.Ampersand, (t6, e, r) => new Kt(t6, r)).infixLeft("and", S.And, (t6, e, r) => new nr(t6, r)).infixLeft("as", S.As, (t6, e, r) => new Pe(t6, r)).infixLeft("contains", S.Contains, (t6, e, r) => new Yt(t6, r)).infixLeft("div", S.Divide, (t6, e, r) => new q("div", t6, r, (n, i) => Math.trunc(n / i))).infixLeft("in", S.In, (t6, e, r) => new Xt(t6, r)).infixLeft("is", S.Is, (t6, e, r) => new We(t6, r)).infixLeft("mod", S.Modulo, (t6, e, r) => new q("mod", t6, r, (n, i) => n % i)).infixLeft("or", S.Or, (t6, e, r) => new ir(t6, r)).infixLeft("xor", S.Xor, (t6, e, r) => new or(t6, r)).infixLeft("implies", S.Implies, (t6, e, r) => new sr(t6, r));
|
|
75729
75729
|
}
|
|
75730
|
-
var Ua =
|
|
75730
|
+
var Ua = yt();
|
|
75731
75731
|
var g = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
|
|
75732
75732
|
var vn = { contains: g.CONTAINS, exact: g.EXACT, above: g.ABOVE, below: g.BELOW, text: g.TEXT, not: g.NOT, in: g.IN, "not-in": g.NOT_IN, "of-type": g.OF_TYPE, missing: g.MISSING, identifier: g.IDENTIFIER, iterate: g.ITERATE };
|
|
75733
75733
|
var Tn = { eq: g.EQUALS, ne: g.NOT_EQUALS, lt: g.LESS_THAN, le: g.LESS_THAN_OR_EQUALS, gt: g.GREATER_THAN, ge: g.GREATER_THAN_OR_EQUALS, sa: g.STARTS_AFTER, eb: g.ENDS_BEFORE, ap: g.APPROXIMATELY, sw: g.STARTS_WITH };
|
|
@@ -75735,7 +75735,7 @@ var Qa = [g.MISSING, g.PRESENT];
|
|
|
75735
75735
|
var rc = new ee(1e3);
|
|
75736
75736
|
var He = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
|
|
75737
75737
|
var hc = [He.READ, He.VREAD, He.HISTORY, He.SEARCH];
|
|
75738
|
-
var
|
|
75738
|
+
var Om = { FIRST: "first", APPLICATION: "application" };
|
|
75739
75739
|
function Z() {
|
|
75740
75740
|
return typeof window < "u";
|
|
75741
75741
|
}
|
|
@@ -75764,7 +75764,7 @@ function xc(t6) {
|
|
|
75764
75764
|
if (e) return e.from(t6, "base64").toString("utf-8");
|
|
75765
75765
|
throw new Error("Unable to decode base64");
|
|
75766
75766
|
}
|
|
75767
|
-
function
|
|
75767
|
+
function lr(t6) {
|
|
75768
75768
|
if (Z()) {
|
|
75769
75769
|
let r = new window.TextEncoder().encode(t6), n = String.fromCodePoint.apply(null, r);
|
|
75770
75770
|
return window.btoa(n);
|
|
@@ -75773,7 +75773,7 @@ function ur(t6) {
|
|
|
75773
75773
|
if (e) return e.from(t6, "utf8").toString("base64");
|
|
75774
75774
|
throw new Error("Unable to encode base64");
|
|
75775
75775
|
}
|
|
75776
|
-
function
|
|
75776
|
+
function dr(t6) {
|
|
75777
75777
|
t6 = t6.padEnd(t6.length + (4 - t6.length % 4) % 4, "=");
|
|
75778
75778
|
let e = t6.replaceAll("-", "+").replaceAll("_", "/");
|
|
75779
75779
|
return xc(e);
|
|
@@ -75845,231 +75845,9 @@ var le = class {
|
|
|
75845
75845
|
return this.emitter.listenerCount(e);
|
|
75846
75846
|
}
|
|
75847
75847
|
};
|
|
75848
|
-
var Rn = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
|
|
75849
|
-
var Oc = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
|
|
75850
|
-
var Cn = ["DiagnosticReport-update"];
|
|
75851
|
-
function bo(t6) {
|
|
75852
|
-
return Cn.includes(t6);
|
|
75853
|
-
}
|
|
75854
|
-
function Eo(t6) {
|
|
75855
|
-
if (Cn.includes(t6)) throw new m(T(`'context.version' is required for '${t6}'.`));
|
|
75856
|
-
}
|
|
75857
|
-
var Ic = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
|
|
75858
|
-
function kc(t6) {
|
|
75859
|
-
return Oc.includes(t6);
|
|
75860
|
-
}
|
|
75861
|
-
function Ro(t6) {
|
|
75862
|
-
return !!t6.endpoint;
|
|
75863
|
-
}
|
|
75864
|
-
function Pn(t6) {
|
|
75865
|
-
if (!pr(t6)) throw new m(T("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
|
|
75866
|
-
let { channelType: e, mode: r, topic: n, events: i } = t6, o2 = { "hub.channel.type": e, "hub.mode": r, "hub.topic": n };
|
|
75867
|
-
return r === "subscribe" && (o2["hub.events"] = i.join(",")), Ro(t6) && (o2["hub.channel.endpoint"] = t6.endpoint), new URLSearchParams(o2).toString();
|
|
75868
|
-
}
|
|
75869
|
-
function pr(t6) {
|
|
75870
|
-
if (typeof t6 != "object") return false;
|
|
75871
|
-
let { channelType: e, mode: r, topic: n, events: i } = t6;
|
|
75872
|
-
if (!(e && r && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || r !== "subscribe" && r !== "unsubscribe") return false;
|
|
75873
|
-
for (let o2 of i) if (!Rn[o2]) return false;
|
|
75874
|
-
return !(Ro(t6) && !(typeof t6.endpoint == "string" && t6.endpoint.startsWith("ws")));
|
|
75875
|
-
}
|
|
75876
|
-
function Mc(t6, e, r, n) {
|
|
75877
|
-
if (typeof e != "object") throw new m(T(`context[${r}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
|
|
75878
|
-
if (!(e.id && typeof e.id == "string")) throw new m(T(`context[${r}] is invalid. Resource must contain a valid string ID.`));
|
|
75879
|
-
if (!e.resourceType) throw new m(T(`context[${r}] is invalid. Resource must contain a resource type. No resource type found.`));
|
|
75880
|
-
let i = n.resourceType;
|
|
75881
|
-
if (i !== "*") {
|
|
75882
|
-
if (!kc(e.resourceType)) throw new m(T(`context[${r}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
|
|
75883
|
-
if (i && e.resourceType !== i) throw new m(T(`context[${r}] is invalid. context[${r}] for the '${t6}' event should contain resource of type ${i}.`));
|
|
75884
|
-
}
|
|
75885
|
-
}
|
|
75886
|
-
function Dc(t6, e, r, n, i) {
|
|
75887
|
-
if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
|
|
75888
|
-
if (!Y(e.reference)) throw new m(T(`context[${r}] is invalid. Expected key '${e.key}' to be a reference.`));
|
|
75889
|
-
} else Mc(t6, e.resource, r, n);
|
|
75890
|
-
}
|
|
75891
|
-
function Vc(t6, e) {
|
|
75892
|
-
let r = /* @__PURE__ */ new Map(), n = Ic[t6];
|
|
75893
|
-
for (let i = 0; i < e.length; i++) {
|
|
75894
|
-
let o2 = e[i].key;
|
|
75895
|
-
if (!n[o2]) throw new m(T(`Key '${o2}' not found for event '${t6}'. Make sure to add only valid keys.`));
|
|
75896
|
-
Dc(t6, e[i], i, n[o2], r);
|
|
75897
|
-
}
|
|
75898
|
-
for (let [i, o2] of Object.entries(n)) {
|
|
75899
|
-
if (!(o2.optional || r.has(i))) throw new m(T(`Missing required key '${i}' on context for '${t6}' event.`));
|
|
75900
|
-
if (!o2.manyAllowed && (r.get(i) ?? 0) > 1) throw new m(T(`${r.get(i)} context entries with key '${i}' found for the '${t6}' event when schema only allows for 1.`));
|
|
75901
|
-
}
|
|
75902
|
-
}
|
|
75903
|
-
function An(t6, e, r, n) {
|
|
75904
|
-
if (!(t6 && typeof t6 == "string")) throw new m(T("Must provide a topic."));
|
|
75905
|
-
if (!Rn[e]) throw new m(T(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Rn).join(", ")}`));
|
|
75906
|
-
if (typeof r != "object") throw new m(T("context must be a context object or array of context objects."));
|
|
75907
|
-
if (Cn.includes(e) && !n) throw new m(T(`The '${e}' event must contain a 'context.versionId'.`));
|
|
75908
|
-
let i = Array.isArray(r) ? r : [r];
|
|
75909
|
-
return Vc(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ue(), event: { "hub.topic": t6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
|
|
75910
|
-
}
|
|
75911
|
-
var dr = class extends le {
|
|
75912
|
-
constructor(r) {
|
|
75913
|
-
super();
|
|
75914
|
-
c(this, "subRequest");
|
|
75915
|
-
c(this, "websocket");
|
|
75916
|
-
if (this.subRequest = r, !r.endpoint) throw new m(T("Subscription request should contain an endpoint."));
|
|
75917
|
-
if (!pr(r)) throw new m(T("Subscription request failed validation."));
|
|
75918
|
-
let n = new WebSocket(r.endpoint);
|
|
75919
|
-
n.addEventListener("open", () => {
|
|
75920
|
-
this.dispatchEvent({ type: "connect" }), n.addEventListener("message", (i) => {
|
|
75921
|
-
let o2 = JSON.parse(i.data);
|
|
75922
|
-
if (!o2.event) {
|
|
75923
|
-
o2["hub.mode"] === "denied" && n.close();
|
|
75924
|
-
return;
|
|
75925
|
-
}
|
|
75926
|
-
let s = o2;
|
|
75927
|
-
s.event["hub.event"] !== "heartbeat" && (this.dispatchEvent({ type: "message", payload: s }), n.send(JSON.stringify({ id: o2?.id, timestamp: (/* @__PURE__ */ new Date()).toISOString() })));
|
|
75928
|
-
}), n.addEventListener("close", () => {
|
|
75929
|
-
this.dispatchEvent({ type: "disconnect" });
|
|
75930
|
-
});
|
|
75931
|
-
}), this.websocket = n;
|
|
75932
|
-
}
|
|
75933
|
-
disconnect() {
|
|
75934
|
-
this.websocket.close();
|
|
75935
|
-
}
|
|
75936
|
-
};
|
|
75937
|
-
function _c(t6) {
|
|
75938
|
-
return JSON.parse(lr(t6));
|
|
75939
|
-
}
|
|
75940
|
-
function Co(t6) {
|
|
75941
|
-
return t6.split(".").length === 3;
|
|
75942
|
-
}
|
|
75943
|
-
function fr(t6) {
|
|
75944
|
-
let [e, r, n] = t6.split(".");
|
|
75945
|
-
return _c(r);
|
|
75946
|
-
}
|
|
75947
|
-
function Po(t6) {
|
|
75948
|
-
try {
|
|
75949
|
-
return typeof fr(t6).login_id == "string";
|
|
75950
|
-
} catch {
|
|
75951
|
-
return false;
|
|
75952
|
-
}
|
|
75953
|
-
}
|
|
75954
|
-
function Ao(t6) {
|
|
75955
|
-
try {
|
|
75956
|
-
let r = fr(t6).exp;
|
|
75957
|
-
return typeof r == "number" ? r * 1e3 : void 0;
|
|
75958
|
-
} catch {
|
|
75959
|
-
return;
|
|
75960
|
-
}
|
|
75961
|
-
}
|
|
75962
|
-
var mr = class {
|
|
75963
|
-
constructor(e) {
|
|
75964
|
-
c(this, "medplum");
|
|
75965
|
-
this.medplum = e;
|
|
75966
|
-
}
|
|
75967
|
-
async get(e) {
|
|
75968
|
-
return this.medplum.get(`keyvalue/v1/${e}`);
|
|
75969
|
-
}
|
|
75970
|
-
async set(e, r) {
|
|
75971
|
-
await this.medplum.put(`keyvalue/v1/${e}`, r, V.TEXT);
|
|
75972
|
-
}
|
|
75973
|
-
async delete(e) {
|
|
75974
|
-
await this.medplum.delete(`keyvalue/v1/${e}`);
|
|
75975
|
-
}
|
|
75976
|
-
};
|
|
75977
|
-
var wo;
|
|
75978
|
-
wo = Symbol.toStringTag;
|
|
75979
|
-
var $ = class {
|
|
75980
|
-
constructor(e) {
|
|
75981
|
-
c(this, wo, "ReadablePromise");
|
|
75982
|
-
c(this, "suspender");
|
|
75983
|
-
c(this, "status", "pending");
|
|
75984
|
-
c(this, "response");
|
|
75985
|
-
c(this, "error");
|
|
75986
|
-
this.suspender = e.then((r) => (this.status = "success", this.response = r, r), (r) => {
|
|
75987
|
-
throw this.status = "error", this.error = r, r;
|
|
75988
|
-
});
|
|
75989
|
-
}
|
|
75990
|
-
isPending() {
|
|
75991
|
-
return this.status === "pending";
|
|
75992
|
-
}
|
|
75993
|
-
isOk() {
|
|
75994
|
-
return this.status === "success";
|
|
75995
|
-
}
|
|
75996
|
-
read() {
|
|
75997
|
-
switch (this.status) {
|
|
75998
|
-
case "pending":
|
|
75999
|
-
throw this.suspender;
|
|
76000
|
-
case "error":
|
|
76001
|
-
throw this.error;
|
|
76002
|
-
default:
|
|
76003
|
-
return this.response;
|
|
76004
|
-
}
|
|
76005
|
-
}
|
|
76006
|
-
then(e, r) {
|
|
76007
|
-
return this.suspender.then(e, r);
|
|
76008
|
-
}
|
|
76009
|
-
catch(e) {
|
|
76010
|
-
return this.suspender.catch(e);
|
|
76011
|
-
}
|
|
76012
|
-
finally(e) {
|
|
76013
|
-
return this.suspender.finally(e);
|
|
76014
|
-
}
|
|
76015
|
-
};
|
|
76016
|
-
var vt = class {
|
|
76017
|
-
constructor(e, r = "") {
|
|
76018
|
-
c(this, "storage");
|
|
76019
|
-
c(this, "prefix", "");
|
|
76020
|
-
this.storage = e ?? globalThis.localStorage ?? new wn(), this.prefix = r;
|
|
76021
|
-
}
|
|
76022
|
-
makeKey(e) {
|
|
76023
|
-
return this.prefix + e;
|
|
76024
|
-
}
|
|
76025
|
-
clear() {
|
|
76026
|
-
if (this.storage === globalThis.localStorage && this.prefix) for (let e = this.storage.length - 1; e >= 0; e--) {
|
|
76027
|
-
let r = this.storage.key(e);
|
|
76028
|
-
r?.startsWith(this.prefix) && this.storage.removeItem(r);
|
|
76029
|
-
}
|
|
76030
|
-
else this.storage.clear();
|
|
76031
|
-
}
|
|
76032
|
-
getString(e) {
|
|
76033
|
-
return this.storage.getItem(this.makeKey(e)) ?? void 0;
|
|
76034
|
-
}
|
|
76035
|
-
setString(e, r) {
|
|
76036
|
-
r ? this.storage.setItem(this.makeKey(e), r) : this.storage.removeItem(this.makeKey(e));
|
|
76037
|
-
}
|
|
76038
|
-
getObject(e) {
|
|
76039
|
-
let r = this.getString(e);
|
|
76040
|
-
return r ? JSON.parse(r) : void 0;
|
|
76041
|
-
}
|
|
76042
|
-
setObject(e, r) {
|
|
76043
|
-
this.setString(e, r ? $t(r) : void 0);
|
|
76044
|
-
}
|
|
76045
|
-
};
|
|
76046
|
-
var wn = class {
|
|
76047
|
-
constructor() {
|
|
76048
|
-
c(this, "data");
|
|
76049
|
-
this.data = /* @__PURE__ */ new Map();
|
|
76050
|
-
}
|
|
76051
|
-
get length() {
|
|
76052
|
-
return this.data.size;
|
|
76053
|
-
}
|
|
76054
|
-
clear() {
|
|
76055
|
-
this.data.clear();
|
|
76056
|
-
}
|
|
76057
|
-
getItem(e) {
|
|
76058
|
-
return this.data.get(e) ?? null;
|
|
76059
|
-
}
|
|
76060
|
-
setItem(e, r) {
|
|
76061
|
-
r ? this.data.set(e, r) : this.data.delete(e);
|
|
76062
|
-
}
|
|
76063
|
-
removeItem(e) {
|
|
76064
|
-
this.data.delete(e);
|
|
76065
|
-
}
|
|
76066
|
-
key(e) {
|
|
76067
|
-
return Array.from(this.data.keys())[e];
|
|
76068
|
-
}
|
|
76069
|
-
};
|
|
76070
75848
|
var J = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
|
|
76071
|
-
var
|
|
76072
|
-
function
|
|
75849
|
+
var bo = false;
|
|
75850
|
+
function Oc() {
|
|
76073
75851
|
if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
|
|
76074
75852
|
J.Event = globalThis.Event, J.ErrorEvent = class extends Event {
|
|
76075
75853
|
constructor(r, n) {
|
|
@@ -76088,12 +75866,12 @@ function Lc() {
|
|
|
76088
75866
|
}
|
|
76089
75867
|
};
|
|
76090
75868
|
}
|
|
76091
|
-
function
|
|
75869
|
+
function Ic(t6, e) {
|
|
76092
75870
|
if (!t6) throw new Error(e);
|
|
76093
75871
|
}
|
|
76094
|
-
function
|
|
75872
|
+
function kc() {
|
|
76095
75873
|
}
|
|
76096
|
-
function
|
|
75874
|
+
function pr(t6) {
|
|
76097
75875
|
if (t6 instanceof J.CloseEvent) {
|
|
76098
75876
|
let e = t6;
|
|
76099
75877
|
return new J.CloseEvent(e.code, e.reason, void 0);
|
|
@@ -76104,15 +75882,15 @@ function hr(t6) {
|
|
|
76104
75882
|
}
|
|
76105
75883
|
return new t6.constructor(t6.type, t6);
|
|
76106
75884
|
}
|
|
76107
|
-
function
|
|
75885
|
+
function Mc(t6, e) {
|
|
76108
75886
|
let r = t6;
|
|
76109
75887
|
return r.error instanceof Error ? new J.ErrorEvent(r.error, e) : new J.ErrorEvent(new Error(r.message || "WebSocket error"), e);
|
|
76110
75888
|
}
|
|
76111
75889
|
var Ge = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
|
|
76112
|
-
var
|
|
76113
|
-
var
|
|
75890
|
+
var Eo = false;
|
|
75891
|
+
var ot = class t extends le {
|
|
76114
75892
|
constructor(r, n, i = {}) {
|
|
76115
|
-
|
|
75893
|
+
bo || (Oc(), bo = true);
|
|
76116
75894
|
super();
|
|
76117
75895
|
c(this, "_ws");
|
|
76118
75896
|
c(this, "_retryCount", -1);
|
|
@@ -76134,17 +75912,17 @@ var gr = class t extends le {
|
|
|
76134
75912
|
c(this, "_handleOpen", (r2) => {
|
|
76135
75913
|
this._debug("open event");
|
|
76136
75914
|
let { minUptime: n2 = Ge.minUptime } = this._options;
|
|
76137
|
-
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2),
|
|
75915
|
+
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Ic(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(r2), this.dispatchEvent(pr(r2));
|
|
76138
75916
|
});
|
|
76139
75917
|
c(this, "_handleMessage", (r2) => {
|
|
76140
|
-
this._debug("message event"), this.onmessage && this.onmessage(r2), this.dispatchEvent(
|
|
75918
|
+
this._debug("message event"), this.onmessage && this.onmessage(r2), this.dispatchEvent(pr(r2));
|
|
76141
75919
|
});
|
|
76142
75920
|
c(this, "_handleError", (r2) => {
|
|
76143
|
-
let n2 =
|
|
76144
|
-
this._debug("error event", n2.message), this._disconnect(void 0, n2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(n2), this._debug("exec error listeners"), this.dispatchEvent(
|
|
75921
|
+
let n2 = Mc(r2, this);
|
|
75922
|
+
this._debug("error event", n2.message), this._disconnect(void 0, n2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(n2), this._debug("exec error listeners"), this.dispatchEvent(pr(n2)), this._connect();
|
|
76145
75923
|
});
|
|
76146
75924
|
c(this, "_handleClose", (r2) => {
|
|
76147
|
-
this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(r2), this.dispatchEvent(
|
|
75925
|
+
this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(r2), this.dispatchEvent(pr(r2));
|
|
76148
75926
|
});
|
|
76149
75927
|
this._url = r, this._protocols = n, this._options = i, this._options.startClosed && (this._shouldReconnect = false), this._options.binaryType ? this._binaryType = this._options.binaryType : this._binaryType = "blob", this._options.debugLogger && (this._debugLogger = this._options.debugLogger), this._connect();
|
|
76150
75928
|
}
|
|
@@ -76245,7 +76023,7 @@ var gr = class t extends le {
|
|
|
76245
76023
|
this._connectLock = false;
|
|
76246
76024
|
return;
|
|
76247
76025
|
}
|
|
76248
|
-
!this._options.WebSocket && typeof WebSocket > "u" && !
|
|
76026
|
+
!this._options.WebSocket && typeof WebSocket > "u" && !Eo && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Eo = true);
|
|
76249
76027
|
let i = this._options.WebSocket || WebSocket;
|
|
76250
76028
|
this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i(this._url, this._protocols) : new i(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
|
|
76251
76029
|
}).catch((i) => {
|
|
@@ -76258,7 +76036,7 @@ var gr = class t extends le {
|
|
|
76258
76036
|
_disconnect(r = 1e3, n) {
|
|
76259
76037
|
if (this._clearTimeouts(), !this._ws) return;
|
|
76260
76038
|
let i = this._ws;
|
|
76261
|
-
this._removeListeners(), i.addEventListener("error",
|
|
76039
|
+
this._removeListeners(), i.addEventListener("error", kc);
|
|
76262
76040
|
try {
|
|
76263
76041
|
i.close(r, n), this._handleClose(new J.CloseEvent(r, n, this));
|
|
76264
76042
|
} catch {
|
|
@@ -76277,8 +76055,230 @@ var gr = class t extends le {
|
|
|
76277
76055
|
clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
|
|
76278
76056
|
}
|
|
76279
76057
|
};
|
|
76058
|
+
var Rn = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
|
|
76059
|
+
var Dc = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
|
|
76060
|
+
var Cn = ["DiagnosticReport-update"];
|
|
76061
|
+
function Ro(t6) {
|
|
76062
|
+
return Cn.includes(t6);
|
|
76063
|
+
}
|
|
76064
|
+
function Co(t6) {
|
|
76065
|
+
if (Cn.includes(t6)) throw new m(T(`'context.version' is required for '${t6}'.`));
|
|
76066
|
+
}
|
|
76067
|
+
var Vc = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
|
|
76068
|
+
function _c(t6) {
|
|
76069
|
+
return Dc.includes(t6);
|
|
76070
|
+
}
|
|
76071
|
+
function Po(t6) {
|
|
76072
|
+
return !!t6.endpoint;
|
|
76073
|
+
}
|
|
76074
|
+
function Pn(t6) {
|
|
76075
|
+
if (!mr(t6)) throw new m(T("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
|
|
76076
|
+
let { channelType: e, mode: r, topic: n, events: i } = t6, o2 = { "hub.channel.type": e, "hub.mode": r, "hub.topic": n };
|
|
76077
|
+
return r === "subscribe" && (o2["hub.events"] = i.join(",")), Po(t6) && (o2["hub.channel.endpoint"] = t6.endpoint), new URLSearchParams(o2).toString();
|
|
76078
|
+
}
|
|
76079
|
+
function mr(t6) {
|
|
76080
|
+
if (typeof t6 != "object") return false;
|
|
76081
|
+
let { channelType: e, mode: r, topic: n, events: i } = t6;
|
|
76082
|
+
if (!(e && r && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || r !== "subscribe" && r !== "unsubscribe") return false;
|
|
76083
|
+
for (let o2 of i) if (!Rn[o2]) return false;
|
|
76084
|
+
return !(Po(t6) && !(typeof t6.endpoint == "string" && t6.endpoint.startsWith("ws")));
|
|
76085
|
+
}
|
|
76086
|
+
function Lc(t6, e, r, n) {
|
|
76087
|
+
if (typeof e != "object") throw new m(T(`context[${r}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
|
|
76088
|
+
if (!(e.id && typeof e.id == "string")) throw new m(T(`context[${r}] is invalid. Resource must contain a valid string ID.`));
|
|
76089
|
+
if (!e.resourceType) throw new m(T(`context[${r}] is invalid. Resource must contain a resource type. No resource type found.`));
|
|
76090
|
+
let i = n.resourceType;
|
|
76091
|
+
if (i !== "*") {
|
|
76092
|
+
if (!_c(e.resourceType)) throw new m(T(`context[${r}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
|
|
76093
|
+
if (i && e.resourceType !== i) throw new m(T(`context[${r}] is invalid. context[${r}] for the '${t6}' event should contain resource of type ${i}.`));
|
|
76094
|
+
}
|
|
76095
|
+
}
|
|
76096
|
+
function Nc(t6, e, r, n, i) {
|
|
76097
|
+
if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
|
|
76098
|
+
if (!Y(e.reference)) throw new m(T(`context[${r}] is invalid. Expected key '${e.key}' to be a reference.`));
|
|
76099
|
+
} else Lc(t6, e.resource, r, n);
|
|
76100
|
+
}
|
|
76101
|
+
function Fc(t6, e) {
|
|
76102
|
+
let r = /* @__PURE__ */ new Map(), n = Vc[t6];
|
|
76103
|
+
for (let i = 0; i < e.length; i++) {
|
|
76104
|
+
let o2 = e[i].key;
|
|
76105
|
+
if (!n[o2]) throw new m(T(`Key '${o2}' not found for event '${t6}'. Make sure to add only valid keys.`));
|
|
76106
|
+
Nc(t6, e[i], i, n[o2], r);
|
|
76107
|
+
}
|
|
76108
|
+
for (let [i, o2] of Object.entries(n)) {
|
|
76109
|
+
if (!(o2.optional || r.has(i))) throw new m(T(`Missing required key '${i}' on context for '${t6}' event.`));
|
|
76110
|
+
if (!o2.manyAllowed && (r.get(i) ?? 0) > 1) throw new m(T(`${r.get(i)} context entries with key '${i}' found for the '${t6}' event when schema only allows for 1.`));
|
|
76111
|
+
}
|
|
76112
|
+
}
|
|
76113
|
+
function An(t6, e, r, n) {
|
|
76114
|
+
if (!(t6 && typeof t6 == "string")) throw new m(T("Must provide a topic."));
|
|
76115
|
+
if (!Rn[e]) throw new m(T(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Rn).join(", ")}`));
|
|
76116
|
+
if (typeof r != "object") throw new m(T("context must be a context object or array of context objects."));
|
|
76117
|
+
if (Cn.includes(e) && !n) throw new m(T(`The '${e}' event must contain a 'context.versionId'.`));
|
|
76118
|
+
let i = Array.isArray(r) ? r : [r];
|
|
76119
|
+
return Fc(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ue(), event: { "hub.topic": t6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
|
|
76120
|
+
}
|
|
76121
|
+
var fr = class extends le {
|
|
76122
|
+
constructor(r, n) {
|
|
76123
|
+
super();
|
|
76124
|
+
c(this, "subRequest");
|
|
76125
|
+
c(this, "websocket");
|
|
76126
|
+
if (this.subRequest = r, !r.endpoint) throw new m(T("Subscription request should contain an endpoint."));
|
|
76127
|
+
if (!mr(r)) throw new m(T("Subscription request failed validation."));
|
|
76128
|
+
let { ReconnectingWebSocket: i = ot, ...o2 } = n ?? {}, s = new i(r.endpoint, void 0, o2);
|
|
76129
|
+
s.addEventListener("open", () => {
|
|
76130
|
+
this.dispatchEvent({ type: "connect" });
|
|
76131
|
+
}), s.addEventListener("message", (a) => {
|
|
76132
|
+
let u = JSON.parse(a.data);
|
|
76133
|
+
if (!u.event) {
|
|
76134
|
+
u["hub.mode"] === "denied" && this.disconnect();
|
|
76135
|
+
return;
|
|
76136
|
+
}
|
|
76137
|
+
let l = u;
|
|
76138
|
+
l.event["hub.event"] !== "heartbeat" && (this.dispatchEvent({ type: "message", payload: l }), s.send(JSON.stringify({ id: u?.id, timestamp: (/* @__PURE__ */ new Date()).toISOString() })));
|
|
76139
|
+
}), s.addEventListener("close", () => {
|
|
76140
|
+
this.dispatchEvent({ type: "disconnect" });
|
|
76141
|
+
}), this.websocket = s;
|
|
76142
|
+
}
|
|
76143
|
+
disconnect() {
|
|
76144
|
+
this.websocket.close();
|
|
76145
|
+
}
|
|
76146
|
+
};
|
|
76147
|
+
function Uc(t6) {
|
|
76148
|
+
return JSON.parse(dr(t6));
|
|
76149
|
+
}
|
|
76150
|
+
function Ao(t6) {
|
|
76151
|
+
return t6.split(".").length === 3;
|
|
76152
|
+
}
|
|
76153
|
+
function hr(t6) {
|
|
76154
|
+
let [e, r, n] = t6.split(".");
|
|
76155
|
+
return Uc(r);
|
|
76156
|
+
}
|
|
76157
|
+
function wo(t6) {
|
|
76158
|
+
try {
|
|
76159
|
+
return typeof hr(t6).login_id == "string";
|
|
76160
|
+
} catch {
|
|
76161
|
+
return false;
|
|
76162
|
+
}
|
|
76163
|
+
}
|
|
76164
|
+
function Oo(t6) {
|
|
76165
|
+
try {
|
|
76166
|
+
let r = hr(t6).exp;
|
|
76167
|
+
return typeof r == "number" ? r * 1e3 : void 0;
|
|
76168
|
+
} catch {
|
|
76169
|
+
return;
|
|
76170
|
+
}
|
|
76171
|
+
}
|
|
76172
|
+
var gr = class {
|
|
76173
|
+
constructor(e) {
|
|
76174
|
+
c(this, "medplum");
|
|
76175
|
+
this.medplum = e;
|
|
76176
|
+
}
|
|
76177
|
+
async get(e) {
|
|
76178
|
+
return this.medplum.get(`keyvalue/v1/${e}`);
|
|
76179
|
+
}
|
|
76180
|
+
async set(e, r) {
|
|
76181
|
+
await this.medplum.put(`keyvalue/v1/${e}`, r, V.TEXT);
|
|
76182
|
+
}
|
|
76183
|
+
async delete(e) {
|
|
76184
|
+
await this.medplum.delete(`keyvalue/v1/${e}`);
|
|
76185
|
+
}
|
|
76186
|
+
};
|
|
76187
|
+
var Io;
|
|
76188
|
+
Io = Symbol.toStringTag;
|
|
76189
|
+
var $ = class {
|
|
76190
|
+
constructor(e) {
|
|
76191
|
+
c(this, Io, "ReadablePromise");
|
|
76192
|
+
c(this, "suspender");
|
|
76193
|
+
c(this, "status", "pending");
|
|
76194
|
+
c(this, "response");
|
|
76195
|
+
c(this, "error");
|
|
76196
|
+
this.suspender = e.then((r) => (this.status = "success", this.response = r, r), (r) => {
|
|
76197
|
+
throw this.status = "error", this.error = r, r;
|
|
76198
|
+
});
|
|
76199
|
+
}
|
|
76200
|
+
isPending() {
|
|
76201
|
+
return this.status === "pending";
|
|
76202
|
+
}
|
|
76203
|
+
isOk() {
|
|
76204
|
+
return this.status === "success";
|
|
76205
|
+
}
|
|
76206
|
+
read() {
|
|
76207
|
+
switch (this.status) {
|
|
76208
|
+
case "pending":
|
|
76209
|
+
throw this.suspender;
|
|
76210
|
+
case "error":
|
|
76211
|
+
throw this.error;
|
|
76212
|
+
default:
|
|
76213
|
+
return this.response;
|
|
76214
|
+
}
|
|
76215
|
+
}
|
|
76216
|
+
then(e, r) {
|
|
76217
|
+
return this.suspender.then(e, r);
|
|
76218
|
+
}
|
|
76219
|
+
catch(e) {
|
|
76220
|
+
return this.suspender.catch(e);
|
|
76221
|
+
}
|
|
76222
|
+
finally(e) {
|
|
76223
|
+
return this.suspender.finally(e);
|
|
76224
|
+
}
|
|
76225
|
+
};
|
|
76226
|
+
var Tt = class {
|
|
76227
|
+
constructor(e, r = "") {
|
|
76228
|
+
c(this, "storage");
|
|
76229
|
+
c(this, "prefix", "");
|
|
76230
|
+
this.storage = e ?? globalThis.localStorage ?? new wn(), this.prefix = r;
|
|
76231
|
+
}
|
|
76232
|
+
makeKey(e) {
|
|
76233
|
+
return this.prefix + e;
|
|
76234
|
+
}
|
|
76235
|
+
clear() {
|
|
76236
|
+
if (this.storage === globalThis.localStorage && this.prefix) for (let e = this.storage.length - 1; e >= 0; e--) {
|
|
76237
|
+
let r = this.storage.key(e);
|
|
76238
|
+
r?.startsWith(this.prefix) && this.storage.removeItem(r);
|
|
76239
|
+
}
|
|
76240
|
+
else this.storage.clear();
|
|
76241
|
+
}
|
|
76242
|
+
getString(e) {
|
|
76243
|
+
return this.storage.getItem(this.makeKey(e)) ?? void 0;
|
|
76244
|
+
}
|
|
76245
|
+
setString(e, r) {
|
|
76246
|
+
r ? this.storage.setItem(this.makeKey(e), r) : this.storage.removeItem(this.makeKey(e));
|
|
76247
|
+
}
|
|
76248
|
+
getObject(e) {
|
|
76249
|
+
let r = this.getString(e);
|
|
76250
|
+
return r ? JSON.parse(r) : void 0;
|
|
76251
|
+
}
|
|
76252
|
+
setObject(e, r) {
|
|
76253
|
+
this.setString(e, r ? jt(r) : void 0);
|
|
76254
|
+
}
|
|
76255
|
+
};
|
|
76256
|
+
var wn = class {
|
|
76257
|
+
constructor() {
|
|
76258
|
+
c(this, "data");
|
|
76259
|
+
this.data = /* @__PURE__ */ new Map();
|
|
76260
|
+
}
|
|
76261
|
+
get length() {
|
|
76262
|
+
return this.data.size;
|
|
76263
|
+
}
|
|
76264
|
+
clear() {
|
|
76265
|
+
this.data.clear();
|
|
76266
|
+
}
|
|
76267
|
+
getItem(e) {
|
|
76268
|
+
return this.data.get(e) ?? null;
|
|
76269
|
+
}
|
|
76270
|
+
setItem(e, r) {
|
|
76271
|
+
r ? this.data.set(e, r) : this.data.delete(e);
|
|
76272
|
+
}
|
|
76273
|
+
removeItem(e) {
|
|
76274
|
+
this.data.delete(e);
|
|
76275
|
+
}
|
|
76276
|
+
key(e) {
|
|
76277
|
+
return Array.from(this.data.keys())[e];
|
|
76278
|
+
}
|
|
76279
|
+
};
|
|
76280
76280
|
var Bc = [WebSocket.CLOSING, WebSocket.CLOSED];
|
|
76281
|
-
var
|
|
76281
|
+
var bt = class extends le {
|
|
76282
76282
|
constructor(...r) {
|
|
76283
76283
|
super();
|
|
76284
76284
|
c(this, "criteria");
|
|
@@ -76306,7 +76306,7 @@ var On = class {
|
|
|
76306
76306
|
c(this, "state", "idle");
|
|
76307
76307
|
c(this, "generation", 0);
|
|
76308
76308
|
c(this, "lastUnrefTime");
|
|
76309
|
-
this.criteria = e, this.emitter = new
|
|
76309
|
+
this.criteria = e, this.emitter = new bt(e), this.refCount = 1, this.subscriptionProps = r ? { ...r } : void 0;
|
|
76310
76310
|
}
|
|
76311
76311
|
nextGeneration() {
|
|
76312
76312
|
return ++this.generation;
|
|
@@ -76332,8 +76332,8 @@ var yr = class {
|
|
|
76332
76332
|
} catch {
|
|
76333
76333
|
throw new m(T("Not a valid URL"));
|
|
76334
76334
|
}
|
|
76335
|
-
let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new
|
|
76336
|
-
this.medplum = e, this.ws = o2, this.masterSubEmitter = new
|
|
76335
|
+
let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new ot(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
|
|
76336
|
+
this.medplum = e, this.ws = o2, this.masterSubEmitter = new bt(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? 5e3, this.currentProfile = e.getProfile(), this.setupListeners();
|
|
76337
76337
|
}
|
|
76338
76338
|
setupListeners() {
|
|
76339
76339
|
let e = this.ws;
|
|
@@ -76429,7 +76429,7 @@ var yr = class {
|
|
|
76429
76429
|
}
|
|
76430
76430
|
getAllCriteriaEmitters() {
|
|
76431
76431
|
let e = [];
|
|
76432
|
-
for (let r of this.criteriaEntries.values()) for (let n of
|
|
76432
|
+
for (let r of this.criteriaEntries.values()) for (let n of St(r)) n.refCount > 0 && e.push(n.emitter);
|
|
76433
76433
|
return e;
|
|
76434
76434
|
}
|
|
76435
76435
|
addCriteriaEntry(e) {
|
|
@@ -76452,7 +76452,7 @@ var yr = class {
|
|
|
76452
76452
|
async refreshAllSubscriptions() {
|
|
76453
76453
|
this.criteriaEntriesBySubscriptionId.clear();
|
|
76454
76454
|
let e = [], r = [];
|
|
76455
|
-
for (let n of this.criteriaEntries.values()) for (let i of
|
|
76455
|
+
for (let n of this.criteriaEntries.values()) for (let i of St(n)) i.refCount === 0 ? r.push(i) : e.push(i);
|
|
76456
76456
|
for (let n of r) this.removeCriteriaEntry(n);
|
|
76457
76457
|
for (let n of e) n.token && this.sendUnbind(n.token), n.token = void 0, n.tokenExpiry = void 0, n.subscriptionId = void 0, n.state = "idle", n.generation++, await this.subscribeToCriteria(n);
|
|
76458
76458
|
}
|
|
@@ -76476,7 +76476,7 @@ var yr = class {
|
|
|
76476
76476
|
checkTokenExpirations() {
|
|
76477
76477
|
if (!this.medplum.getProfile()) return;
|
|
76478
76478
|
let e = Date.now();
|
|
76479
|
-
for (let r of this.criteriaEntries.values()) for (let n of
|
|
76479
|
+
for (let r of this.criteriaEntries.values()) for (let n of St(r)) n.refCount === 0 || !n.tokenExpiry || n.tokenExpiry - e <= 3e5 && n.state === "active" && this.ws.readyState === WebSocket.OPEN && (n.state = "refreshing", this.rebindCriteriaEntry(n).catch((i) => {
|
|
76480
76480
|
this.masterSubEmitter?.dispatchEvent({ type: "error", payload: i });
|
|
76481
76481
|
}));
|
|
76482
76482
|
}
|
|
@@ -76497,7 +76497,7 @@ var yr = class {
|
|
|
76497
76497
|
}
|
|
76498
76498
|
gcUnrefEntries() {
|
|
76499
76499
|
let e = Date.now(), r = [];
|
|
76500
|
-
for (let n of this.criteriaEntries.values()) for (let i of
|
|
76500
|
+
for (let n of this.criteriaEntries.values()) for (let i of St(n)) i.refCount === 0 && i.lastUnrefTime !== void 0 && e - i.lastUnrefTime >= 1e4 && r.push(i);
|
|
76501
76501
|
for (let n of r) this.maybeEmitDisconnect(n), this.removeCriteriaEntry(n);
|
|
76502
76502
|
r.length > 0 && this.criteriaEntries.size === 0 && this.closeWebSocket();
|
|
76503
76503
|
}
|
|
@@ -76509,7 +76509,7 @@ var yr = class {
|
|
|
76509
76509
|
}
|
|
76510
76510
|
closeWebSocket() {
|
|
76511
76511
|
if (!this.wsClosed) {
|
|
76512
|
-
if (this.ws.readyState === WebSocket.OPEN) for (let e of this.criteriaEntries.values()) for (let r of
|
|
76512
|
+
if (this.ws.readyState === WebSocket.OPEN) for (let e of this.criteriaEntries.values()) for (let r of St(e)) r.token && this.sendUnbind(r.token);
|
|
76513
76513
|
this.wsClosed = true, this.ws.close();
|
|
76514
76514
|
}
|
|
76515
76515
|
}
|
|
@@ -76520,7 +76520,7 @@ var yr = class {
|
|
|
76520
76520
|
return this.getAllCriteriaEmitters().length;
|
|
76521
76521
|
}
|
|
76522
76522
|
getMasterEmitter() {
|
|
76523
|
-
return this.masterSubEmitter || (this.masterSubEmitter = new
|
|
76523
|
+
return this.masterSubEmitter || (this.masterSubEmitter = new bt(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
|
|
76524
76524
|
}
|
|
76525
76525
|
async reconnectIfNeeded() {
|
|
76526
76526
|
Bc.includes(this.getWebSocket().readyState) && await new Promise((e) => {
|
|
@@ -76531,11 +76531,11 @@ var yr = class {
|
|
|
76531
76531
|
});
|
|
76532
76532
|
}
|
|
76533
76533
|
};
|
|
76534
|
-
function
|
|
76534
|
+
function St(t6) {
|
|
76535
76535
|
return t6.bareCriteria ? [t6.bareCriteria, ...t6.criteriaWithProps] : t6.criteriaWithProps;
|
|
76536
76536
|
}
|
|
76537
76537
|
var qc = new ee(1e3);
|
|
76538
|
-
var In = "5.1.
|
|
76538
|
+
var In = "5.1.30-72b528b";
|
|
76539
76539
|
var jc = V.FHIR_JSON + ", */*; q=0.1";
|
|
76540
76540
|
var Hc = "https://api.medplum.com/";
|
|
76541
76541
|
var Gc = 1e3;
|
|
@@ -76545,7 +76545,7 @@ var Jc = 3e5;
|
|
|
76545
76545
|
var Kc = "Binary/";
|
|
76546
76546
|
var Mo = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
|
|
76547
76547
|
var Yc = 2;
|
|
76548
|
-
var
|
|
76548
|
+
var st = { ClientCredentials: "client_credentials", AuthorizationCode: "authorization_code", RefreshToken: "refresh_token", JwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer", TokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange", PreAuthorizedCode: "urn:ietf:params:oauth:grant-type:pre-authorized_code" };
|
|
76549
76549
|
var Xc = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
|
|
76550
76550
|
var Zc = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
|
|
76551
76551
|
var xr = class extends le {
|
|
@@ -76590,7 +76590,7 @@ var xr = class extends le {
|
|
|
76590
76590
|
c(this, "keyValueClient");
|
|
76591
76591
|
c(this, "logLevel");
|
|
76592
76592
|
if (r?.baseUrl && !r.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
|
|
76593
|
-
this.options = r ?? {}, this.fetch = r?.fetch ?? eu(), this.storage = r?.storage ?? new
|
|
76593
|
+
this.options = r ?? {}, this.fetch = r?.fetch ?? eu(), this.storage = r?.storage ?? new Tt(void 0, r?.storagePrefix), this.createPdfImpl = r?.createPdf, this.baseUrl = yn(r?.baseUrl ?? Hc), this.fhirBaseUrl = W(this.baseUrl, r?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, r?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, r?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, r?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, r?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = W(this.baseUrl, r?.cdsServicesUrl ?? "cds-services"), this.clientId = r?.clientId ?? "", this.clientSecret = r?.clientSecret ?? "", this.credentialsInHeader = r?.authCredentialsMethod === "header", this.defaultHeaders = r?.defaultHeaders ?? {}, this.onUnauthenticated = r?.onUnauthenticated, this.refreshGracePeriod = r?.refreshGracePeriod ?? Jc, this.logLevel = this.initializeLogLevel(r), this.maxRetries = r?.maxRetries ?? 2, this.maxRetryTime = r?.maxRetryTime ?? 2e3, this.cacheTime = r?.cacheTime ?? (Z() ? Qc : zc), this.cacheTime > 0 ? this.requestCache = new ee(r?.resourceCacheSize ?? Gc) : this.requestCache = void 0, r?.autoBatchTime ? (this.autoBatchTime = r.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), r?.accessToken && this.setAccessToken(r.accessToken), this.storage.getInitPromise === void 0 ? (r?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
|
|
76594
76594
|
r?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
|
|
76595
76595
|
}).catch((n) => {
|
|
76596
76596
|
console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
|
|
@@ -76711,7 +76711,7 @@ var xr = class extends le {
|
|
|
76711
76711
|
}
|
|
76712
76712
|
async exchangeExternalAccessToken(r, n, i) {
|
|
76713
76713
|
if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
|
|
76714
|
-
let o2 = { grant_type:
|
|
76714
|
+
let o2 = { grant_type: st.TokenExchange, subject_token_type: Xc.AccessToken, client_id: n, subject_token: r };
|
|
76715
76715
|
return i && (o2.membership_id = i), this.fetchTokens(o2);
|
|
76716
76716
|
}
|
|
76717
76717
|
getExternalAuthRedirectUri(r, n, i, o2, s = true) {
|
|
@@ -76921,7 +76921,7 @@ var xr = class extends le {
|
|
|
76921
76921
|
s?.signal?.removeEventListener("abort", d), h4 instanceof Error ? u(h4) : a(h4);
|
|
76922
76922
|
};
|
|
76923
76923
|
if (l.responseType = "json", l.onabort = () => f(new DOMException("Request aborted", "AbortError")), l.onerror = () => f(new Error("Request error")), o2 && (l.upload.onprogress = (h4) => o2(h4), l.upload.onload = (h4) => o2(h4)), l.onload = () => {
|
|
76924
|
-
l.status >= 200 && l.status < 300 ? f(l.response) : f(new m(
|
|
76924
|
+
l.status >= 200 && l.status < 300 ? f(l.response) : f(new m(Vt(l.response || l.statusText)));
|
|
76925
76925
|
}, l.open("POST", r), l.withCredentials = true, l.setRequestHeader("Authorization", "Bearer " + this.accessToken), l.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), l.setRequestHeader("Content-Type", i), this.options.extendedMode !== false && l.setRequestHeader("X-Medplum", "extended"), s?.headers) {
|
|
76926
76926
|
let h4 = s.headers;
|
|
76927
76927
|
for (let [b2, P] of Object.entries(h4)) l.setRequestHeader(b2, P);
|
|
@@ -77002,7 +77002,7 @@ var xr = class extends le {
|
|
|
77002
77002
|
return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (r ?? this.refreshGracePeriod);
|
|
77003
77003
|
}
|
|
77004
77004
|
setAccessToken(r, n) {
|
|
77005
|
-
this.accessToken = r, this.refreshToken = n, this.accessTokenExpires =
|
|
77005
|
+
this.accessToken = r, this.refreshToken = n, this.accessTokenExpires = Oo(r), this.medplumServer = wo(r);
|
|
77006
77006
|
}
|
|
77007
77007
|
getLogins() {
|
|
77008
77008
|
return this.storage.getObject("logins") ?? [];
|
|
@@ -77091,7 +77091,7 @@ var xr = class extends le {
|
|
|
77091
77091
|
return await this.refreshIfExpired(), this.addFetchOptionsDefaults(n), this.fetchWithRetry(r, n);
|
|
77092
77092
|
}
|
|
77093
77093
|
get keyValue() {
|
|
77094
|
-
return this.keyValueClient || (this.keyValueClient = new
|
|
77094
|
+
return this.keyValueClient || (this.keyValueClient = new gr(this)), this.keyValueClient;
|
|
77095
77095
|
}
|
|
77096
77096
|
getBundle(r, n) {
|
|
77097
77097
|
return new $((async () => {
|
|
@@ -77137,7 +77137,7 @@ var xr = class extends le {
|
|
|
77137
77137
|
let d = await Do(o2, u) ?? i.statusUrl;
|
|
77138
77138
|
if (d) return this.pollStatus(d, n, i);
|
|
77139
77139
|
}
|
|
77140
|
-
if (o2.status >= 400) throw new m(
|
|
77140
|
+
if (o2.status >= 400) throw new m(Vt(u));
|
|
77141
77141
|
return u;
|
|
77142
77142
|
}
|
|
77143
77143
|
async parseBody(r, n) {
|
|
@@ -77170,7 +77170,7 @@ var xr = class extends le {
|
|
|
77170
77170
|
logRequest(r, n) {
|
|
77171
77171
|
if (console.log(`> ${n.method} ${r}`), this.logLevel === "verbose" && n.headers) {
|
|
77172
77172
|
let i = n.headers;
|
|
77173
|
-
for (let o2 of
|
|
77173
|
+
for (let o2 of Ht(Object.keys(i))) console.log(`> ${o2}: ${i[o2]}`);
|
|
77174
77174
|
}
|
|
77175
77175
|
}
|
|
77176
77176
|
logResponse(r) {
|
|
@@ -77214,7 +77214,7 @@ var xr = class extends le {
|
|
|
77214
77214
|
try {
|
|
77215
77215
|
o2.options.method = o2.method, o2.resolve(await this.request(W(this.fhirBaseUrl, o2.url), o2.options));
|
|
77216
77216
|
} catch (s) {
|
|
77217
|
-
o2.reject(new m(
|
|
77217
|
+
o2.reject(new m(Vt(s)));
|
|
77218
77218
|
}
|
|
77219
77219
|
return;
|
|
77220
77220
|
}
|
|
@@ -77227,7 +77227,7 @@ var xr = class extends le {
|
|
|
77227
77227
|
addFetchOptionsDefaults(r) {
|
|
77228
77228
|
Object.entries(this.defaultHeaders).forEach(([n, i]) => {
|
|
77229
77229
|
this.setRequestHeader(r, n, i);
|
|
77230
|
-
}), this.setRequestHeader(r, "Accept", jc, true), this.options.extendedMode !== false && this.setRequestHeader(r, "X-Medplum", "extended"), r.body && this.setRequestHeader(r, "Content-Type", V.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(r, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(r, "Authorization", "Basic " + this.basicAuth), r.
|
|
77230
|
+
}), this.setRequestHeader(r, "Accept", jc, true), this.options.extendedMode !== false && this.setRequestHeader(r, "X-Medplum", "extended"), r.body && this.setRequestHeader(r, "Content-Type", V.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(r, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(r, "Authorization", "Basic " + this.basicAuth), r.credentials || (r.credentials = "include");
|
|
77231
77231
|
}
|
|
77232
77232
|
setRequestContentType(r, n) {
|
|
77233
77233
|
this.setRequestHeader(r, "Content-Type", n);
|
|
@@ -77272,7 +77272,7 @@ var xr = class extends le {
|
|
|
77272
77272
|
i.searchParams.set("response_type", "code"), i.searchParams.set("state", this.storage.getString("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? ge.getOrigin()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), ge.assign(i.toString());
|
|
77273
77273
|
}
|
|
77274
77274
|
processCode(r, n) {
|
|
77275
|
-
let i = { grant_type:
|
|
77275
|
+
let i = { grant_type: st.AuthorizationCode, code: r, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? ge.getOrigin() }, o2 = this.storage.getString("codeVerifier");
|
|
77276
77276
|
return o2 && (i.code_verifier = o2), this.fetchTokens(i);
|
|
77277
77277
|
}
|
|
77278
77278
|
refreshIfExpired(r) {
|
|
@@ -77287,23 +77287,23 @@ var xr = class extends le {
|
|
|
77287
77287
|
let a = this.accessToken, u = this.getActiveLogin();
|
|
77288
77288
|
u?.accessToken && u.accessToken !== this.accessToken && this.setAccessToken(u.accessToken, u.refreshToken);
|
|
77289
77289
|
let l = this.accessToken !== a;
|
|
77290
|
-
return this.isAuthenticated(r) && (!n || l) ? Promise.resolve(this.getProfile()) : this.refreshToken ? this.fetchTokens({ grant_type:
|
|
77290
|
+
return this.isAuthenticated(r) && (!n || l) ? Promise.resolve(this.getProfile()) : this.refreshToken ? this.fetchTokens({ grant_type: st.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }) : this.clientId && this.clientSecret ? this.startClientLogin(this.clientId, this.clientSecret) : Promise.resolve(void 0);
|
|
77291
77291
|
}, o2 = typeof navigator < "u" ? navigator.locks : void 0;
|
|
77292
77292
|
if (!o2?.request) return i();
|
|
77293
77293
|
let s = `medplum-refresh:${this.storage.makeKey("activeLogin")}`;
|
|
77294
77294
|
return o2.request(s, i);
|
|
77295
77295
|
}
|
|
77296
77296
|
async startClientLogin(r, n) {
|
|
77297
|
-
return this.clientId = r, this.clientSecret = n, this.fetchTokens({ grant_type:
|
|
77297
|
+
return this.clientId = r, this.clientSecret = n, this.fetchTokens({ grant_type: st.ClientCredentials, client_id: r, client_secret: n });
|
|
77298
77298
|
}
|
|
77299
77299
|
async startJwtBearerLogin(r, n, i) {
|
|
77300
|
-
return this.clientId = r, this.fetchTokens({ grant_type:
|
|
77300
|
+
return this.clientId = r, this.fetchTokens({ grant_type: st.JwtBearer, client_id: r, assertion: n, scope: i });
|
|
77301
77301
|
}
|
|
77302
77302
|
async startJwtAssertionLogin(r) {
|
|
77303
|
-
return this.fetchTokens({ grant_type:
|
|
77303
|
+
return this.fetchTokens({ grant_type: st.ClientCredentials, client_assertion_type: Zc.JwtBearer, client_assertion: r });
|
|
77304
77304
|
}
|
|
77305
77305
|
setBasicAuth(r, n) {
|
|
77306
|
-
this.clientId = r, this.clientSecret = n, this.basicAuth =
|
|
77306
|
+
this.clientId = r, this.clientSecret = n, this.basicAuth = lr(r + ":" + n);
|
|
77307
77307
|
}
|
|
77308
77308
|
setLogLevel(r) {
|
|
77309
77309
|
this.logLevel = r, this.options.verbose = r === "verbose";
|
|
@@ -77322,15 +77322,15 @@ var xr = class extends le {
|
|
|
77322
77322
|
return i.endpoint = s, i;
|
|
77323
77323
|
}
|
|
77324
77324
|
async fhircastUnsubscribe(r) {
|
|
77325
|
-
if (!
|
|
77325
|
+
if (!mr(r)) throw new m(T("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
|
|
77326
77326
|
if (!(r.endpoint && typeof r.endpoint == "string" && r.endpoint.startsWith("ws"))) throw new m(T("Provided subscription request must have an endpoint in order to unsubscribe."));
|
|
77327
77327
|
r.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Pn(r), V.FORM_URL_ENCODED);
|
|
77328
77328
|
}
|
|
77329
|
-
fhircastConnect(r) {
|
|
77330
|
-
return new
|
|
77329
|
+
fhircastConnect(r, n) {
|
|
77330
|
+
return new fr(r, n);
|
|
77331
77331
|
}
|
|
77332
77332
|
async fhircastPublish(r, n, i, o2) {
|
|
77333
|
-
return
|
|
77333
|
+
return Ro(n) ? this.post(this.fhircastHubUrl, An(r, n, i, o2), V.JSON) : (Co(n), this.post(this.fhircastHubUrl, An(r, n, i), V.JSON));
|
|
77334
77334
|
}
|
|
77335
77335
|
async fhircastGetContext(r) {
|
|
77336
77336
|
return this.get(`${this.fhircastHubUrl}/${r}`, { cache: "no-cache" });
|
|
@@ -77341,14 +77341,14 @@ var xr = class extends le {
|
|
|
77341
77341
|
async handleTokenError(r) {
|
|
77342
77342
|
try {
|
|
77343
77343
|
let n = await r.json();
|
|
77344
|
-
throw
|
|
77344
|
+
throw ut(n) ? new m(n) : n.error_description ? new m(w(n.error_description)) : new Error(JSON.stringify(n));
|
|
77345
77345
|
} catch (n) {
|
|
77346
77346
|
throw n instanceof m ? (n.message = `Failed to fetch tokens: ${n.message}`, n) : new m(w("Failed to fetch tokens"), { cause: n });
|
|
77347
77347
|
}
|
|
77348
77348
|
}
|
|
77349
77349
|
async fetchTokens(r) {
|
|
77350
77350
|
let n = new URLSearchParams(r), i = { ...this.defaultHeaders, "Content-Type": V.FORM_URL_ENCODED };
|
|
77351
|
-
this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && r.client_id && r.client_secret && (i.Authorization = `Basic ${
|
|
77351
|
+
this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && r.client_id && r.client_secret && (i.Authorization = `Basic ${lr(r.client_id + ":" + r.client_secret)}`));
|
|
77352
77352
|
let o2 = { method: "POST", headers: i, body: n.toString(), credentials: "include" }, s;
|
|
77353
77353
|
try {
|
|
77354
77354
|
s = await this.fetchWithRetry(this.tokenUrl, o2);
|
|
@@ -77361,8 +77361,8 @@ var xr = class extends le {
|
|
|
77361
77361
|
}
|
|
77362
77362
|
async verifyTokens(r) {
|
|
77363
77363
|
let n = r.access_token;
|
|
77364
|
-
if (
|
|
77365
|
-
let i =
|
|
77364
|
+
if (Ao(n)) {
|
|
77365
|
+
let i = hr(n);
|
|
77366
77366
|
if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new m(hi);
|
|
77367
77367
|
if (i.cid) {
|
|
77368
77368
|
if (i.cid !== this.clientId) throw this.clearActiveLogin(), new m(Br);
|
|
@@ -77407,7 +77407,7 @@ async function Do(t6, e) {
|
|
|
77407
77407
|
if (r) return r;
|
|
77408
77408
|
let n = t6.headers.get("location");
|
|
77409
77409
|
if (n) return n;
|
|
77410
|
-
if (
|
|
77410
|
+
if (ut(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
|
|
77411
77411
|
}
|
|
77412
77412
|
function Vo(t6) {
|
|
77413
77413
|
let e = t6.entry?.map((r) => r.resource) ?? [];
|
|
@@ -77428,13 +77428,13 @@ function nu(t6, e, r, n) {
|
|
|
77428
77428
|
function iu(t6) {
|
|
77429
77429
|
return t6.status === 429 || t6.status >= 500;
|
|
77430
77430
|
}
|
|
77431
|
-
var gu = [...
|
|
77432
|
-
var vu =
|
|
77431
|
+
var gu = [...gt, "->", "<<", ">>", "=="];
|
|
77432
|
+
var vu = yt().registerInfix("->", { precedence: S.Arrow }).registerInfix(";", { precedence: S.Semicolon });
|
|
77433
77433
|
var zu = Object.freeze({ implicitArrayCreation: true });
|
|
77434
77434
|
var Ku = " ".repeat(2);
|
|
77435
|
-
var Xu = [...
|
|
77435
|
+
var Xu = [...gt, "eq", "ne", "co"];
|
|
77436
77436
|
var Zu = { eq: g.EXACT, ne: g.NOT_EQUALS, co: g.CONTAINS, sw: g.STARTS_WITH, ew: void 0, gt: g.GREATER_THAN, lt: g.LESS_THAN, ge: g.GREATER_THAN_OR_EQUALS, le: g.LESS_THAN_OR_EQUALS, ap: g.APPROXIMATELY, sa: g.STARTS_AFTER, eb: g.ENDS_BEFORE, pr: g.PRESENT, po: void 0, ss: void 0, sb: void 0, in: g.IN, ni: g.NOT_IN, re: g.EQUALS, identifier: g.IDENTIFIER };
|
|
77437
|
-
var tl =
|
|
77437
|
+
var tl = yt();
|
|
77438
77438
|
var rl = { AA: "AA", AE: "AE", AR: "AR", CA: "CA", CE: "CE", CR: "CR" };
|
|
77439
77439
|
function nl(t6) {
|
|
77440
77440
|
return t6 !== void 0 && Object.hasOwn(rl, t6);
|
|
@@ -77497,7 +77497,7 @@ var as = class t2 {
|
|
|
77497
77497
|
let r = this._segments[e];
|
|
77498
77498
|
if (r === void 0) return;
|
|
77499
77499
|
if (typeof r != "string") return r;
|
|
77500
|
-
let n =
|
|
77500
|
+
let n = At.parse(r, this.context);
|
|
77501
77501
|
return n.onModified = () => {
|
|
77502
77502
|
this.cachedString = void 0;
|
|
77503
77503
|
}, this._segments[e] = n, n;
|
|
@@ -77511,7 +77511,7 @@ var as = class t2 {
|
|
|
77511
77511
|
}
|
|
77512
77512
|
buildAck(e) {
|
|
77513
77513
|
let r = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o2 = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", u = n?.getField(10)?.toString() ?? "", l = n?.getField(12)?.toString() ?? "2.5.1", d = e?.ackCode ?? "AA";
|
|
77514
|
-
return new t2([new
|
|
77514
|
+
return new t2([new At(["MSH", this.context.getMsh2(), s, a, i, o2, sl(r), "", this.buildAckMessageType(n), r.getTime().toString(), "P", l], this.context), new At(["MSA", d, u, il[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
|
|
77515
77515
|
}
|
|
77516
77516
|
buildAckMessageType(e) {
|
|
77517
77517
|
let r = e?.getField(9), n = r?.getComponent(2), i = r?.getComponent(3), o2 = "ACK";
|
|
@@ -77556,7 +77556,7 @@ function cs(t6) {
|
|
|
77556
77556
|
}
|
|
77557
77557
|
return e;
|
|
77558
77558
|
}
|
|
77559
|
-
var
|
|
77559
|
+
var At = class t3 {
|
|
77560
77560
|
constructor(e, r = new Ie()) {
|
|
77561
77561
|
c(this, "context");
|
|
77562
77562
|
c(this, "name");
|
|
@@ -77675,10 +77675,10 @@ function sl(t6) {
|
|
|
77675
77675
|
let e = t6 instanceof Date ? t6 : new Date(t6), n = e.toISOString().replaceAll(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
|
|
77676
77676
|
return i > 0 && (n += "." + i.toString()), n;
|
|
77677
77677
|
}
|
|
77678
|
-
var
|
|
77678
|
+
var ct = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
|
|
77679
77679
|
var al = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
|
|
77680
77680
|
var us = class t5 {
|
|
77681
|
-
constructor(e, r = {}, n =
|
|
77681
|
+
constructor(e, r = {}, n = ct.INFO, i = {}) {
|
|
77682
77682
|
c(this, "write");
|
|
77683
77683
|
c(this, "metadata");
|
|
77684
77684
|
c(this, "options");
|
|
@@ -77695,16 +77695,16 @@ var us = class t5 {
|
|
|
77695
77695
|
return { write: e, metadata: r, level: n, options: i };
|
|
77696
77696
|
}
|
|
77697
77697
|
error(e, r) {
|
|
77698
|
-
this.log(
|
|
77698
|
+
this.log(ct.ERROR, e, r);
|
|
77699
77699
|
}
|
|
77700
77700
|
warn(e, r) {
|
|
77701
|
-
this.log(
|
|
77701
|
+
this.log(ct.WARN, e, r);
|
|
77702
77702
|
}
|
|
77703
77703
|
info(e, r) {
|
|
77704
|
-
this.log(
|
|
77704
|
+
this.log(ct.INFO, e, r);
|
|
77705
77705
|
}
|
|
77706
77706
|
debug(e, r) {
|
|
77707
|
-
this.log(
|
|
77707
|
+
this.log(ct.DEBUG, e, r);
|
|
77708
77708
|
}
|
|
77709
77709
|
log(e, r, n) {
|
|
77710
77710
|
if (e > this.level) return;
|
|
@@ -77717,8 +77717,8 @@ var us = class t5 {
|
|
|
77717
77717
|
this.write(JSON.stringify({ level: al[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${r}` : r, ...i, ...this.metadata }));
|
|
77718
77718
|
}
|
|
77719
77719
|
};
|
|
77720
|
-
function
|
|
77721
|
-
let e =
|
|
77720
|
+
function Qy(t6) {
|
|
77721
|
+
let e = ct[t6.toUpperCase()];
|
|
77722
77722
|
if (e === void 0) throw new Error(`Invalid log level: ${t6}`);
|
|
77723
77723
|
return e;
|
|
77724
77724
|
}
|
|
@@ -77735,11 +77735,12 @@ function Or(t6, e = 0, r = 10) {
|
|
|
77735
77735
|
}
|
|
77736
77736
|
return n;
|
|
77737
77737
|
}
|
|
77738
|
-
var Zn = `${
|
|
77738
|
+
var Zn = `${It}/fhir/StructureDefinition/patient-preferredPharmacy`;
|
|
77739
|
+
var Ol = { wk: 1440 * 7, d: 1440, h: 60, min: 1 };
|
|
77739
77740
|
var Ts = /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/;
|
|
77740
|
-
var
|
|
77741
|
+
var Wl = "https://meta.medplum.com/releases";
|
|
77741
77742
|
var ri = /* @__PURE__ */ new Map();
|
|
77742
|
-
function
|
|
77743
|
+
function $l(t6) {
|
|
77743
77744
|
let e = t6;
|
|
77744
77745
|
if (!e.tag_name?.startsWith("v")) throw new Error("Manifest missing valid tag_name starting with a 'v' (eg. v5.1.15)");
|
|
77745
77746
|
let r = e.assets;
|
|
@@ -77750,7 +77751,7 @@ function Wl(t6) {
|
|
|
77750
77751
|
}
|
|
77751
77752
|
}
|
|
77752
77753
|
async function Ss(t6, e, r, n) {
|
|
77753
|
-
let i = new URL(`${
|
|
77754
|
+
let i = new URL(`${Wl}/${t6}`);
|
|
77754
77755
|
if (i.searchParams.set("a", e), i.searchParams.set("c", In), n) for (let [s, a] of Object.entries(n)) i.searchParams.set(s, a);
|
|
77755
77756
|
let o2 = await fetch(i.toString());
|
|
77756
77757
|
if (o2.status !== 200) {
|
|
@@ -77768,17 +77769,17 @@ async function ni(t6, e, r) {
|
|
|
77768
77769
|
let n = e ? ri.get(e) : void 0;
|
|
77769
77770
|
if (!n) {
|
|
77770
77771
|
let i = e ? `v${e}` : "latest", o2 = await Ss(`${i}.json`, t6, `fetching manifest for version '${e ?? "latest"}'`, r);
|
|
77771
|
-
|
|
77772
|
+
$l(o2), n = o2, ri.set(n.tag_name.slice(1), n);
|
|
77772
77773
|
}
|
|
77773
77774
|
return n;
|
|
77774
77775
|
}
|
|
77775
77776
|
function bs(t6) {
|
|
77776
77777
|
return Ts.test(t6);
|
|
77777
77778
|
}
|
|
77778
|
-
function
|
|
77779
|
+
function jl(t6) {
|
|
77779
77780
|
if (!Ts.test(t6)) throw new TypeError(`Version is not a valid Medplum semver (eg. 1.1.1 or 1.1.1-a1bc): ${t6}`);
|
|
77780
77781
|
}
|
|
77781
|
-
async function
|
|
77782
|
+
async function mv(t6, e) {
|
|
77782
77783
|
if (!bs(e)) return false;
|
|
77783
77784
|
try {
|
|
77784
77785
|
await ni(t6, e);
|
|
@@ -77787,11 +77788,11 @@ async function cv(t6, e) {
|
|
|
77787
77788
|
}
|
|
77788
77789
|
return true;
|
|
77789
77790
|
}
|
|
77790
|
-
async function
|
|
77791
|
+
async function hv(t6) {
|
|
77791
77792
|
let e = await ni(t6);
|
|
77792
77793
|
if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
|
|
77793
77794
|
let r = e.tag_name.slice(1);
|
|
77794
|
-
return
|
|
77795
|
+
return jl(r), r;
|
|
77795
77796
|
}
|
|
77796
77797
|
|
|
77797
77798
|
// src/main.ts
|
|
@@ -77900,7 +77901,7 @@ var v2 = class extends m2 {
|
|
|
77900
77901
|
return;
|
|
77901
77902
|
}
|
|
77902
77903
|
let l = i.message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
|
|
77903
|
-
l && (u.returnAck ===
|
|
77904
|
+
l && (u.returnAck === Om.APPLICATION && l === "CA" || (u.timer && clearTimeout(u.timer), u.resolve(i.message), this.deletePendingMessage(a)));
|
|
77904
77905
|
});
|
|
77905
77906
|
}
|
|
77906
77907
|
isClosed() {
|
|
@@ -77953,7 +77954,7 @@ var v2 = class extends m2 {
|
|
|
77953
77954
|
let c2;
|
|
77954
77955
|
t6?.timeoutMs && (c2 = setTimeout(() => {
|
|
77955
77956
|
this.deletePendingMessage(i), n(new m({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "timeout", details: { text: "Client timeout" }, diagnostics: `Request timed out after waiting ${t6.timeoutMs} milliseconds for response` }] }));
|
|
77956
|
-
}, t6.timeoutMs)), this.setPendingMessage(i, { message: e, resolve: s, reject: n, returnAck: t6?.returnAck ??
|
|
77957
|
+
}, t6.timeoutMs)), this.setPendingMessage(i, { message: e, resolve: s, reject: n, returnAck: t6?.returnAck ?? Om.APPLICATION, timer: c2 }), this.sendImpl(e);
|
|
77957
77958
|
});
|
|
77958
77959
|
}
|
|
77959
77960
|
async close() {
|
|
@@ -78674,7 +78675,7 @@ __export(dcmjs_es_exports, {
|
|
|
78674
78675
|
derivations: () => derivations,
|
|
78675
78676
|
log: () => log2,
|
|
78676
78677
|
normalizers: () => normalizers,
|
|
78677
|
-
sr: () =>
|
|
78678
|
+
sr: () => sr2,
|
|
78678
78679
|
utilities: () => utilities
|
|
78679
78680
|
});
|
|
78680
78681
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
@@ -93195,7 +93196,7 @@ var flipImageOrientationPatient = {
|
|
|
93195
93196
|
* @param {Number[6]} iop - ImageOrientationPatient
|
|
93196
93197
|
* @returns {Number[6]} The transformed ImageOrientationPatient
|
|
93197
93198
|
*/
|
|
93198
|
-
hv: function
|
|
93199
|
+
hv: function hv2(iop) {
|
|
93199
93200
|
return [-iop[0], -iop[1], -iop[2], -iop[3], -iop[4], -iop[5]];
|
|
93200
93201
|
}
|
|
93201
93202
|
};
|
|
@@ -100010,7 +100011,7 @@ var documents = /* @__PURE__ */ Object.freeze({
|
|
|
100010
100011
|
__proto__: null,
|
|
100011
100012
|
Comprehensive3DSR
|
|
100012
100013
|
});
|
|
100013
|
-
var
|
|
100014
|
+
var sr2 = {
|
|
100014
100015
|
coding,
|
|
100015
100016
|
contentItems,
|
|
100016
100017
|
documents,
|
|
@@ -100327,7 +100328,7 @@ var dcmjs = {
|
|
|
100327
100328
|
data,
|
|
100328
100329
|
derivations,
|
|
100329
100330
|
normalizers,
|
|
100330
|
-
sr,
|
|
100331
|
+
sr: sr2,
|
|
100331
100332
|
utilities,
|
|
100332
100333
|
log: log2,
|
|
100333
100334
|
anonymizer,
|
|
@@ -103243,7 +103244,7 @@ var DEFAULT_LOGGER_CONFIG = {
|
|
|
103243
103244
|
logDir: __dirname,
|
|
103244
103245
|
maxFileSizeMb: 10,
|
|
103245
103246
|
filesToKeep: 10,
|
|
103246
|
-
logLevel:
|
|
103247
|
+
logLevel: ct.INFO
|
|
103247
103248
|
};
|
|
103248
103249
|
var LOGGER_CONFIG_INTEGER_KEYS = ["maxFileSizeMb", "filesToKeep"];
|
|
103249
103250
|
var LEVELS_TO_UPPERCASE = {
|
|
@@ -103317,7 +103318,7 @@ function parseLoggerConfigFromArgs(args) {
|
|
|
103317
103318
|
let configValue;
|
|
103318
103319
|
if (settingName === "logLevel") {
|
|
103319
103320
|
try {
|
|
103320
|
-
configValue =
|
|
103321
|
+
configValue = Qy(propVal);
|
|
103321
103322
|
} catch (err2) {
|
|
103322
103323
|
warnings.push(`Error while parsing ${propName}: ${Ve(err2)}`);
|
|
103323
103324
|
}
|
|
@@ -103345,14 +103346,14 @@ function parseLoggerConfigFromArgs(args) {
|
|
|
103345
103346
|
function getWinstonLevelFromMedplumLevel(level) {
|
|
103346
103347
|
switch (level) {
|
|
103347
103348
|
// Return error for NONE since we are going to turn silent on anyways
|
|
103348
|
-
case
|
|
103349
|
-
case
|
|
103349
|
+
case ct.NONE:
|
|
103350
|
+
case ct.ERROR:
|
|
103350
103351
|
return "error";
|
|
103351
|
-
case
|
|
103352
|
+
case ct.WARN:
|
|
103352
103353
|
return "warn";
|
|
103353
|
-
case
|
|
103354
|
+
case ct.INFO:
|
|
103354
103355
|
return "info";
|
|
103355
|
-
case
|
|
103356
|
+
case ct.DEBUG:
|
|
103356
103357
|
return "debug";
|
|
103357
103358
|
default:
|
|
103358
103359
|
throw new Error("Invalid log level");
|
|
@@ -103362,7 +103363,7 @@ function createWinstonFromLoggerConfig(config, loggerType) {
|
|
|
103362
103363
|
const level = getWinstonLevelFromMedplumLevel(config.logLevel);
|
|
103363
103364
|
const logger = import_winston.default.createLogger({
|
|
103364
103365
|
level,
|
|
103365
|
-
silent: config.logLevel ===
|
|
103366
|
+
silent: config.logLevel === ct.NONE,
|
|
103366
103367
|
format: import_winston.default.format.combine(
|
|
103367
103368
|
import_winston.default.format.timestamp(),
|
|
103368
103369
|
// Custom transform to match previous Medplum logger output
|
|
@@ -103416,16 +103417,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
|
|
|
103416
103417
|
this.prefix = options?.prefix;
|
|
103417
103418
|
}
|
|
103418
103419
|
debug(msg, data3) {
|
|
103419
|
-
this.log(
|
|
103420
|
+
this.log(ct.DEBUG, msg, data3);
|
|
103420
103421
|
}
|
|
103421
103422
|
info(msg, data3) {
|
|
103422
|
-
this.log(
|
|
103423
|
+
this.log(ct.INFO, msg, data3);
|
|
103423
103424
|
}
|
|
103424
103425
|
warn(msg, data3) {
|
|
103425
|
-
this.log(
|
|
103426
|
+
this.log(ct.WARN, msg, data3);
|
|
103426
103427
|
}
|
|
103427
103428
|
error(msg, data3) {
|
|
103428
|
-
this.log(
|
|
103429
|
+
this.log(ct.ERROR, msg, data3);
|
|
103429
103430
|
}
|
|
103430
103431
|
log(level, msg, data3) {
|
|
103431
103432
|
if (level > this.level) {
|
|
@@ -103440,16 +103441,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
|
|
|
103440
103441
|
const dataToLog = { ...data3, ...this.metadata };
|
|
103441
103442
|
const msgToLog = this.prefix ? `${this.prefix}${msg}` : msg;
|
|
103442
103443
|
switch (level) {
|
|
103443
|
-
case
|
|
103444
|
+
case ct.DEBUG:
|
|
103444
103445
|
this.winston.debug(msgToLog, dataToLog);
|
|
103445
103446
|
return;
|
|
103446
|
-
case
|
|
103447
|
+
case ct.INFO:
|
|
103447
103448
|
this.winston.info(msgToLog, dataToLog);
|
|
103448
103449
|
return;
|
|
103449
|
-
case
|
|
103450
|
+
case ct.WARN:
|
|
103450
103451
|
this.winston.warn(msgToLog, dataToLog);
|
|
103451
103452
|
return;
|
|
103452
|
-
case
|
|
103453
|
+
case ct.ERROR:
|
|
103453
103454
|
this.winston.error(msgToLog, dataToLog);
|
|
103454
103455
|
}
|
|
103455
103456
|
}
|
|
@@ -103473,9 +103474,9 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
|
|
|
103473
103474
|
let until;
|
|
103474
103475
|
let skip = 0;
|
|
103475
103476
|
if (options?.before !== void 0) {
|
|
103476
|
-
const
|
|
103477
|
-
const timestampPart =
|
|
103478
|
-
const skipPart =
|
|
103477
|
+
const at = options.before.lastIndexOf("@");
|
|
103478
|
+
const timestampPart = at === -1 ? options.before : options.before.slice(0, at);
|
|
103479
|
+
const skipPart = at === -1 ? "0" : options.before.slice(at + 1);
|
|
103479
103480
|
const beforeMs = new Date(timestampPart).getTime();
|
|
103480
103481
|
const parsedSkip = Number(skipPart);
|
|
103481
103482
|
if (Number.isNaN(beforeMs) || !Number.isInteger(parsedSkip) || parsedSkip < 0) {
|
|
@@ -105747,7 +105748,7 @@ var _App = class _App {
|
|
|
105747
105748
|
webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
105748
105749
|
webSocketUrl.pathname = "/ws/agent";
|
|
105749
105750
|
this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
|
|
105750
|
-
this.webSocket = new
|
|
105751
|
+
this.webSocket = new ot(webSocketUrl.toString(), void 0, {
|
|
105751
105752
|
WebSocket: wrapper_default,
|
|
105752
105753
|
binaryType: "nodebuffer"
|
|
105753
105754
|
});
|
|
@@ -106633,7 +106634,7 @@ IPv6 is currently unsupported.`;
|
|
|
106633
106634
|
this.log.error(errMsg);
|
|
106634
106635
|
throw new Error(errMsg);
|
|
106635
106636
|
}
|
|
106636
|
-
if (!((0, import_node_net4.isIPv4)(message2.remote) ||
|
|
106637
|
+
if (!((0, import_node_net4.isIPv4)(message2.remote) || Hp(message2.remote))) {
|
|
106637
106638
|
const errMsg = `Attempted to ping an invalid host.
|
|
106638
106639
|
|
|
106639
106640
|
"${message2.remote}" is not a valid IPv4 address or a resolvable hostname.`;
|
|
@@ -106708,7 +106709,7 @@ ${result}`);
|
|
|
106708
106709
|
return;
|
|
106709
106710
|
}
|
|
106710
106711
|
let child;
|
|
106711
|
-
if (message2.version && !await
|
|
106712
|
+
if (message2.version && !await mv("agent-upgrader", message2.version)) {
|
|
106712
106713
|
const versionTag = message2.version ? `v${message2.version}` : "latest";
|
|
106713
106714
|
const errMsg = `Error during upgrading to version '${versionTag}'. '${message2.version}' is not a valid version`;
|
|
106714
106715
|
this.log.error(errMsg);
|
|
@@ -106719,7 +106720,7 @@ ${result}`);
|
|
|
106719
106720
|
});
|
|
106720
106721
|
return;
|
|
106721
106722
|
}
|
|
106722
|
-
const targetVersion = message2.version ?? await
|
|
106723
|
+
const targetVersion = message2.version ?? await hv("agent-upgrader");
|
|
106723
106724
|
if (In.startsWith(targetVersion)) {
|
|
106724
106725
|
if (!message2?.force) {
|
|
106725
106726
|
this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
|
|
@@ -106944,7 +106945,7 @@ ${result}`);
|
|
|
106944
106945
|
} catch (err2) {
|
|
106945
106946
|
this.log.warn(`${Ve(err2)} - falling back to default return ACK behavior of 'first'.`);
|
|
106946
106947
|
}
|
|
106947
|
-
const returnAck = msgReturnAck ?? defaultReturnAck ??
|
|
106948
|
+
const returnAck = msgReturnAck ?? defaultReturnAck ?? Om.FIRST;
|
|
106948
106949
|
let pool;
|
|
106949
106950
|
if (this.hl7Clients.has(message2.remote)) {
|
|
106950
106951
|
pool = this.hl7Clients.get(message2.remote);
|
|
@@ -107047,10 +107048,10 @@ ${result}`);
|
|
|
107047
107048
|
}
|
|
107048
107049
|
const normalizedValue = rawValue.toLowerCase();
|
|
107049
107050
|
if (normalizedValue === "application") {
|
|
107050
|
-
return
|
|
107051
|
+
return Om.APPLICATION;
|
|
107051
107052
|
}
|
|
107052
107053
|
if (normalizedValue === "first") {
|
|
107053
|
-
return
|
|
107054
|
+
return Om.FIRST;
|
|
107054
107055
|
}
|
|
107055
107056
|
throw new Error(`Invalid value for returnAck; expected: 'first' or 'application', received: ${rawValue}`);
|
|
107056
107057
|
}
|
|
@@ -107113,7 +107114,7 @@ async function agentMain(argv) {
|
|
|
107113
107114
|
for (const warning of warnings) {
|
|
107114
107115
|
mainLogger.warn(warning);
|
|
107115
107116
|
}
|
|
107116
|
-
const app = new App(medplum, agentId, args.logLevel ?
|
|
107117
|
+
const app = new App(medplum, agentId, args.logLevel ? Qy(args.logLevel) : void 0, {
|
|
107117
107118
|
mainLogger,
|
|
107118
107119
|
channelLogger
|
|
107119
107120
|
});
|
|
@@ -107162,7 +107163,7 @@ async function upgraderMain(argv) {
|
|
|
107162
107163
|
if (argv[3] && !bs(argv[3])) {
|
|
107163
107164
|
throw new Error("Invalid version specified");
|
|
107164
107165
|
}
|
|
107165
|
-
version = argv[3] ?? await
|
|
107166
|
+
version = argv[3] ?? await hv("agent-upgrader");
|
|
107166
107167
|
binPath = getReleaseBinPath(version);
|
|
107167
107168
|
if (!(0, import_node_fs7.existsSync)(binPath)) {
|
|
107168
107169
|
globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
|