@medplum/agent 5.1.14 → 5.1.15
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 +442 -333
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -8946,7 +8946,7 @@ var require_stream = __commonJS({
|
|
|
8946
8946
|
this.emit("error", err2);
|
|
8947
8947
|
}
|
|
8948
8948
|
}
|
|
8949
|
-
function createWebSocketStream2(
|
|
8949
|
+
function createWebSocketStream2(ws2, options) {
|
|
8950
8950
|
let terminateOnDestroy = true;
|
|
8951
8951
|
const duplex = new Duplex({
|
|
8952
8952
|
...options,
|
|
@@ -8955,65 +8955,65 @@ var require_stream = __commonJS({
|
|
|
8955
8955
|
objectMode: false,
|
|
8956
8956
|
writableObjectMode: false
|
|
8957
8957
|
});
|
|
8958
|
-
|
|
8958
|
+
ws2.on("message", function message(msg, isBinary) {
|
|
8959
8959
|
const data2 = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
8960
|
-
if (!duplex.push(data2))
|
|
8960
|
+
if (!duplex.push(data2)) ws2.pause();
|
|
8961
8961
|
});
|
|
8962
|
-
|
|
8962
|
+
ws2.once("error", function error(err2) {
|
|
8963
8963
|
if (duplex.destroyed) return;
|
|
8964
8964
|
terminateOnDestroy = false;
|
|
8965
8965
|
duplex.destroy(err2);
|
|
8966
8966
|
});
|
|
8967
|
-
|
|
8967
|
+
ws2.once("close", function close() {
|
|
8968
8968
|
if (duplex.destroyed) return;
|
|
8969
8969
|
duplex.push(null);
|
|
8970
8970
|
});
|
|
8971
8971
|
duplex._destroy = function(err2, callback) {
|
|
8972
|
-
if (
|
|
8972
|
+
if (ws2.readyState === ws2.CLOSED) {
|
|
8973
8973
|
callback(err2);
|
|
8974
8974
|
process.nextTick(emitClose, duplex);
|
|
8975
8975
|
return;
|
|
8976
8976
|
}
|
|
8977
8977
|
let called = false;
|
|
8978
|
-
|
|
8978
|
+
ws2.once("error", function error(err3) {
|
|
8979
8979
|
called = true;
|
|
8980
8980
|
callback(err3);
|
|
8981
8981
|
});
|
|
8982
|
-
|
|
8982
|
+
ws2.once("close", function close() {
|
|
8983
8983
|
if (!called) callback(err2);
|
|
8984
8984
|
process.nextTick(emitClose, duplex);
|
|
8985
8985
|
});
|
|
8986
|
-
if (terminateOnDestroy)
|
|
8986
|
+
if (terminateOnDestroy) ws2.terminate();
|
|
8987
8987
|
};
|
|
8988
8988
|
duplex._final = function(callback) {
|
|
8989
|
-
if (
|
|
8990
|
-
|
|
8989
|
+
if (ws2.readyState === ws2.CONNECTING) {
|
|
8990
|
+
ws2.once("open", function open() {
|
|
8991
8991
|
duplex._final(callback);
|
|
8992
8992
|
});
|
|
8993
8993
|
return;
|
|
8994
8994
|
}
|
|
8995
|
-
if (
|
|
8996
|
-
if (
|
|
8995
|
+
if (ws2._socket === null) return;
|
|
8996
|
+
if (ws2._socket._writableState.finished) {
|
|
8997
8997
|
callback();
|
|
8998
8998
|
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
8999
8999
|
} else {
|
|
9000
|
-
|
|
9000
|
+
ws2._socket.once("finish", function finish() {
|
|
9001
9001
|
callback();
|
|
9002
9002
|
});
|
|
9003
|
-
|
|
9003
|
+
ws2.close();
|
|
9004
9004
|
}
|
|
9005
9005
|
};
|
|
9006
9006
|
duplex._read = function() {
|
|
9007
|
-
if (
|
|
9007
|
+
if (ws2.isPaused) ws2.resume();
|
|
9008
9008
|
};
|
|
9009
9009
|
duplex._write = function(chunk, encoding, callback) {
|
|
9010
|
-
if (
|
|
9011
|
-
|
|
9010
|
+
if (ws2.readyState === ws2.CONNECTING) {
|
|
9011
|
+
ws2.once("open", function open() {
|
|
9012
9012
|
duplex._write(chunk, encoding, callback);
|
|
9013
9013
|
});
|
|
9014
9014
|
return;
|
|
9015
9015
|
}
|
|
9016
|
-
|
|
9016
|
+
ws2.send(chunk, callback);
|
|
9017
9017
|
};
|
|
9018
9018
|
duplex.on("end", duplexOnEnd);
|
|
9019
9019
|
duplex.on("error", duplexOnError);
|
|
@@ -9389,12 +9389,12 @@ var require_websocket_server = __commonJS({
|
|
|
9389
9389
|
"Connection: Upgrade",
|
|
9390
9390
|
`Sec-WebSocket-Accept: ${digest}`
|
|
9391
9391
|
];
|
|
9392
|
-
const
|
|
9392
|
+
const ws2 = new this.options.WebSocket(null, void 0, this.options);
|
|
9393
9393
|
if (protocols.size) {
|
|
9394
9394
|
const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
|
|
9395
9395
|
if (protocol) {
|
|
9396
9396
|
headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
|
|
9397
|
-
|
|
9397
|
+
ws2._protocol = protocol;
|
|
9398
9398
|
}
|
|
9399
9399
|
}
|
|
9400
9400
|
if (extensions[PerMessageDeflate2.extensionName]) {
|
|
@@ -9403,12 +9403,12 @@ var require_websocket_server = __commonJS({
|
|
|
9403
9403
|
[PerMessageDeflate2.extensionName]: [params]
|
|
9404
9404
|
});
|
|
9405
9405
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
9406
|
-
|
|
9406
|
+
ws2._extensions = extensions;
|
|
9407
9407
|
}
|
|
9408
9408
|
this.emit("headers", headers, req);
|
|
9409
9409
|
socket.write(headers.concat("\r\n").join("\r\n"));
|
|
9410
9410
|
socket.removeListener("error", socketOnError);
|
|
9411
|
-
|
|
9411
|
+
ws2.setSocket(socket, head, {
|
|
9412
9412
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
9413
9413
|
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
9414
9414
|
maxFragments: this.options.maxFragments,
|
|
@@ -9416,15 +9416,15 @@ var require_websocket_server = __commonJS({
|
|
|
9416
9416
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
9417
9417
|
});
|
|
9418
9418
|
if (this.clients) {
|
|
9419
|
-
this.clients.add(
|
|
9420
|
-
|
|
9421
|
-
this.clients.delete(
|
|
9419
|
+
this.clients.add(ws2);
|
|
9420
|
+
ws2.on("close", () => {
|
|
9421
|
+
this.clients.delete(ws2);
|
|
9422
9422
|
if (this._shouldEmitClose && !this.clients.size) {
|
|
9423
9423
|
process.nextTick(emitClose, this);
|
|
9424
9424
|
}
|
|
9425
9425
|
});
|
|
9426
9426
|
}
|
|
9427
|
-
cb(
|
|
9427
|
+
cb(ws2, req);
|
|
9428
9428
|
}
|
|
9429
9429
|
};
|
|
9430
9430
|
module2.exports = WebSocketServer2;
|
|
@@ -17324,8 +17324,8 @@ var require_dcmjs = __commonJS({
|
|
|
17324
17324
|
key: "writeBytes",
|
|
17325
17325
|
value: function writeBytes(stream, value, writeOptions) {
|
|
17326
17326
|
var _this11 = this;
|
|
17327
|
-
var val = Array.isArray(value) ? value.map(function(
|
|
17328
|
-
return _this11.convertToString(
|
|
17327
|
+
var val = Array.isArray(value) ? value.map(function(is) {
|
|
17328
|
+
return _this11.convertToString(is);
|
|
17329
17329
|
}) : [this.convertToString(value)];
|
|
17330
17330
|
return _get2(_getPrototypeOf2(IntegerString3.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
17331
17331
|
}
|
|
@@ -19219,7 +19219,7 @@ var require_dcmjs = __commonJS({
|
|
|
19219
19219
|
}
|
|
19220
19220
|
}, {
|
|
19221
19221
|
key: "is",
|
|
19222
|
-
value: function
|
|
19222
|
+
value: function is(t) {
|
|
19223
19223
|
return this.value == t;
|
|
19224
19224
|
}
|
|
19225
19225
|
/**
|
|
@@ -34541,11 +34541,11 @@ var require_decorator = __commonJS({
|
|
|
34541
34541
|
};
|
|
34542
34542
|
};
|
|
34543
34543
|
var mergeDecorators = (d1, d2) => {
|
|
34544
|
-
var _a, _b, _c, _d,
|
|
34544
|
+
var _a, _b, _c, _d, _e, _f;
|
|
34545
34545
|
return {
|
|
34546
34546
|
class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
|
|
34547
34547
|
static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
|
|
34548
|
-
instance: mergePropertyAndMethodDecorators((
|
|
34548
|
+
instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
|
|
34549
34549
|
};
|
|
34550
34550
|
};
|
|
34551
34551
|
var decorators = /* @__PURE__ */ new Map();
|
|
@@ -49121,8 +49121,8 @@ var require_moment = __commonJS({
|
|
|
49121
49121
|
}
|
|
49122
49122
|
return isNaN(input) ? null : input;
|
|
49123
49123
|
}
|
|
49124
|
-
function shiftWeekdays(
|
|
49125
|
-
return
|
|
49124
|
+
function shiftWeekdays(ws2, n) {
|
|
49125
|
+
return ws2.slice(n, 7).concat(ws2.slice(0, n));
|
|
49126
49126
|
}
|
|
49127
49127
|
var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord;
|
|
49128
49128
|
function localeWeekdays(m3, format2) {
|
|
@@ -52757,9 +52757,9 @@ __export(main_exports, {
|
|
|
52757
52757
|
module.exports = __toCommonJS(main_exports);
|
|
52758
52758
|
|
|
52759
52759
|
// ../core/dist/esm/index.mjs
|
|
52760
|
-
var
|
|
52761
|
-
var
|
|
52762
|
-
var c = (r6, e, t) =>
|
|
52760
|
+
var Lo = Object.defineProperty;
|
|
52761
|
+
var No = (r6, e, t) => e in r6 ? Lo(r6, e, { enumerable: true, configurable: true, writable: true, value: t }) : r6[e] = t;
|
|
52762
|
+
var c = (r6, e, t) => No(r6, typeof e != "symbol" ? e + "" : e, t);
|
|
52763
52763
|
var K = class {
|
|
52764
52764
|
constructor(e = 10) {
|
|
52765
52765
|
c(this, "max");
|
|
@@ -52896,9 +52896,9 @@ var xr = "not-found";
|
|
|
52896
52896
|
var Tr = "unauthorized";
|
|
52897
52897
|
var gt = "accepted";
|
|
52898
52898
|
var Fn = { resourceType: "OperationOutcome", id: xr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
|
|
52899
|
-
var
|
|
52900
|
-
var Un = { ...
|
|
52901
|
-
var Sr = { ...
|
|
52899
|
+
var Le = { resourceType: "OperationOutcome", id: Tr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
|
|
52900
|
+
var Un = { ...Le, issue: [...Le.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
|
|
52901
|
+
var Sr = { ...Le, issue: [...Le.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
|
|
52902
52902
|
function P(r6, e) {
|
|
52903
52903
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: oe(e) } : void 0 }] };
|
|
52904
52904
|
}
|
|
@@ -52908,7 +52908,7 @@ function T(r6, e, t, n) {
|
|
|
52908
52908
|
function br(r6) {
|
|
52909
52909
|
return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
|
|
52910
52910
|
}
|
|
52911
|
-
function
|
|
52911
|
+
function ze(r6) {
|
|
52912
52912
|
return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
|
|
52913
52913
|
}
|
|
52914
52914
|
function Er(r6) {
|
|
@@ -52922,26 +52922,26 @@ var f = class extends Error {
|
|
|
52922
52922
|
}
|
|
52923
52923
|
};
|
|
52924
52924
|
function yt(r6) {
|
|
52925
|
-
return r6 instanceof f ? r6.outcome :
|
|
52925
|
+
return r6 instanceof f ? r6.outcome : ze(r6) ? r6 : P(Ne(r6));
|
|
52926
52926
|
}
|
|
52927
|
-
function
|
|
52928
|
-
return r6 ? typeof r6 == "string" ? r6 : br(r6) ? r6.message :
|
|
52927
|
+
function Ne(r6) {
|
|
52928
|
+
return r6 ? typeof r6 == "string" ? r6 : br(r6) ? r6.message : ze(r6) ? Bn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
|
|
52929
52929
|
}
|
|
52930
52930
|
function Bn(r6) {
|
|
52931
|
-
let e = r6.issue?.map(
|
|
52931
|
+
let e = r6.issue?.map(Uo) ?? [];
|
|
52932
52932
|
return e.length > 0 ? e.join("; ") : "Unknown error";
|
|
52933
52933
|
}
|
|
52934
|
-
function
|
|
52934
|
+
function Uo(r6) {
|
|
52935
52935
|
let e;
|
|
52936
52936
|
return r6.details?.text ? r6.diagnostics ? e = `${r6.details.text} (${r6.diagnostics})` : e = r6.details.text : r6.diagnostics ? e = r6.diagnostics : e = "Unknown error", r6.expression?.length && (e += ` (${r6.expression.join(", ")})`), e;
|
|
52937
52937
|
}
|
|
52938
|
-
function
|
|
52938
|
+
function Wo(r6, e) {
|
|
52939
52939
|
let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
|
|
52940
52940
|
return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
|
|
52941
52941
|
}
|
|
52942
52942
|
function jn(r6) {
|
|
52943
52943
|
let e = /* @__PURE__ */ Object.create(null);
|
|
52944
|
-
for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o2]) => [i,
|
|
52944
|
+
for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o2]) => [i, Wo(i, o2)])), constraints: [], innerTypes: [] };
|
|
52945
52945
|
return e;
|
|
52946
52946
|
}
|
|
52947
52947
|
var $n = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] }, identitySource: { type: [{ code: "code" }] }, identityMappingMode: { type: [{ code: "code" }] } } } };
|
|
@@ -52951,7 +52951,7 @@ function Ar(r6) {
|
|
|
52951
52951
|
var be = jn($n);
|
|
52952
52952
|
var wr = /* @__PURE__ */ Object.create(null);
|
|
52953
52953
|
var Hn = /* @__PURE__ */ Object.create(null);
|
|
52954
|
-
var
|
|
52954
|
+
var jo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
|
|
52955
52955
|
function Jn(r6) {
|
|
52956
52956
|
let e;
|
|
52957
52957
|
return e = Hn[r6], e || (e = Hn[r6] = /* @__PURE__ */ Object.create(null)), e;
|
|
@@ -52964,7 +52964,7 @@ function Or(r6) {
|
|
|
52964
52964
|
function Ir(r6) {
|
|
52965
52965
|
if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
|
|
52966
52966
|
if (r6.resourceType !== "StructureDefinition") return;
|
|
52967
|
-
let e = Ar(r6), t =
|
|
52967
|
+
let e = Ar(r6), t = jo[r6.url], n, i;
|
|
52968
52968
|
t ? (n = be, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = be, i = r6.type) : (n = Jn(r6.url), i = r6.type), n[i] = e;
|
|
52969
52969
|
for (let o2 of e.innerTypes) o2.parentType = e, n[o2.name] = o2;
|
|
52970
52970
|
wr[r6.url] = e;
|
|
@@ -52972,7 +52972,7 @@ function Ir(r6) {
|
|
|
52972
52972
|
function Yn(r6) {
|
|
52973
52973
|
return !!be[r6];
|
|
52974
52974
|
}
|
|
52975
|
-
function
|
|
52975
|
+
function Ee(r6, e) {
|
|
52976
52976
|
if (e) {
|
|
52977
52977
|
let t = Jn(e)[r6];
|
|
52978
52978
|
if (t) return t;
|
|
@@ -52993,7 +52993,7 @@ var Cr = class {
|
|
|
52993
52993
|
c(this, "innerTypes");
|
|
52994
52994
|
c(this, "backboneContext");
|
|
52995
52995
|
if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
|
|
52996
|
-
this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description:
|
|
52996
|
+
this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: Qo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
|
|
52997
52997
|
}
|
|
52998
52998
|
parse() {
|
|
52999
52999
|
let e = this.next();
|
|
@@ -53026,23 +53026,23 @@ var Cr = class {
|
|
|
53026
53026
|
return this.checkFieldExit(), this.innerTypes.length > 0 && (this.resourceSchema.innerTypes = this.innerTypes), this.resourceSchema;
|
|
53027
53027
|
}
|
|
53028
53028
|
checkFieldEnter(e, t) {
|
|
53029
|
-
this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !
|
|
53029
|
+
this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Fe(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
|
|
53030
53030
|
}
|
|
53031
53031
|
enterInnerType(e) {
|
|
53032
|
-
for (; this.backboneContext && !
|
|
53032
|
+
for (; this.backboneContext && !Fe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
|
|
53033
53033
|
let t = Pr(e);
|
|
53034
|
-
this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent:
|
|
53034
|
+
this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Fe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
|
|
53035
53035
|
}
|
|
53036
53036
|
enterSlice(e, t) {
|
|
53037
|
-
|
|
53037
|
+
Go(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
|
|
53038
53038
|
if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
|
|
53039
53039
|
return { path: n.path, type: n.type };
|
|
53040
53040
|
}), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
|
|
53041
53041
|
}
|
|
53042
53042
|
checkFieldExit(e = void 0) {
|
|
53043
|
-
if (this.backboneContext && !
|
|
53043
|
+
if (this.backboneContext && !Fe(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
|
|
53044
53044
|
this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
|
|
53045
|
-
while (this.backboneContext && !
|
|
53045
|
+
while (this.backboneContext && !Fe(this.backboneContext.path, e?.path));
|
|
53046
53046
|
else this.innerTypes.push(this.backboneContext.type), this.backboneContext = void 0;
|
|
53047
53047
|
}
|
|
53048
53048
|
next() {
|
|
@@ -53061,7 +53061,7 @@ var Cr = class {
|
|
|
53061
53061
|
}
|
|
53062
53062
|
isInnerType(e) {
|
|
53063
53063
|
let t = this.peek();
|
|
53064
|
-
return !!(
|
|
53064
|
+
return !!(Fe(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
|
|
53065
53065
|
}
|
|
53066
53066
|
parseSliceStart(e) {
|
|
53067
53067
|
if (!this.slicingContext) throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
|
|
@@ -53082,34 +53082,34 @@ function Qn(r6) {
|
|
|
53082
53082
|
return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
|
|
53083
53083
|
}
|
|
53084
53084
|
function Rr(r6, e = "") {
|
|
53085
|
-
return
|
|
53085
|
+
return Ho(r6.path, e);
|
|
53086
53086
|
}
|
|
53087
|
-
function
|
|
53087
|
+
function Ho(r6, e) {
|
|
53088
53088
|
return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
|
|
53089
53089
|
}
|
|
53090
|
-
function
|
|
53090
|
+
function Fe(r6, e) {
|
|
53091
53091
|
return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
|
|
53092
53092
|
}
|
|
53093
53093
|
function zn(r6) {
|
|
53094
53094
|
return Array.isArray(r6) && r6.length > 0 ? r6[0] : A(r6) ? void 0 : r6;
|
|
53095
53095
|
}
|
|
53096
|
-
function
|
|
53096
|
+
function Go(r6) {
|
|
53097
53097
|
let e = r6.slicing?.discriminator;
|
|
53098
53098
|
return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
|
|
53099
53099
|
}
|
|
53100
|
-
function
|
|
53100
|
+
function Qo(r6) {
|
|
53101
53101
|
let e = r6.description;
|
|
53102
53102
|
return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
|
|
53103
53103
|
}
|
|
53104
53104
|
function _r(r6, e, t) {
|
|
53105
53105
|
let n = r6.path;
|
|
53106
|
-
return
|
|
53106
|
+
return zo(L(r6, e, t), n, e);
|
|
53107
53107
|
}
|
|
53108
|
-
function
|
|
53108
|
+
function zo(r6, e, t) {
|
|
53109
53109
|
let n = e ? e + "." : "";
|
|
53110
53110
|
return r6 === void 0 ? { type: "undefined", value: void 0, path: `${n}${t}` } : Array.isArray(r6) ? r6.map((i, o2) => ({ ...i, path: `${n}${t}[${o2}]` })) : { ...r6, path: `${n}${t}` };
|
|
53111
53111
|
}
|
|
53112
|
-
var
|
|
53112
|
+
var Jo = new K(1e3);
|
|
53113
53113
|
var Tt = { 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: /.*/ };
|
|
53114
53114
|
function h(r6) {
|
|
53115
53115
|
return [{ type: d.boolean, value: r6 }];
|
|
@@ -53129,9 +53129,9 @@ function D(r6, e) {
|
|
|
53129
53129
|
function L(r6, e, t) {
|
|
53130
53130
|
if (!r6.value) return;
|
|
53131
53131
|
let n = Ct(r6.type, e, t?.profileUrl);
|
|
53132
|
-
return n ?
|
|
53132
|
+
return n ? os(r6, e, n) : ss(r6, e);
|
|
53133
53133
|
}
|
|
53134
|
-
function
|
|
53134
|
+
function os(r6, e, t) {
|
|
53135
53135
|
let n = r6.value, i = t.type;
|
|
53136
53136
|
if (!i || i.length === 0) return;
|
|
53137
53137
|
let o2, s = "undefined", a, u2 = t.path.lastIndexOf("."), l = t.path.substring(u2 + 1), p2 = l, g2 = false;
|
|
@@ -53155,7 +53155,7 @@ function is(r6, e, t) {
|
|
|
53155
53155
|
function ti(r6, e) {
|
|
53156
53156
|
return e === "Resource" && I(r6) && (e = r6.resourceType), { type: e, value: r6 };
|
|
53157
53157
|
}
|
|
53158
|
-
function
|
|
53158
|
+
function ss(r6, e) {
|
|
53159
53159
|
let t = r6.value;
|
|
53160
53160
|
if (!t || typeof t != "object") return;
|
|
53161
53161
|
let n;
|
|
@@ -53204,9 +53204,9 @@ function Ke(r6, e) {
|
|
|
53204
53204
|
return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : V(t) && V(n) ? h(ui(t, n)) : h(typeof t == "object" && typeof n == "object" ? qr(r6, e) : t === n);
|
|
53205
53205
|
}
|
|
53206
53206
|
function Wr(r6, e) {
|
|
53207
|
-
return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(ri), e.sort(ri), h(r6.every((t, n) => j(
|
|
53207
|
+
return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(ri), e.sort(ri), h(r6.every((t, n) => j(as(t, e[n])))));
|
|
53208
53208
|
}
|
|
53209
|
-
function
|
|
53209
|
+
function as(r6, e) {
|
|
53210
53210
|
let { type: t, value: n } = r6, { type: i, value: o2 } = e, s = n?.valueOf(), a = o2?.valueOf();
|
|
53211
53211
|
return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : V(s) && V(a) ? h(ui(s, a)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? qr({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
|
|
53212
53212
|
}
|
|
@@ -53227,7 +53227,7 @@ function Et(r6, e) {
|
|
|
53227
53227
|
case "Date":
|
|
53228
53228
|
return ai(t);
|
|
53229
53229
|
case "DateTime":
|
|
53230
|
-
return
|
|
53230
|
+
return Be(t);
|
|
53231
53231
|
case "Time":
|
|
53232
53232
|
return typeof t == "string" && !!/^T\d/.exec(t);
|
|
53233
53233
|
case "Period":
|
|
@@ -53241,11 +53241,11 @@ function Et(r6, e) {
|
|
|
53241
53241
|
function ai(r6) {
|
|
53242
53242
|
return typeof r6 == "string" && !!Tt.date.exec(r6);
|
|
53243
53243
|
}
|
|
53244
|
-
function
|
|
53244
|
+
function Be(r6) {
|
|
53245
53245
|
return typeof r6 == "string" && !!Tt.dateTime.exec(r6);
|
|
53246
53246
|
}
|
|
53247
53247
|
function ci(r6) {
|
|
53248
|
-
return !!(r6 && typeof r6 == "object" && ("start" in r6 &&
|
|
53248
|
+
return !!(r6 && typeof r6 == "object" && ("start" in r6 && Be(r6.start) || "end" in r6 && Be(r6.end)));
|
|
53249
53249
|
}
|
|
53250
53250
|
function V(r6) {
|
|
53251
53251
|
return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
|
|
@@ -53270,37 +53270,37 @@ function ni(r6) {
|
|
|
53270
53270
|
function Br(r6, e) {
|
|
53271
53271
|
if (e) {
|
|
53272
53272
|
if (typeof e != "object") throw new Error("Primitive extension must be an object");
|
|
53273
|
-
return
|
|
53273
|
+
return cs(r6 ?? {}, e);
|
|
53274
53274
|
}
|
|
53275
53275
|
return r6;
|
|
53276
53276
|
}
|
|
53277
|
-
function
|
|
53277
|
+
function cs(r6, e) {
|
|
53278
53278
|
return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
|
|
53279
53279
|
}
|
|
53280
53280
|
function Xe(r6, e) {
|
|
53281
53281
|
return I(r6, e) && "id" in r6 && typeof r6.id == "string";
|
|
53282
53282
|
}
|
|
53283
|
-
function
|
|
53284
|
-
let e = O(r6) ?? "undefined/undefined", t =
|
|
53283
|
+
function Re(r6) {
|
|
53284
|
+
let e = O(r6) ?? "undefined/undefined", t = ls(r6);
|
|
53285
53285
|
return t === e ? { reference: e } : { reference: e, display: t };
|
|
53286
53286
|
}
|
|
53287
53287
|
function O(r6) {
|
|
53288
53288
|
if (Q(r6)) return r6.reference;
|
|
53289
53289
|
if (Xe(r6)) return `${r6.resourceType}/${r6.id}`;
|
|
53290
53290
|
}
|
|
53291
|
-
function
|
|
53291
|
+
function Ce(r6) {
|
|
53292
53292
|
if (r6) return Q(r6) ? r6.reference.split("/")[1] : r6.id;
|
|
53293
53293
|
}
|
|
53294
|
-
function
|
|
53294
|
+
function us(r6) {
|
|
53295
53295
|
return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
|
|
53296
53296
|
}
|
|
53297
|
-
function
|
|
53298
|
-
if (
|
|
53299
|
-
let e =
|
|
53297
|
+
function ls(r6) {
|
|
53298
|
+
if (us(r6)) {
|
|
53299
|
+
let e = ds(r6);
|
|
53300
53300
|
if (e) return e;
|
|
53301
53301
|
}
|
|
53302
53302
|
if (r6.resourceType === "Device") {
|
|
53303
|
-
let e =
|
|
53303
|
+
let e = ps(r6);
|
|
53304
53304
|
if (e) return e;
|
|
53305
53305
|
}
|
|
53306
53306
|
if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ye(r6.medicationCodeableConcept);
|
|
@@ -53310,15 +53310,15 @@ function us(r6) {
|
|
|
53310
53310
|
if ("code" in r6 && r6.code) {
|
|
53311
53311
|
let e = r6.code;
|
|
53312
53312
|
if (Array.isArray(e) && (e = e[0]), $r(e)) return Ye(e);
|
|
53313
|
-
if (
|
|
53313
|
+
if (Ts(e)) return e.text;
|
|
53314
53314
|
}
|
|
53315
53315
|
return O(r6) ?? "";
|
|
53316
53316
|
}
|
|
53317
|
-
function
|
|
53317
|
+
function ds(r6) {
|
|
53318
53318
|
let e = r6.name;
|
|
53319
53319
|
if (e && e.length > 0) return Ze(e[0]);
|
|
53320
53320
|
}
|
|
53321
|
-
function
|
|
53321
|
+
function ps(r6) {
|
|
53322
53322
|
let e = r6.deviceName;
|
|
53323
53323
|
if (e && e.length > 0) return e[0].name;
|
|
53324
53324
|
}
|
|
@@ -53344,9 +53344,9 @@ function At(r6, e) {
|
|
|
53344
53344
|
return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
|
|
53345
53345
|
}
|
|
53346
53346
|
function Jr(r6) {
|
|
53347
|
-
if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ?
|
|
53347
|
+
if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? fs2(r6) : ms(r6) : r6;
|
|
53348
53348
|
}
|
|
53349
|
-
function
|
|
53349
|
+
function fs2(r6) {
|
|
53350
53350
|
let e = r6.length;
|
|
53351
53351
|
if (e === 0) return;
|
|
53352
53352
|
let t, n = 0;
|
|
@@ -53356,7 +53356,7 @@ function ps(r6) {
|
|
|
53356
53356
|
}
|
|
53357
53357
|
if (n !== 0) return t ?? r6;
|
|
53358
53358
|
}
|
|
53359
|
-
function
|
|
53359
|
+
function ms(r6) {
|
|
53360
53360
|
let e, t = 0;
|
|
53361
53361
|
for (let n in r6) {
|
|
53362
53362
|
let i = r6[n], o2 = Jr(i);
|
|
@@ -53375,14 +53375,14 @@ function se(r6) {
|
|
|
53375
53375
|
return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
|
|
53376
53376
|
}
|
|
53377
53377
|
function fe(r6, e, t) {
|
|
53378
|
-
return r6 === e || A(r6) && A(e) ? true : A(r6) || A(e) ? false : Array.isArray(r6) && Array.isArray(e) ?
|
|
53378
|
+
return r6 === e || A(r6) && A(e) ? true : A(r6) || A(e) ? false : Array.isArray(r6) && Array.isArray(e) ? hs(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : C(r6) && C(e) ? gs(r6, e, t) : (C(r6) || C(e), false);
|
|
53379
53379
|
}
|
|
53380
|
-
function
|
|
53380
|
+
function hs(r6, e) {
|
|
53381
53381
|
if (r6.length !== e.length) return false;
|
|
53382
53382
|
for (let t = 0; t < r6.length; t++) if (!fe(r6[t], e[t])) return false;
|
|
53383
53383
|
return true;
|
|
53384
53384
|
}
|
|
53385
|
-
function
|
|
53385
|
+
function gs(r6, e, t) {
|
|
53386
53386
|
let n = /* @__PURE__ */ new Set();
|
|
53387
53387
|
for (let i of Object.keys(r6)) n.add(i);
|
|
53388
53388
|
for (let i of Object.keys(e)) n.add(i);
|
|
@@ -53402,7 +53402,7 @@ function jr(r6) {
|
|
|
53402
53402
|
function $r(r6) {
|
|
53403
53403
|
return C(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(jr);
|
|
53404
53404
|
}
|
|
53405
|
-
function
|
|
53405
|
+
function Ts(r6) {
|
|
53406
53406
|
return C(r6) && "text" in r6 && typeof r6.text == "string";
|
|
53407
53407
|
}
|
|
53408
53408
|
var fi = [];
|
|
@@ -53430,7 +53430,7 @@ var Yr = (r6, e) => new Promise((t, n) => {
|
|
|
53430
53430
|
clearTimeout(i), n(e.signal?.reason);
|
|
53431
53431
|
}, { once: true });
|
|
53432
53432
|
});
|
|
53433
|
-
function
|
|
53433
|
+
function qe(r6, e, t) {
|
|
53434
53434
|
let n = [];
|
|
53435
53435
|
for (let i = 0; i < t - 1; i++) {
|
|
53436
53436
|
let o2 = r6.indexOf(e);
|
|
@@ -53445,11 +53445,11 @@ function wt(r6) {
|
|
|
53445
53445
|
function Xr(r6) {
|
|
53446
53446
|
return r6.endsWith("/") ? r6 : r6 + "/";
|
|
53447
53447
|
}
|
|
53448
|
-
function
|
|
53448
|
+
function As(r6) {
|
|
53449
53449
|
return r6.startsWith("/") ? r6.slice(1) : r6;
|
|
53450
53450
|
}
|
|
53451
53451
|
function U(r6, e) {
|
|
53452
|
-
return new URL(
|
|
53452
|
+
return new URL(As(e), Xr(r6.toString())).toString();
|
|
53453
53453
|
}
|
|
53454
53454
|
function Ti(r6, e) {
|
|
53455
53455
|
return U(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
|
|
@@ -53457,34 +53457,34 @@ function Ti(r6, e) {
|
|
|
53457
53457
|
function Si(r6) {
|
|
53458
53458
|
return typeof r6 == "object" && !Array.isArray(r6) && !(r6 instanceof URLSearchParams) && (r6 = Object.fromEntries(Object.entries(r6).filter((e) => e[1] !== void 0))), new URLSearchParams(r6).toString();
|
|
53459
53459
|
}
|
|
53460
|
-
var
|
|
53460
|
+
var ws = /^(([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])$/;
|
|
53461
53461
|
function Cd(r6) {
|
|
53462
|
-
return
|
|
53462
|
+
return ws.test(r6);
|
|
53463
53463
|
}
|
|
53464
53464
|
var y = Object.freeze([]);
|
|
53465
53465
|
function Ze(r6, e) {
|
|
53466
53466
|
if (!r6) return "";
|
|
53467
53467
|
let t = [];
|
|
53468
53468
|
if (r6.prefix && e?.prefix !== false && t.push(...r6.prefix), r6.given && t.push(...r6.given), r6.family && t.push(r6.family), r6.suffix && e?.suffix !== false && t.push(...r6.suffix), r6.use && (e?.all || e?.use) && t.push("[" + r6.use + "]"), t.length === 0) {
|
|
53469
|
-
let n =
|
|
53469
|
+
let n = Ae(r6.text);
|
|
53470
53470
|
if (n) return n;
|
|
53471
53471
|
}
|
|
53472
53472
|
return t.join(" ").trim();
|
|
53473
53473
|
}
|
|
53474
53474
|
function Ye(r6) {
|
|
53475
53475
|
if (!r6) return "";
|
|
53476
|
-
let e =
|
|
53476
|
+
let e = Ae(r6.text);
|
|
53477
53477
|
return e || (r6.coding ? r6.coding.map((t) => Ei(t)).join(", ") : "");
|
|
53478
53478
|
}
|
|
53479
53479
|
function Ei(r6, e) {
|
|
53480
|
-
let t =
|
|
53480
|
+
let t = Ae(r6?.display);
|
|
53481
53481
|
if (t) {
|
|
53482
|
-
let n = e ?
|
|
53482
|
+
let n = e ? Ae(r6?.code) : void 0;
|
|
53483
53483
|
return `${t}${n ? " (" + n + ")" : ""}`;
|
|
53484
53484
|
}
|
|
53485
|
-
return
|
|
53485
|
+
return Ae(r6?.code) ?? "";
|
|
53486
53486
|
}
|
|
53487
|
-
function
|
|
53487
|
+
function Ae(r6) {
|
|
53488
53488
|
return typeof r6 == "string" ? r6 : void 0;
|
|
53489
53489
|
}
|
|
53490
53490
|
var d = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Element: "Element", ElementDefinition: "ElementDefinition", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", MoneyQuantity: "MoneyQuantity", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SimpleQuantity: "SimpleQuantity", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid", xhtml: "xhtml" };
|
|
@@ -53504,16 +53504,16 @@ function en(r6) {
|
|
|
53504
53504
|
}
|
|
53505
53505
|
function Pr(r6) {
|
|
53506
53506
|
let e = r6.type?.[0]?.code;
|
|
53507
|
-
return e === "BackboneElement" || e === "Element" ?
|
|
53507
|
+
return e === "BackboneElement" || e === "Element" ? Us((r6.base?.path ?? r6.path)?.split(".")) : e;
|
|
53508
53508
|
}
|
|
53509
|
-
function
|
|
53509
|
+
function Us(r6) {
|
|
53510
53510
|
return r6.length === 1 ? r6[0] : r6.map(N).join("");
|
|
53511
53511
|
}
|
|
53512
53512
|
function Ct(r6, e, t) {
|
|
53513
|
-
let n =
|
|
53514
|
-
if (n) return
|
|
53513
|
+
let n = Ee(r6, t);
|
|
53514
|
+
if (n) return Ai(n.elements, e);
|
|
53515
53515
|
}
|
|
53516
|
-
function
|
|
53516
|
+
function Ai(r6, e) {
|
|
53517
53517
|
let t = r6[e] ?? r6[e + "[x]"];
|
|
53518
53518
|
if (t) return t;
|
|
53519
53519
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -53531,7 +53531,7 @@ function Q(r6, e) {
|
|
|
53531
53531
|
return r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string" ? e ? r6.reference.match(new RegExp(`^${e}(/|\\?)`)) !== null : true : false;
|
|
53532
53532
|
}
|
|
53533
53533
|
var $ = { types: {} };
|
|
53534
|
-
function
|
|
53534
|
+
function je(r6) {
|
|
53535
53535
|
if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
|
|
53536
53536
|
if (r6.length <= 10) return r6;
|
|
53537
53537
|
try {
|
|
@@ -53555,10 +53555,10 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
|
|
|
53555
53555
|
return h(false);
|
|
53556
53556
|
}, subsetOf: (r6, e, t) => {
|
|
53557
53557
|
if (e.length === 0) return h(true);
|
|
53558
|
-
let n = t.eval(r6,
|
|
53558
|
+
let n = t.eval(r6, we(r6));
|
|
53559
53559
|
return n.length === 0 ? h(false) : h(e.every((i) => n.some((o2) => o2.value === i.value)));
|
|
53560
53560
|
}, supersetOf: (r6, e, t) => {
|
|
53561
|
-
let n = t.eval(r6,
|
|
53561
|
+
let n = t.eval(r6, we(r6));
|
|
53562
53562
|
return n.length === 0 ? h(true) : e.length === 0 ? h(false) : h(n.every((i) => e.some((o2) => o2.value === i.value)));
|
|
53563
53563
|
}, count: (r6, e) => [{ type: d.integer, value: e.length }], distinct: (r6, e) => {
|
|
53564
53564
|
let t = [];
|
|
@@ -53577,21 +53577,21 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
|
|
|
53577
53577
|
return n <= 0 ? [] : e.slice(0, n);
|
|
53578
53578
|
}, intersect: (r6, e, t) => {
|
|
53579
53579
|
if (!t) return e;
|
|
53580
|
-
let n = t.eval(r6,
|
|
53580
|
+
let n = t.eval(r6, we(r6)), i = [];
|
|
53581
53581
|
for (let o2 of e) !i.some((s) => s.value === o2.value) && n.some((s) => s.value === o2.value) && i.push(o2);
|
|
53582
53582
|
return i;
|
|
53583
53583
|
}, exclude: (r6, e, t) => {
|
|
53584
53584
|
if (!t) return e;
|
|
53585
|
-
let n = t.eval(r6,
|
|
53585
|
+
let n = t.eval(r6, we(r6)), i = [];
|
|
53586
53586
|
for (let o2 of e) n.some((s) => s.value === o2.value) || i.push(o2);
|
|
53587
53587
|
return i;
|
|
53588
53588
|
}, union: (r6, e, t) => {
|
|
53589
53589
|
if (!t) return e;
|
|
53590
|
-
let n = t.eval(r6,
|
|
53590
|
+
let n = t.eval(r6, we(r6));
|
|
53591
53591
|
return bt([...e, ...n]);
|
|
53592
53592
|
}, combine: (r6, e, t) => {
|
|
53593
53593
|
if (!t) return e;
|
|
53594
|
-
let n = t.eval(r6,
|
|
53594
|
+
let n = t.eval(r6, we(r6));
|
|
53595
53595
|
return [...e, ...n];
|
|
53596
53596
|
}, htmlChecks: (r6, e, t) => [b(true)], iif: (r6, e, t, n, i) => {
|
|
53597
53597
|
let o2 = t.eval(r6, e);
|
|
@@ -53615,11 +53615,11 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
|
|
|
53615
53615
|
}, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(_.toInteger(r6, e).length === 1), toDate: (r6, e) => {
|
|
53616
53616
|
if (e.length === 0) return [];
|
|
53617
53617
|
let [{ value: t }] = ee(e, 1);
|
|
53618
|
-
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: d.date, value:
|
|
53618
|
+
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: d.date, value: je(t) }] : [];
|
|
53619
53619
|
}, convertsToDate: (r6, e) => e.length === 0 ? [] : h(_.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
|
|
53620
53620
|
if (e.length === 0) return [];
|
|
53621
53621
|
let [{ value: t }] = ee(e, 1);
|
|
53622
|
-
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: d.dateTime, value:
|
|
53622
|
+
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: d.dateTime, value: je(t) }] : [];
|
|
53623
53623
|
}, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(_.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
|
|
53624
53624
|
if (e.length === 0) return [];
|
|
53625
53625
|
let [{ value: t }] = ee(e, 1);
|
|
@@ -53637,14 +53637,14 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
|
|
|
53637
53637
|
let [{ value: t }] = ee(e, 1);
|
|
53638
53638
|
if (typeof t == "string") {
|
|
53639
53639
|
let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
|
|
53640
|
-
if (n) return [{ type: d.time, value:
|
|
53640
|
+
if (n) return [{ type: d.time, value: je("T" + n[1]) }];
|
|
53641
53641
|
}
|
|
53642
53642
|
return [];
|
|
53643
53643
|
}, convertsToTime: (r6, e) => e.length === 0 ? [] : h(_.toTime(r6, e).length === 1), indexOf: (r6, e, t) => H((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => H((i, o2, s) => {
|
|
53644
53644
|
let a = o2, u2 = s ? a + s : i.length;
|
|
53645
53645
|
return a < 0 || a >= i.length ? void 0 : i.substring(a, u2);
|
|
53646
53646
|
}, r6, e, t, n), startsWith: (r6, e, t) => H((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => H((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => H((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => H((t) => t.toUpperCase(), r6, e), lower: (r6, e) => H((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => H((i, o2, s) => i.replaceAll(o2, s), r6, e, t, n), matches: (r6, e, t) => H((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => H((i, o2, s) => i.replaceAll(new RegExp(o2, "g"), s.replaceAll(/\$\{(\w+)\}/g, "$<$1>")), r6, e, t, n), length: (r6, e) => H((t) => t.length, r6, e), toChars: (r6, e) => H((t) => t ? t.split("") : void 0, r6, e), encode: ae, decode: ae, escape: ae, unescape: ae, trim: ae, split: ae, join: (r6, e, t) => {
|
|
53647
|
-
let n = t?.eval(r6,
|
|
53647
|
+
let n = t?.eval(r6, we(r6))[0]?.value ?? "";
|
|
53648
53648
|
if (typeof n != "string") throw new TypeError("Separator must be a string.");
|
|
53649
53649
|
return [{ type: d.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
|
|
53650
53650
|
}, abs: (r6, e) => Z(Math.abs, r6, e), ceiling: (r6, e) => Z(Math.ceil, r6, e), exp: (r6, e) => Z(Math.exp, r6, e), floor: (r6, e) => Z(Math.floor, r6, e), ln: (r6, e) => Z(Math.log, r6, e), log: (r6, e, t) => Z((n, i) => Math.log(n) / Math.log(i), r6, e, t), power: (r6, e, t) => Z(Math.pow, r6, e, t), round: (r6, e, ...t) => Z((n, i = 0) => {
|
|
@@ -53695,7 +53695,7 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
|
|
|
53695
53695
|
let n = e[0].value;
|
|
53696
53696
|
if (!n?.reference) return [];
|
|
53697
53697
|
let i = "";
|
|
53698
|
-
return t instanceof B && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: d.id, value:
|
|
53698
|
+
return t instanceof B && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: d.id, value: Ce(n) }];
|
|
53699
53699
|
}, extension: (r6, e, t) => {
|
|
53700
53700
|
let n = t.eval(r6, e)[0].value, i = e?.[0]?.value;
|
|
53701
53701
|
if (i) {
|
|
@@ -53723,7 +53723,7 @@ function ee(r6, e) {
|
|
|
53723
53723
|
for (let t of r6) if (t == null) throw new Error("Expected non-null argument");
|
|
53724
53724
|
return r6;
|
|
53725
53725
|
}
|
|
53726
|
-
function
|
|
53726
|
+
function we(r6) {
|
|
53727
53727
|
let e = r6;
|
|
53728
53728
|
for (; e.parent?.variables.$this; ) e = e.parent;
|
|
53729
53729
|
return [e.variables.$this];
|
|
@@ -53760,7 +53760,7 @@ var B = class {
|
|
|
53760
53760
|
}
|
|
53761
53761
|
evalValue(e) {
|
|
53762
53762
|
let t = e.value;
|
|
53763
|
-
if (!(!t || typeof t != "object")) return I(t, this.name) ? e : _r(e, this.name);
|
|
53763
|
+
if (!(!t || typeof t != "object")) return I(t, this.name) ? ("path" in e || (e.path = t.resourceType), e) : _r(e, this.name);
|
|
53764
53764
|
}
|
|
53765
53765
|
toString() {
|
|
53766
53766
|
return this.name;
|
|
@@ -53808,13 +53808,13 @@ var F = class extends R {
|
|
|
53808
53808
|
return typeof p2 == "boolean" ? h(p2) : V(s) ? [{ type: d.Quantity, value: { ...s, value: p2 } }] : [b(p2)];
|
|
53809
53809
|
}
|
|
53810
53810
|
};
|
|
53811
|
-
var
|
|
53811
|
+
var Oi = Object.freeze({ type: "string", value: "" });
|
|
53812
53812
|
var Vt = class extends R {
|
|
53813
53813
|
constructor(e, t) {
|
|
53814
53814
|
super("&", e, t);
|
|
53815
53815
|
}
|
|
53816
53816
|
eval(e, t) {
|
|
53817
|
-
let n = D(this.left.eval(e, t)) ??
|
|
53817
|
+
let n = D(this.left.eval(e, t)) ?? Oi, i = D(this.right.eval(e, t)) ?? Oi;
|
|
53818
53818
|
if (typeof n.value != "string") throw new Error(`Expected string operand for &, but got ${n.type}`);
|
|
53819
53819
|
if (typeof i.value != "string") throw new Error(`Expected string operand for &, but got ${i.type}`);
|
|
53820
53820
|
return [{ type: d.string, value: n.value + i.value }];
|
|
@@ -53849,7 +53849,7 @@ var te = class extends R {
|
|
|
53849
53849
|
return `${this.left.toString()}.${this.right.toString()}`;
|
|
53850
53850
|
}
|
|
53851
53851
|
};
|
|
53852
|
-
var
|
|
53852
|
+
var Oe = class extends R {
|
|
53853
53853
|
constructor(e, t) {
|
|
53854
53854
|
super("|", e, t);
|
|
53855
53855
|
}
|
|
@@ -53894,7 +53894,7 @@ var Ft = class extends R {
|
|
|
53894
53894
|
return ii(Wr(n, i));
|
|
53895
53895
|
}
|
|
53896
53896
|
};
|
|
53897
|
-
var
|
|
53897
|
+
var Ie = class extends R {
|
|
53898
53898
|
constructor(e, t) {
|
|
53899
53899
|
super("is", e, t);
|
|
53900
53900
|
}
|
|
@@ -53956,7 +53956,7 @@ var re = class {
|
|
|
53956
53956
|
return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
|
|
53957
53957
|
}
|
|
53958
53958
|
};
|
|
53959
|
-
var
|
|
53959
|
+
var ke = class {
|
|
53960
53960
|
constructor(e, t) {
|
|
53961
53961
|
c(this, "left");
|
|
53962
53962
|
c(this, "expr");
|
|
@@ -53984,7 +53984,7 @@ var Gs = { parse(r6) {
|
|
|
53984
53984
|
var Qs = { parse(r6, e) {
|
|
53985
53985
|
let t = r6.consumeAndParse();
|
|
53986
53986
|
if (!r6.match("]")) throw new Error("Parse error: expected `]`");
|
|
53987
|
-
return new
|
|
53987
|
+
return new ke(e, t);
|
|
53988
53988
|
}, precedence: S.Indexer };
|
|
53989
53989
|
var zs = { parse(r6, e) {
|
|
53990
53990
|
if (!(e instanceof B)) throw new Error("Unexpected parentheses");
|
|
@@ -53997,7 +53997,7 @@ function Js(r6) {
|
|
|
53997
53997
|
return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
|
|
53998
53998
|
}
|
|
53999
53999
|
function rt() {
|
|
54000
|
-
return new pt().registerPrefix("String", { parse: (r6, e) => new G({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new G({ type: d.dateTime, value:
|
|
54000
|
+
return new pt().registerPrefix("String", { parse: (r6, e) => new G({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new G({ type: d.dateTime, value: je(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new G({ type: d.Quantity, value: Js(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new G({ type: e.value.includes(".") ? d.decimal : d.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new G({ type: d.boolean, value: true }) }).registerPrefix("false", { parse: () => new G({ type: d.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new It() }).registerPrefix("(", Gs).registerInfix("[", Qs).registerInfix("(", zs).prefix("+", S.UnaryAdd, (r6, e) => new kt("+", e, (t) => t)).prefix("-", S.UnarySubtract, (r6, e) => new F("-", e, e, (t, n) => -n)).infixLeft(".", S.Dot, (r6, e, t) => new te(r6, t)).infixLeft("/", S.Divide, (r6, e, t) => new F("/", r6, t, (n, i) => n / i)).infixLeft("*", S.Multiply, (r6, e, t) => new F("*", r6, t, (n, i) => n * i)).infixLeft("+", S.Add, (r6, e, t) => new F("+", r6, t, (n, i) => n + i)).infixLeft("-", S.Subtract, (r6, e, t) => new F("-", r6, t, (n, i) => n - i)).infixLeft("|", S.Union, (r6, e, t) => new Oe(r6, t)).infixLeft("=", S.Equals, (r6, e, t) => new _t(r6, t)).infixLeft("!=", S.NotEquals, (r6, e, t) => new Lt(r6, t)).infixLeft("~", S.Equivalent, (r6, e, t) => new Nt(r6, t)).infixLeft("!~", S.NotEquivalent, (r6, e, t) => new Ft(r6, t)).infixLeft("<", S.LessThan, (r6, e, t) => new F("<", r6, t, (n, i) => n < i)).infixLeft("<=", S.LessThanOrEquals, (r6, e, t) => new F("<=", r6, t, (n, i) => n <= i)).infixLeft(">", S.GreaterThan, (r6, e, t) => new F(">", r6, t, (n, i) => n > i)).infixLeft(">=", S.GreaterThanOrEquals, (r6, e, t) => new F(">=", r6, t, (n, i) => n >= i)).infixLeft("&", S.Ampersand, (r6, e, t) => new Vt(r6, t)).infixLeft("and", S.And, (r6, e, t) => new Ut(r6, t)).infixLeft("as", S.As, (r6, e, t) => new ye(r6, t)).infixLeft("contains", S.Contains, (r6, e, t) => new Dt(r6, t)).infixLeft("div", S.Divide, (r6, e, t) => new F("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", S.In, (r6, e, t) => new Mt(r6, t)).infixLeft("is", S.Is, (r6, e, t) => new Ie(r6, t)).infixLeft("mod", S.Modulo, (r6, e, t) => new F("mod", r6, t, (n, i) => n % i)).infixLeft("or", S.Or, (r6, e, t) => new Bt(r6, t)).infixLeft("xor", S.Xor, (r6, e, t) => new Wt(r6, t)).infixLeft("implies", S.Implies, (r6, e, t) => new qt(r6, t));
|
|
54001
54001
|
}
|
|
54002
54002
|
var Ks = rt();
|
|
54003
54003
|
var m = { 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" };
|
|
@@ -54005,9 +54005,9 @@ var tn = { contains: m.CONTAINS, exact: m.EXACT, above: m.ABOVE, below: m.BELOW,
|
|
|
54005
54005
|
var rn = { eq: m.EQUALS, ne: m.NOT_EQUALS, lt: m.LESS_THAN, le: m.LESS_THAN_OR_EQUALS, gt: m.GREATER_THAN, ge: m.GREATER_THAN_OR_EQUALS, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, ap: m.APPROXIMATELY, sw: m.STARTS_WITH };
|
|
54006
54006
|
var ia = [m.MISSING, m.PRESENT];
|
|
54007
54007
|
var fa = new K(1e3);
|
|
54008
|
-
var
|
|
54009
|
-
var Pa = [
|
|
54010
|
-
var
|
|
54008
|
+
var De = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
|
|
54009
|
+
var Pa = [De.READ, De.VREAD, De.HISTORY, De.SEARCH];
|
|
54010
|
+
var af = { FIRST: "first", APPLICATION: "application" };
|
|
54011
54011
|
function z() {
|
|
54012
54012
|
return typeof window < "u";
|
|
54013
54013
|
}
|
|
@@ -54045,7 +54045,7 @@ function Gt(r6) {
|
|
|
54045
54045
|
if (e) return e.from(r6, "utf8").toString("base64");
|
|
54046
54046
|
throw new Error("Unable to encode base64");
|
|
54047
54047
|
}
|
|
54048
|
-
function
|
|
54048
|
+
function Wi(r6) {
|
|
54049
54049
|
r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
|
|
54050
54050
|
let e = r6.replaceAll("-", "+").replaceAll("_", "/");
|
|
54051
54051
|
return Oa(e);
|
|
@@ -54054,7 +54054,7 @@ function on() {
|
|
|
54054
54054
|
let r6 = new Uint32Array(28);
|
|
54055
54055
|
return crypto.getRandomValues(r6), mi(r6.buffer);
|
|
54056
54056
|
}
|
|
54057
|
-
async function
|
|
54057
|
+
async function qi(r6) {
|
|
54058
54058
|
return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
|
|
54059
54059
|
}
|
|
54060
54060
|
function ne() {
|
|
@@ -54116,30 +54116,30 @@ var ie = class {
|
|
|
54116
54116
|
var an = { "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" };
|
|
54117
54117
|
var Ba = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
|
|
54118
54118
|
var cn = ["DiagnosticReport-update"];
|
|
54119
|
-
function
|
|
54119
|
+
function $i(r6) {
|
|
54120
54120
|
return cn.includes(r6);
|
|
54121
54121
|
}
|
|
54122
|
-
function
|
|
54122
|
+
function Hi(r6) {
|
|
54123
54123
|
if (cn.includes(r6)) throw new f(T(`'context.version' is required for '${r6}'.`));
|
|
54124
54124
|
}
|
|
54125
54125
|
var Wa = { "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" } } };
|
|
54126
54126
|
function qa(r6) {
|
|
54127
54127
|
return Ba.includes(r6);
|
|
54128
54128
|
}
|
|
54129
|
-
function
|
|
54129
|
+
function Gi(r6) {
|
|
54130
54130
|
return !!r6.endpoint;
|
|
54131
54131
|
}
|
|
54132
54132
|
function un(r6) {
|
|
54133
54133
|
if (!zt(r6)) throw new f(T("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
|
|
54134
54134
|
let { channelType: e, mode: t, topic: n, events: i } = r6, o2 = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
|
|
54135
|
-
return
|
|
54135
|
+
return Gi(r6) && (o2.endpoint = r6.endpoint), new URLSearchParams(o2).toString();
|
|
54136
54136
|
}
|
|
54137
54137
|
function zt(r6) {
|
|
54138
54138
|
if (typeof r6 != "object") return false;
|
|
54139
54139
|
let { channelType: e, mode: t, topic: n, events: i } = r6;
|
|
54140
54140
|
if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
|
|
54141
54141
|
for (let o2 of i) if (!an[o2]) return false;
|
|
54142
|
-
return !(
|
|
54142
|
+
return !(Gi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
|
|
54143
54143
|
}
|
|
54144
54144
|
function ja(r6, e, t, n) {
|
|
54145
54145
|
if (typeof e != "object") throw new f(T(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
|
|
@@ -54200,23 +54200,23 @@ var Qt = class extends ie {
|
|
|
54200
54200
|
}
|
|
54201
54201
|
};
|
|
54202
54202
|
function Ga(r6) {
|
|
54203
|
-
return JSON.parse(
|
|
54203
|
+
return JSON.parse(Wi(r6));
|
|
54204
54204
|
}
|
|
54205
|
-
function
|
|
54205
|
+
function Qi(r6) {
|
|
54206
54206
|
return r6.split(".").length === 3;
|
|
54207
54207
|
}
|
|
54208
54208
|
function Jt(r6) {
|
|
54209
54209
|
let [e, t, n] = r6.split(".");
|
|
54210
54210
|
return Ga(t);
|
|
54211
54211
|
}
|
|
54212
|
-
function
|
|
54212
|
+
function zi(r6) {
|
|
54213
54213
|
try {
|
|
54214
54214
|
return typeof Jt(r6).login_id == "string";
|
|
54215
54215
|
} catch {
|
|
54216
54216
|
return false;
|
|
54217
54217
|
}
|
|
54218
54218
|
}
|
|
54219
|
-
function
|
|
54219
|
+
function Ji(r6) {
|
|
54220
54220
|
try {
|
|
54221
54221
|
let t = Jt(r6).exp;
|
|
54222
54222
|
return typeof t == "number" ? t * 1e3 : void 0;
|
|
@@ -54239,11 +54239,11 @@ var Kt = class {
|
|
|
54239
54239
|
await this.medplum.delete(`keyvalue/v1/${e}`);
|
|
54240
54240
|
}
|
|
54241
54241
|
};
|
|
54242
|
-
var
|
|
54243
|
-
|
|
54242
|
+
var Ki;
|
|
54243
|
+
Ki = Symbol.toStringTag;
|
|
54244
54244
|
var W = class {
|
|
54245
54245
|
constructor(e) {
|
|
54246
|
-
c(this,
|
|
54246
|
+
c(this, Ki, "ReadablePromise");
|
|
54247
54247
|
c(this, "suspender");
|
|
54248
54248
|
c(this, "status", "pending");
|
|
54249
54249
|
c(this, "response");
|
|
@@ -54330,18 +54330,18 @@ var dn = class {
|
|
|
54330
54330
|
return Array.from(this.data.keys())[e];
|
|
54331
54331
|
}
|
|
54332
54332
|
};
|
|
54333
|
-
var
|
|
54334
|
-
var
|
|
54333
|
+
var He = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
|
|
54334
|
+
var Xi = false;
|
|
54335
54335
|
function Qa() {
|
|
54336
54336
|
if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
|
|
54337
|
-
|
|
54337
|
+
He.Event = globalThis.Event, He.ErrorEvent = class extends Event {
|
|
54338
54338
|
constructor(t, n) {
|
|
54339
54339
|
super("error", n);
|
|
54340
54340
|
c(this, "message");
|
|
54341
54341
|
c(this, "error");
|
|
54342
54342
|
this.message = t.message, this.error = t;
|
|
54343
54343
|
}
|
|
54344
|
-
},
|
|
54344
|
+
}, He.CloseEvent = class extends Event {
|
|
54345
54345
|
constructor(t = 1e3, n = "", i) {
|
|
54346
54346
|
super("close", i);
|
|
54347
54347
|
c(this, "code");
|
|
@@ -54357,11 +54357,11 @@ function za(r6, e) {
|
|
|
54357
54357
|
function Yt(r6) {
|
|
54358
54358
|
return new r6.constructor(r6.type, r6);
|
|
54359
54359
|
}
|
|
54360
|
-
var
|
|
54361
|
-
var
|
|
54360
|
+
var Me = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
|
|
54361
|
+
var Zi = false;
|
|
54362
54362
|
var Xt = class r extends ie {
|
|
54363
54363
|
constructor(t, n, i = {}) {
|
|
54364
|
-
|
|
54364
|
+
Xi || (Qa(), Xi = true);
|
|
54365
54365
|
super();
|
|
54366
54366
|
c(this, "_ws");
|
|
54367
54367
|
c(this, "_retryCount", -1);
|
|
@@ -54382,7 +54382,7 @@ var Xt = class r extends ie {
|
|
|
54382
54382
|
c(this, "onopen", null);
|
|
54383
54383
|
c(this, "_handleOpen", (t2) => {
|
|
54384
54384
|
this._debug("open event");
|
|
54385
|
-
let { minUptime: n2 =
|
|
54385
|
+
let { minUptime: n2 = Me.minUptime } = this._options;
|
|
54386
54386
|
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), za(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(t2), this.dispatchEvent(Yt(t2));
|
|
54387
54387
|
});
|
|
54388
54388
|
c(this, "_handleMessage", (t2) => {
|
|
@@ -54464,7 +54464,7 @@ var Xt = class r extends ie {
|
|
|
54464
54464
|
send(t) {
|
|
54465
54465
|
if (this._ws?.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
|
|
54466
54466
|
else {
|
|
54467
|
-
let { maxEnqueuedMessages: n =
|
|
54467
|
+
let { maxEnqueuedMessages: n = Me.maxEnqueuedMessages } = this._options;
|
|
54468
54468
|
this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
|
|
54469
54469
|
}
|
|
54470
54470
|
}
|
|
@@ -54472,7 +54472,7 @@ var Xt = class r extends ie {
|
|
|
54472
54472
|
this._options.debug && this._debugLogger("RWS>", ...t);
|
|
54473
54473
|
}
|
|
54474
54474
|
_getNextDelay() {
|
|
54475
|
-
let { reconnectionDelayGrowFactor: t =
|
|
54475
|
+
let { reconnectionDelayGrowFactor: t = Me.reconnectionDelayGrowFactor, minReconnectionDelay: n = Me.minReconnectionDelay, maxReconnectionDelay: i = Me.maxReconnectionDelay } = this._options, o2 = 0;
|
|
54476
54476
|
return this._retryCount > 0 && (o2 = n * Math.pow(t, this._retryCount - 1), o2 > i && (o2 = i)), this._debug("next delay", o2), o2;
|
|
54477
54477
|
}
|
|
54478
54478
|
_wait() {
|
|
@@ -54483,7 +54483,7 @@ var Xt = class r extends ie {
|
|
|
54483
54483
|
_connect() {
|
|
54484
54484
|
if (this._connectLock || !this._shouldReconnect) return;
|
|
54485
54485
|
this._connectLock = true;
|
|
54486
|
-
let { maxRetries: t =
|
|
54486
|
+
let { maxRetries: t = Me.maxRetries, connectionTimeout: n = Me.connectionTimeout } = this._options;
|
|
54487
54487
|
if (this._retryCount >= t) {
|
|
54488
54488
|
this._debug("max retries reached", this._retryCount, ">=", t);
|
|
54489
54489
|
return;
|
|
@@ -54493,21 +54493,21 @@ var Xt = class r extends ie {
|
|
|
54493
54493
|
this._connectLock = false;
|
|
54494
54494
|
return;
|
|
54495
54495
|
}
|
|
54496
|
-
!this._options.WebSocket && typeof WebSocket > "u" && !
|
|
54496
|
+
!this._options.WebSocket && typeof WebSocket > "u" && !Zi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Zi = true);
|
|
54497
54497
|
let i = this._options.WebSocket || WebSocket;
|
|
54498
54498
|
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);
|
|
54499
54499
|
}).catch((i) => {
|
|
54500
|
-
this._connectLock = false, this._handleError(new
|
|
54500
|
+
this._connectLock = false, this._handleError(new He.ErrorEvent(Error(i.message), this));
|
|
54501
54501
|
});
|
|
54502
54502
|
}
|
|
54503
54503
|
_handleTimeout() {
|
|
54504
|
-
this._debug("timeout event"), this._handleError(new
|
|
54504
|
+
this._debug("timeout event"), this._handleError(new He.ErrorEvent(Error("TIMEOUT"), this));
|
|
54505
54505
|
}
|
|
54506
54506
|
_disconnect(t = 1e3, n) {
|
|
54507
54507
|
if (this._clearTimeouts(), !!this._ws) {
|
|
54508
54508
|
this._removeListeners();
|
|
54509
54509
|
try {
|
|
54510
|
-
this._ws.close(t, n), this._handleClose(new
|
|
54510
|
+
this._ws.close(t, n), this._handleClose(new He.CloseEvent(t, n, this));
|
|
54511
54511
|
} catch {
|
|
54512
54512
|
}
|
|
54513
54513
|
}
|
|
@@ -54598,7 +54598,7 @@ var Zt = class {
|
|
|
54598
54598
|
return;
|
|
54599
54599
|
}
|
|
54600
54600
|
if (o2.type === "handshake") {
|
|
54601
|
-
let a =
|
|
54601
|
+
let a = Ce(o2.subscription), u2 = { type: "connect", payload: { subscriptionId: a } };
|
|
54602
54602
|
this.masterSubEmitter?.dispatchEvent(u2);
|
|
54603
54603
|
let l = this.criteriaEntriesBySubscriptionId.get(a);
|
|
54604
54604
|
if (!l) {
|
|
@@ -54609,7 +54609,7 @@ var Zt = class {
|
|
|
54609
54609
|
return;
|
|
54610
54610
|
}
|
|
54611
54611
|
this.masterSubEmitter?.dispatchEvent({ type: "message", payload: i });
|
|
54612
|
-
let s = this.criteriaEntriesBySubscriptionId.get(
|
|
54612
|
+
let s = this.criteriaEntriesBySubscriptionId.get(Ce(o2.subscription));
|
|
54613
54613
|
if (!s) {
|
|
54614
54614
|
console.warn("Received notification for criteria the SubscriptionManager is not listening for");
|
|
54615
54615
|
return;
|
|
@@ -54714,7 +54714,7 @@ var Zt = class {
|
|
|
54714
54714
|
if (this.isStale(e, t)) return;
|
|
54715
54715
|
e.token = i, e.tokenExpiry = new Date(s).getTime(), this.criteriaEntriesBySubscriptionId.set(e.subscriptionId, e), this.sendBind(i);
|
|
54716
54716
|
} catch (n) {
|
|
54717
|
-
console.error(
|
|
54717
|
+
console.error(Ne(n)), e.generation === t && !this.isEntryGettingRemoved(e) && (e.state = e.state === "refreshing" ? "active" : "idle"), this.emitError(e, n);
|
|
54718
54718
|
}
|
|
54719
54719
|
}
|
|
54720
54720
|
checkTokenExpirations() {
|
|
@@ -54779,7 +54779,7 @@ function st(r6) {
|
|
|
54779
54779
|
return r6.bareCriteria ? [r6.bareCriteria, ...r6.criteriaWithProps] : r6.criteriaWithProps;
|
|
54780
54780
|
}
|
|
54781
54781
|
var Ka = new K(1e3);
|
|
54782
|
-
var fn = "5.1.
|
|
54782
|
+
var fn = "5.1.15-088bfde";
|
|
54783
54783
|
var Za = k.FHIR_JSON + ", */*; q=0.1";
|
|
54784
54784
|
var ec = "https://api.medplum.com/";
|
|
54785
54785
|
var tc = 1e3;
|
|
@@ -54787,8 +54787,8 @@ var rc = 6e4;
|
|
|
54787
54787
|
var nc = 0;
|
|
54788
54788
|
var ic = 3e5;
|
|
54789
54789
|
var oc = "Binary/";
|
|
54790
|
-
var
|
|
54791
|
-
var
|
|
54790
|
+
var eo = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
|
|
54791
|
+
var Ge = { 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" };
|
|
54792
54792
|
var sc = { 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" };
|
|
54793
54793
|
var ac = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
|
|
54794
54794
|
var er = class extends ie {
|
|
@@ -54951,7 +54951,7 @@ var er = class extends ie {
|
|
|
54951
54951
|
}
|
|
54952
54952
|
async exchangeExternalAccessToken(t, n, i) {
|
|
54953
54953
|
if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
|
|
54954
|
-
let o2 = { grant_type:
|
|
54954
|
+
let o2 = { grant_type: Ge.TokenExchange, subject_token_type: sc.AccessToken, client_id: n, subject_token: t };
|
|
54955
54955
|
return i && (o2.membership_id = i), this.fetchTokens(o2);
|
|
54956
54956
|
}
|
|
54957
54957
|
getExternalAuthRedirectUri(t, n, i, o2, s = true) {
|
|
@@ -54988,7 +54988,7 @@ var er = class extends ie {
|
|
|
54988
54988
|
searchResources(t, n, i) {
|
|
54989
54989
|
let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i);
|
|
54990
54990
|
if (a) return a.value;
|
|
54991
|
-
let u2 = new W(this.search(t, n, i).then(
|
|
54991
|
+
let u2 = new W(this.search(t, n, i).then(ro));
|
|
54992
54992
|
return this.setCacheEntry(s, u2, i), u2;
|
|
54993
54993
|
}
|
|
54994
54994
|
async *searchResourcePages(t, n, i) {
|
|
@@ -54998,7 +54998,7 @@ var er = class extends ie {
|
|
|
54998
54998
|
s.has("_count") || s.set("_count", "1000");
|
|
54999
54999
|
let a = await this.search(t, s, i), u2 = a.link?.find((l) => l.relation === "next");
|
|
55000
55000
|
if (!a.entry?.length && !u2) break;
|
|
55001
|
-
yield
|
|
55001
|
+
yield ro(a), o2 = u2?.url ? new URL(u2.url) : void 0;
|
|
55002
55002
|
}
|
|
55003
55003
|
}
|
|
55004
55004
|
valueSetExpand(t, n) {
|
|
@@ -55012,7 +55012,7 @@ var er = class extends ie {
|
|
|
55012
55012
|
getCachedReference(t) {
|
|
55013
55013
|
let n = t.reference;
|
|
55014
55014
|
if (!n) return;
|
|
55015
|
-
if (n === "system") return
|
|
55015
|
+
if (n === "system") return eo;
|
|
55016
55016
|
let [i, o2] = n.split("/");
|
|
55017
55017
|
if (!(!i || !o2)) return this.getCached(i, o2);
|
|
55018
55018
|
}
|
|
@@ -55023,7 +55023,7 @@ var er = class extends ie {
|
|
|
55023
55023
|
readReference(t, n) {
|
|
55024
55024
|
let i = t.reference;
|
|
55025
55025
|
if (!i) return new W(Promise.reject(new Error("Missing reference")));
|
|
55026
|
-
if (i === "system") return new W(Promise.resolve(
|
|
55026
|
+
if (i === "system") return new W(Promise.resolve(eo));
|
|
55027
55027
|
let [o2, s] = i.split("/");
|
|
55028
55028
|
return !o2 || !s ? new W(Promise.reject(new Error("Invalid reference"))) : this.readResource(o2, s, n);
|
|
55029
55029
|
}
|
|
@@ -55130,7 +55130,7 @@ var er = class extends ie {
|
|
|
55130
55130
|
return s || (s = t), this.cacheResource(s, i), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
|
|
55131
55131
|
}
|
|
55132
55132
|
async createAttachment(t, n, i, o2, s) {
|
|
55133
|
-
let a =
|
|
55133
|
+
let a = no(t, n, i, o2);
|
|
55134
55134
|
if (a.contentType === k.XML) {
|
|
55135
55135
|
let p2 = a.data, g2;
|
|
55136
55136
|
p2 instanceof Blob ? g2 = await new Promise((v2, M2) => {
|
|
@@ -55148,7 +55148,7 @@ var er = class extends ie {
|
|
|
55148
55148
|
return { contentType: a.contentType, url: l.url, title: a.filename };
|
|
55149
55149
|
}
|
|
55150
55150
|
createBinary(t, n, i, o2, s) {
|
|
55151
|
-
let a =
|
|
55151
|
+
let a = no(t, n, i, o2), u2 = s ?? (typeof n == "object" ? n : {}), { data: l, contentType: p2, filename: g2, securityContext: v2, onProgress: M2 } = a, J = this.fhirUrl("Binary");
|
|
55152
55152
|
return g2 && J.searchParams.set("_filename", g2), v2?.reference && this.setRequestHeader(u2, "X-Security-Context", v2.reference), M2 ? this.uploadwithProgress(J, l, p2, M2, u2) : this.post(J, l, p2, u2);
|
|
55153
55153
|
}
|
|
55154
55154
|
uploadwithProgress(t, n, i, o2, s) {
|
|
@@ -55174,7 +55174,7 @@ var er = class extends ie {
|
|
|
55174
55174
|
}
|
|
55175
55175
|
createComment(t, n, i) {
|
|
55176
55176
|
let o2 = this.getProfile(), s, a;
|
|
55177
|
-
return t.resourceType === "Encounter" && (s =
|
|
55177
|
+
return t.resourceType === "Encounter" && (s = Re(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = Re(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [Re(t)], encounter: s, subject: a, sender: o2 ? Re(o2) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
|
|
55178
55178
|
}
|
|
55179
55179
|
async updateResource(t, n) {
|
|
55180
55180
|
if (!t.resourceType) throw new Error("Missing resourceType");
|
|
@@ -55217,7 +55217,7 @@ var er = class extends ie {
|
|
|
55217
55217
|
}
|
|
55218
55218
|
pushToAgent(t, n, i, o2, s, a) {
|
|
55219
55219
|
let { waitTimeout: u2, returnAck: l, ...p2 } = a ?? {};
|
|
55220
|
-
return this.post(this.fhirUrl("Agent",
|
|
55220
|
+
return this.post(this.fhirUrl("Agent", Ce(t), "$push"), { destination: typeof n == "string" ? n : O(n), body: i, contentType: o2, waitForResponse: s, ...u2 !== void 0 ? { waitTimeout: u2 } : void 0, ...l !== void 0 ? { returnAck: l } : void 0 }, k.FHIR_JSON, p2);
|
|
55221
55221
|
}
|
|
55222
55222
|
getCdsServices(t) {
|
|
55223
55223
|
return this.get(this.cdsServicesUrl, t);
|
|
@@ -55238,7 +55238,7 @@ var er = class extends ie {
|
|
|
55238
55238
|
return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
|
|
55239
55239
|
}
|
|
55240
55240
|
setAccessToken(t, n) {
|
|
55241
|
-
this.accessToken = t, this.refreshToken = n, this.accessTokenExpires =
|
|
55241
|
+
this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ji(t), this.medplumServer = zi(t);
|
|
55242
55242
|
}
|
|
55243
55243
|
getLogins() {
|
|
55244
55244
|
return this.storage.getObject("logins") ?? [];
|
|
@@ -55295,7 +55295,7 @@ var er = class extends ie {
|
|
|
55295
55295
|
}
|
|
55296
55296
|
async createMedia(t, n) {
|
|
55297
55297
|
let { additionalFields: i, ...o2 } = t, s = await this.createResource({ resourceType: "Media", status: "preparation", content: { contentType: t.contentType }, ...i });
|
|
55298
|
-
o2.securityContext || (o2.securityContext =
|
|
55298
|
+
o2.securityContext || (o2.securityContext = Re(s));
|
|
55299
55299
|
let a = await this.createAttachment(o2, n);
|
|
55300
55300
|
return this.updateResource({ ...s, status: "completed", content: a });
|
|
55301
55301
|
}
|
|
@@ -55304,7 +55304,7 @@ var er = class extends ie {
|
|
|
55304
55304
|
}
|
|
55305
55305
|
async createDocumentReference(t, n) {
|
|
55306
55306
|
let { additionalFields: i, ...o2 } = t, s = await this.createResource({ resourceType: "DocumentReference", status: "current", content: [{ attachment: { contentType: t.contentType } }], ...i });
|
|
55307
|
-
o2.securityContext || (o2.securityContext =
|
|
55307
|
+
o2.securityContext || (o2.securityContext = Re(s));
|
|
55308
55308
|
let a = await this.createAttachment(o2, n);
|
|
55309
55309
|
return this.updateResource({ ...s, content: [{ attachment: a }] });
|
|
55310
55310
|
}
|
|
@@ -55357,11 +55357,11 @@ var er = class extends ie {
|
|
|
55357
55357
|
if (o2.status === 404 && !a) throw new f(Fn);
|
|
55358
55358
|
let u2 = await this.parseBody(o2, a);
|
|
55359
55359
|
if (o2.status === 200 && n.followRedirectOnOk || o2.status === 201 && n.followRedirectOnCreated) {
|
|
55360
|
-
let l = await
|
|
55360
|
+
let l = await to(o2, u2);
|
|
55361
55361
|
if (l) return this.request(l, { ...n, method: "GET", body: void 0 });
|
|
55362
55362
|
}
|
|
55363
55363
|
if (o2.status === 202 && n.pollStatusOnAccepted) {
|
|
55364
|
-
let p2 = await
|
|
55364
|
+
let p2 = await to(o2, u2) ?? i.statusUrl;
|
|
55365
55365
|
if (p2) return this.pollStatus(p2, n, i);
|
|
55366
55366
|
}
|
|
55367
55367
|
if (o2.status >= 400) throw new f(yt(u2));
|
|
@@ -55479,7 +55479,7 @@ var er = class extends ie {
|
|
|
55479
55479
|
}
|
|
55480
55480
|
handleUnauthenticated(t, n) {
|
|
55481
55481
|
if (this.refresh()) return this.request(t, n);
|
|
55482
|
-
throw this.clear(), this.onUnauthenticated?.(), new f(
|
|
55482
|
+
throw this.clear(), this.onUnauthenticated?.(), new f(Le);
|
|
55483
55483
|
}
|
|
55484
55484
|
async startPkce() {
|
|
55485
55485
|
let t = on();
|
|
@@ -55487,7 +55487,7 @@ var er = class extends ie {
|
|
|
55487
55487
|
let n = on().slice(0, 128);
|
|
55488
55488
|
this.storage.setString("codeVerifier", n);
|
|
55489
55489
|
try {
|
|
55490
|
-
let i = await
|
|
55490
|
+
let i = await qi(n);
|
|
55491
55491
|
return { codeChallengeMethod: "S256", codeChallenge: hi(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
|
|
55492
55492
|
} catch (i) {
|
|
55493
55493
|
return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method", i), { codeChallengeMethod: "plain", codeChallenge: n };
|
|
@@ -55498,7 +55498,7 @@ var er = class extends ie {
|
|
|
55498
55498
|
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 ?? ce.getOrigin()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), ce.assign(i.toString());
|
|
55499
55499
|
}
|
|
55500
55500
|
processCode(t, n) {
|
|
55501
|
-
let i = { grant_type:
|
|
55501
|
+
let i = { grant_type: Ge.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? ce.getOrigin() }, o2 = this.storage.getString("codeVerifier");
|
|
55502
55502
|
return o2 && (i.code_verifier = o2), this.fetchTokens(i);
|
|
55503
55503
|
}
|
|
55504
55504
|
refreshIfExpired(t) {
|
|
@@ -55511,20 +55511,20 @@ var er = class extends ie {
|
|
|
55511
55511
|
async runRefreshWithLock(t) {
|
|
55512
55512
|
let n = () => {
|
|
55513
55513
|
let s = this.getActiveLogin();
|
|
55514
|
-
return s?.accessToken && s.accessToken !== this.accessToken && this.setAccessToken(s.accessToken, s.refreshToken), this.isAuthenticated(t) ? Promise.resolve(this.getProfile()) : this.refreshToken ? this.fetchTokens({ grant_type:
|
|
55514
|
+
return s?.accessToken && s.accessToken !== this.accessToken && this.setAccessToken(s.accessToken, s.refreshToken), this.isAuthenticated(t) ? Promise.resolve(this.getProfile()) : this.refreshToken ? this.fetchTokens({ grant_type: Ge.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }) : this.clientId && this.clientSecret ? this.startClientLogin(this.clientId, this.clientSecret) : Promise.resolve(void 0);
|
|
55515
55515
|
}, i = typeof navigator < "u" ? navigator.locks : void 0;
|
|
55516
55516
|
if (!i?.request) return n();
|
|
55517
55517
|
let o2 = `medplum-refresh:${this.storage.makeKey("activeLogin")}`;
|
|
55518
55518
|
return i.request(o2, n);
|
|
55519
55519
|
}
|
|
55520
55520
|
async startClientLogin(t, n) {
|
|
55521
|
-
return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type:
|
|
55521
|
+
return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: Ge.ClientCredentials, client_id: t, client_secret: n });
|
|
55522
55522
|
}
|
|
55523
55523
|
async startJwtBearerLogin(t, n, i) {
|
|
55524
|
-
return this.clientId = t, this.fetchTokens({ grant_type:
|
|
55524
|
+
return this.clientId = t, this.fetchTokens({ grant_type: Ge.JwtBearer, client_id: t, assertion: n, scope: i });
|
|
55525
55525
|
}
|
|
55526
55526
|
async startJwtAssertionLogin(t) {
|
|
55527
|
-
return this.fetchTokens({ grant_type:
|
|
55527
|
+
return this.fetchTokens({ grant_type: Ge.ClientCredentials, client_assertion_type: ac.JwtBearer, client_assertion: t });
|
|
55528
55528
|
}
|
|
55529
55529
|
setBasicAuth(t, n) {
|
|
55530
55530
|
this.clientId = t, this.clientSecret = n, this.basicAuth = Gt(t + ":" + n);
|
|
@@ -55554,7 +55554,7 @@ var er = class extends ie {
|
|
|
55554
55554
|
return new Qt(t);
|
|
55555
55555
|
}
|
|
55556
55556
|
async fhircastPublish(t, n, i, o2) {
|
|
55557
|
-
return
|
|
55557
|
+
return $i(n) ? this.post(this.fhircastHubUrl, ln(t, n, i, o2), k.JSON) : (Hi(n), this.post(this.fhircastHubUrl, ln(t, n, i), k.JSON));
|
|
55558
55558
|
}
|
|
55559
55559
|
async fhircastGetContext(t) {
|
|
55560
55560
|
return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
|
|
@@ -55565,7 +55565,7 @@ var er = class extends ie {
|
|
|
55565
55565
|
async handleTokenError(t) {
|
|
55566
55566
|
try {
|
|
55567
55567
|
let n = await t.json();
|
|
55568
|
-
throw
|
|
55568
|
+
throw ze(n) ? new f(n) : n.error_description ? new f(P(n.error_description)) : new Error(JSON.stringify(n));
|
|
55569
55569
|
} catch (n) {
|
|
55570
55570
|
throw n instanceof f ? (n.message = `Failed to fetch tokens: ${n.message}`, n) : new f(P("Failed to fetch tokens"), { cause: n });
|
|
55571
55571
|
}
|
|
@@ -55585,7 +55585,7 @@ var er = class extends ie {
|
|
|
55585
55585
|
}
|
|
55586
55586
|
async verifyTokens(t) {
|
|
55587
55587
|
let n = t.access_token;
|
|
55588
|
-
if (
|
|
55588
|
+
if (Qi(n)) {
|
|
55589
55589
|
let i = Jt(n);
|
|
55590
55590
|
if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new f(Un);
|
|
55591
55591
|
if (i.cid) {
|
|
@@ -55626,21 +55626,21 @@ function cc() {
|
|
|
55626
55626
|
if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
|
|
55627
55627
|
return globalThis.fetch.bind(globalThis);
|
|
55628
55628
|
}
|
|
55629
|
-
async function
|
|
55629
|
+
async function to(r6, e) {
|
|
55630
55630
|
let t = r6.headers.get("content-location");
|
|
55631
55631
|
if (t) return t;
|
|
55632
55632
|
let n = r6.headers.get("location");
|
|
55633
55633
|
if (n) return n;
|
|
55634
|
-
if (
|
|
55634
|
+
if (ze(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
|
|
55635
55635
|
}
|
|
55636
|
-
function
|
|
55636
|
+
function ro(r6) {
|
|
55637
55637
|
let e = r6.entry?.map((t) => t.resource) ?? [];
|
|
55638
55638
|
return Object.assign(e, { bundle: r6 });
|
|
55639
55639
|
}
|
|
55640
55640
|
function uc(r6) {
|
|
55641
55641
|
return C(r6) && "data" in r6 && "contentType" in r6;
|
|
55642
55642
|
}
|
|
55643
|
-
function
|
|
55643
|
+
function no(r6, e, t, n) {
|
|
55644
55644
|
return uc(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
|
|
55645
55645
|
}
|
|
55646
55646
|
function lc(r6) {
|
|
@@ -55676,14 +55676,14 @@ var Te = class {
|
|
|
55676
55676
|
return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
|
|
55677
55677
|
}
|
|
55678
55678
|
};
|
|
55679
|
-
var
|
|
55679
|
+
var Ro = class r2 {
|
|
55680
55680
|
constructor(e, t = new Te()) {
|
|
55681
55681
|
c(this, "context");
|
|
55682
55682
|
c(this, "_segments");
|
|
55683
55683
|
c(this, "segmentsByName");
|
|
55684
55684
|
c(this, "cachedString");
|
|
55685
55685
|
c(this, "allSegmentsParsed");
|
|
55686
|
-
this.context = t, this._segments = e, this.segmentsByName =
|
|
55686
|
+
this.context = t, this._segments = e, this.segmentsByName = Co(e), this.allSegmentsParsed = e.every((n) => typeof n != "string"), this.bindSegments();
|
|
55687
55687
|
}
|
|
55688
55688
|
get segments() {
|
|
55689
55689
|
if (!this.allSegmentsParsed) {
|
|
@@ -55754,7 +55754,7 @@ var Eo = class r2 {
|
|
|
55754
55754
|
return this.segmentsByName.get(e)?.[0] ?? -1;
|
|
55755
55755
|
}
|
|
55756
55756
|
invalidateCache() {
|
|
55757
|
-
this.segmentsByName =
|
|
55757
|
+
this.segmentsByName = Co(this._segments), this.cachedString = void 0, this.bindSegments();
|
|
55758
55758
|
}
|
|
55759
55759
|
bindSegments() {
|
|
55760
55760
|
let e = () => {
|
|
@@ -55763,7 +55763,7 @@ var Eo = class r2 {
|
|
|
55763
55763
|
for (let t of this._segments) typeof t != "string" && (t.onModified = e);
|
|
55764
55764
|
}
|
|
55765
55765
|
};
|
|
55766
|
-
function
|
|
55766
|
+
function Co(r6) {
|
|
55767
55767
|
let e = /* @__PURE__ */ new Map();
|
|
55768
55768
|
for (let t = 0; t < r6.length; t++) {
|
|
55769
55769
|
let n = r6[t], i = typeof n == "string" ? n.slice(0, 3) : n.name, o2 = e.get(i);
|
|
@@ -55890,10 +55890,10 @@ function Zc(r6) {
|
|
|
55890
55890
|
let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replaceAll(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
|
|
55891
55891
|
return i > 0 && (n += "." + i.toString()), n;
|
|
55892
55892
|
}
|
|
55893
|
-
var
|
|
55893
|
+
var Qe = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
|
|
55894
55894
|
var eu = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
|
|
55895
|
-
var
|
|
55896
|
-
constructor(e, t = {}, n =
|
|
55895
|
+
var Po = class r5 {
|
|
55896
|
+
constructor(e, t = {}, n = Qe.INFO, i = {}) {
|
|
55897
55897
|
c(this, "write");
|
|
55898
55898
|
c(this, "metadata");
|
|
55899
55899
|
c(this, "options");
|
|
@@ -55910,16 +55910,16 @@ var Co = class r5 {
|
|
|
55910
55910
|
return { write: e, metadata: t, level: n, options: i };
|
|
55911
55911
|
}
|
|
55912
55912
|
error(e, t) {
|
|
55913
|
-
this.log(
|
|
55913
|
+
this.log(Qe.ERROR, e, t);
|
|
55914
55914
|
}
|
|
55915
55915
|
warn(e, t) {
|
|
55916
|
-
this.log(
|
|
55916
|
+
this.log(Qe.WARN, e, t);
|
|
55917
55917
|
}
|
|
55918
55918
|
info(e, t) {
|
|
55919
|
-
this.log(
|
|
55919
|
+
this.log(Qe.INFO, e, t);
|
|
55920
55920
|
}
|
|
55921
55921
|
debug(e, t) {
|
|
55922
|
-
this.log(
|
|
55922
|
+
this.log(Qe.DEBUG, e, t);
|
|
55923
55923
|
}
|
|
55924
55924
|
log(e, t, n) {
|
|
55925
55925
|
if (e > this.level) return;
|
|
@@ -55932,8 +55932,8 @@ var Co = class r5 {
|
|
|
55932
55932
|
this.write(JSON.stringify({ level: eu[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
|
|
55933
55933
|
}
|
|
55934
55934
|
};
|
|
55935
|
-
function
|
|
55936
|
-
let e =
|
|
55935
|
+
function Jh(r6) {
|
|
55936
|
+
let e = Qe[r6.toUpperCase()];
|
|
55937
55937
|
if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
|
|
55938
55938
|
return e;
|
|
55939
55939
|
}
|
|
@@ -55974,7 +55974,7 @@ async function wn(r6, e, t) {
|
|
|
55974
55974
|
try {
|
|
55975
55975
|
u2 = (await s.json()).message;
|
|
55976
55976
|
} catch (l) {
|
|
55977
|
-
console.error(`Failed to parse message from body: ${
|
|
55977
|
+
console.error(`Failed to parse message from body: ${Ne(l)}`);
|
|
55978
55978
|
}
|
|
55979
55979
|
throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${u2}`);
|
|
55980
55980
|
}
|
|
@@ -55986,7 +55986,7 @@ async function wn(r6, e, t) {
|
|
|
55986
55986
|
function Ru(r6) {
|
|
55987
55987
|
return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
|
|
55988
55988
|
}
|
|
55989
|
-
async function
|
|
55989
|
+
async function Gg(r6, e) {
|
|
55990
55990
|
if (!Ru(e)) return false;
|
|
55991
55991
|
try {
|
|
55992
55992
|
await wn(r6, e);
|
|
@@ -55995,7 +55995,7 @@ async function Hg(r6, e) {
|
|
|
55995
55995
|
}
|
|
55996
55996
|
return true;
|
|
55997
55997
|
}
|
|
55998
|
-
async function
|
|
55998
|
+
async function Qg(r6) {
|
|
55999
55999
|
let e = await wn(r6);
|
|
56000
56000
|
if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
|
|
56001
56001
|
return e.tag_name.slice(1);
|
|
@@ -56107,7 +56107,7 @@ var v = class extends m2 {
|
|
|
56107
56107
|
return;
|
|
56108
56108
|
}
|
|
56109
56109
|
let l = c2.message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
|
|
56110
|
-
l && (h2.returnAck ===
|
|
56110
|
+
l && (h2.returnAck === af.APPLICATION && l === "CA" || (h2.timer && clearTimeout(h2.timer), h2.resolve(c2.message), this.deletePendingMessage(a)));
|
|
56111
56111
|
});
|
|
56112
56112
|
}
|
|
56113
56113
|
isClosed() {
|
|
@@ -56142,7 +56142,7 @@ var v = class extends m2 {
|
|
|
56142
56142
|
break;
|
|
56143
56143
|
}
|
|
56144
56144
|
if (n === -1) break;
|
|
56145
|
-
let r6 = t.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r6, this.encoding), h2 =
|
|
56145
|
+
let r6 = t.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r6, this.encoding), h2 = Ro.parse(a);
|
|
56146
56146
|
e.push(h2), s = n + 1;
|
|
56147
56147
|
}
|
|
56148
56148
|
return this.chunks = s < t.length ? [t.subarray(s)] : [], e;
|
|
@@ -56160,7 +56160,7 @@ var v = class extends m2 {
|
|
|
56160
56160
|
let r6;
|
|
56161
56161
|
t?.timeoutMs && (r6 = setTimeout(() => {
|
|
56162
56162
|
this.deletePendingMessage(c2), n(new f({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "timeout", details: { text: "Client timeout" }, diagnostics: `Request timed out after waiting ${t.timeoutMs} milliseconds for response` }] }));
|
|
56163
|
-
}, t.timeoutMs)), this.setPendingMessage(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ??
|
|
56163
|
+
}, t.timeoutMs)), this.setPendingMessage(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ?? af.APPLICATION, timer: r6 }), this.sendImpl(e);
|
|
56164
56164
|
});
|
|
56165
56165
|
}
|
|
56166
56166
|
async close() {
|
|
@@ -56608,7 +56608,7 @@ var ByteStreamChannelConnection = class {
|
|
|
56608
56608
|
}
|
|
56609
56609
|
} catch (err2) {
|
|
56610
56610
|
this.channel.log.error(`Byte stream error occurred - check channel logs`);
|
|
56611
|
-
this.channel.channelLog.error(`Byte stream error: ${
|
|
56611
|
+
this.channel.channelLog.error(`Byte stream error: ${Ne(err2)}`);
|
|
56612
56612
|
}
|
|
56613
56613
|
}
|
|
56614
56614
|
write(data2) {
|
|
@@ -63908,8 +63908,8 @@ var IntegerString = /* @__PURE__ */ (function(_NumericStringReprese2) {
|
|
|
63908
63908
|
key: "writeBytes",
|
|
63909
63909
|
value: function writeBytes(stream, value, writeOptions) {
|
|
63910
63910
|
var _this11 = this;
|
|
63911
|
-
var val = Array.isArray(value) ? value.map(function(
|
|
63912
|
-
return _this11.convertToString(
|
|
63911
|
+
var val = Array.isArray(value) ? value.map(function(is) {
|
|
63912
|
+
return _this11.convertToString(is);
|
|
63913
63913
|
}) : [this.convertToString(value)];
|
|
63914
63914
|
return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
63915
63915
|
}
|
|
@@ -65803,7 +65803,7 @@ var Tag = /* @__PURE__ */ (function() {
|
|
|
65803
65803
|
}
|
|
65804
65804
|
}, {
|
|
65805
65805
|
key: "is",
|
|
65806
|
-
value: function
|
|
65806
|
+
value: function is(t) {
|
|
65807
65807
|
return this.value == t;
|
|
65808
65808
|
}
|
|
65809
65809
|
/**
|
|
@@ -73306,7 +73306,7 @@ var AgentDicomChannel = class extends BaseChannel {
|
|
|
73306
73306
|
calledAeTitle: this.association?.getCalledAeTitle()
|
|
73307
73307
|
},
|
|
73308
73308
|
dataset: dicomJson2,
|
|
73309
|
-
binary: binary ?
|
|
73309
|
+
binary: binary ? Re(binary) : void 0
|
|
73310
73310
|
};
|
|
73311
73311
|
App.instance.addToWebSocketQueue({
|
|
73312
73312
|
type: "agent:transmit:request",
|
|
@@ -73320,7 +73320,7 @@ var AgentDicomChannel = class extends BaseChannel {
|
|
|
73320
73320
|
response2.setStatus(dimse.constants.Status.Success);
|
|
73321
73321
|
} catch (err2) {
|
|
73322
73322
|
_DcmjsDimseScp.channel.log.error(`DICOM error - check channel logs`);
|
|
73323
|
-
_DcmjsDimseScp.channel.channelLog.error(`DICOM error: ${
|
|
73323
|
+
_DcmjsDimseScp.channel.channelLog.error(`DICOM error: ${Ne(err2)}`);
|
|
73324
73324
|
response2.setStatus(dimse.constants.Status.ProcessingFailure);
|
|
73325
73325
|
}
|
|
73326
73326
|
return response2;
|
|
@@ -73633,7 +73633,7 @@ var AgentHl7Channel = class extends BaseChannel {
|
|
|
73633
73633
|
sendToRemote(msg) {
|
|
73634
73634
|
const connection = this.connections.get(msg.remote);
|
|
73635
73635
|
if (connection) {
|
|
73636
|
-
const hl7Message =
|
|
73636
|
+
const hl7Message = Ro.parse(msg.body);
|
|
73637
73637
|
const msgControlId = hl7Message.getSegment("MSA")?.getField(2)?.toString();
|
|
73638
73638
|
const ackCode = hl7Message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
|
|
73639
73639
|
if (ackCode && isAppLevelAckCode(ackCode) && !shouldSendAppLevelAck({
|
|
@@ -73647,7 +73647,7 @@ var AgentHl7Channel = class extends BaseChannel {
|
|
|
73647
73647
|
return;
|
|
73648
73648
|
}
|
|
73649
73649
|
this.channelLog.info(`[Sending ACK -- ID: ${msgControlId}]: ${hl7Message.toString().replaceAll("\r", "\n")}`);
|
|
73650
|
-
connection.hl7Connection.send(
|
|
73650
|
+
connection.hl7Connection.send(Ro.parse(msg.body));
|
|
73651
73651
|
if (msgControlId) {
|
|
73652
73652
|
this.stats.recordAckReceived(msgControlId);
|
|
73653
73653
|
}
|
|
@@ -73760,12 +73760,12 @@ var AgentHl7ChannelConnection = class {
|
|
|
73760
73760
|
}
|
|
73761
73761
|
} catch (err2) {
|
|
73762
73762
|
this.channel.log.error(`HL7 error occurred - check channel logs`);
|
|
73763
|
-
this.channel.channelLog.error(`HL7 error: ${
|
|
73763
|
+
this.channel.channelLog.error(`HL7 error: ${Ne(err2)}`);
|
|
73764
73764
|
}
|
|
73765
73765
|
}
|
|
73766
73766
|
async handleError(event) {
|
|
73767
|
-
this.channel.log.error(`HL7 connection error: ${
|
|
73768
|
-
this.channel.channelLog.error(`HL7 connection error: ${
|
|
73767
|
+
this.channel.log.error(`HL7 connection error: ${Ne(event.error)}`);
|
|
73768
|
+
this.channel.channelLog.error(`HL7 connection error: ${Ne(event.error)}`);
|
|
73769
73769
|
}
|
|
73770
73770
|
handleEnhancedAckSent(event) {
|
|
73771
73771
|
const hl7Message = event.message;
|
|
@@ -74160,13 +74160,13 @@ var Hl7ClientPool = class {
|
|
|
74160
74160
|
this.closeAndRemoveClient(client);
|
|
74161
74161
|
if (this.keepAlive) {
|
|
74162
74162
|
this.log.error(
|
|
74163
|
-
`Persistent connection to remote 'mllp://${this.host}:${this.port}' encountered error: '${
|
|
74163
|
+
`Persistent connection to remote 'mllp://${this.host}:${this.port}' encountered error: '${Ne(event.error)}' - Closing connection...`
|
|
74164
74164
|
);
|
|
74165
74165
|
}
|
|
74166
74166
|
});
|
|
74167
74167
|
client.addEventListener("warning", (event) => {
|
|
74168
74168
|
this.log.warn(
|
|
74169
|
-
`Connection to remote 'mllp://${this.host}:${this.port}' warning: '${
|
|
74169
|
+
`Connection to remote 'mllp://${this.host}:${this.port}' warning: '${Ne(event.error)}'`
|
|
74170
74170
|
);
|
|
74171
74171
|
});
|
|
74172
74172
|
return client;
|
|
@@ -74199,7 +74199,7 @@ var DEFAULT_LOGGER_CONFIG = {
|
|
|
74199
74199
|
logDir: __dirname,
|
|
74200
74200
|
maxFileSizeMb: 10,
|
|
74201
74201
|
filesToKeep: 10,
|
|
74202
|
-
logLevel:
|
|
74202
|
+
logLevel: Qe.INFO
|
|
74203
74203
|
};
|
|
74204
74204
|
var LOGGER_CONFIG_INTEGER_KEYS = ["maxFileSizeMb", "filesToKeep"];
|
|
74205
74205
|
var LEVELS_TO_UPPERCASE = {
|
|
@@ -74266,16 +74266,16 @@ function parseLoggerConfigFromArgs(args) {
|
|
|
74266
74266
|
if (!propName.startsWith("logger.") || propVal === void 0) {
|
|
74267
74267
|
continue;
|
|
74268
74268
|
}
|
|
74269
|
-
const [_2, configType, settingName] =
|
|
74269
|
+
const [_2, configType, settingName] = qe(propName, ".", 3);
|
|
74270
74270
|
if (!LOGGER_CONFIG_KEYS.includes(settingName)) {
|
|
74271
74271
|
warnings.push(`${propName} is not a valid setting name`);
|
|
74272
74272
|
}
|
|
74273
74273
|
let configValue;
|
|
74274
74274
|
if (settingName === "logLevel") {
|
|
74275
74275
|
try {
|
|
74276
|
-
configValue =
|
|
74276
|
+
configValue = Jh(propVal);
|
|
74277
74277
|
} catch (err2) {
|
|
74278
|
-
warnings.push(`Error while parsing ${propName}: ${
|
|
74278
|
+
warnings.push(`Error while parsing ${propName}: ${Ne(err2)}`);
|
|
74279
74279
|
}
|
|
74280
74280
|
} else if (LOGGER_CONFIG_INTEGER_KEYS.includes(settingName)) {
|
|
74281
74281
|
try {
|
|
@@ -74301,14 +74301,14 @@ function parseLoggerConfigFromArgs(args) {
|
|
|
74301
74301
|
function getWinstonLevelFromMedplumLevel(level) {
|
|
74302
74302
|
switch (level) {
|
|
74303
74303
|
// Return error for NONE since we are going to turn silent on anyways
|
|
74304
|
-
case
|
|
74305
|
-
case
|
|
74304
|
+
case Qe.NONE:
|
|
74305
|
+
case Qe.ERROR:
|
|
74306
74306
|
return "error";
|
|
74307
|
-
case
|
|
74307
|
+
case Qe.WARN:
|
|
74308
74308
|
return "warn";
|
|
74309
|
-
case
|
|
74309
|
+
case Qe.INFO:
|
|
74310
74310
|
return "info";
|
|
74311
|
-
case
|
|
74311
|
+
case Qe.DEBUG:
|
|
74312
74312
|
return "debug";
|
|
74313
74313
|
default:
|
|
74314
74314
|
throw new Error("Invalid log level");
|
|
@@ -74318,7 +74318,7 @@ function createWinstonFromLoggerConfig(config, loggerType) {
|
|
|
74318
74318
|
const level = getWinstonLevelFromMedplumLevel(config.logLevel);
|
|
74319
74319
|
const logger = import_winston.default.createLogger({
|
|
74320
74320
|
level,
|
|
74321
|
-
silent: config.logLevel ===
|
|
74321
|
+
silent: config.logLevel === Qe.NONE,
|
|
74322
74322
|
format: import_winston.default.format.combine(
|
|
74323
74323
|
import_winston.default.format.timestamp(),
|
|
74324
74324
|
// Custom transform to match previous Medplum logger output
|
|
@@ -74372,16 +74372,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
|
|
|
74372
74372
|
this.prefix = options?.prefix;
|
|
74373
74373
|
}
|
|
74374
74374
|
debug(msg, data2) {
|
|
74375
|
-
this.log(
|
|
74375
|
+
this.log(Qe.DEBUG, msg, data2);
|
|
74376
74376
|
}
|
|
74377
74377
|
info(msg, data2) {
|
|
74378
|
-
this.log(
|
|
74378
|
+
this.log(Qe.INFO, msg, data2);
|
|
74379
74379
|
}
|
|
74380
74380
|
warn(msg, data2) {
|
|
74381
|
-
this.log(
|
|
74381
|
+
this.log(Qe.WARN, msg, data2);
|
|
74382
74382
|
}
|
|
74383
74383
|
error(msg, data2) {
|
|
74384
|
-
this.log(
|
|
74384
|
+
this.log(Qe.ERROR, msg, data2);
|
|
74385
74385
|
}
|
|
74386
74386
|
log(level, msg, data2) {
|
|
74387
74387
|
if (level > this.level) {
|
|
@@ -74396,16 +74396,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
|
|
|
74396
74396
|
const dataToLog = { ...data2, ...this.metadata };
|
|
74397
74397
|
const msgToLog = this.prefix ? `${this.prefix}${msg}` : msg;
|
|
74398
74398
|
switch (level) {
|
|
74399
|
-
case
|
|
74399
|
+
case Qe.DEBUG:
|
|
74400
74400
|
this.winston.debug(msgToLog, dataToLog);
|
|
74401
74401
|
return;
|
|
74402
|
-
case
|
|
74402
|
+
case Qe.INFO:
|
|
74403
74403
|
this.winston.info(msgToLog, dataToLog);
|
|
74404
74404
|
return;
|
|
74405
|
-
case
|
|
74405
|
+
case Qe.WARN:
|
|
74406
74406
|
this.winston.warn(msgToLog, dataToLog);
|
|
74407
74407
|
return;
|
|
74408
|
-
case
|
|
74408
|
+
case Qe.ERROR:
|
|
74409
74409
|
this.winston.error(msgToLog, dataToLog);
|
|
74410
74410
|
}
|
|
74411
74411
|
}
|
|
@@ -74447,7 +74447,7 @@ var import_node_os2 = require("node:os");
|
|
|
74447
74447
|
var import_node_path3 = __toESM(require("node:path"));
|
|
74448
74448
|
var import_node_process = __toESM(require("node:process"));
|
|
74449
74449
|
var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
74450
|
-
var pidLogger = new
|
|
74450
|
+
var pidLogger = new Po((msg) => `[PID]: ${msg}`);
|
|
74451
74451
|
var pidFileApps = /* @__PURE__ */ new Set();
|
|
74452
74452
|
var processExitListener = () => {
|
|
74453
74453
|
removeAllPidFiles();
|
|
@@ -74686,21 +74686,29 @@ var _App = class _App {
|
|
|
74686
74686
|
__publicField(this, "logStatsTimer");
|
|
74687
74687
|
__publicField(this, "config");
|
|
74688
74688
|
__publicField(this, "lastHeartbeatSentTime", -1);
|
|
74689
|
+
// Whether this process owns the `medplum-agent` PID, i.e. it is the sole agent that should
|
|
74690
|
+
// touch the data plane. A normally-started agent is primary from the outset (main.ts creates
|
|
74691
|
+
// the PID before start()). An upgrading agent stays non-primary until it wins the PID from the
|
|
74692
|
+
// outgoing agent, so that the two overlapping processes don't both send to the same remote.
|
|
74693
|
+
__publicField(this, "isPrimary", false);
|
|
74689
74694
|
_App.instance = this;
|
|
74690
74695
|
this.medplum = medplum;
|
|
74691
74696
|
this.agentId = agentId;
|
|
74692
|
-
this.log = options?.mainLogger ?? new
|
|
74693
|
-
this.channelLog = options?.channelLogger ?? new
|
|
74697
|
+
this.log = options?.mainLogger ?? new Po((msg) => console.log(msg), void 0, logLevel);
|
|
74698
|
+
this.channelLog = options?.channelLogger ?? new Po((msg) => console.log(msg), void 0, logLevel);
|
|
74694
74699
|
}
|
|
74695
74700
|
async start() {
|
|
74696
74701
|
this.log.info("Medplum service starting...");
|
|
74702
|
+
this.isPrimary = !(0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH);
|
|
74697
74703
|
await this.startWebSocket();
|
|
74698
|
-
await this.
|
|
74699
|
-
|
|
74704
|
+
const { listenersStarted } = await this.beginReloadConfig();
|
|
74705
|
+
const upgradeManifest = this.consumeUpgradeManifest();
|
|
74706
|
+
await listenersStarted;
|
|
74707
|
+
await this.maybeFinalizeUpgrade(upgradeManifest);
|
|
74700
74708
|
this.medplum.addEventListener("change", () => {
|
|
74701
74709
|
if (!this.webSocket) {
|
|
74702
74710
|
this.connectWebSocket().catch((err2) => {
|
|
74703
|
-
this.log.error(
|
|
74711
|
+
this.log.error(Ne(err2));
|
|
74704
74712
|
});
|
|
74705
74713
|
} else {
|
|
74706
74714
|
this.startWebSocketWorker();
|
|
@@ -74708,47 +74716,65 @@ var _App = class _App {
|
|
|
74708
74716
|
});
|
|
74709
74717
|
this.log.info("Medplum service started successfully");
|
|
74710
74718
|
}
|
|
74711
|
-
|
|
74712
|
-
|
|
74713
|
-
|
|
74714
|
-
|
|
74715
|
-
|
|
74716
|
-
|
|
74717
|
-
|
|
74718
|
-
|
|
74719
|
-
|
|
74720
|
-
|
|
74721
|
-
|
|
74722
|
-
|
|
74723
|
-
|
|
74724
|
-
|
|
74725
|
-
|
|
74726
|
-
|
|
74727
|
-
|
|
74728
|
-
|
|
74729
|
-
|
|
74730
|
-
|
|
74731
|
-
|
|
74732
|
-
|
|
74733
|
-
|
|
74734
|
-
|
|
74719
|
+
/**
|
|
74720
|
+
* Reads and deletes the upgrade manifest if one is present.
|
|
74721
|
+
*
|
|
74722
|
+
* Deleting the manifest is intentionally decoupled from {@link App.maybeFinalizeUpgrade}: removing
|
|
74723
|
+
* the file is the signal the installer waits on before stopping the previous agent (which frees the
|
|
74724
|
+
* ports the new agent is binding to), so it must happen BEFORE we await the channel binds. Reporting
|
|
74725
|
+
* upgrade status and taking over the agent PID file happen afterwards in {@link App.maybeFinalizeUpgrade}.
|
|
74726
|
+
*
|
|
74727
|
+
* @returns The parsed manifest, or undefined if no upgrade is in progress.
|
|
74728
|
+
*/
|
|
74729
|
+
consumeUpgradeManifest() {
|
|
74730
|
+
if (!(0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH)) {
|
|
74731
|
+
return void 0;
|
|
74732
|
+
}
|
|
74733
|
+
const upgradeFile = (0, import_node_fs4.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
|
|
74734
|
+
const upgradeDetails = JSON.parse(upgradeFile);
|
|
74735
|
+
(0, import_node_fs4.unlinkSync)(UPGRADE_MANIFEST_PATH);
|
|
74736
|
+
return upgradeDetails;
|
|
74737
|
+
}
|
|
74738
|
+
async maybeFinalizeUpgrade(upgradeDetails) {
|
|
74739
|
+
if (!upgradeDetails) {
|
|
74740
|
+
return;
|
|
74741
|
+
}
|
|
74742
|
+
if (fn.startsWith(upgradeDetails.targetVersion)) {
|
|
74743
|
+
await this.sendToWebSocket({
|
|
74744
|
+
type: "agent:upgrade:response",
|
|
74745
|
+
statusCode: 200,
|
|
74746
|
+
callback: upgradeDetails.callback ?? void 0
|
|
74747
|
+
});
|
|
74748
|
+
this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
|
|
74749
|
+
} else {
|
|
74750
|
+
const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${fn}`;
|
|
74751
|
+
await this.sendToWebSocket({
|
|
74752
|
+
type: "agent:error",
|
|
74753
|
+
body: errMsg,
|
|
74754
|
+
callback: upgradeDetails.callback ?? void 0
|
|
74755
|
+
});
|
|
74756
|
+
this.log.error(errMsg);
|
|
74735
74757
|
}
|
|
74758
|
+
await this.tryToCreateAgentPidFile();
|
|
74759
|
+
await waitForPidFile("medplum-upgrading-agent");
|
|
74760
|
+
removePidFile("medplum-upgrading-agent");
|
|
74736
74761
|
}
|
|
74737
74762
|
async tryToCreateAgentPidFile() {
|
|
74738
|
-
const maxAttempts =
|
|
74763
|
+
const maxAttempts = 1e4;
|
|
74739
74764
|
let attempt = 0;
|
|
74740
74765
|
let success = false;
|
|
74741
74766
|
while (!success) {
|
|
74742
74767
|
try {
|
|
74743
74768
|
createPidFile("medplum-agent");
|
|
74744
74769
|
success = true;
|
|
74770
|
+
this.isPrimary = true;
|
|
74745
74771
|
} catch (_err) {
|
|
74746
74772
|
this.log.info("Unable to create agent PID file, trying again...");
|
|
74747
74773
|
attempt++;
|
|
74748
74774
|
if (attempt === maxAttempts) {
|
|
74749
74775
|
throw new Error("Too many unsuccessful attempts to create agent PID file");
|
|
74750
74776
|
}
|
|
74751
|
-
await Yr(
|
|
74777
|
+
await Yr(50);
|
|
74752
74778
|
}
|
|
74753
74779
|
}
|
|
74754
74780
|
}
|
|
@@ -74761,7 +74787,7 @@ var _App = class _App {
|
|
|
74761
74787
|
if (!this.webSocket) {
|
|
74762
74788
|
this.log.warn("WebSocket not connected");
|
|
74763
74789
|
this.connectWebSocket().catch((err2) => {
|
|
74764
|
-
this.log.error(
|
|
74790
|
+
this.log.error(Ne(err2));
|
|
74765
74791
|
});
|
|
74766
74792
|
return;
|
|
74767
74793
|
}
|
|
@@ -74830,6 +74856,10 @@ var _App = class _App {
|
|
|
74830
74856
|
// @ts-expect-error - Deprecated message type
|
|
74831
74857
|
case "transmit":
|
|
74832
74858
|
case "agent:transmit:response": {
|
|
74859
|
+
if (!this.isPrimary) {
|
|
74860
|
+
this.log.debug("Ignoring transmit response while not primary");
|
|
74861
|
+
break;
|
|
74862
|
+
}
|
|
74833
74863
|
if (!command.callback) {
|
|
74834
74864
|
this.log.warn("Transmit response missing callback");
|
|
74835
74865
|
}
|
|
@@ -74845,6 +74875,10 @@ var _App = class _App {
|
|
|
74845
74875
|
// @ts-expect-error - Deprecated message type
|
|
74846
74876
|
case "push":
|
|
74847
74877
|
case "agent:transmit:request":
|
|
74878
|
+
if (!this.isPrimary) {
|
|
74879
|
+
this.log.debug("Ignoring transmit request while not primary");
|
|
74880
|
+
break;
|
|
74881
|
+
}
|
|
74848
74882
|
if (this.config?.status !== "active") {
|
|
74849
74883
|
this.sendAgentDisabledError(command);
|
|
74850
74884
|
} else if (command.contentType === k.PING) {
|
|
@@ -74865,7 +74899,7 @@ var _App = class _App {
|
|
|
74865
74899
|
} catch (err2) {
|
|
74866
74900
|
await this.sendToWebSocket({
|
|
74867
74901
|
type: "agent:error",
|
|
74868
|
-
body:
|
|
74902
|
+
body: Ne(err2),
|
|
74869
74903
|
callback: command.callback
|
|
74870
74904
|
});
|
|
74871
74905
|
}
|
|
@@ -74893,7 +74927,7 @@ var _App = class _App {
|
|
|
74893
74927
|
}
|
|
74894
74928
|
}
|
|
74895
74929
|
} catch (err2) {
|
|
74896
|
-
const errMsg = `WebSocket error on incoming message: ${
|
|
74930
|
+
const errMsg = `WebSocket error on incoming message: ${Ne(err2)}`;
|
|
74897
74931
|
this.log.error(errMsg);
|
|
74898
74932
|
try {
|
|
74899
74933
|
await this.sendToWebSocket({
|
|
@@ -74902,7 +74936,7 @@ var _App = class _App {
|
|
|
74902
74936
|
callback: command?.callback
|
|
74903
74937
|
});
|
|
74904
74938
|
} catch (sendErr) {
|
|
74905
|
-
this.log.error(`Failed to send agent:error response: ${
|
|
74939
|
+
this.log.error(`Failed to send agent:error response: ${Ne(sendErr)}`);
|
|
74906
74940
|
}
|
|
74907
74941
|
}
|
|
74908
74942
|
});
|
|
@@ -74915,6 +74949,21 @@ var _App = class _App {
|
|
|
74915
74949
|
});
|
|
74916
74950
|
}
|
|
74917
74951
|
async reloadConfig() {
|
|
74952
|
+
const { listenersStarted } = await this.beginReloadConfig();
|
|
74953
|
+
await listenersStarted;
|
|
74954
|
+
}
|
|
74955
|
+
/**
|
|
74956
|
+
* Reloads the agent config and begins (re)starting channel listeners, resolving as soon as the
|
|
74957
|
+
* listeners have been *kicked off* -- it does NOT wait for them to finish binding to their ports.
|
|
74958
|
+
* The returned `listenersStarted` promise resolves once all listeners have bound, or rejects with
|
|
74959
|
+
* the aggregated bind errors.
|
|
74960
|
+
*
|
|
74961
|
+
* This split exists for the zero-downtime upgrade flow; see {@link App.start} and
|
|
74962
|
+
* {@link App.consumeUpgradeManifest} for why binding must be deferred past manifest deletion.
|
|
74963
|
+
*
|
|
74964
|
+
* @returns An object whose `listenersStarted` promise resolves once all channel listeners have bound.
|
|
74965
|
+
*/
|
|
74966
|
+
async beginReloadConfig() {
|
|
74918
74967
|
const agent = await this.medplum.readResource("Agent", this.agentId, { cache: "no-cache" });
|
|
74919
74968
|
const keepAlive = agent?.setting?.find((setting) => setting.name === "keepAlive")?.valueBoolean;
|
|
74920
74969
|
const maxClientsPerRemote = agent?.setting?.find((setting) => setting.name === "maxClientsPerRemote")?.valueInteger;
|
|
@@ -74923,7 +74972,7 @@ var _App = class _App {
|
|
|
74923
74972
|
const results = await Promise.allSettled(Array.from(this.hl7Clients.values()).map((pool) => pool.closeAll()));
|
|
74924
74973
|
for (const result of results) {
|
|
74925
74974
|
if (result.status === "rejected") {
|
|
74926
|
-
this.log.error(
|
|
74975
|
+
this.log.error(Ne(result.reason));
|
|
74927
74976
|
}
|
|
74928
74977
|
}
|
|
74929
74978
|
this.hl7Clients.clear();
|
|
@@ -74949,7 +74998,8 @@ var _App = class _App {
|
|
|
74949
74998
|
this.log.info(`Stats logging enabled. Logging stats every ${this.logStatsFreqSecs} seconds...`);
|
|
74950
74999
|
this.logStatsTimer ??= setInterval(() => this.logStats(), this.logStatsFreqSecs * 1e3);
|
|
74951
75000
|
}
|
|
74952
|
-
await this.hydrateListeners();
|
|
75001
|
+
const startPromises = await this.hydrateListeners();
|
|
75002
|
+
return { listenersStarted: this.waitForChannelsToStart(startPromises) };
|
|
74953
75003
|
}
|
|
74954
75004
|
getStats() {
|
|
74955
75005
|
const stats = getCurrentStats();
|
|
@@ -74984,7 +75034,13 @@ var _App = class _App {
|
|
|
74984
75034
|
this.log.info("Agent stats", { stats: this.getStats() });
|
|
74985
75035
|
}
|
|
74986
75036
|
/**
|
|
74987
|
-
* This method should only be called by {@link App.
|
|
75037
|
+
* This method should only be called by {@link App.beginReloadConfig}.
|
|
75038
|
+
*
|
|
75039
|
+
* Channel listener start promises are returned rather than awaited here, so the caller can delete
|
|
75040
|
+
* the upgrade manifest before waiting for the listeners to bind. See {@link App.start} for the
|
|
75041
|
+
* zero-downtime upgrade rationale.
|
|
75042
|
+
*
|
|
75043
|
+
* @returns The channel listener start promises for the caller to await.
|
|
74988
75044
|
*/
|
|
74989
75045
|
async hydrateListeners() {
|
|
74990
75046
|
const config = this.config;
|
|
@@ -75024,6 +75080,7 @@ var _App = class _App {
|
|
|
75024
75080
|
this.channels.delete(leftover);
|
|
75025
75081
|
}
|
|
75026
75082
|
const errors = [];
|
|
75083
|
+
const startPromises = [];
|
|
75027
75084
|
for (let i = 0; i < filteredChannels.length; i++) {
|
|
75028
75085
|
const definition = filteredChannels[i];
|
|
75029
75086
|
const endpoint = filteredEndpoints[i];
|
|
@@ -75031,10 +75088,17 @@ var _App = class _App {
|
|
|
75031
75088
|
this.log.warn(`Ignoring empty endpoint address: ${definition.name}`);
|
|
75032
75089
|
}
|
|
75033
75090
|
try {
|
|
75034
|
-
await this.
|
|
75091
|
+
const newChannel = await this.reloadOrCreateChannel(definition, endpoint);
|
|
75092
|
+
if (newChannel) {
|
|
75093
|
+
startPromises.push(
|
|
75094
|
+
newChannel.start().then(() => {
|
|
75095
|
+
this.channels.set(definition.name, newChannel);
|
|
75096
|
+
})
|
|
75097
|
+
);
|
|
75098
|
+
}
|
|
75035
75099
|
} catch (err2) {
|
|
75036
75100
|
errors.push(err2);
|
|
75037
|
-
this.log.error(
|
|
75101
|
+
this.log.error(Ne(err2));
|
|
75038
75102
|
}
|
|
75039
75103
|
}
|
|
75040
75104
|
if (errors.length) {
|
|
@@ -75052,12 +75116,48 @@ var _App = class _App {
|
|
|
75052
75116
|
(err2) => ({
|
|
75053
75117
|
severity: "error",
|
|
75054
75118
|
code: "invalid",
|
|
75055
|
-
details: { text:
|
|
75119
|
+
details: { text: Ne(err2) }
|
|
75056
75120
|
})
|
|
75057
75121
|
)
|
|
75058
75122
|
]
|
|
75059
75123
|
});
|
|
75060
75124
|
}
|
|
75125
|
+
return startPromises;
|
|
75126
|
+
}
|
|
75127
|
+
/**
|
|
75128
|
+
* Awaits the channel listener start promises returned by {@link App.hydrateListeners},
|
|
75129
|
+
* aggregating any bind failures into a single error (mirroring {@link App.hydrateListeners}).
|
|
75130
|
+
*
|
|
75131
|
+
* @param startPromises - The channel listener start promises to await.
|
|
75132
|
+
*/
|
|
75133
|
+
async waitForChannelsToStart(startPromises) {
|
|
75134
|
+
const results = await Promise.allSettled(startPromises);
|
|
75135
|
+
const errors = results.filter((result) => result.status === "rejected").map((result) => result.reason);
|
|
75136
|
+
if (!errors.length) {
|
|
75137
|
+
return;
|
|
75138
|
+
}
|
|
75139
|
+
for (const err2 of errors) {
|
|
75140
|
+
this.log.error(Ne(err2));
|
|
75141
|
+
}
|
|
75142
|
+
throw new f({
|
|
75143
|
+
resourceType: "OperationOutcome",
|
|
75144
|
+
issue: [
|
|
75145
|
+
{
|
|
75146
|
+
severity: "error",
|
|
75147
|
+
code: "invalid",
|
|
75148
|
+
details: {
|
|
75149
|
+
text: `${errors.length} error(s) occurred while starting channel listeners`
|
|
75150
|
+
}
|
|
75151
|
+
},
|
|
75152
|
+
...errors.map(
|
|
75153
|
+
(err2) => ({
|
|
75154
|
+
severity: "error",
|
|
75155
|
+
code: "invalid",
|
|
75156
|
+
details: { text: Ne(err2) }
|
|
75157
|
+
})
|
|
75158
|
+
)
|
|
75159
|
+
]
|
|
75160
|
+
});
|
|
75061
75161
|
}
|
|
75062
75162
|
/**
|
|
75063
75163
|
* Validates whether all endpoints are valid. Also ensures that there are no conflicting ports between any endpoints in the group.
|
|
@@ -75081,7 +75181,7 @@ var _App = class _App {
|
|
|
75081
75181
|
parsedEndpoint = new URL(endpoint.address);
|
|
75082
75182
|
} catch (err2) {
|
|
75083
75183
|
throw new Error(
|
|
75084
|
-
`Error while validating endpoint address for channel '${channel.name}': ${
|
|
75184
|
+
`Error while validating endpoint address for channel '${channel.name}': ${Ne(err2)}`
|
|
75085
75185
|
);
|
|
75086
75186
|
}
|
|
75087
75187
|
if (seenPorts.has(parsedEndpoint.port)) {
|
|
@@ -75094,28 +75194,37 @@ var _App = class _App {
|
|
|
75094
75194
|
portToChannelMap.set(parsedEndpoint.port, [channel.name, endpoint.address]);
|
|
75095
75195
|
}
|
|
75096
75196
|
}
|
|
75097
|
-
|
|
75197
|
+
/**
|
|
75198
|
+
* Reloads the config of an existing channel, or creates a new (unstarted) one.
|
|
75199
|
+
*
|
|
75200
|
+
* Starting the new channel is intentionally left to the caller ({@link App.hydrateListeners}),
|
|
75201
|
+
* which collects the unawaited `start()` promises so binding can be deferred past upgrade
|
|
75202
|
+
* manifest deletion. See {@link App.start} for the zero-downtime upgrade rationale.
|
|
75203
|
+
*
|
|
75204
|
+
* @param definition - The channel definition from the agent config.
|
|
75205
|
+
* @param endpoint - The endpoint for the channel.
|
|
75206
|
+
* @returns The newly created channel for the caller to start, or `undefined` if no new channel
|
|
75207
|
+
* was needed (config reload) or creating it failed.
|
|
75208
|
+
*/
|
|
75209
|
+
async reloadOrCreateChannel(definition, endpoint) {
|
|
75098
75210
|
const existingChannel = this.channels.get(definition.name);
|
|
75099
75211
|
if (existingChannel) {
|
|
75100
75212
|
const previousType = getChannelType(existingChannel.getEndpoint());
|
|
75101
75213
|
const nextType = getChannelType(endpoint);
|
|
75102
75214
|
if (previousType === nextType) {
|
|
75103
75215
|
await existingChannel.reloadConfig(definition, endpoint);
|
|
75104
|
-
return;
|
|
75216
|
+
return void 0;
|
|
75105
75217
|
}
|
|
75106
75218
|
await existingChannel.stop();
|
|
75107
75219
|
this.channels.delete(definition.name);
|
|
75108
75220
|
}
|
|
75109
|
-
let channel;
|
|
75110
75221
|
try {
|
|
75111
75222
|
const channelType = getChannelType(endpoint);
|
|
75112
|
-
|
|
75223
|
+
return this.createChannel(channelType, definition, endpoint);
|
|
75113
75224
|
} catch (err2) {
|
|
75114
|
-
this.log.error(
|
|
75115
|
-
return;
|
|
75225
|
+
this.log.error(Ne(err2));
|
|
75226
|
+
return void 0;
|
|
75116
75227
|
}
|
|
75117
|
-
await channel.start();
|
|
75118
|
-
this.channels.set(definition.name, channel);
|
|
75119
75228
|
}
|
|
75120
75229
|
createChannel(channelType, definition, endpoint) {
|
|
75121
75230
|
switch (channelType) {
|
|
@@ -75186,7 +75295,7 @@ var _App = class _App {
|
|
|
75186
75295
|
try {
|
|
75187
75296
|
await this.sendToWebSocket(msg);
|
|
75188
75297
|
} catch (err2) {
|
|
75189
|
-
this.log.error(`WebSocket error while attempting to send message: ${
|
|
75298
|
+
this.log.error(`WebSocket error while attempting to send message: ${Ne(err2)}`);
|
|
75190
75299
|
this.webSocketQueue.unshift(msg);
|
|
75191
75300
|
throw err2;
|
|
75192
75301
|
}
|
|
@@ -75262,7 +75371,7 @@ ${result}`);
|
|
|
75262
75371
|
body: result
|
|
75263
75372
|
});
|
|
75264
75373
|
} catch (err2) {
|
|
75265
|
-
this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${
|
|
75374
|
+
this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ne(err2)}`);
|
|
75266
75375
|
this.addToWebSocketQueue({
|
|
75267
75376
|
type: "agent:transmit:response",
|
|
75268
75377
|
channel: message.channel,
|
|
@@ -75270,7 +75379,7 @@ ${result}`);
|
|
|
75270
75379
|
remote: message.remote,
|
|
75271
75380
|
callback: message.callback,
|
|
75272
75381
|
statusCode: 400,
|
|
75273
|
-
body:
|
|
75382
|
+
body: Ne(err2)
|
|
75274
75383
|
});
|
|
75275
75384
|
}
|
|
75276
75385
|
}
|
|
@@ -75298,7 +75407,7 @@ ${result}`);
|
|
|
75298
75407
|
return;
|
|
75299
75408
|
}
|
|
75300
75409
|
let child;
|
|
75301
|
-
if (message.version && !await
|
|
75410
|
+
if (message.version && !await Gg("agent-upgrader", message.version)) {
|
|
75302
75411
|
const versionTag = message.version ? `v${message.version}` : "latest";
|
|
75303
75412
|
const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
|
|
75304
75413
|
this.log.error(errMsg);
|
|
@@ -75309,7 +75418,7 @@ ${result}`);
|
|
|
75309
75418
|
});
|
|
75310
75419
|
return;
|
|
75311
75420
|
}
|
|
75312
|
-
const targetVersion = message.version ?? await
|
|
75421
|
+
const targetVersion = message.version ?? await Qg("agent-upgrader");
|
|
75313
75422
|
if (fn.startsWith(targetVersion)) {
|
|
75314
75423
|
if (!message?.force) {
|
|
75315
75424
|
this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
|
|
@@ -75347,7 +75456,7 @@ ${result}`);
|
|
|
75347
75456
|
parseDownloadUrl(release, (0, import_node_os4.platform)());
|
|
75348
75457
|
} catch (err2) {
|
|
75349
75458
|
const versionTag = message.version ? `v${message.version}` : "latest";
|
|
75350
|
-
const errMsg = `Error during upgrading to version '${versionTag}': ${
|
|
75459
|
+
const errMsg = `Error during upgrading to version '${versionTag}': ${Ne(err2)}`;
|
|
75351
75460
|
this.log.error(errMsg);
|
|
75352
75461
|
await this.sendToWebSocket({
|
|
75353
75462
|
type: "agent:error",
|
|
@@ -75381,13 +75490,13 @@ ${result}`);
|
|
|
75381
75490
|
}
|
|
75382
75491
|
});
|
|
75383
75492
|
child.on("error", (err2) => {
|
|
75384
|
-
this.log.error(
|
|
75493
|
+
this.log.error(Ne(err2));
|
|
75385
75494
|
reject(err2);
|
|
75386
75495
|
});
|
|
75387
75496
|
});
|
|
75388
75497
|
} catch (err2) {
|
|
75389
75498
|
const versionTag = message.version ? `v${message.version}` : "latest";
|
|
75390
|
-
const errMsg = `Error during upgrading to version '${versionTag}': ${
|
|
75499
|
+
const errMsg = `Error during upgrading to version '${versionTag}': ${Ne(err2)}`;
|
|
75391
75500
|
this.log.error(errMsg);
|
|
75392
75501
|
await this.sendToWebSocket({
|
|
75393
75502
|
type: "agent:error",
|
|
@@ -75411,7 +75520,7 @@ ${result}`);
|
|
|
75411
75520
|
child.disconnect();
|
|
75412
75521
|
} catch (err2) {
|
|
75413
75522
|
this.log.error(
|
|
75414
|
-
`Error while stopping agent or messaging child process as part of upgrade: ${
|
|
75523
|
+
`Error while stopping agent or messaging child process as part of upgrade: ${Ne(err2)}`
|
|
75415
75524
|
);
|
|
75416
75525
|
import_node_process2.default.exit(1);
|
|
75417
75526
|
}
|
|
@@ -75425,10 +75534,10 @@ ${result}`);
|
|
|
75425
75534
|
callback: command.callback
|
|
75426
75535
|
});
|
|
75427
75536
|
} catch (err2) {
|
|
75428
|
-
this.log.error(
|
|
75537
|
+
this.log.error(Ne(err2));
|
|
75429
75538
|
await this.sendToWebSocket({
|
|
75430
75539
|
type: "agent:error",
|
|
75431
|
-
body:
|
|
75540
|
+
body: Ne(err2),
|
|
75432
75541
|
callback: command.callback
|
|
75433
75542
|
});
|
|
75434
75543
|
}
|
|
@@ -75453,10 +75562,10 @@ ${result}`);
|
|
|
75453
75562
|
callback: command.callback
|
|
75454
75563
|
});
|
|
75455
75564
|
} catch (err2) {
|
|
75456
|
-
this.log.error(
|
|
75565
|
+
this.log.error(Ne(err2));
|
|
75457
75566
|
await this.sendToWebSocket({
|
|
75458
75567
|
type: "agent:error",
|
|
75459
|
-
body:
|
|
75568
|
+
body: Ne(err2),
|
|
75460
75569
|
callback: command.callback
|
|
75461
75570
|
});
|
|
75462
75571
|
}
|
|
@@ -75497,7 +75606,7 @@ ${result}`);
|
|
|
75497
75606
|
try {
|
|
75498
75607
|
msgReturnAck = this.parseReturnAck(message.returnAck);
|
|
75499
75608
|
} catch (err2) {
|
|
75500
|
-
this.log.error(
|
|
75609
|
+
this.log.error(Ne(err2));
|
|
75501
75610
|
this.addToWebSocketQueue({
|
|
75502
75611
|
type: "agent:transmit:response",
|
|
75503
75612
|
channel: message.channel,
|
|
@@ -75505,7 +75614,7 @@ ${result}`);
|
|
|
75505
75614
|
callback: message.callback,
|
|
75506
75615
|
contentType: k.TEXT,
|
|
75507
75616
|
statusCode: 400,
|
|
75508
|
-
body:
|
|
75617
|
+
body: Ne(err2)
|
|
75509
75618
|
});
|
|
75510
75619
|
return;
|
|
75511
75620
|
}
|
|
@@ -75513,9 +75622,9 @@ ${result}`);
|
|
|
75513
75622
|
try {
|
|
75514
75623
|
defaultReturnAck = this.parseReturnAck(address.searchParams.get("defaultReturnAck"));
|
|
75515
75624
|
} catch (err2) {
|
|
75516
|
-
this.log.warn(`${
|
|
75625
|
+
this.log.warn(`${Ne(err2)} - falling back to default return ACK behavior of 'first'.`);
|
|
75517
75626
|
}
|
|
75518
|
-
const returnAck = msgReturnAck ?? defaultReturnAck ??
|
|
75627
|
+
const returnAck = msgReturnAck ?? defaultReturnAck ?? af.FIRST;
|
|
75519
75628
|
let pool;
|
|
75520
75629
|
if (this.hl7Clients.has(message.remote)) {
|
|
75521
75630
|
pool = this.hl7Clients.get(message.remote);
|
|
@@ -75536,7 +75645,7 @@ ${result}`);
|
|
|
75536
75645
|
encoding
|
|
75537
75646
|
});
|
|
75538
75647
|
}
|
|
75539
|
-
const requestMsg =
|
|
75648
|
+
const requestMsg = Ro.parse(message.body);
|
|
75540
75649
|
const msh10 = requestMsg.getSegment("MSH")?.getField(10);
|
|
75541
75650
|
if (!msh10) {
|
|
75542
75651
|
const errMsg = "MSH.10 is missing but required";
|
|
@@ -75558,7 +75667,7 @@ ${result}`);
|
|
|
75558
75667
|
try {
|
|
75559
75668
|
client = pool.getClient();
|
|
75560
75669
|
} catch (err2) {
|
|
75561
|
-
this.log.error(`Failed to get client from pool: ${
|
|
75670
|
+
this.log.error(`Failed to get client from pool: ${Ne(err2)}`);
|
|
75562
75671
|
this.addToWebSocketQueue({
|
|
75563
75672
|
type: "agent:transmit:response",
|
|
75564
75673
|
channel: message.channel,
|
|
@@ -75566,7 +75675,7 @@ ${result}`);
|
|
|
75566
75675
|
callback: message.callback,
|
|
75567
75676
|
contentType: k.TEXT,
|
|
75568
75677
|
statusCode: 400,
|
|
75569
|
-
body:
|
|
75678
|
+
body: Ne(err2)
|
|
75570
75679
|
});
|
|
75571
75680
|
return;
|
|
75572
75681
|
}
|
|
@@ -75582,7 +75691,7 @@ ${result}`);
|
|
|
75582
75691
|
body: response2.toString()
|
|
75583
75692
|
});
|
|
75584
75693
|
}).catch((err2) => {
|
|
75585
|
-
this.log.error(`HL7 error: ${
|
|
75694
|
+
this.log.error(`HL7 error: ${Ne(err2)}`);
|
|
75586
75695
|
this.addToWebSocketQueue({
|
|
75587
75696
|
type: "agent:transmit:response",
|
|
75588
75697
|
channel: message.channel,
|
|
@@ -75590,7 +75699,7 @@ ${result}`);
|
|
|
75590
75699
|
callback: message.callback,
|
|
75591
75700
|
contentType: k.TEXT,
|
|
75592
75701
|
statusCode: 400,
|
|
75593
|
-
body:
|
|
75702
|
+
body: Ne(err2)
|
|
75594
75703
|
});
|
|
75595
75704
|
forceClose = true;
|
|
75596
75705
|
}).finally(() => {
|
|
@@ -75618,10 +75727,10 @@ ${result}`);
|
|
|
75618
75727
|
}
|
|
75619
75728
|
const normalizedValue = rawValue.toLowerCase();
|
|
75620
75729
|
if (normalizedValue === "application") {
|
|
75621
|
-
return
|
|
75730
|
+
return af.APPLICATION;
|
|
75622
75731
|
}
|
|
75623
75732
|
if (normalizedValue === "first") {
|
|
75624
|
-
return
|
|
75733
|
+
return af.FIRST;
|
|
75625
75734
|
}
|
|
75626
75735
|
throw new Error(`Invalid value for returnAck; expected: 'first' or 'application', received: ${rawValue}`);
|
|
75627
75736
|
}
|
|
@@ -75669,7 +75778,7 @@ async function agentMain(argv) {
|
|
|
75669
75778
|
await medplum.startClientLogin(clientId, clientSecret);
|
|
75670
75779
|
loggedIn = true;
|
|
75671
75780
|
} catch (err2) {
|
|
75672
|
-
console.error("Failed to login", { err:
|
|
75781
|
+
console.error("Failed to login", { err: Ne(err2) });
|
|
75673
75782
|
console.log("Retrying login in 10 seconds...");
|
|
75674
75783
|
await Yr(RETRY_WAIT_DURATION_MS);
|
|
75675
75784
|
}
|
|
@@ -75684,7 +75793,7 @@ async function agentMain(argv) {
|
|
|
75684
75793
|
for (const warning of warnings) {
|
|
75685
75794
|
mainLogger.warn(warning);
|
|
75686
75795
|
}
|
|
75687
|
-
const app = new App(medplum, agentId, args.logLevel ?
|
|
75796
|
+
const app = new App(medplum, agentId, args.logLevel ? Jh(args.logLevel) : void 0, {
|
|
75688
75797
|
mainLogger,
|
|
75689
75798
|
channelLogger
|
|
75690
75799
|
});
|
|
@@ -75716,7 +75825,7 @@ async function upgraderMain(argv) {
|
|
|
75716
75825
|
if ((0, import_node_os5.platform)() !== "win32") {
|
|
75717
75826
|
throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
|
|
75718
75827
|
}
|
|
75719
|
-
const globalLogger = new
|
|
75828
|
+
const globalLogger = new Po((msg) => console.log(msg));
|
|
75720
75829
|
if (!import_node_process3.default.send) {
|
|
75721
75830
|
globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
|
|
75722
75831
|
import_node_process3.default.exit(1);
|
|
@@ -75733,7 +75842,7 @@ async function upgraderMain(argv) {
|
|
|
75733
75842
|
if (argv[3] && !Ru(argv[3])) {
|
|
75734
75843
|
throw new Error("Invalid version specified");
|
|
75735
75844
|
}
|
|
75736
|
-
version = argv[3] ?? await
|
|
75845
|
+
version = argv[3] ?? await Qg("agent-upgrader");
|
|
75737
75846
|
binPath = getReleaseBinPath(version);
|
|
75738
75847
|
if (!(0, import_node_fs6.existsSync)(binPath)) {
|
|
75739
75848
|
globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
|
|
@@ -75741,7 +75850,7 @@ async function upgraderMain(argv) {
|
|
|
75741
75850
|
globalLogger.info("Release successfully downloaded");
|
|
75742
75851
|
}
|
|
75743
75852
|
} catch (err2) {
|
|
75744
|
-
import_node_process3.default.send({ type: "ERROR", err:
|
|
75853
|
+
import_node_process3.default.send({ type: "ERROR", err: Ne(err2) });
|
|
75745
75854
|
throw err2;
|
|
75746
75855
|
}
|
|
75747
75856
|
import_node_process3.default.send({ type: "STARTED" });
|
|
@@ -75762,7 +75871,7 @@ async function upgraderMain(argv) {
|
|
|
75762
75871
|
(0, import_node_child_process2.spawnSync)(`"${binPath}" /S`, { windowsHide: true, shell: true });
|
|
75763
75872
|
globalLogger.info(`Agent version ${version} successfully installed`);
|
|
75764
75873
|
} catch (err2) {
|
|
75765
|
-
globalLogger.error(`Error while attempting to run installer: ${
|
|
75874
|
+
globalLogger.error(`Error while attempting to run installer: ${Ne(err2)}`);
|
|
75766
75875
|
globalLogger.error("Failed to run installer, attempting to restart agent service...");
|
|
75767
75876
|
try {
|
|
75768
75877
|
(0, import_node_child_process2.execSync)('net start "Medplum Agent"');
|
|
@@ -75812,10 +75921,10 @@ ${allAgentServices.join("\r\n")}\r
|
|
|
75812
75921
|
} catch (err2) {
|
|
75813
75922
|
(0, import_node_fs7.appendFileSync)(logFileFd, `Failed to stop service: ${serviceName}\r
|
|
75814
75923
|
`, { encoding: "utf-8" });
|
|
75815
|
-
(0, import_node_fs7.appendFileSync)(logFileFd, `${
|
|
75924
|
+
(0, import_node_fs7.appendFileSync)(logFileFd, `${Ne(err2)}\r
|
|
75816
75925
|
`, { encoding: "utf-8" });
|
|
75817
75926
|
console.error(`Failed to stop service: ${serviceName}`);
|
|
75818
|
-
console.error(
|
|
75927
|
+
console.error(Ne(err2));
|
|
75819
75928
|
}
|
|
75820
75929
|
try {
|
|
75821
75930
|
(0, import_node_child_process3.execSync)(`sc.exe delete ${serviceName}`);
|
|
@@ -75825,10 +75934,10 @@ ${allAgentServices.join("\r\n")}\r
|
|
|
75825
75934
|
} catch (err2) {
|
|
75826
75935
|
(0, import_node_fs7.appendFileSync)(logFileFd, `Failed to delete service: ${serviceName}\r
|
|
75827
75936
|
`, { encoding: "utf-8" });
|
|
75828
|
-
(0, import_node_fs7.appendFileSync)(logFileFd, `${
|
|
75937
|
+
(0, import_node_fs7.appendFileSync)(logFileFd, `${Ne(err2)}\r
|
|
75829
75938
|
`, { encoding: "utf-8" });
|
|
75830
75939
|
console.error(`Failed to delete service: ${serviceName}`);
|
|
75831
|
-
console.error(
|
|
75940
|
+
console.error(Ne(err2));
|
|
75832
75941
|
}
|
|
75833
75942
|
}
|
|
75834
75943
|
(0, import_node_fs7.closeSync)(logFileFd);
|