@medplum/agent 5.0.14 → 5.0.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 +876 -859
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -8845,7 +8845,7 @@ var require_stream = __commonJS({
|
|
|
8845
8845
|
this.emit("error", err);
|
|
8846
8846
|
}
|
|
8847
8847
|
}
|
|
8848
|
-
function createWebSocketStream2(
|
|
8848
|
+
function createWebSocketStream2(ws, options) {
|
|
8849
8849
|
let terminateOnDestroy = true;
|
|
8850
8850
|
const duplex = new Duplex({
|
|
8851
8851
|
...options,
|
|
@@ -8854,65 +8854,65 @@ var require_stream = __commonJS({
|
|
|
8854
8854
|
objectMode: false,
|
|
8855
8855
|
writableObjectMode: false
|
|
8856
8856
|
});
|
|
8857
|
-
|
|
8857
|
+
ws.on("message", function message(msg, isBinary) {
|
|
8858
8858
|
const data2 = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
8859
|
-
if (!duplex.push(data2))
|
|
8859
|
+
if (!duplex.push(data2)) ws.pause();
|
|
8860
8860
|
});
|
|
8861
|
-
|
|
8861
|
+
ws.once("error", function error(err) {
|
|
8862
8862
|
if (duplex.destroyed) return;
|
|
8863
8863
|
terminateOnDestroy = false;
|
|
8864
8864
|
duplex.destroy(err);
|
|
8865
8865
|
});
|
|
8866
|
-
|
|
8866
|
+
ws.once("close", function close() {
|
|
8867
8867
|
if (duplex.destroyed) return;
|
|
8868
8868
|
duplex.push(null);
|
|
8869
8869
|
});
|
|
8870
8870
|
duplex._destroy = function(err, callback) {
|
|
8871
|
-
if (
|
|
8871
|
+
if (ws.readyState === ws.CLOSED) {
|
|
8872
8872
|
callback(err);
|
|
8873
8873
|
process.nextTick(emitClose, duplex);
|
|
8874
8874
|
return;
|
|
8875
8875
|
}
|
|
8876
8876
|
let called = false;
|
|
8877
|
-
|
|
8877
|
+
ws.once("error", function error(err2) {
|
|
8878
8878
|
called = true;
|
|
8879
8879
|
callback(err2);
|
|
8880
8880
|
});
|
|
8881
|
-
|
|
8881
|
+
ws.once("close", function close() {
|
|
8882
8882
|
if (!called) callback(err);
|
|
8883
8883
|
process.nextTick(emitClose, duplex);
|
|
8884
8884
|
});
|
|
8885
|
-
if (terminateOnDestroy)
|
|
8885
|
+
if (terminateOnDestroy) ws.terminate();
|
|
8886
8886
|
};
|
|
8887
8887
|
duplex._final = function(callback) {
|
|
8888
|
-
if (
|
|
8889
|
-
|
|
8888
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
8889
|
+
ws.once("open", function open() {
|
|
8890
8890
|
duplex._final(callback);
|
|
8891
8891
|
});
|
|
8892
8892
|
return;
|
|
8893
8893
|
}
|
|
8894
|
-
if (
|
|
8895
|
-
if (
|
|
8894
|
+
if (ws._socket === null) return;
|
|
8895
|
+
if (ws._socket._writableState.finished) {
|
|
8896
8896
|
callback();
|
|
8897
8897
|
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
8898
8898
|
} else {
|
|
8899
|
-
|
|
8899
|
+
ws._socket.once("finish", function finish() {
|
|
8900
8900
|
callback();
|
|
8901
8901
|
});
|
|
8902
|
-
|
|
8902
|
+
ws.close();
|
|
8903
8903
|
}
|
|
8904
8904
|
};
|
|
8905
8905
|
duplex._read = function() {
|
|
8906
|
-
if (
|
|
8906
|
+
if (ws.isPaused) ws.resume();
|
|
8907
8907
|
};
|
|
8908
8908
|
duplex._write = function(chunk, encoding, callback) {
|
|
8909
|
-
if (
|
|
8910
|
-
|
|
8909
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
8910
|
+
ws.once("open", function open() {
|
|
8911
8911
|
duplex._write(chunk, encoding, callback);
|
|
8912
8912
|
});
|
|
8913
8913
|
return;
|
|
8914
8914
|
}
|
|
8915
|
-
|
|
8915
|
+
ws.send(chunk, callback);
|
|
8916
8916
|
};
|
|
8917
8917
|
duplex.on("end", duplexOnEnd);
|
|
8918
8918
|
duplex.on("error", duplexOnError);
|
|
@@ -9282,12 +9282,12 @@ var require_websocket_server = __commonJS({
|
|
|
9282
9282
|
"Connection: Upgrade",
|
|
9283
9283
|
`Sec-WebSocket-Accept: ${digest}`
|
|
9284
9284
|
];
|
|
9285
|
-
const
|
|
9285
|
+
const ws = new this.options.WebSocket(null, void 0, this.options);
|
|
9286
9286
|
if (protocols.size) {
|
|
9287
9287
|
const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
|
|
9288
9288
|
if (protocol) {
|
|
9289
9289
|
headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
|
|
9290
|
-
|
|
9290
|
+
ws._protocol = protocol;
|
|
9291
9291
|
}
|
|
9292
9292
|
}
|
|
9293
9293
|
if (extensions[PerMessageDeflate.extensionName]) {
|
|
@@ -9296,26 +9296,26 @@ var require_websocket_server = __commonJS({
|
|
|
9296
9296
|
[PerMessageDeflate.extensionName]: [params]
|
|
9297
9297
|
});
|
|
9298
9298
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
9299
|
-
|
|
9299
|
+
ws._extensions = extensions;
|
|
9300
9300
|
}
|
|
9301
9301
|
this.emit("headers", headers, req);
|
|
9302
9302
|
socket.write(headers.concat("\r\n").join("\r\n"));
|
|
9303
9303
|
socket.removeListener("error", socketOnError);
|
|
9304
|
-
|
|
9304
|
+
ws.setSocket(socket, head, {
|
|
9305
9305
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
9306
9306
|
maxPayload: this.options.maxPayload,
|
|
9307
9307
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
9308
9308
|
});
|
|
9309
9309
|
if (this.clients) {
|
|
9310
|
-
this.clients.add(
|
|
9311
|
-
|
|
9312
|
-
this.clients.delete(
|
|
9310
|
+
this.clients.add(ws);
|
|
9311
|
+
ws.on("close", () => {
|
|
9312
|
+
this.clients.delete(ws);
|
|
9313
9313
|
if (this._shouldEmitClose && !this.clients.size) {
|
|
9314
9314
|
process.nextTick(emitClose, this);
|
|
9315
9315
|
}
|
|
9316
9316
|
});
|
|
9317
9317
|
}
|
|
9318
|
-
cb(
|
|
9318
|
+
cb(ws, req);
|
|
9319
9319
|
}
|
|
9320
9320
|
};
|
|
9321
9321
|
module2.exports = WebSocketServer2;
|
|
@@ -16094,8 +16094,8 @@ var require_dcmjs = __commonJS({
|
|
|
16094
16094
|
key: "writeBytes",
|
|
16095
16095
|
value: function writeBytes(stream, value, writeOptions) {
|
|
16096
16096
|
var _this8 = this;
|
|
16097
|
-
var val = Array.isArray(value) ? value.map(function(
|
|
16098
|
-
return _this8.convertToString(
|
|
16097
|
+
var val = Array.isArray(value) ? value.map(function(ds) {
|
|
16098
|
+
return _this8.convertToString(ds);
|
|
16099
16099
|
}) : [this.convertToString(value)];
|
|
16100
16100
|
return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
16101
16101
|
}
|
|
@@ -17128,8 +17128,8 @@ var require_dcmjs = __commonJS({
|
|
|
17128
17128
|
if (keys1.length !== keys2.length) {
|
|
17129
17129
|
return false;
|
|
17130
17130
|
}
|
|
17131
|
-
for (var
|
|
17132
|
-
var key = _keys[
|
|
17131
|
+
for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {
|
|
17132
|
+
var key = _keys[_i];
|
|
17133
17133
|
if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {
|
|
17134
17134
|
return false;
|
|
17135
17135
|
}
|
|
@@ -18408,8 +18408,8 @@ var require_dcmjs = __commonJS({
|
|
|
18408
18408
|
}, {
|
|
18409
18409
|
key: "isMultiframeDataset",
|
|
18410
18410
|
value: function isMultiframeDataset() {
|
|
18411
|
-
var
|
|
18412
|
-
var sopClassUID =
|
|
18411
|
+
var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
|
|
18412
|
+
var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
|
|
18413
18413
|
return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
|
|
18414
18414
|
}
|
|
18415
18415
|
}, {
|
|
@@ -18449,16 +18449,16 @@ var require_dcmjs = __commonJS({
|
|
|
18449
18449
|
}
|
|
18450
18450
|
this.derivation = new DerivedImage(this.datasets);
|
|
18451
18451
|
this.dataset = this.derivation.dataset;
|
|
18452
|
-
var
|
|
18452
|
+
var ds = this.dataset;
|
|
18453
18453
|
var referenceDataset = this.datasets[0];
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18454
|
+
ds.NumberOfFrames = this.datasets.length;
|
|
18455
|
+
ds.SOPClassUID = referenceDataset.SOPClassUID;
|
|
18456
|
+
ds.Rows = referenceDataset.Rows;
|
|
18457
|
+
ds.Columns = referenceDataset.Columns;
|
|
18458
|
+
ds.BitsAllocated = referenceDataset.BitsAllocated;
|
|
18459
|
+
ds.PixelRepresentation = referenceDataset.PixelRepresentation;
|
|
18460
|
+
ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
|
|
18461
|
+
ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
|
|
18462
18462
|
var referencePosition = referenceDataset.ImagePositionPatient;
|
|
18463
18463
|
var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
|
|
18464
18464
|
var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
|
|
@@ -18473,43 +18473,43 @@ var require_dcmjs = __commonJS({
|
|
|
18473
18473
|
distanceDatasetPairs.sort(function(a, b3) {
|
|
18474
18474
|
return b3[0] - a[0];
|
|
18475
18475
|
});
|
|
18476
|
-
if (
|
|
18476
|
+
if (ds.BitsAllocated !== 16) {
|
|
18477
18477
|
log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
|
|
18478
18478
|
}
|
|
18479
18479
|
if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
|
|
18480
18480
|
log2.warn("No vr map given for pixel data, using OW");
|
|
18481
|
-
|
|
18481
|
+
ds._vrMap = {
|
|
18482
18482
|
PixelData: "OW"
|
|
18483
18483
|
};
|
|
18484
18484
|
} else {
|
|
18485
|
-
|
|
18485
|
+
ds._vrMap = {
|
|
18486
18486
|
PixelData: referenceDataset._vrMap.PixelData
|
|
18487
18487
|
};
|
|
18488
18488
|
}
|
|
18489
18489
|
var frameSize = referenceDataset.PixelData.byteLength;
|
|
18490
|
-
|
|
18490
|
+
ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
|
|
18491
18491
|
var frame = 0;
|
|
18492
18492
|
distanceDatasetPairs.forEach(function(pair) {
|
|
18493
18493
|
var dataset = pair[1];
|
|
18494
18494
|
var pixels = new Uint16Array(dataset.PixelData);
|
|
18495
|
-
var frameView = new Uint16Array(
|
|
18495
|
+
var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
|
|
18496
18496
|
try {
|
|
18497
18497
|
frameView.set(pixels);
|
|
18498
18498
|
} catch (e) {
|
|
18499
18499
|
if (e instanceof RangeError) {
|
|
18500
|
-
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(
|
|
18500
|
+
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
|
|
18501
18501
|
log2.error(message2);
|
|
18502
18502
|
}
|
|
18503
18503
|
}
|
|
18504
18504
|
frame++;
|
|
18505
18505
|
});
|
|
18506
|
-
if (
|
|
18506
|
+
if (ds.NumberOfFrames < 2) {
|
|
18507
18507
|
log2.error("Cannot populate shared groups uniquely without multiple frames");
|
|
18508
18508
|
}
|
|
18509
18509
|
var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
|
|
18510
18510
|
var distance1 = distanceDatasetPairs[1][0];
|
|
18511
18511
|
var SpacingBetweenSlices = Math.abs(distance1 - distance0);
|
|
18512
|
-
|
|
18512
|
+
ds.SharedFunctionalGroupsSequence = {
|
|
18513
18513
|
PlaneOrientationSequence: {
|
|
18514
18514
|
ImageOrientationPatient: dataset0.ImageOrientationPatient
|
|
18515
18515
|
},
|
|
@@ -18519,14 +18519,14 @@ var require_dcmjs = __commonJS({
|
|
|
18519
18519
|
SliceThickness: SpacingBetweenSlices
|
|
18520
18520
|
}
|
|
18521
18521
|
};
|
|
18522
|
-
|
|
18522
|
+
ds.ReferencedSeriesSequence = {
|
|
18523
18523
|
SeriesInstanceUID: dataset0.SeriesInstanceUID,
|
|
18524
18524
|
ReferencedInstanceSequence: []
|
|
18525
18525
|
};
|
|
18526
|
-
|
|
18526
|
+
ds.PerFrameFunctionalGroupsSequence = [];
|
|
18527
18527
|
distanceDatasetPairs.forEach(function(pair) {
|
|
18528
18528
|
var dataset = pair[1];
|
|
18529
|
-
|
|
18529
|
+
ds.PerFrameFunctionalGroupsSequence.push({
|
|
18530
18530
|
PlanePositionSequence: {
|
|
18531
18531
|
ImagePositionPatient: dataset.ImagePositionPatient
|
|
18532
18532
|
},
|
|
@@ -18535,7 +18535,7 @@ var require_dcmjs = __commonJS({
|
|
|
18535
18535
|
WindowWidth: dataset.WindowWidth
|
|
18536
18536
|
}
|
|
18537
18537
|
});
|
|
18538
|
-
|
|
18538
|
+
ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
|
|
18539
18539
|
ReferencedSOPClassUID: dataset.SOPClassUID,
|
|
18540
18540
|
ReferencedSOPInstanceUID: dataset.SOPInstanceUID
|
|
18541
18541
|
});
|
|
@@ -18555,29 +18555,29 @@ var require_dcmjs = __commonJS({
|
|
|
18555
18555
|
}, {
|
|
18556
18556
|
key: "normalizeMultiframe",
|
|
18557
18557
|
value: function normalizeMultiframe() {
|
|
18558
|
-
var
|
|
18559
|
-
if (!
|
|
18558
|
+
var ds = this.dataset;
|
|
18559
|
+
if (!ds.NumberOfFrames) {
|
|
18560
18560
|
log2.error("Missing number or frames not supported");
|
|
18561
18561
|
return;
|
|
18562
18562
|
}
|
|
18563
|
-
if (!
|
|
18564
|
-
|
|
18563
|
+
if (!ds.PixelRepresentation) {
|
|
18564
|
+
ds.PixelRepresentation = 1;
|
|
18565
18565
|
}
|
|
18566
|
-
if (!
|
|
18567
|
-
|
|
18566
|
+
if (!ds.StudyID || ds.StudyID === "") {
|
|
18567
|
+
ds.StudyID = "No Study ID";
|
|
18568
18568
|
}
|
|
18569
18569
|
var validLateralities = ["R", "L"];
|
|
18570
|
-
if (validLateralities.indexOf(
|
|
18571
|
-
delete
|
|
18570
|
+
if (validLateralities.indexOf(ds.Laterality) === -1) {
|
|
18571
|
+
delete ds.Laterality;
|
|
18572
18572
|
}
|
|
18573
|
-
if (!
|
|
18574
|
-
|
|
18573
|
+
if (!ds.PresentationLUTShape) {
|
|
18574
|
+
ds.PresentationLUTShape = "IDENTITY";
|
|
18575
18575
|
}
|
|
18576
|
-
if (!
|
|
18576
|
+
if (!ds.SharedFunctionalGroupsSequence) {
|
|
18577
18577
|
log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
|
|
18578
18578
|
}
|
|
18579
|
-
if (
|
|
18580
|
-
|
|
18579
|
+
if (ds.BodyPartExamined === "PROSTATE") {
|
|
18580
|
+
ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
|
|
18581
18581
|
AnatomicRegionSequence: {
|
|
18582
18582
|
CodeValue: "T-9200B",
|
|
18583
18583
|
CodingSchemeDesignator: "SRT",
|
|
@@ -18586,17 +18586,17 @@ var require_dcmjs = __commonJS({
|
|
|
18586
18586
|
FrameLaterality: "U"
|
|
18587
18587
|
};
|
|
18588
18588
|
}
|
|
18589
|
-
var rescaleIntercept =
|
|
18590
|
-
var rescaleSlope =
|
|
18591
|
-
|
|
18589
|
+
var rescaleIntercept = ds.RescaleIntercept || 0;
|
|
18590
|
+
var rescaleSlope = ds.RescaleSlope || 1;
|
|
18591
|
+
ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
|
|
18592
18592
|
RescaleIntercept: rescaleIntercept,
|
|
18593
18593
|
RescaleSlope: rescaleSlope,
|
|
18594
18594
|
RescaleType: "US"
|
|
18595
18595
|
};
|
|
18596
18596
|
var frameNumber = 1;
|
|
18597
18597
|
this.datasets.forEach(function(dataset) {
|
|
18598
|
-
if (
|
|
18599
|
-
|
|
18598
|
+
if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
|
|
18599
|
+
ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
|
|
18600
18600
|
FrameAcquisitionDuration: 0,
|
|
18601
18601
|
StackID: 1,
|
|
18602
18602
|
InStackPositionNumber: frameNumber,
|
|
@@ -18604,30 +18604,30 @@ var require_dcmjs = __commonJS({
|
|
|
18604
18604
|
};
|
|
18605
18605
|
var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
|
|
18606
18606
|
if (!isNaN(frameTime)) {
|
|
18607
|
-
var frameContentSequence =
|
|
18607
|
+
var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
|
|
18608
18608
|
frameContentSequence.FrameAcquisitionDateTime = frameTime;
|
|
18609
18609
|
frameContentSequence.FrameReferenceDateTime = frameTime;
|
|
18610
18610
|
}
|
|
18611
18611
|
frameNumber++;
|
|
18612
18612
|
});
|
|
18613
|
-
if (
|
|
18614
|
-
if (!Array.isArray(
|
|
18615
|
-
|
|
18613
|
+
if (ds.WindowCenter && ds.WindowWidth) {
|
|
18614
|
+
if (!Array.isArray(ds.WindowCenter)) {
|
|
18615
|
+
ds.WindowCenter = [ds.WindowCenter];
|
|
18616
18616
|
}
|
|
18617
|
-
if (!Array.isArray(
|
|
18618
|
-
|
|
18617
|
+
if (!Array.isArray(ds.WindowWidth)) {
|
|
18618
|
+
ds.WindowWidth = [ds.WindowWidth];
|
|
18619
18619
|
}
|
|
18620
18620
|
}
|
|
18621
|
-
if (!
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
if (
|
|
18621
|
+
if (!ds.WindowCenter || !ds.WindowWidth) {
|
|
18622
|
+
ds.WindowCenter = [];
|
|
18623
|
+
ds.WindowWidth = [];
|
|
18624
|
+
if (ds.PerFrameFunctionalGroupsSequence) {
|
|
18625
18625
|
var wcww = {
|
|
18626
18626
|
center: 0,
|
|
18627
18627
|
width: 0,
|
|
18628
18628
|
count: 0
|
|
18629
18629
|
};
|
|
18630
|
-
|
|
18630
|
+
ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
|
|
18631
18631
|
if (functionalGroup.FrameVOILUT) {
|
|
18632
18632
|
var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
|
|
18633
18633
|
var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
|
|
@@ -18645,16 +18645,16 @@ var require_dcmjs = __commonJS({
|
|
|
18645
18645
|
}
|
|
18646
18646
|
});
|
|
18647
18647
|
if (wcww.count > 0) {
|
|
18648
|
-
|
|
18649
|
-
|
|
18648
|
+
ds.WindowCenter.push(String(wcww.center / wcww.count));
|
|
18649
|
+
ds.WindowWidth.push(String(wcww.width / wcww.count));
|
|
18650
18650
|
}
|
|
18651
18651
|
}
|
|
18652
18652
|
}
|
|
18653
|
-
if (
|
|
18654
|
-
|
|
18653
|
+
if (ds.WindowCenter.length === 0) {
|
|
18654
|
+
ds.WindowCenter = [300];
|
|
18655
18655
|
}
|
|
18656
|
-
if (
|
|
18657
|
-
|
|
18656
|
+
if (ds.WindowWidth.length === 0) {
|
|
18657
|
+
ds.WindowWidth = [500];
|
|
18658
18658
|
}
|
|
18659
18659
|
}
|
|
18660
18660
|
}], [{
|
|
@@ -18700,12 +18700,12 @@ var require_dcmjs = __commonJS({
|
|
|
18700
18700
|
key: "normalizeMultiframe",
|
|
18701
18701
|
value: function normalizeMultiframe() {
|
|
18702
18702
|
_get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
|
|
18703
|
-
var
|
|
18704
|
-
if (!
|
|
18705
|
-
|
|
18703
|
+
var ds = this.dataset;
|
|
18704
|
+
if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
|
|
18705
|
+
ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
|
|
18706
18706
|
}
|
|
18707
|
-
|
|
18708
|
-
FrameType:
|
|
18707
|
+
ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
|
|
18708
|
+
FrameType: ds.ImageType,
|
|
18709
18709
|
PixelPresentation: "MONOCHROME",
|
|
18710
18710
|
VolumetricProperties: "VOLUME",
|
|
18711
18711
|
VolumeBasedCalculationTechnique: "NONE",
|
|
@@ -18830,9 +18830,9 @@ var require_dcmjs = __commonJS({
|
|
|
18830
18830
|
key: "normalize",
|
|
18831
18831
|
value: function normalize3() {
|
|
18832
18832
|
_get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
|
|
18833
|
-
var
|
|
18834
|
-
if (
|
|
18835
|
-
log2.error("Only works with 32 bit data, not " + String(
|
|
18833
|
+
var ds = this.datasets[0];
|
|
18834
|
+
if (ds.BitsAllocated !== 32) {
|
|
18835
|
+
log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
|
|
18836
18836
|
}
|
|
18837
18837
|
}
|
|
18838
18838
|
}]);
|
|
@@ -19636,8 +19636,8 @@ var require_dcmjs = __commonJS({
|
|
|
19636
19636
|
return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
|
|
19637
19637
|
});
|
|
19638
19638
|
var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
|
|
19639
|
-
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(
|
|
19640
|
-
return
|
|
19639
|
+
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
|
|
19640
|
+
return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
|
|
19641
19641
|
});
|
|
19642
19642
|
if (toolClass) {
|
|
19643
19643
|
var measurement = toolClass.getMeasurementData(measurementGroup);
|
|
@@ -21149,9 +21149,9 @@ var require_dcmjs = __commonJS({
|
|
|
21149
21149
|
NumberOfFrames += referencedFramesPerSegment[i].length;
|
|
21150
21150
|
}
|
|
21151
21151
|
seg.setNumberOfFrames(NumberOfFrames);
|
|
21152
|
-
for (var
|
|
21153
|
-
var segmentIndex = segmentIndicies[
|
|
21154
|
-
var referencedFrameIndicies = referencedFramesPerSegment[
|
|
21152
|
+
for (var _i = 0; _i < segmentIndicies.length; _i++) {
|
|
21153
|
+
var segmentIndex = segmentIndicies[_i];
|
|
21154
|
+
var referencedFrameIndicies = referencedFramesPerSegment[_i];
|
|
21155
21155
|
var referencedFrameNumbers = referencedFrameIndicies.map(function(element) {
|
|
21156
21156
|
return element + 1;
|
|
21157
21157
|
});
|
|
@@ -21436,11 +21436,11 @@ var require_dcmjs = __commonJS({
|
|
|
21436
21436
|
var bodyLength = rleArray.length % 2 === 0 ? rleArray.length : rleArray.length + 1;
|
|
21437
21437
|
var encodedFrameBuffer = new ArrayBuffer(headerLength + bodyLength);
|
|
21438
21438
|
var headerView = new Uint32Array(encodedFrameBuffer, 0, 16);
|
|
21439
|
-
for (var
|
|
21440
|
-
headerView[
|
|
21439
|
+
for (var _i = 0; _i < headerView.length; _i++) {
|
|
21440
|
+
headerView[_i] = header[_i];
|
|
21441
21441
|
}
|
|
21442
|
-
for (var
|
|
21443
|
-
rleArray.push(headerView[
|
|
21442
|
+
for (var _i2 = 0; _i2 < headerView.length; _i2++) {
|
|
21443
|
+
rleArray.push(headerView[_i2]);
|
|
21444
21444
|
}
|
|
21445
21445
|
var bodyView = new Uint8Array(encodedFrameBuffer, 64);
|
|
21446
21446
|
for (var _i3 = 0; _i3 < rleArray.length; _i3++) {
|
|
@@ -22138,20 +22138,20 @@ var require_dcmjs = __commonJS({
|
|
|
22138
22138
|
referencedFramesPerSegment2[i] = [];
|
|
22139
22139
|
}
|
|
22140
22140
|
}
|
|
22141
|
-
var _loop22 = function _loop23(
|
|
22142
|
-
var labelmap2D = labelmaps2D[
|
|
22143
|
-
if (labelmaps2D[
|
|
22141
|
+
var _loop22 = function _loop23(_i2) {
|
|
22142
|
+
var labelmap2D = labelmaps2D[_i2];
|
|
22143
|
+
if (labelmaps2D[_i2]) {
|
|
22144
22144
|
var segmentsOnLabelmap = labelmap2D.segmentsOnLabelmap;
|
|
22145
22145
|
segmentsOnLabelmap.forEach(function(segmentIndex2) {
|
|
22146
22146
|
if (segmentIndex2 !== 0) {
|
|
22147
|
-
referencedFramesPerSegment2[segmentIndex2].push(
|
|
22147
|
+
referencedFramesPerSegment2[segmentIndex2].push(_i2);
|
|
22148
22148
|
numberOfFrames++;
|
|
22149
22149
|
}
|
|
22150
22150
|
});
|
|
22151
22151
|
}
|
|
22152
22152
|
};
|
|
22153
|
-
for (var
|
|
22154
|
-
_loop22(
|
|
22153
|
+
for (var _i = 0; _i < labelmaps2D.length; _i++) {
|
|
22154
|
+
_loop22(_i);
|
|
22155
22155
|
}
|
|
22156
22156
|
referencedFramesPerLabelmap[labelmapIndex] = referencedFramesPerSegment2;
|
|
22157
22157
|
};
|
|
@@ -23110,8 +23110,8 @@ var require_dcmjs = __commonJS({
|
|
|
23110
23110
|
value: function getCornerstoneLabelFromDefaultState(defaultState) {
|
|
23111
23111
|
var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
|
|
23112
23112
|
var cornersoneFreeTextCodingValue = CodingScheme.codeValues.CORNERSTONEFREETEXT;
|
|
23113
|
-
var freeTextLabel = findingSites.find(function(
|
|
23114
|
-
return
|
|
23113
|
+
var freeTextLabel = findingSites.find(function(fs3) {
|
|
23114
|
+
return fs3.CodeValue === cornersoneFreeTextCodingValue;
|
|
23115
23115
|
});
|
|
23116
23116
|
if (freeTextLabel) {
|
|
23117
23117
|
return freeTextLabel.CodeMeaning;
|
|
@@ -23297,8 +23297,8 @@ var require_dcmjs = __commonJS({
|
|
|
23297
23297
|
return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
|
|
23298
23298
|
});
|
|
23299
23299
|
var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
|
|
23300
|
-
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(
|
|
23301
|
-
return
|
|
23300
|
+
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
|
|
23301
|
+
return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
|
|
23302
23302
|
});
|
|
23303
23303
|
if (toolClass) {
|
|
23304
23304
|
var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
|
|
@@ -35798,8 +35798,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
35798
35798
|
key: "writeBytes",
|
|
35799
35799
|
value: function writeBytes(stream, value, writeOptions) {
|
|
35800
35800
|
var _this8 = this;
|
|
35801
|
-
var val = Array.isArray(value) ? value.map(function(
|
|
35802
|
-
return _this8.convertToString(
|
|
35801
|
+
var val = Array.isArray(value) ? value.map(function(ds) {
|
|
35802
|
+
return _this8.convertToString(ds);
|
|
35803
35803
|
}) : [this.convertToString(value)];
|
|
35804
35804
|
return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
35805
35805
|
}
|
|
@@ -36787,8 +36787,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
36787
36787
|
if (keys1.length !== keys2.length) {
|
|
36788
36788
|
return false;
|
|
36789
36789
|
}
|
|
36790
|
-
for (var
|
|
36791
|
-
var key = _keys[
|
|
36790
|
+
for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {
|
|
36791
|
+
var key = _keys[_i];
|
|
36792
36792
|
if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {
|
|
36793
36793
|
return false;
|
|
36794
36794
|
}
|
|
@@ -37572,8 +37572,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
37572
37572
|
}, {
|
|
37573
37573
|
key: "isMultiframeDataset",
|
|
37574
37574
|
value: function isMultiframeDataset() {
|
|
37575
|
-
var
|
|
37576
|
-
var sopClassUID =
|
|
37575
|
+
var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
|
|
37576
|
+
var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
|
|
37577
37577
|
return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
|
|
37578
37578
|
}
|
|
37579
37579
|
}, {
|
|
@@ -37613,16 +37613,16 @@ var require_dcmjs2 = __commonJS({
|
|
|
37613
37613
|
}
|
|
37614
37614
|
this.derivation = new DerivedImage(this.datasets);
|
|
37615
37615
|
this.dataset = this.derivation.dataset;
|
|
37616
|
-
var
|
|
37616
|
+
var ds = this.dataset;
|
|
37617
37617
|
var referenceDataset = this.datasets[0];
|
|
37618
|
-
|
|
37619
|
-
|
|
37620
|
-
|
|
37621
|
-
|
|
37622
|
-
|
|
37623
|
-
|
|
37624
|
-
|
|
37625
|
-
|
|
37618
|
+
ds.NumberOfFrames = this.datasets.length;
|
|
37619
|
+
ds.SOPClassUID = referenceDataset.SOPClassUID;
|
|
37620
|
+
ds.Rows = referenceDataset.Rows;
|
|
37621
|
+
ds.Columns = referenceDataset.Columns;
|
|
37622
|
+
ds.BitsAllocated = referenceDataset.BitsAllocated;
|
|
37623
|
+
ds.PixelRepresentation = referenceDataset.PixelRepresentation;
|
|
37624
|
+
ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
|
|
37625
|
+
ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
|
|
37626
37626
|
var referencePosition = referenceDataset.ImagePositionPatient;
|
|
37627
37627
|
var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
|
|
37628
37628
|
var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
|
|
@@ -37637,43 +37637,43 @@ var require_dcmjs2 = __commonJS({
|
|
|
37637
37637
|
distanceDatasetPairs.sort(function(a, b3) {
|
|
37638
37638
|
return b3[0] - a[0];
|
|
37639
37639
|
});
|
|
37640
|
-
if (
|
|
37640
|
+
if (ds.BitsAllocated !== 16) {
|
|
37641
37641
|
log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
|
|
37642
37642
|
}
|
|
37643
37643
|
if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
|
|
37644
37644
|
log2.warn("No vr map given for pixel data, using OW");
|
|
37645
|
-
|
|
37645
|
+
ds._vrMap = {
|
|
37646
37646
|
PixelData: "OW"
|
|
37647
37647
|
};
|
|
37648
37648
|
} else {
|
|
37649
|
-
|
|
37649
|
+
ds._vrMap = {
|
|
37650
37650
|
PixelData: referenceDataset._vrMap.PixelData
|
|
37651
37651
|
};
|
|
37652
37652
|
}
|
|
37653
37653
|
var frameSize = referenceDataset.PixelData.byteLength;
|
|
37654
|
-
|
|
37654
|
+
ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
|
|
37655
37655
|
var frame = 0;
|
|
37656
37656
|
distanceDatasetPairs.forEach(function(pair) {
|
|
37657
37657
|
var dataset = pair[1];
|
|
37658
37658
|
var pixels = new Uint16Array(dataset.PixelData);
|
|
37659
|
-
var frameView = new Uint16Array(
|
|
37659
|
+
var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
|
|
37660
37660
|
try {
|
|
37661
37661
|
frameView.set(pixels);
|
|
37662
37662
|
} catch (e) {
|
|
37663
37663
|
if (e instanceof RangeError) {
|
|
37664
|
-
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(
|
|
37664
|
+
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
|
|
37665
37665
|
log2.error(message2);
|
|
37666
37666
|
}
|
|
37667
37667
|
}
|
|
37668
37668
|
frame++;
|
|
37669
37669
|
});
|
|
37670
|
-
if (
|
|
37670
|
+
if (ds.NumberOfFrames < 2) {
|
|
37671
37671
|
log2.error("Cannot populate shared groups uniquely without multiple frames");
|
|
37672
37672
|
}
|
|
37673
37673
|
var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
|
|
37674
37674
|
var distance1 = distanceDatasetPairs[1][0];
|
|
37675
37675
|
var SpacingBetweenSlices = Math.abs(distance1 - distance0);
|
|
37676
|
-
|
|
37676
|
+
ds.SharedFunctionalGroupsSequence = {
|
|
37677
37677
|
PlaneOrientationSequence: {
|
|
37678
37678
|
ImageOrientationPatient: dataset0.ImageOrientationPatient
|
|
37679
37679
|
},
|
|
@@ -37683,14 +37683,14 @@ var require_dcmjs2 = __commonJS({
|
|
|
37683
37683
|
SliceThickness: SpacingBetweenSlices
|
|
37684
37684
|
}
|
|
37685
37685
|
};
|
|
37686
|
-
|
|
37686
|
+
ds.ReferencedSeriesSequence = {
|
|
37687
37687
|
SeriesInstanceUID: dataset0.SeriesInstanceUID,
|
|
37688
37688
|
ReferencedInstanceSequence: []
|
|
37689
37689
|
};
|
|
37690
|
-
|
|
37690
|
+
ds.PerFrameFunctionalGroupsSequence = [];
|
|
37691
37691
|
distanceDatasetPairs.forEach(function(pair) {
|
|
37692
37692
|
var dataset = pair[1];
|
|
37693
|
-
|
|
37693
|
+
ds.PerFrameFunctionalGroupsSequence.push({
|
|
37694
37694
|
PlanePositionSequence: {
|
|
37695
37695
|
ImagePositionPatient: dataset.ImagePositionPatient
|
|
37696
37696
|
},
|
|
@@ -37699,7 +37699,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
37699
37699
|
WindowWidth: dataset.WindowWidth
|
|
37700
37700
|
}
|
|
37701
37701
|
});
|
|
37702
|
-
|
|
37702
|
+
ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
|
|
37703
37703
|
ReferencedSOPClassUID: dataset.SOPClassUID,
|
|
37704
37704
|
ReferencedSOPInstanceUID: dataset.SOPInstanceUID
|
|
37705
37705
|
});
|
|
@@ -37719,29 +37719,29 @@ var require_dcmjs2 = __commonJS({
|
|
|
37719
37719
|
}, {
|
|
37720
37720
|
key: "normalizeMultiframe",
|
|
37721
37721
|
value: function normalizeMultiframe() {
|
|
37722
|
-
var
|
|
37723
|
-
if (!
|
|
37722
|
+
var ds = this.dataset;
|
|
37723
|
+
if (!ds.NumberOfFrames) {
|
|
37724
37724
|
log2.error("Missing number or frames not supported");
|
|
37725
37725
|
return;
|
|
37726
37726
|
}
|
|
37727
|
-
if (!
|
|
37728
|
-
|
|
37727
|
+
if (!ds.PixelRepresentation) {
|
|
37728
|
+
ds.PixelRepresentation = 1;
|
|
37729
37729
|
}
|
|
37730
|
-
if (!
|
|
37731
|
-
|
|
37730
|
+
if (!ds.StudyID || ds.StudyID === "") {
|
|
37731
|
+
ds.StudyID = "No Study ID";
|
|
37732
37732
|
}
|
|
37733
37733
|
var validLateralities = ["R", "L"];
|
|
37734
|
-
if (validLateralities.indexOf(
|
|
37735
|
-
delete
|
|
37734
|
+
if (validLateralities.indexOf(ds.Laterality) === -1) {
|
|
37735
|
+
delete ds.Laterality;
|
|
37736
37736
|
}
|
|
37737
|
-
if (!
|
|
37738
|
-
|
|
37737
|
+
if (!ds.PresentationLUTShape) {
|
|
37738
|
+
ds.PresentationLUTShape = "IDENTITY";
|
|
37739
37739
|
}
|
|
37740
|
-
if (!
|
|
37740
|
+
if (!ds.SharedFunctionalGroupsSequence) {
|
|
37741
37741
|
log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
|
|
37742
37742
|
}
|
|
37743
|
-
if (
|
|
37744
|
-
|
|
37743
|
+
if (ds.BodyPartExamined === "PROSTATE") {
|
|
37744
|
+
ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
|
|
37745
37745
|
AnatomicRegionSequence: {
|
|
37746
37746
|
CodeValue: "T-9200B",
|
|
37747
37747
|
CodingSchemeDesignator: "SRT",
|
|
@@ -37750,17 +37750,17 @@ var require_dcmjs2 = __commonJS({
|
|
|
37750
37750
|
FrameLaterality: "U"
|
|
37751
37751
|
};
|
|
37752
37752
|
}
|
|
37753
|
-
var rescaleIntercept =
|
|
37754
|
-
var rescaleSlope =
|
|
37755
|
-
|
|
37753
|
+
var rescaleIntercept = ds.RescaleIntercept || 0;
|
|
37754
|
+
var rescaleSlope = ds.RescaleSlope || 1;
|
|
37755
|
+
ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
|
|
37756
37756
|
RescaleIntercept: rescaleIntercept,
|
|
37757
37757
|
RescaleSlope: rescaleSlope,
|
|
37758
37758
|
RescaleType: "US"
|
|
37759
37759
|
};
|
|
37760
37760
|
var frameNumber = 1;
|
|
37761
37761
|
this.datasets.forEach(function(dataset) {
|
|
37762
|
-
if (
|
|
37763
|
-
|
|
37762
|
+
if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
|
|
37763
|
+
ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
|
|
37764
37764
|
FrameAcquisitionDuration: 0,
|
|
37765
37765
|
StackID: 1,
|
|
37766
37766
|
InStackPositionNumber: frameNumber,
|
|
@@ -37768,30 +37768,30 @@ var require_dcmjs2 = __commonJS({
|
|
|
37768
37768
|
};
|
|
37769
37769
|
var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
|
|
37770
37770
|
if (!isNaN(frameTime)) {
|
|
37771
|
-
var frameContentSequence =
|
|
37771
|
+
var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
|
|
37772
37772
|
frameContentSequence.FrameAcquisitionDateTime = frameTime;
|
|
37773
37773
|
frameContentSequence.FrameReferenceDateTime = frameTime;
|
|
37774
37774
|
}
|
|
37775
37775
|
frameNumber++;
|
|
37776
37776
|
});
|
|
37777
|
-
if (
|
|
37778
|
-
if (!Array.isArray(
|
|
37779
|
-
|
|
37777
|
+
if (ds.WindowCenter && ds.WindowWidth) {
|
|
37778
|
+
if (!Array.isArray(ds.WindowCenter)) {
|
|
37779
|
+
ds.WindowCenter = [ds.WindowCenter];
|
|
37780
37780
|
}
|
|
37781
|
-
if (!Array.isArray(
|
|
37782
|
-
|
|
37781
|
+
if (!Array.isArray(ds.WindowWidth)) {
|
|
37782
|
+
ds.WindowWidth = [ds.WindowWidth];
|
|
37783
37783
|
}
|
|
37784
37784
|
}
|
|
37785
|
-
if (!
|
|
37786
|
-
|
|
37787
|
-
|
|
37788
|
-
if (
|
|
37785
|
+
if (!ds.WindowCenter || !ds.WindowWidth) {
|
|
37786
|
+
ds.WindowCenter = [];
|
|
37787
|
+
ds.WindowWidth = [];
|
|
37788
|
+
if (ds.PerFrameFunctionalGroupsSequence) {
|
|
37789
37789
|
var wcww = {
|
|
37790
37790
|
center: 0,
|
|
37791
37791
|
width: 0,
|
|
37792
37792
|
count: 0
|
|
37793
37793
|
};
|
|
37794
|
-
|
|
37794
|
+
ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
|
|
37795
37795
|
if (functionalGroup.FrameVOILUT) {
|
|
37796
37796
|
var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
|
|
37797
37797
|
var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
|
|
@@ -37809,16 +37809,16 @@ var require_dcmjs2 = __commonJS({
|
|
|
37809
37809
|
}
|
|
37810
37810
|
});
|
|
37811
37811
|
if (wcww.count > 0) {
|
|
37812
|
-
|
|
37813
|
-
|
|
37812
|
+
ds.WindowCenter.push(String(wcww.center / wcww.count));
|
|
37813
|
+
ds.WindowWidth.push(String(wcww.width / wcww.count));
|
|
37814
37814
|
}
|
|
37815
37815
|
}
|
|
37816
37816
|
}
|
|
37817
|
-
if (
|
|
37818
|
-
|
|
37817
|
+
if (ds.WindowCenter.length === 0) {
|
|
37818
|
+
ds.WindowCenter = [300];
|
|
37819
37819
|
}
|
|
37820
|
-
if (
|
|
37821
|
-
|
|
37820
|
+
if (ds.WindowWidth.length === 0) {
|
|
37821
|
+
ds.WindowWidth = [500];
|
|
37822
37822
|
}
|
|
37823
37823
|
}
|
|
37824
37824
|
}], [{
|
|
@@ -37864,12 +37864,12 @@ var require_dcmjs2 = __commonJS({
|
|
|
37864
37864
|
key: "normalizeMultiframe",
|
|
37865
37865
|
value: function normalizeMultiframe() {
|
|
37866
37866
|
_get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
|
|
37867
|
-
var
|
|
37868
|
-
if (!
|
|
37869
|
-
|
|
37867
|
+
var ds = this.dataset;
|
|
37868
|
+
if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
|
|
37869
|
+
ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
|
|
37870
37870
|
}
|
|
37871
|
-
|
|
37872
|
-
FrameType:
|
|
37871
|
+
ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
|
|
37872
|
+
FrameType: ds.ImageType,
|
|
37873
37873
|
PixelPresentation: "MONOCHROME",
|
|
37874
37874
|
VolumetricProperties: "VOLUME",
|
|
37875
37875
|
VolumeBasedCalculationTechnique: "NONE",
|
|
@@ -37994,9 +37994,9 @@ var require_dcmjs2 = __commonJS({
|
|
|
37994
37994
|
key: "normalize",
|
|
37995
37995
|
value: function normalize3() {
|
|
37996
37996
|
_get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
|
|
37997
|
-
var
|
|
37998
|
-
if (
|
|
37999
|
-
log2.error("Only works with 32 bit data, not " + String(
|
|
37997
|
+
var ds = this.datasets[0];
|
|
37998
|
+
if (ds.BitsAllocated !== 32) {
|
|
37999
|
+
log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
|
|
38000
38000
|
}
|
|
38001
38001
|
}
|
|
38002
38002
|
}]);
|
|
@@ -38800,8 +38800,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
38800
38800
|
return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
|
|
38801
38801
|
});
|
|
38802
38802
|
var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
|
|
38803
|
-
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(
|
|
38804
|
-
return
|
|
38803
|
+
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
|
|
38804
|
+
return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
|
|
38805
38805
|
});
|
|
38806
38806
|
if (toolClass) {
|
|
38807
38807
|
var measurement = toolClass.getMeasurementData(measurementGroup);
|
|
@@ -40313,9 +40313,9 @@ var require_dcmjs2 = __commonJS({
|
|
|
40313
40313
|
NumberOfFrames += referencedFramesPerSegment[i].length;
|
|
40314
40314
|
}
|
|
40315
40315
|
seg.setNumberOfFrames(NumberOfFrames);
|
|
40316
|
-
for (var
|
|
40317
|
-
var segmentIndex = segmentIndicies[
|
|
40318
|
-
var referencedFrameIndicies = referencedFramesPerSegment[
|
|
40316
|
+
for (var _i = 0; _i < segmentIndicies.length; _i++) {
|
|
40317
|
+
var segmentIndex = segmentIndicies[_i];
|
|
40318
|
+
var referencedFrameIndicies = referencedFramesPerSegment[_i];
|
|
40319
40319
|
var referencedFrameNumbers = referencedFrameIndicies.map(function(element) {
|
|
40320
40320
|
return element + 1;
|
|
40321
40321
|
});
|
|
@@ -40600,11 +40600,11 @@ var require_dcmjs2 = __commonJS({
|
|
|
40600
40600
|
var bodyLength = rleArray.length % 2 === 0 ? rleArray.length : rleArray.length + 1;
|
|
40601
40601
|
var encodedFrameBuffer = new ArrayBuffer(headerLength + bodyLength);
|
|
40602
40602
|
var headerView = new Uint32Array(encodedFrameBuffer, 0, 16);
|
|
40603
|
-
for (var
|
|
40604
|
-
headerView[
|
|
40603
|
+
for (var _i = 0; _i < headerView.length; _i++) {
|
|
40604
|
+
headerView[_i] = header[_i];
|
|
40605
40605
|
}
|
|
40606
|
-
for (var
|
|
40607
|
-
rleArray.push(headerView[
|
|
40606
|
+
for (var _i2 = 0; _i2 < headerView.length; _i2++) {
|
|
40607
|
+
rleArray.push(headerView[_i2]);
|
|
40608
40608
|
}
|
|
40609
40609
|
var bodyView = new Uint8Array(encodedFrameBuffer, 64);
|
|
40610
40610
|
for (var _i3 = 0; _i3 < rleArray.length; _i3++) {
|
|
@@ -41302,20 +41302,20 @@ var require_dcmjs2 = __commonJS({
|
|
|
41302
41302
|
referencedFramesPerSegment2[i] = [];
|
|
41303
41303
|
}
|
|
41304
41304
|
}
|
|
41305
|
-
var _loop22 = function _loop23(
|
|
41306
|
-
var labelmap2D = labelmaps2D[
|
|
41307
|
-
if (labelmaps2D[
|
|
41305
|
+
var _loop22 = function _loop23(_i2) {
|
|
41306
|
+
var labelmap2D = labelmaps2D[_i2];
|
|
41307
|
+
if (labelmaps2D[_i2]) {
|
|
41308
41308
|
var segmentsOnLabelmap = labelmap2D.segmentsOnLabelmap;
|
|
41309
41309
|
segmentsOnLabelmap.forEach(function(segmentIndex2) {
|
|
41310
41310
|
if (segmentIndex2 !== 0) {
|
|
41311
|
-
referencedFramesPerSegment2[segmentIndex2].push(
|
|
41311
|
+
referencedFramesPerSegment2[segmentIndex2].push(_i2);
|
|
41312
41312
|
numberOfFrames++;
|
|
41313
41313
|
}
|
|
41314
41314
|
});
|
|
41315
41315
|
}
|
|
41316
41316
|
};
|
|
41317
|
-
for (var
|
|
41318
|
-
_loop22(
|
|
41317
|
+
for (var _i = 0; _i < labelmaps2D.length; _i++) {
|
|
41318
|
+
_loop22(_i);
|
|
41319
41319
|
}
|
|
41320
41320
|
referencedFramesPerLabelmap[labelmapIndex] = referencedFramesPerSegment2;
|
|
41321
41321
|
};
|
|
@@ -42274,8 +42274,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
42274
42274
|
value: function getCornerstoneLabelFromDefaultState(defaultState) {
|
|
42275
42275
|
var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
|
|
42276
42276
|
var cornersoneFreeTextCodingValue = CodingScheme.codeValues.CORNERSTONEFREETEXT;
|
|
42277
|
-
var freeTextLabel = findingSites.find(function(
|
|
42278
|
-
return
|
|
42277
|
+
var freeTextLabel = findingSites.find(function(fs3) {
|
|
42278
|
+
return fs3.CodeValue === cornersoneFreeTextCodingValue;
|
|
42279
42279
|
});
|
|
42280
42280
|
if (freeTextLabel) {
|
|
42281
42281
|
return freeTextLabel.CodeMeaning;
|
|
@@ -42461,8 +42461,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
42461
42461
|
return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
|
|
42462
42462
|
});
|
|
42463
42463
|
var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
|
|
42464
|
-
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(
|
|
42465
|
-
return
|
|
42464
|
+
var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
|
|
42465
|
+
return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
|
|
42466
42466
|
});
|
|
42467
42467
|
if (toolClass) {
|
|
42468
42468
|
var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
|
|
@@ -53811,8 +53811,8 @@ var require_fecha_umd = __commonJS({
|
|
|
53811
53811
|
};
|
|
53812
53812
|
function assign(origObj) {
|
|
53813
53813
|
var args = [];
|
|
53814
|
-
for (var
|
|
53815
|
-
args[
|
|
53814
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
53815
|
+
args[_i - 1] = arguments[_i];
|
|
53816
53816
|
}
|
|
53817
53817
|
for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) {
|
|
53818
53818
|
var obj = args_1[_a2];
|
|
@@ -56351,9 +56351,9 @@ var require_stream_readable = __commonJS({
|
|
|
56351
56351
|
return from(Readable2, iterable, opts);
|
|
56352
56352
|
};
|
|
56353
56353
|
}
|
|
56354
|
-
function indexOf(
|
|
56355
|
-
for (var i = 0, l2 =
|
|
56356
|
-
if (
|
|
56354
|
+
function indexOf(xs2, x3) {
|
|
56355
|
+
for (var i = 0, l2 = xs2.length; i < l2; i++) {
|
|
56356
|
+
if (xs2[i] === x3) return i;
|
|
56357
56357
|
}
|
|
56358
56358
|
return -1;
|
|
56359
56359
|
}
|
|
@@ -58250,27 +58250,27 @@ var require_index_cjs = __commonJS({
|
|
|
58250
58250
|
reverseNames[cssKeywords[name]] = name;
|
|
58251
58251
|
}
|
|
58252
58252
|
}
|
|
58253
|
-
var
|
|
58253
|
+
var cs2 = {
|
|
58254
58254
|
to: {},
|
|
58255
58255
|
get: {}
|
|
58256
58256
|
};
|
|
58257
|
-
|
|
58257
|
+
cs2.get = function(string) {
|
|
58258
58258
|
const prefix = string.slice(0, 3).toLowerCase();
|
|
58259
58259
|
let value;
|
|
58260
58260
|
let model;
|
|
58261
58261
|
switch (prefix) {
|
|
58262
58262
|
case "hsl": {
|
|
58263
|
-
value =
|
|
58263
|
+
value = cs2.get.hsl(string);
|
|
58264
58264
|
model = "hsl";
|
|
58265
58265
|
break;
|
|
58266
58266
|
}
|
|
58267
58267
|
case "hwb": {
|
|
58268
|
-
value =
|
|
58268
|
+
value = cs2.get.hwb(string);
|
|
58269
58269
|
model = "hwb";
|
|
58270
58270
|
break;
|
|
58271
58271
|
}
|
|
58272
58272
|
default: {
|
|
58273
|
-
value =
|
|
58273
|
+
value = cs2.get.rgb(string);
|
|
58274
58274
|
model = "rgb";
|
|
58275
58275
|
break;
|
|
58276
58276
|
}
|
|
@@ -58280,7 +58280,7 @@ var require_index_cjs = __commonJS({
|
|
|
58280
58280
|
}
|
|
58281
58281
|
return { model, value };
|
|
58282
58282
|
};
|
|
58283
|
-
|
|
58283
|
+
cs2.get.rgb = function(string) {
|
|
58284
58284
|
if (!string) {
|
|
58285
58285
|
return null;
|
|
58286
58286
|
}
|
|
@@ -58345,7 +58345,7 @@ var require_index_cjs = __commonJS({
|
|
|
58345
58345
|
rgb[3] = clamp(rgb[3], 0, 1);
|
|
58346
58346
|
return rgb;
|
|
58347
58347
|
};
|
|
58348
|
-
|
|
58348
|
+
cs2.get.hsl = function(string) {
|
|
58349
58349
|
if (!string) {
|
|
58350
58350
|
return null;
|
|
58351
58351
|
}
|
|
@@ -58361,7 +58361,7 @@ var require_index_cjs = __commonJS({
|
|
|
58361
58361
|
}
|
|
58362
58362
|
return null;
|
|
58363
58363
|
};
|
|
58364
|
-
|
|
58364
|
+
cs2.get.hwb = function(string) {
|
|
58365
58365
|
if (!string) {
|
|
58366
58366
|
return null;
|
|
58367
58367
|
}
|
|
@@ -58377,29 +58377,29 @@ var require_index_cjs = __commonJS({
|
|
|
58377
58377
|
}
|
|
58378
58378
|
return null;
|
|
58379
58379
|
};
|
|
58380
|
-
|
|
58380
|
+
cs2.to.hex = function(...rgba) {
|
|
58381
58381
|
return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
|
|
58382
58382
|
};
|
|
58383
|
-
|
|
58383
|
+
cs2.to.rgb = function(...rgba) {
|
|
58384
58384
|
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
|
|
58385
58385
|
};
|
|
58386
|
-
|
|
58386
|
+
cs2.to.rgb.percent = function(...rgba) {
|
|
58387
58387
|
const r6 = Math.round(rgba[0] / 255 * 100);
|
|
58388
58388
|
const g3 = Math.round(rgba[1] / 255 * 100);
|
|
58389
58389
|
const b3 = Math.round(rgba[2] / 255 * 100);
|
|
58390
58390
|
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r6 + "%, " + g3 + "%, " + b3 + "%)" : "rgba(" + r6 + "%, " + g3 + "%, " + b3 + "%, " + rgba[3] + ")";
|
|
58391
58391
|
};
|
|
58392
|
-
|
|
58392
|
+
cs2.to.hsl = function(...hsla) {
|
|
58393
58393
|
return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
|
|
58394
58394
|
};
|
|
58395
|
-
|
|
58395
|
+
cs2.to.hwb = function(...hwba) {
|
|
58396
58396
|
let a = "";
|
|
58397
58397
|
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
58398
58398
|
a = ", " + hwba[3];
|
|
58399
58399
|
}
|
|
58400
58400
|
return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")";
|
|
58401
58401
|
};
|
|
58402
|
-
|
|
58402
|
+
cs2.to.keyword = function(...rgb) {
|
|
58403
58403
|
return reverseNames[rgb.slice(0, 3)];
|
|
58404
58404
|
};
|
|
58405
58405
|
function clamp(number_, min, max) {
|
|
@@ -58675,13 +58675,13 @@ var require_index_cjs = __commonJS({
|
|
|
58675
58675
|
const h2 = hsv[0] / 60;
|
|
58676
58676
|
const s = hsv[1] / 100;
|
|
58677
58677
|
let v3 = hsv[2] / 100;
|
|
58678
|
-
const
|
|
58678
|
+
const hi = Math.floor(h2) % 6;
|
|
58679
58679
|
const f2 = h2 - Math.floor(h2);
|
|
58680
58680
|
const p = 255 * v3 * (1 - s);
|
|
58681
58681
|
const q2 = 255 * v3 * (1 - s * f2);
|
|
58682
58682
|
const t = 255 * v3 * (1 - s * (1 - f2));
|
|
58683
58683
|
v3 *= 255;
|
|
58684
|
-
switch (
|
|
58684
|
+
switch (hi) {
|
|
58685
58685
|
case 0: {
|
|
58686
58686
|
return [v3, t, p];
|
|
58687
58687
|
}
|
|
@@ -59035,11 +59035,11 @@ var require_index_cjs = __commonJS({
|
|
|
59035
59035
|
return [g3 * 255, g3 * 255, g3 * 255];
|
|
59036
59036
|
}
|
|
59037
59037
|
const pure = [0, 0, 0];
|
|
59038
|
-
const
|
|
59039
|
-
const v3 =
|
|
59038
|
+
const hi = h2 % 1 * 6;
|
|
59039
|
+
const v3 = hi % 1;
|
|
59040
59040
|
const w3 = 1 - v3;
|
|
59041
59041
|
let mg = 0;
|
|
59042
|
-
switch (Math.floor(
|
|
59042
|
+
switch (Math.floor(hi)) {
|
|
59043
59043
|
case 0: {
|
|
59044
59044
|
pure[0] = 1;
|
|
59045
59045
|
pure[1] = v3;
|
|
@@ -59303,7 +59303,7 @@ var require_index_cjs = __commonJS({
|
|
|
59303
59303
|
this.color = [...object.color];
|
|
59304
59304
|
this.valpha = object.valpha;
|
|
59305
59305
|
} else if (typeof object === "string") {
|
|
59306
|
-
const result =
|
|
59306
|
+
const result = cs2.get(object);
|
|
59307
59307
|
if (result === null) {
|
|
59308
59308
|
throw new Error("Unable to parse color from string: " + object);
|
|
59309
59309
|
}
|
|
@@ -59366,15 +59366,15 @@ var require_index_cjs = __commonJS({
|
|
|
59366
59366
|
return this[this.model]();
|
|
59367
59367
|
},
|
|
59368
59368
|
string(places) {
|
|
59369
|
-
let self2 = this.model in
|
|
59369
|
+
let self2 = this.model in cs2.to ? this : this.rgb();
|
|
59370
59370
|
self2 = self2.round(typeof places === "number" ? places : 1);
|
|
59371
59371
|
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
59372
|
-
return
|
|
59372
|
+
return cs2.to[self2.model](...arguments_);
|
|
59373
59373
|
},
|
|
59374
59374
|
percentString(places) {
|
|
59375
59375
|
const self2 = this.rgb().round(typeof places === "number" ? places : 1);
|
|
59376
59376
|
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
59377
|
-
return
|
|
59377
|
+
return cs2.to.rgb.percent(...arguments_);
|
|
59378
59378
|
},
|
|
59379
59379
|
array() {
|
|
59380
59380
|
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
|
|
@@ -59454,7 +59454,7 @@ var require_index_cjs = __commonJS({
|
|
|
59454
59454
|
if (value !== void 0) {
|
|
59455
59455
|
return new Color(value);
|
|
59456
59456
|
}
|
|
59457
|
-
return
|
|
59457
|
+
return cs2.to.hex(...this.rgb().round().color);
|
|
59458
59458
|
},
|
|
59459
59459
|
hexa(value) {
|
|
59460
59460
|
if (value !== void 0) {
|
|
@@ -59465,7 +59465,7 @@ var require_index_cjs = __commonJS({
|
|
|
59465
59465
|
if (alphaHex.length === 1) {
|
|
59466
59466
|
alphaHex = "0" + alphaHex;
|
|
59467
59467
|
}
|
|
59468
|
-
return
|
|
59468
|
+
return cs2.to.hex(...rgbArray) + alphaHex;
|
|
59469
59469
|
},
|
|
59470
59470
|
rgbNumber() {
|
|
59471
59471
|
const rgb = this.rgb().color;
|
|
@@ -59836,7 +59836,7 @@ var require_node2 = __commonJS({
|
|
|
59836
59836
|
var require_tail_file = __commonJS({
|
|
59837
59837
|
"../../node_modules/winston/lib/winston/tail-file.js"(exports2, module2) {
|
|
59838
59838
|
"use strict";
|
|
59839
|
-
var
|
|
59839
|
+
var fs3 = require("fs");
|
|
59840
59840
|
var { StringDecoder } = require("string_decoder");
|
|
59841
59841
|
var { Stream } = require_readable();
|
|
59842
59842
|
function noop() {
|
|
@@ -59857,7 +59857,7 @@ var require_tail_file = __commonJS({
|
|
|
59857
59857
|
stream.emit("end");
|
|
59858
59858
|
stream.emit("close");
|
|
59859
59859
|
};
|
|
59860
|
-
|
|
59860
|
+
fs3.open(options.file, "a+", "0644", (err, fd) => {
|
|
59861
59861
|
if (err) {
|
|
59862
59862
|
if (!iter) {
|
|
59863
59863
|
stream.emit("error", err);
|
|
@@ -59869,10 +59869,10 @@ var require_tail_file = __commonJS({
|
|
|
59869
59869
|
}
|
|
59870
59870
|
(function read() {
|
|
59871
59871
|
if (stream.destroyed) {
|
|
59872
|
-
|
|
59872
|
+
fs3.close(fd, noop);
|
|
59873
59873
|
return;
|
|
59874
59874
|
}
|
|
59875
|
-
return
|
|
59875
|
+
return fs3.read(fd, buffer2, 0, buffer2.length, pos, (error, bytes) => {
|
|
59876
59876
|
if (error) {
|
|
59877
59877
|
if (!iter) {
|
|
59878
59878
|
stream.emit("error", error);
|
|
@@ -59931,7 +59931,7 @@ var require_tail_file = __commonJS({
|
|
|
59931
59931
|
var require_file = __commonJS({
|
|
59932
59932
|
"../../node_modules/winston/lib/winston/transports/file.js"(exports2, module2) {
|
|
59933
59933
|
"use strict";
|
|
59934
|
-
var
|
|
59934
|
+
var fs3 = require("fs");
|
|
59935
59935
|
var path4 = require("path");
|
|
59936
59936
|
var asyncSeries = require_series();
|
|
59937
59937
|
var zlib = require("zlib");
|
|
@@ -60136,7 +60136,7 @@ var require_file = __commonJS({
|
|
|
60136
60136
|
let buff = "";
|
|
60137
60137
|
let results = [];
|
|
60138
60138
|
let row = 0;
|
|
60139
|
-
const stream =
|
|
60139
|
+
const stream = fs3.createReadStream(file, {
|
|
60140
60140
|
encoding: "utf8"
|
|
60141
60141
|
});
|
|
60142
60142
|
stream.on("error", (err) => {
|
|
@@ -60288,7 +60288,7 @@ var require_file = __commonJS({
|
|
|
60288
60288
|
stat(callback) {
|
|
60289
60289
|
const target = this._getFile();
|
|
60290
60290
|
const fullpath = path4.join(this.dirname, target);
|
|
60291
|
-
|
|
60291
|
+
fs3.stat(fullpath, (err, stat) => {
|
|
60292
60292
|
if (err && err.code === "ENOENT") {
|
|
60293
60293
|
debug("ENOENT\xA0ok", fullpath);
|
|
60294
60294
|
this.filename = target;
|
|
@@ -60393,7 +60393,7 @@ var require_file = __commonJS({
|
|
|
60393
60393
|
_createStream(source) {
|
|
60394
60394
|
const fullpath = path4.join(this.dirname, this.filename);
|
|
60395
60395
|
debug("create stream start", fullpath, this.options);
|
|
60396
|
-
const dest =
|
|
60396
|
+
const dest = fs3.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
|
|
60397
60397
|
debug("file open ok", fullpath);
|
|
60398
60398
|
this.emit("open", fullpath);
|
|
60399
60399
|
source.pipe(dest);
|
|
@@ -60472,7 +60472,7 @@ var require_file = __commonJS({
|
|
|
60472
60472
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
60473
60473
|
const filePath = `${basename}${isOldest}${ext}${isZipped}`;
|
|
60474
60474
|
const target = path4.join(this.dirname, filePath);
|
|
60475
|
-
|
|
60475
|
+
fs3.unlink(target, callback);
|
|
60476
60476
|
}
|
|
60477
60477
|
/**
|
|
60478
60478
|
* Roll files forward based on integer, up to maxFiles. e.g. if base if
|
|
@@ -60495,17 +60495,17 @@ var require_file = __commonJS({
|
|
|
60495
60495
|
tasks.push(function(i, cb) {
|
|
60496
60496
|
let fileName = `${basename}${i - 1}${ext}${isZipped}`;
|
|
60497
60497
|
const tmppath = path4.join(this.dirname, fileName);
|
|
60498
|
-
|
|
60498
|
+
fs3.exists(tmppath, (exists) => {
|
|
60499
60499
|
if (!exists) {
|
|
60500
60500
|
return cb(null);
|
|
60501
60501
|
}
|
|
60502
60502
|
fileName = `${basename}${i}${ext}${isZipped}`;
|
|
60503
|
-
|
|
60503
|
+
fs3.rename(tmppath, path4.join(this.dirname, fileName), cb);
|
|
60504
60504
|
});
|
|
60505
60505
|
}.bind(this, x3));
|
|
60506
60506
|
}
|
|
60507
60507
|
asyncSeries(tasks, () => {
|
|
60508
|
-
|
|
60508
|
+
fs3.rename(
|
|
60509
60509
|
path4.join(this.dirname, `${basename}${ext}${isZipped}`),
|
|
60510
60510
|
path4.join(this.dirname, `${basename}1${ext}${isZipped}`),
|
|
60511
60511
|
callback
|
|
@@ -60521,22 +60521,22 @@ var require_file = __commonJS({
|
|
|
60521
60521
|
* @private
|
|
60522
60522
|
*/
|
|
60523
60523
|
_compressFile(src, dest, callback) {
|
|
60524
|
-
|
|
60524
|
+
fs3.access(src, fs3.F_OK, (err) => {
|
|
60525
60525
|
if (err) {
|
|
60526
60526
|
return callback();
|
|
60527
60527
|
}
|
|
60528
60528
|
var gzip = zlib.createGzip();
|
|
60529
|
-
var inp =
|
|
60530
|
-
var out =
|
|
60529
|
+
var inp = fs3.createReadStream(src);
|
|
60530
|
+
var out = fs3.createWriteStream(dest);
|
|
60531
60531
|
out.on("finish", () => {
|
|
60532
|
-
|
|
60532
|
+
fs3.unlink(src, callback);
|
|
60533
60533
|
});
|
|
60534
60534
|
inp.pipe(gzip).pipe(out);
|
|
60535
60535
|
});
|
|
60536
60536
|
}
|
|
60537
60537
|
_createLogDirIfNotExist(dirPath) {
|
|
60538
|
-
if (!
|
|
60539
|
-
|
|
60538
|
+
if (!fs3.existsSync(dirPath)) {
|
|
60539
|
+
fs3.mkdirSync(dirPath, { recursive: true });
|
|
60540
60540
|
}
|
|
60541
60541
|
}
|
|
60542
60542
|
};
|
|
@@ -60701,11 +60701,11 @@ var require_http = __commonJS({
|
|
|
60701
60701
|
_doBatch(options, callback, auth, path4) {
|
|
60702
60702
|
this.batchOptions.push(options);
|
|
60703
60703
|
if (this.batchOptions.length === 1) {
|
|
60704
|
-
const
|
|
60704
|
+
const me = this;
|
|
60705
60705
|
this.batchCallback = callback;
|
|
60706
60706
|
this.batchTimeoutID = setTimeout(function() {
|
|
60707
|
-
|
|
60708
|
-
|
|
60707
|
+
me.batchTimeoutID = -1;
|
|
60708
|
+
me._doBatchRequest(me.batchCallback, auth, path4);
|
|
60709
60709
|
}, this.batchInterval);
|
|
60710
60710
|
}
|
|
60711
60711
|
if (this.batchOptions.length === this.batchCount) {
|
|
@@ -63627,7 +63627,7 @@ var require_moment = __commonJS({
|
|
|
63627
63627
|
return isArray(this._monthsShort) ? this._monthsShort[m3.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m3.month()];
|
|
63628
63628
|
}
|
|
63629
63629
|
function handleStrictParse(monthName, format2, strict) {
|
|
63630
|
-
var i,
|
|
63630
|
+
var i, ii2, mom, llc = monthName.toLocaleLowerCase();
|
|
63631
63631
|
if (!this._monthsParse) {
|
|
63632
63632
|
this._monthsParse = [];
|
|
63633
63633
|
this._longMonthsParse = [];
|
|
@@ -63643,27 +63643,27 @@ var require_moment = __commonJS({
|
|
|
63643
63643
|
}
|
|
63644
63644
|
if (strict) {
|
|
63645
63645
|
if (format2 === "MMM") {
|
|
63646
|
-
|
|
63647
|
-
return
|
|
63646
|
+
ii2 = indexOf.call(this._shortMonthsParse, llc);
|
|
63647
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63648
63648
|
} else {
|
|
63649
|
-
|
|
63650
|
-
return
|
|
63649
|
+
ii2 = indexOf.call(this._longMonthsParse, llc);
|
|
63650
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63651
63651
|
}
|
|
63652
63652
|
} else {
|
|
63653
63653
|
if (format2 === "MMM") {
|
|
63654
|
-
|
|
63655
|
-
if (
|
|
63656
|
-
return
|
|
63654
|
+
ii2 = indexOf.call(this._shortMonthsParse, llc);
|
|
63655
|
+
if (ii2 !== -1) {
|
|
63656
|
+
return ii2;
|
|
63657
63657
|
}
|
|
63658
|
-
|
|
63659
|
-
return
|
|
63658
|
+
ii2 = indexOf.call(this._longMonthsParse, llc);
|
|
63659
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63660
63660
|
} else {
|
|
63661
|
-
|
|
63662
|
-
if (
|
|
63663
|
-
return
|
|
63661
|
+
ii2 = indexOf.call(this._longMonthsParse, llc);
|
|
63662
|
+
if (ii2 !== -1) {
|
|
63663
|
+
return ii2;
|
|
63664
63664
|
}
|
|
63665
|
-
|
|
63666
|
-
return
|
|
63665
|
+
ii2 = indexOf.call(this._shortMonthsParse, llc);
|
|
63666
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63667
63667
|
}
|
|
63668
63668
|
}
|
|
63669
63669
|
}
|
|
@@ -63952,8 +63952,8 @@ var require_moment = __commonJS({
|
|
|
63952
63952
|
}
|
|
63953
63953
|
return isNaN(input) ? null : input;
|
|
63954
63954
|
}
|
|
63955
|
-
function shiftWeekdays(
|
|
63956
|
-
return
|
|
63955
|
+
function shiftWeekdays(ws, n) {
|
|
63956
|
+
return ws.slice(n, 7).concat(ws.slice(0, n));
|
|
63957
63957
|
}
|
|
63958
63958
|
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;
|
|
63959
63959
|
function localeWeekdays(m3, format2) {
|
|
@@ -63967,7 +63967,7 @@ var require_moment = __commonJS({
|
|
|
63967
63967
|
return m3 === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m3 ? this._weekdaysMin[m3.day()] : this._weekdaysMin;
|
|
63968
63968
|
}
|
|
63969
63969
|
function handleStrictParse$1(weekdayName, format2, strict) {
|
|
63970
|
-
var i,
|
|
63970
|
+
var i, ii2, mom, llc = weekdayName.toLocaleLowerCase();
|
|
63971
63971
|
if (!this._weekdaysParse) {
|
|
63972
63972
|
this._weekdaysParse = [];
|
|
63973
63973
|
this._shortWeekdaysParse = [];
|
|
@@ -63987,49 +63987,49 @@ var require_moment = __commonJS({
|
|
|
63987
63987
|
}
|
|
63988
63988
|
if (strict) {
|
|
63989
63989
|
if (format2 === "dddd") {
|
|
63990
|
-
|
|
63991
|
-
return
|
|
63990
|
+
ii2 = indexOf.call(this._weekdaysParse, llc);
|
|
63991
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63992
63992
|
} else if (format2 === "ddd") {
|
|
63993
|
-
|
|
63994
|
-
return
|
|
63993
|
+
ii2 = indexOf.call(this._shortWeekdaysParse, llc);
|
|
63994
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63995
63995
|
} else {
|
|
63996
|
-
|
|
63997
|
-
return
|
|
63996
|
+
ii2 = indexOf.call(this._minWeekdaysParse, llc);
|
|
63997
|
+
return ii2 !== -1 ? ii2 : null;
|
|
63998
63998
|
}
|
|
63999
63999
|
} else {
|
|
64000
64000
|
if (format2 === "dddd") {
|
|
64001
|
-
|
|
64002
|
-
if (
|
|
64003
|
-
return
|
|
64001
|
+
ii2 = indexOf.call(this._weekdaysParse, llc);
|
|
64002
|
+
if (ii2 !== -1) {
|
|
64003
|
+
return ii2;
|
|
64004
64004
|
}
|
|
64005
|
-
|
|
64006
|
-
if (
|
|
64007
|
-
return
|
|
64005
|
+
ii2 = indexOf.call(this._shortWeekdaysParse, llc);
|
|
64006
|
+
if (ii2 !== -1) {
|
|
64007
|
+
return ii2;
|
|
64008
64008
|
}
|
|
64009
|
-
|
|
64010
|
-
return
|
|
64009
|
+
ii2 = indexOf.call(this._minWeekdaysParse, llc);
|
|
64010
|
+
return ii2 !== -1 ? ii2 : null;
|
|
64011
64011
|
} else if (format2 === "ddd") {
|
|
64012
|
-
|
|
64013
|
-
if (
|
|
64014
|
-
return
|
|
64012
|
+
ii2 = indexOf.call(this._shortWeekdaysParse, llc);
|
|
64013
|
+
if (ii2 !== -1) {
|
|
64014
|
+
return ii2;
|
|
64015
64015
|
}
|
|
64016
|
-
|
|
64017
|
-
if (
|
|
64018
|
-
return
|
|
64016
|
+
ii2 = indexOf.call(this._weekdaysParse, llc);
|
|
64017
|
+
if (ii2 !== -1) {
|
|
64018
|
+
return ii2;
|
|
64019
64019
|
}
|
|
64020
|
-
|
|
64021
|
-
return
|
|
64020
|
+
ii2 = indexOf.call(this._minWeekdaysParse, llc);
|
|
64021
|
+
return ii2 !== -1 ? ii2 : null;
|
|
64022
64022
|
} else {
|
|
64023
|
-
|
|
64024
|
-
if (
|
|
64025
|
-
return
|
|
64023
|
+
ii2 = indexOf.call(this._minWeekdaysParse, llc);
|
|
64024
|
+
if (ii2 !== -1) {
|
|
64025
|
+
return ii2;
|
|
64026
64026
|
}
|
|
64027
|
-
|
|
64028
|
-
if (
|
|
64029
|
-
return
|
|
64027
|
+
ii2 = indexOf.call(this._weekdaysParse, llc);
|
|
64028
|
+
if (ii2 !== -1) {
|
|
64029
|
+
return ii2;
|
|
64030
64030
|
}
|
|
64031
|
-
|
|
64032
|
-
return
|
|
64031
|
+
ii2 = indexOf.call(this._shortWeekdaysParse, llc);
|
|
64032
|
+
return ii2 !== -1 ? ii2 : null;
|
|
64033
64033
|
}
|
|
64034
64034
|
}
|
|
64035
64035
|
}
|
|
@@ -66551,7 +66551,7 @@ var require_moment = __commonJS({
|
|
|
66551
66551
|
function monthsToDays(months2) {
|
|
66552
66552
|
return months2 * 146097 / 4800;
|
|
66553
66553
|
}
|
|
66554
|
-
function
|
|
66554
|
+
function as2(units) {
|
|
66555
66555
|
if (!this.isValid()) {
|
|
66556
66556
|
return NaN;
|
|
66557
66557
|
}
|
|
@@ -66719,7 +66719,7 @@ var require_moment = __commonJS({
|
|
|
66719
66719
|
proto$2.abs = abs;
|
|
66720
66720
|
proto$2.add = add$1;
|
|
66721
66721
|
proto$2.subtract = subtract$1;
|
|
66722
|
-
proto$2.as =
|
|
66722
|
+
proto$2.as = as2;
|
|
66723
66723
|
proto$2.asMilliseconds = asMilliseconds;
|
|
66724
66724
|
proto$2.asSeconds = asSeconds;
|
|
66725
66725
|
proto$2.asMinutes = asMinutes;
|
|
@@ -66820,7 +66820,7 @@ var require_moment = __commonJS({
|
|
|
66820
66820
|
var require_FileStreamRotator = __commonJS({
|
|
66821
66821
|
"../../node_modules/file-stream-rotator/FileStreamRotator.js"(exports2, module2) {
|
|
66822
66822
|
"use strict";
|
|
66823
|
-
var
|
|
66823
|
+
var fs3 = require("fs");
|
|
66824
66824
|
var path4 = require("path");
|
|
66825
66825
|
var moment = require_moment();
|
|
66826
66826
|
var crypto2 = require("crypto");
|
|
@@ -66870,15 +66870,15 @@ var require_FileStreamRotator = __commonJS({
|
|
|
66870
66870
|
};
|
|
66871
66871
|
FileStreamRotator.parseFileSize = function(size) {
|
|
66872
66872
|
if (size && typeof size == "string") {
|
|
66873
|
-
var
|
|
66874
|
-
if (
|
|
66875
|
-
switch (
|
|
66873
|
+
var _s = size.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);
|
|
66874
|
+
if (_s) {
|
|
66875
|
+
switch (_s[2]) {
|
|
66876
66876
|
case "k":
|
|
66877
|
-
return
|
|
66877
|
+
return _s[1] * 1024;
|
|
66878
66878
|
case "m":
|
|
66879
|
-
return
|
|
66879
|
+
return _s[1] * 1024 * 1024;
|
|
66880
66880
|
case "g":
|
|
66881
|
-
return
|
|
66881
|
+
return _s[1] * 1024 * 1024 * 1024;
|
|
66882
66882
|
}
|
|
66883
66883
|
}
|
|
66884
66884
|
}
|
|
@@ -66915,10 +66915,10 @@ var require_FileStreamRotator = __commonJS({
|
|
|
66915
66915
|
try {
|
|
66916
66916
|
if (audit_file) {
|
|
66917
66917
|
var full_path = path4.resolve(audit_file);
|
|
66918
|
-
_rtn = JSON.parse(
|
|
66918
|
+
_rtn = JSON.parse(fs3.readFileSync(full_path, { encoding: "utf-8" }));
|
|
66919
66919
|
} else {
|
|
66920
66920
|
var full_path = path4.resolve(baseLog + "/.audit.json");
|
|
66921
|
-
_rtn = JSON.parse(
|
|
66921
|
+
_rtn = JSON.parse(fs3.readFileSync(full_path, { encoding: "utf-8" }));
|
|
66922
66922
|
}
|
|
66923
66923
|
} catch (e) {
|
|
66924
66924
|
if (e.code !== "ENOENT") {
|
|
@@ -66944,7 +66944,7 @@ var require_FileStreamRotator = __commonJS({
|
|
|
66944
66944
|
FileStreamRotator.writeAuditLog = function(audit, verbose) {
|
|
66945
66945
|
try {
|
|
66946
66946
|
mkDirForFile(audit.auditLog);
|
|
66947
|
-
|
|
66947
|
+
fs3.writeFileSync(audit.auditLog, JSON.stringify(audit, null, 4));
|
|
66948
66948
|
} catch (e) {
|
|
66949
66949
|
if (verbose) {
|
|
66950
66950
|
console.error(/* @__PURE__ */ new Date(), "[FileStreamRotator] Failed to store log audit at:", audit.auditLog, "Error:", e);
|
|
@@ -66954,8 +66954,8 @@ var require_FileStreamRotator = __commonJS({
|
|
|
66954
66954
|
function removeFile(file, verbose) {
|
|
66955
66955
|
if (file.hash === crypto2.createHash(file.hashType).update(file.name + "LOG_FILE" + file.date).digest("hex")) {
|
|
66956
66956
|
try {
|
|
66957
|
-
if (
|
|
66958
|
-
|
|
66957
|
+
if (fs3.existsSync(file.name)) {
|
|
66958
|
+
fs3.unlinkSync(file.name);
|
|
66959
66959
|
}
|
|
66960
66960
|
} catch (e) {
|
|
66961
66961
|
if (verbose) {
|
|
@@ -66970,15 +66970,15 @@ var require_FileStreamRotator = __commonJS({
|
|
|
66970
66970
|
let logfileName = path4.basename(logfile);
|
|
66971
66971
|
let current = logPath + "/" + symLinkName;
|
|
66972
66972
|
try {
|
|
66973
|
-
let stats =
|
|
66973
|
+
let stats = fs3.lstatSync(current);
|
|
66974
66974
|
if (stats.isSymbolicLink()) {
|
|
66975
|
-
|
|
66976
|
-
|
|
66975
|
+
fs3.unlinkSync(current);
|
|
66976
|
+
fs3.symlinkSync(logfileName, current);
|
|
66977
66977
|
}
|
|
66978
66978
|
} catch (err) {
|
|
66979
66979
|
if (err && err.code == "ENOENT") {
|
|
66980
66980
|
try {
|
|
66981
|
-
|
|
66981
|
+
fs3.symlinkSync(logfileName, current);
|
|
66982
66982
|
} catch (e) {
|
|
66983
66983
|
if (verbose) {
|
|
66984
66984
|
console.error(/* @__PURE__ */ new Date(), "[FileStreamRotator] Could not create symlink file: ", current, " -> ", logfileName);
|
|
@@ -66990,11 +66990,11 @@ var require_FileStreamRotator = __commonJS({
|
|
|
66990
66990
|
function createLogWatcher(logfile, verbose, cb) {
|
|
66991
66991
|
if (!logfile) return null;
|
|
66992
66992
|
try {
|
|
66993
|
-
let stats =
|
|
66994
|
-
return
|
|
66993
|
+
let stats = fs3.lstatSync(logfile);
|
|
66994
|
+
return fs3.watch(logfile, function(event, filename) {
|
|
66995
66995
|
if (event == "rename") {
|
|
66996
66996
|
try {
|
|
66997
|
-
let stats2 =
|
|
66997
|
+
let stats2 = fs3.lstatSync(logfile);
|
|
66998
66998
|
} catch (err) {
|
|
66999
66999
|
cb(err, logfile);
|
|
67000
67000
|
}
|
|
@@ -67110,13 +67110,13 @@ var require_FileStreamRotator = __commonJS({
|
|
|
67110
67110
|
if (fileCount == 0 && t_log == logfile) {
|
|
67111
67111
|
t_log += options.extension;
|
|
67112
67112
|
}
|
|
67113
|
-
while (f2 =
|
|
67113
|
+
while (f2 = fs3.existsSync(t_log)) {
|
|
67114
67114
|
lastLogFile = t_log;
|
|
67115
67115
|
fileCount++;
|
|
67116
67116
|
t_log = logfile + "." + fileCount + options.extension;
|
|
67117
67117
|
}
|
|
67118
67118
|
if (lastLogFile) {
|
|
67119
|
-
var lastLogFileStats =
|
|
67119
|
+
var lastLogFileStats = fs3.statSync(lastLogFile);
|
|
67120
67120
|
if (lastLogFileStats.size < fileSize) {
|
|
67121
67121
|
t_log = lastLogFile;
|
|
67122
67122
|
fileCount--;
|
|
@@ -67132,7 +67132,7 @@ var require_FileStreamRotator = __commonJS({
|
|
|
67132
67132
|
}
|
|
67133
67133
|
mkDirForFile(logfile);
|
|
67134
67134
|
var file_options = options.file_options || { flags: "a" };
|
|
67135
|
-
var rotateStream =
|
|
67135
|
+
var rotateStream = fs3.createWriteStream(logfile, file_options);
|
|
67136
67136
|
if (curDate && frequencyMetaData && staticFrequency.indexOf(frequencyMetaData.type) > -1 || fileSize > 0) {
|
|
67137
67137
|
if (self2.verbose) {
|
|
67138
67138
|
console.log(/* @__PURE__ */ new Date(), "[FileStreamRotator] Rotating file: ", frequencyMetaData ? frequencyMetaData.type : "", fileSize ? "size: " + fileSize : "");
|
|
@@ -67171,12 +67171,12 @@ var require_FileStreamRotator = __commonJS({
|
|
|
67171
67171
|
});
|
|
67172
67172
|
stream.on("createLog", function(file) {
|
|
67173
67173
|
try {
|
|
67174
|
-
let stats =
|
|
67174
|
+
let stats = fs3.lstatSync(file);
|
|
67175
67175
|
} catch (err) {
|
|
67176
67176
|
if (rotateStream && rotateStream.end == "function") {
|
|
67177
67177
|
rotateStream.end();
|
|
67178
67178
|
}
|
|
67179
|
-
rotateStream =
|
|
67179
|
+
rotateStream = fs3.createWriteStream(file, file_options);
|
|
67180
67180
|
stream.emit("new", file);
|
|
67181
67181
|
BubbleEvents(rotateStream, stream);
|
|
67182
67182
|
}
|
|
@@ -67208,7 +67208,7 @@ var require_FileStreamRotator = __commonJS({
|
|
|
67208
67208
|
rotateStream.destroy();
|
|
67209
67209
|
}
|
|
67210
67210
|
mkDirForFile(logfile);
|
|
67211
|
-
rotateStream =
|
|
67211
|
+
rotateStream = fs3.createWriteStream(newLogfile, file_options);
|
|
67212
67212
|
stream.emit("new", newLogfile);
|
|
67213
67213
|
stream.emit("rotate", oldFile, newLogfile);
|
|
67214
67214
|
BubbleEvents(rotateStream, stream);
|
|
@@ -67236,9 +67236,9 @@ var require_FileStreamRotator = __commonJS({
|
|
|
67236
67236
|
_path.split(path4.sep).reduce(
|
|
67237
67237
|
function(fullPath, folder) {
|
|
67238
67238
|
fullPath += folder + path4.sep;
|
|
67239
|
-
if (!
|
|
67239
|
+
if (!fs3.existsSync(fullPath)) {
|
|
67240
67240
|
try {
|
|
67241
|
-
|
|
67241
|
+
fs3.mkdirSync(fullPath);
|
|
67242
67242
|
} catch (e) {
|
|
67243
67243
|
if (e.code !== "EEXIST") {
|
|
67244
67244
|
throw e;
|
|
@@ -67271,7 +67271,7 @@ var require_FileStreamRotator = __commonJS({
|
|
|
67271
67271
|
var require_daily_rotate_file = __commonJS({
|
|
67272
67272
|
"../../node_modules/winston-daily-rotate-file/daily-rotate-file.js"(exports2, module2) {
|
|
67273
67273
|
"use strict";
|
|
67274
|
-
var
|
|
67274
|
+
var fs3 = require("fs");
|
|
67275
67275
|
var os2 = require("os");
|
|
67276
67276
|
var path4 = require("path");
|
|
67277
67277
|
var util = require("util");
|
|
@@ -67363,7 +67363,7 @@ var require_daily_rotate_file = __commonJS({
|
|
|
67363
67363
|
if (options.zippedArchive) {
|
|
67364
67364
|
const gzName = params.name + ".gz";
|
|
67365
67365
|
try {
|
|
67366
|
-
|
|
67366
|
+
fs3.unlinkSync(gzName);
|
|
67367
67367
|
} catch (err) {
|
|
67368
67368
|
if (err.code !== "ENOENT") {
|
|
67369
67369
|
err.message = `Error occurred while removing ${gzName}: ${err.message}`;
|
|
@@ -67379,7 +67379,7 @@ var require_daily_rotate_file = __commonJS({
|
|
|
67379
67379
|
if (options.zippedArchive) {
|
|
67380
67380
|
this.logStream.on("rotate", (oldFile) => {
|
|
67381
67381
|
try {
|
|
67382
|
-
if (!
|
|
67382
|
+
if (!fs3.existsSync(oldFile)) {
|
|
67383
67383
|
return;
|
|
67384
67384
|
}
|
|
67385
67385
|
} catch (err) {
|
|
@@ -67388,7 +67388,7 @@ var require_daily_rotate_file = __commonJS({
|
|
|
67388
67388
|
return;
|
|
67389
67389
|
}
|
|
67390
67390
|
try {
|
|
67391
|
-
if (
|
|
67391
|
+
if (fs3.existsSync(`${oldFile}.gz`)) {
|
|
67392
67392
|
return;
|
|
67393
67393
|
}
|
|
67394
67394
|
} catch (err) {
|
|
@@ -67397,19 +67397,19 @@ var require_daily_rotate_file = __commonJS({
|
|
|
67397
67397
|
return;
|
|
67398
67398
|
}
|
|
67399
67399
|
const gzip = zlib.createGzip();
|
|
67400
|
-
const inp =
|
|
67400
|
+
const inp = fs3.createReadStream(oldFile);
|
|
67401
67401
|
inp.on("error", (err) => {
|
|
67402
67402
|
err.message = `Error occurred while reading ${oldFile}: ${err.message}`;
|
|
67403
67403
|
this.emit("error", err);
|
|
67404
67404
|
});
|
|
67405
|
-
const out =
|
|
67405
|
+
const out = fs3.createWriteStream(oldFile + ".gz");
|
|
67406
67406
|
out.on("error", (err) => {
|
|
67407
67407
|
err.message = `Error occurred while writing ${oldFile}.gz: ${err.message}`;
|
|
67408
67408
|
this.emit("error", err);
|
|
67409
67409
|
});
|
|
67410
67410
|
inp.pipe(gzip).pipe(out).on("finish", () => {
|
|
67411
67411
|
try {
|
|
67412
|
-
|
|
67412
|
+
fs3.unlinkSync(oldFile);
|
|
67413
67413
|
} catch (err) {
|
|
67414
67414
|
if (err.code !== "ENOENT") {
|
|
67415
67415
|
err.message = `Error occurred while removing ${oldFile}: ${err.message}`;
|
|
@@ -67474,7 +67474,7 @@ var require_daily_rotate_file = __commonJS({
|
|
|
67474
67474
|
options.order = options.order || "desc";
|
|
67475
67475
|
const logFiles = (() => {
|
|
67476
67476
|
const fileRegex = new RegExp(this.filename.replace("%DATE%", ".*"), "i");
|
|
67477
|
-
return
|
|
67477
|
+
return fs3.readdirSync(this.dirname).filter((file) => path4.basename(file).match(fileRegex));
|
|
67478
67478
|
})();
|
|
67479
67479
|
if (logFiles.length === 0 && callback) {
|
|
67480
67480
|
callback(null, results);
|
|
@@ -67488,14 +67488,14 @@ var require_daily_rotate_file = __commonJS({
|
|
|
67488
67488
|
let stream;
|
|
67489
67489
|
if (file.endsWith(".gz")) {
|
|
67490
67490
|
stream = new PassThrough();
|
|
67491
|
-
const inp =
|
|
67491
|
+
const inp = fs3.createReadStream(logFile);
|
|
67492
67492
|
inp.on("error", (err) => {
|
|
67493
67493
|
err.message = `Error occurred while reading ${logFile}: ${err.message}`;
|
|
67494
67494
|
stream.emit("error", err);
|
|
67495
67495
|
});
|
|
67496
67496
|
inp.pipe(zlib.createGunzip()).pipe(stream);
|
|
67497
67497
|
} else {
|
|
67498
|
-
stream =
|
|
67498
|
+
stream = fs3.createReadStream(logFile, {
|
|
67499
67499
|
encoding: "utf8"
|
|
67500
67500
|
});
|
|
67501
67501
|
}
|
|
@@ -67588,9 +67588,9 @@ __export(main_exports, {
|
|
|
67588
67588
|
module.exports = __toCommonJS(main_exports);
|
|
67589
67589
|
|
|
67590
67590
|
// ../core/dist/esm/index.mjs
|
|
67591
|
-
var
|
|
67592
|
-
var
|
|
67593
|
-
var c = (r6, e, t) =>
|
|
67591
|
+
var Oo = Object.defineProperty;
|
|
67592
|
+
var Io = (r6, e, t) => e in r6 ? Oo(r6, e, { enumerable: true, configurable: true, writable: true, value: t }) : r6[e] = t;
|
|
67593
|
+
var c = (r6, e, t) => Io(r6, typeof e != "symbol" ? e + "" : e, t);
|
|
67594
67594
|
var pt = class {
|
|
67595
67595
|
constructor(e, t) {
|
|
67596
67596
|
c(this, "operator");
|
|
@@ -67636,10 +67636,10 @@ var dt = class {
|
|
|
67636
67636
|
}, precedence: t });
|
|
67637
67637
|
}
|
|
67638
67638
|
construct(e) {
|
|
67639
|
-
return new
|
|
67639
|
+
return new dr(e, this.prefixParselets, this.infixParselets);
|
|
67640
67640
|
}
|
|
67641
67641
|
};
|
|
67642
|
-
var
|
|
67642
|
+
var dr = class {
|
|
67643
67643
|
constructor(e, t, n) {
|
|
67644
67644
|
c(this, "tokens");
|
|
67645
67645
|
c(this, "prefixParselets");
|
|
@@ -67690,7 +67690,7 @@ var pr = class {
|
|
|
67690
67690
|
return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
|
|
67691
67691
|
}
|
|
67692
67692
|
};
|
|
67693
|
-
var
|
|
67693
|
+
var Ve = class {
|
|
67694
67694
|
constructor(e = 10) {
|
|
67695
67695
|
c(this, "max");
|
|
67696
67696
|
c(this, "cache");
|
|
@@ -67716,102 +67716,103 @@ var De = class {
|
|
|
67716
67716
|
return this.cache.keys().next().value;
|
|
67717
67717
|
}
|
|
67718
67718
|
};
|
|
67719
|
-
var ft = "
|
|
67720
|
-
var
|
|
67721
|
-
var mr = "not-
|
|
67722
|
-
var
|
|
67719
|
+
var ft = "http://hl7.org";
|
|
67720
|
+
var mt = "created";
|
|
67721
|
+
var mr = "not-modified";
|
|
67722
|
+
var yr = "not-found";
|
|
67723
|
+
var xr = "unauthorized";
|
|
67723
67724
|
var ht = "accepted";
|
|
67724
|
-
var
|
|
67725
|
-
var Me = { resourceType: "OperationOutcome", id:
|
|
67726
|
-
var
|
|
67727
|
-
var
|
|
67725
|
+
var Vn = { resourceType: "OperationOutcome", id: yr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
|
|
67726
|
+
var Me = { resourceType: "OperationOutcome", id: xr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
|
|
67727
|
+
var Mn = { ...Me, issue: [...Me.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
|
|
67728
|
+
var vr = { ...Me, issue: [...Me.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
|
|
67728
67729
|
function R(r6, e) {
|
|
67729
67730
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
|
|
67730
67731
|
}
|
|
67731
67732
|
function x(r6) {
|
|
67732
67733
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
|
|
67733
67734
|
}
|
|
67734
|
-
function
|
|
67735
|
+
function _n(r6) {
|
|
67735
67736
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
|
|
67736
67737
|
}
|
|
67737
|
-
function
|
|
67738
|
+
function Tr(r6) {
|
|
67738
67739
|
return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
|
|
67739
67740
|
}
|
|
67740
67741
|
function Ge(r6) {
|
|
67741
67742
|
return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
|
|
67742
67743
|
}
|
|
67743
|
-
function
|
|
67744
|
-
return r6.id === "ok" || r6.id ===
|
|
67744
|
+
function br(r6) {
|
|
67745
|
+
return r6.id === "ok" || r6.id === mt || r6.id === mr || r6.id === ht;
|
|
67745
67746
|
}
|
|
67746
67747
|
var f = class extends Error {
|
|
67747
67748
|
constructor(t, n) {
|
|
67748
|
-
super(
|
|
67749
|
+
super(Ln(t), n);
|
|
67749
67750
|
c(this, "outcome");
|
|
67750
67751
|
this.name = "OperationOutcomeError", this.outcome = t;
|
|
67751
67752
|
}
|
|
67752
67753
|
};
|
|
67753
|
-
function
|
|
67754
|
+
function yt(r6) {
|
|
67754
67755
|
return r6 instanceof f ? r6.outcome : Ge(r6) ? r6 : R(_e(r6));
|
|
67755
67756
|
}
|
|
67756
67757
|
function _e(r6) {
|
|
67757
|
-
return r6 ? typeof r6 == "string" ? r6 :
|
|
67758
|
+
return r6 ? typeof r6 == "string" ? r6 : Tr(r6) ? r6.message : Ge(r6) ? Ln(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
|
|
67758
67759
|
}
|
|
67759
|
-
function
|
|
67760
|
-
let e = r6.issue?.map(
|
|
67760
|
+
function Ln(r6) {
|
|
67761
|
+
let e = r6.issue?.map(ko) ?? [];
|
|
67761
67762
|
return e.length > 0 ? e.join("; ") : "Unknown error";
|
|
67762
67763
|
}
|
|
67763
|
-
function
|
|
67764
|
+
function ko(r6) {
|
|
67764
67765
|
let e;
|
|
67765
67766
|
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;
|
|
67766
67767
|
}
|
|
67767
|
-
function
|
|
67768
|
+
function Vo(r6, e) {
|
|
67768
67769
|
let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
|
|
67769
67770
|
return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
|
|
67770
67771
|
}
|
|
67771
|
-
function
|
|
67772
|
+
function Un(r6) {
|
|
67772
67773
|
let e = /* @__PURE__ */ Object.create(null);
|
|
67773
|
-
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,
|
|
67774
|
+
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, Vo(i, o2)])), constraints: [], innerTypes: [] };
|
|
67774
67775
|
return e;
|
|
67775
67776
|
}
|
|
67776
|
-
var Ln = { 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" }] } } } };
|
|
67777
|
-
function
|
|
67778
|
-
return new
|
|
67777
|
+
var Bn = { 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" }] } } } };
|
|
67778
|
+
function Cr(r6) {
|
|
67779
|
+
return new Er(r6).parse();
|
|
67779
67780
|
}
|
|
67780
|
-
var Te =
|
|
67781
|
-
var
|
|
67782
|
-
var
|
|
67783
|
-
var
|
|
67784
|
-
function
|
|
67781
|
+
var Te = Un(Bn);
|
|
67782
|
+
var Pr = /* @__PURE__ */ Object.create(null);
|
|
67783
|
+
var qn = /* @__PURE__ */ Object.create(null);
|
|
67784
|
+
var _o = { "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" };
|
|
67785
|
+
function Hn(r6) {
|
|
67785
67786
|
let e;
|
|
67786
|
-
return e =
|
|
67787
|
+
return e = qn[r6], e || (e = qn[r6] = /* @__PURE__ */ Object.create(null)), e;
|
|
67787
67788
|
}
|
|
67788
|
-
function
|
|
67789
|
+
function Ar(r6) {
|
|
67789
67790
|
let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
|
|
67790
|
-
|
|
67791
|
-
for (let n of t)
|
|
67791
|
+
Kn(t);
|
|
67792
|
+
for (let n of t) wr(n);
|
|
67792
67793
|
}
|
|
67793
|
-
function
|
|
67794
|
+
function wr(r6) {
|
|
67794
67795
|
if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
|
|
67795
67796
|
if (r6.resourceType !== "StructureDefinition") return;
|
|
67796
|
-
let e =
|
|
67797
|
-
t ? (n = Te, 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 = Te, i = r6.type) : (n =
|
|
67797
|
+
let e = Cr(r6), t = _o[r6.url], n, i;
|
|
67798
|
+
t ? (n = Te, 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 = Te, i = r6.type) : (n = Hn(r6.url), i = r6.type), n[i] = e;
|
|
67798
67799
|
for (let o2 of e.innerTypes) o2.parentType = e, n[o2.name] = o2;
|
|
67799
|
-
|
|
67800
|
+
Pr[r6.url] = e;
|
|
67800
67801
|
}
|
|
67801
|
-
function
|
|
67802
|
+
function Qn(r6) {
|
|
67802
67803
|
return !!Te[r6];
|
|
67803
67804
|
}
|
|
67804
67805
|
function Qe(r6, e) {
|
|
67805
67806
|
if (e) {
|
|
67806
|
-
let t =
|
|
67807
|
+
let t = Hn(e)[r6];
|
|
67807
67808
|
if (t) return t;
|
|
67808
67809
|
}
|
|
67809
67810
|
return Te[r6];
|
|
67810
67811
|
}
|
|
67811
|
-
function
|
|
67812
|
-
return !!
|
|
67812
|
+
function zn(r6) {
|
|
67813
|
+
return !!Pr[r6];
|
|
67813
67814
|
}
|
|
67814
|
-
var
|
|
67815
|
+
var Er = class {
|
|
67815
67816
|
constructor(e) {
|
|
67816
67817
|
c(this, "root");
|
|
67817
67818
|
c(this, "elements");
|
|
@@ -67822,7 +67823,7 @@ var Sr = class {
|
|
|
67822
67823
|
c(this, "innerTypes");
|
|
67823
67824
|
c(this, "backboneContext");
|
|
67824
67825
|
if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
|
|
67825
|
-
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:
|
|
67826
|
+
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: Uo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
|
|
67826
67827
|
}
|
|
67827
67828
|
parse() {
|
|
67828
67829
|
let e = this.next();
|
|
@@ -67830,7 +67831,7 @@ var Sr = class {
|
|
|
67830
67831
|
if (e.sliceName) this.parseSliceStart(e);
|
|
67831
67832
|
else if (e.id?.includes(":")) {
|
|
67832
67833
|
if (this.slicingContext?.current) {
|
|
67833
|
-
let t =
|
|
67834
|
+
let t = Sr(e, this.slicingContext.path);
|
|
67834
67835
|
this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
|
|
67835
67836
|
}
|
|
67836
67837
|
} else {
|
|
@@ -67839,13 +67840,13 @@ var Sr = class {
|
|
|
67839
67840
|
let n = this.backboneContext;
|
|
67840
67841
|
for (; n; ) {
|
|
67841
67842
|
if (e.path?.startsWith(n.path + ".")) {
|
|
67842
|
-
n.type.elements[
|
|
67843
|
+
n.type.elements[Sr(e, n.path)] = t;
|
|
67843
67844
|
break;
|
|
67844
67845
|
}
|
|
67845
67846
|
n = n.parent;
|
|
67846
67847
|
}
|
|
67847
67848
|
if (!n) {
|
|
67848
|
-
let i =
|
|
67849
|
+
let i = Sr(e, this.root.path);
|
|
67849
67850
|
e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
|
|
67850
67851
|
}
|
|
67851
67852
|
this.checkFieldExit(e);
|
|
@@ -67859,11 +67860,11 @@ var Sr = class {
|
|
|
67859
67860
|
}
|
|
67860
67861
|
enterInnerType(e) {
|
|
67861
67862
|
for (; this.backboneContext && !Le(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
|
|
67862
|
-
let t =
|
|
67863
|
+
let t = Rr(e);
|
|
67863
67864
|
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: Le(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
|
|
67864
67865
|
}
|
|
67865
67866
|
enterSlice(e, t) {
|
|
67866
|
-
|
|
67867
|
+
No(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
|
|
67867
67868
|
if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
|
|
67868
67869
|
return { path: n.path, type: n.type };
|
|
67869
67870
|
}), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
|
|
@@ -67899,52 +67900,52 @@ var Sr = class {
|
|
|
67899
67900
|
parseElementDefinitionType(e) {
|
|
67900
67901
|
return (e.type ?? []).map((t) => {
|
|
67901
67902
|
let n;
|
|
67902
|
-
return (t.code === "BackboneElement" || t.code === "Element") && (n =
|
|
67903
|
+
return (t.code === "BackboneElement" || t.code === "Element") && (n = Rr(e)), n || (n = le(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
|
|
67903
67904
|
});
|
|
67904
67905
|
}
|
|
67905
67906
|
parseElementDefinition(e) {
|
|
67906
|
-
let t =
|
|
67907
|
-
return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o2) => ({ key: o2.key ?? "", severity: o2.severity ?? "error", expression: o2.expression ?? "", description: o2.human ?? "" })), type: this.parseElementDefinitionType(e), fixed:
|
|
67907
|
+
let t = jn(e.max), n = e.base?.max ? jn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
|
|
67908
|
+
return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o2) => ({ key: o2.key ?? "", severity: o2.severity ?? "error", expression: o2.expression ?? "", description: o2.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: $n(V(i, "fixed[x]")), pattern: $n(V(i, "pattern[x]")), binding: e.binding };
|
|
67908
67909
|
}
|
|
67909
67910
|
};
|
|
67910
|
-
function
|
|
67911
|
+
function jn(r6) {
|
|
67911
67912
|
return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
|
|
67912
67913
|
}
|
|
67913
|
-
function
|
|
67914
|
-
return
|
|
67914
|
+
function Sr(r6, e = "") {
|
|
67915
|
+
return Fo(r6.path, e);
|
|
67915
67916
|
}
|
|
67916
|
-
function
|
|
67917
|
+
function Fo(r6, e) {
|
|
67917
67918
|
return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
|
|
67918
67919
|
}
|
|
67919
67920
|
function Le(r6, e) {
|
|
67920
67921
|
return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
|
|
67921
67922
|
}
|
|
67922
|
-
function
|
|
67923
|
+
function $n(r6) {
|
|
67923
67924
|
return Array.isArray(r6) && r6.length > 0 ? r6[0] : C(r6) ? void 0 : r6;
|
|
67924
67925
|
}
|
|
67925
|
-
function
|
|
67926
|
+
function No(r6) {
|
|
67926
67927
|
let e = r6.slicing?.discriminator;
|
|
67927
67928
|
return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
|
|
67928
67929
|
}
|
|
67929
|
-
function
|
|
67930
|
+
function Uo(r6) {
|
|
67930
67931
|
let e = r6.description;
|
|
67931
67932
|
return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
|
|
67932
67933
|
}
|
|
67933
67934
|
function Vr(r6, e, t) {
|
|
67934
67935
|
let n = r6.path;
|
|
67935
|
-
return
|
|
67936
|
+
return Bo(V(r6, e, t), n, e);
|
|
67936
67937
|
}
|
|
67937
|
-
function
|
|
67938
|
+
function Bo(r6, e, t) {
|
|
67938
67939
|
let n = e ? e + "." : "";
|
|
67939
67940
|
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}` };
|
|
67940
67941
|
}
|
|
67941
|
-
var
|
|
67942
|
+
var qo = new Ve(1e3);
|
|
67942
67943
|
var ze = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, 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: /.*/ };
|
|
67943
|
-
function
|
|
67944
|
+
function h(r6) {
|
|
67944
67945
|
return [{ type: d.boolean, value: r6 }];
|
|
67945
67946
|
}
|
|
67946
67947
|
function b(r6) {
|
|
67947
|
-
return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: d.integer, value: r6 } : typeof r6 == "number" ? { type: d.decimal, value: r6 } : typeof r6 == "boolean" ? { type: d.boolean, value: r6 } : typeof r6 == "string" ? { type: d.string, value: r6 } :
|
|
67948
|
+
return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: d.integer, value: r6 } : typeof r6 == "number" ? { type: d.decimal, value: r6 } : typeof r6 == "boolean" ? { type: d.boolean, value: r6 } : typeof r6 == "string" ? { type: d.string, value: r6 } : I(r6) ? { type: d.Quantity, value: r6 } : k(r6) ? { type: r6.resourceType, value: r6 } : Wr(r6) ? { type: d.CodeableConcept, value: r6 } : qr(r6) ? { type: d.Coding, value: r6 } : { type: d.BackboneElement, value: r6 };
|
|
67948
67949
|
}
|
|
67949
67950
|
function U(r6) {
|
|
67950
67951
|
return r6.length === 0 ? false : !!r6[0].value;
|
|
@@ -67957,15 +67958,15 @@ function J(r6, e) {
|
|
|
67957
67958
|
}
|
|
67958
67959
|
function V(r6, e, t) {
|
|
67959
67960
|
if (!r6.value) return;
|
|
67960
|
-
let n =
|
|
67961
|
-
return n ?
|
|
67961
|
+
let n = Et(r6.type, e, t?.profileUrl);
|
|
67962
|
+
return n ? Ko(r6, e, n) : Yo(r6, e);
|
|
67962
67963
|
}
|
|
67963
|
-
function
|
|
67964
|
+
function Ko(r6, e, t) {
|
|
67964
67965
|
let n = r6.value, i = t.type;
|
|
67965
67966
|
if (!i || i.length === 0) return;
|
|
67966
67967
|
let o2, s = "undefined", a, u2 = t.path.lastIndexOf("."), l2 = t.path.substring(u2 + 1);
|
|
67967
67968
|
for (let p of i) {
|
|
67968
|
-
let y2 = l2.replace("[x]",
|
|
67969
|
+
let y2 = l2.replace("[x]", M(p.code));
|
|
67969
67970
|
if (o2 = n[y2], a = n["_" + y2], o2 !== void 0 || a !== void 0) {
|
|
67970
67971
|
s = p.code;
|
|
67971
67972
|
break;
|
|
@@ -67973,17 +67974,17 @@ function $o(r6, e, t) {
|
|
|
67973
67974
|
}
|
|
67974
67975
|
if (a) if (Array.isArray(o2)) {
|
|
67975
67976
|
o2 = o2.slice();
|
|
67976
|
-
for (let p = 0; p < Math.max(o2.length, a.length); p++) o2[p] =
|
|
67977
|
+
for (let p = 0; p < Math.max(o2.length, a.length); p++) o2[p] = Nr(o2[p], a[p]);
|
|
67977
67978
|
} else if (!o2 && Array.isArray(a)) {
|
|
67978
67979
|
o2 = a.slice();
|
|
67979
|
-
for (let p = 0; p < a.length; p++) o2[p] =
|
|
67980
|
-
} else o2 =
|
|
67981
|
-
if (!C(o2)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o2) ? o2.map((p) =>
|
|
67980
|
+
for (let p = 0; p < a.length; p++) o2[p] = Nr(void 0, a[p]);
|
|
67981
|
+
} else o2 = Nr(o2, a);
|
|
67982
|
+
if (!C(o2)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o2) ? o2.map((p) => Yn(p, s)) : Yn(o2, s);
|
|
67982
67983
|
}
|
|
67983
|
-
function
|
|
67984
|
-
return e === "Resource" &&
|
|
67984
|
+
function Yn(r6, e) {
|
|
67985
|
+
return e === "Resource" && k(r6) && (e = r6.resourceType), { type: e, value: r6 };
|
|
67985
67986
|
}
|
|
67986
|
-
function
|
|
67987
|
+
function Yo(r6, e) {
|
|
67987
67988
|
let t = r6.value;
|
|
67988
67989
|
if (!t || typeof t != "object") return;
|
|
67989
67990
|
let n;
|
|
@@ -67993,7 +67994,7 @@ function Ho(r6, e) {
|
|
|
67993
67994
|
} else {
|
|
67994
67995
|
let i = e.endsWith("[x]") ? e.substring(0, e.length - 3) : e;
|
|
67995
67996
|
for (let o2 of Object.values(d)) {
|
|
67996
|
-
let s = i +
|
|
67997
|
+
let s = i + M(o2);
|
|
67997
67998
|
if (s in t) {
|
|
67998
67999
|
let a = t[s];
|
|
67999
68000
|
Array.isArray(a) ? n = a.map((u2) => ({ type: o2, value: u2 })) : n = { type: o2, value: a };
|
|
@@ -68006,7 +68007,7 @@ function Ho(r6, e) {
|
|
|
68006
68007
|
} else if (C(n)) return;
|
|
68007
68008
|
return n;
|
|
68008
68009
|
}
|
|
68009
|
-
function
|
|
68010
|
+
function Tt(r6) {
|
|
68010
68011
|
let e = [];
|
|
68011
68012
|
for (let t of r6) {
|
|
68012
68013
|
let n = false;
|
|
@@ -68018,31 +68019,31 @@ function vt(r6) {
|
|
|
68018
68019
|
}
|
|
68019
68020
|
return e;
|
|
68020
68021
|
}
|
|
68021
|
-
function
|
|
68022
|
-
return
|
|
68022
|
+
function ei(r6) {
|
|
68023
|
+
return h(!U(r6));
|
|
68023
68024
|
}
|
|
68024
|
-
function
|
|
68025
|
-
return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ?
|
|
68025
|
+
function ti(r6, e) {
|
|
68026
|
+
return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => U(Ke(t, e[n]))));
|
|
68026
68027
|
}
|
|
68027
|
-
function
|
|
68028
|
-
return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ?
|
|
68028
|
+
function ri(r6, e) {
|
|
68029
|
+
return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !U(Ke(t, e[n]))));
|
|
68029
68030
|
}
|
|
68030
68031
|
function Ke(r6, e) {
|
|
68031
68032
|
let t = r6.value?.valueOf(), n = e.value?.valueOf();
|
|
68032
|
-
return typeof t == "number" && typeof n == "number" ?
|
|
68033
|
+
return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : I(t) && I(n) ? h(oi(t, n)) : h(typeof t == "object" && typeof n == "object" ? Br(r6, e) : t === n);
|
|
68033
68034
|
}
|
|
68034
|
-
function
|
|
68035
|
-
return r6.length === 0 && e.length === 0 ?
|
|
68035
|
+
function Ur(r6, e) {
|
|
68036
|
+
return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Xn), e.sort(Xn), h(r6.every((t, n) => U(Xo(t, e[n])))));
|
|
68036
68037
|
}
|
|
68037
|
-
function
|
|
68038
|
+
function Xo(r6, e) {
|
|
68038
68039
|
let { type: t, value: n } = r6, { type: i, value: o2 } = e, s = n?.valueOf(), a = o2?.valueOf();
|
|
68039
|
-
return typeof s == "number" && typeof a == "number" ?
|
|
68040
|
+
return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : I(s) && I(a) ? h(oi(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" ? Br({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
|
|
68040
68041
|
}
|
|
68041
|
-
function
|
|
68042
|
+
function Xn(r6, e) {
|
|
68042
68043
|
let t = r6.value?.valueOf(), n = e.value?.valueOf();
|
|
68043
68044
|
return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
|
|
68044
68045
|
}
|
|
68045
|
-
function
|
|
68046
|
+
function bt(r6, e) {
|
|
68046
68047
|
let { value: t } = r6;
|
|
68047
68048
|
if (t == null) return false;
|
|
68048
68049
|
let n = e;
|
|
@@ -68053,82 +68054,82 @@ function Tt(r6, e) {
|
|
|
68053
68054
|
case "Integer":
|
|
68054
68055
|
return typeof t == "number";
|
|
68055
68056
|
case "Date":
|
|
68056
|
-
return
|
|
68057
|
+
return ni(t);
|
|
68057
68058
|
case "DateTime":
|
|
68058
68059
|
return Ue(t);
|
|
68059
68060
|
case "Time":
|
|
68060
68061
|
return typeof t == "string" && !!/^T\d/.exec(t);
|
|
68061
68062
|
case "Period":
|
|
68062
|
-
return
|
|
68063
|
+
return ii(t);
|
|
68063
68064
|
case "Quantity":
|
|
68064
|
-
return
|
|
68065
|
+
return I(t);
|
|
68065
68066
|
default:
|
|
68066
68067
|
return r6.type === n || typeof t == "object" && t?.resourceType === n;
|
|
68067
68068
|
}
|
|
68068
68069
|
}
|
|
68069
|
-
function
|
|
68070
|
+
function ni(r6) {
|
|
68070
68071
|
return typeof r6 == "string" && !!ze.date.exec(r6);
|
|
68071
68072
|
}
|
|
68072
68073
|
function Ue(r6) {
|
|
68073
68074
|
return typeof r6 == "string" && !!ze.dateTime.exec(r6);
|
|
68074
68075
|
}
|
|
68075
|
-
function
|
|
68076
|
+
function ii(r6) {
|
|
68076
68077
|
return !!(r6 && typeof r6 == "object" && ("start" in r6 && Ue(r6.start) || "end" in r6 && Ue(r6.end)));
|
|
68077
68078
|
}
|
|
68078
|
-
function
|
|
68079
|
+
function I(r6) {
|
|
68079
68080
|
return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
|
|
68080
68081
|
}
|
|
68081
|
-
function
|
|
68082
|
+
function oi(r6, e) {
|
|
68082
68083
|
return Math.abs(r6.value - e.value) < 0.01 && (r6.unit === e.unit || r6.code === e.code || r6.unit === e.code || r6.code === e.unit);
|
|
68083
68084
|
}
|
|
68084
|
-
function
|
|
68085
|
+
function Br(r6, e) {
|
|
68085
68086
|
let t = Object.keys(r6), n = Object.keys(e);
|
|
68086
68087
|
if (t.length !== n.length) return false;
|
|
68087
68088
|
for (let i of t) {
|
|
68088
68089
|
let o2 = r6[i], s = e[i];
|
|
68089
|
-
if (
|
|
68090
|
-
if (!
|
|
68090
|
+
if (Zn(o2) && Zn(s)) {
|
|
68091
|
+
if (!Br(o2, s)) return false;
|
|
68091
68092
|
} else if (o2 !== s) return false;
|
|
68092
68093
|
}
|
|
68093
68094
|
return true;
|
|
68094
68095
|
}
|
|
68095
|
-
function
|
|
68096
|
+
function Zn(r6) {
|
|
68096
68097
|
return r6 !== null && typeof r6 == "object";
|
|
68097
68098
|
}
|
|
68098
|
-
function
|
|
68099
|
+
function Nr(r6, e) {
|
|
68099
68100
|
if (e) {
|
|
68100
68101
|
if (typeof e != "object") throw new Error("Primitive extension must be an object");
|
|
68101
|
-
return
|
|
68102
|
+
return Zo(r6 ?? {}, e);
|
|
68102
68103
|
}
|
|
68103
68104
|
return r6;
|
|
68104
68105
|
}
|
|
68105
|
-
function
|
|
68106
|
+
function Zo(r6, e) {
|
|
68106
68107
|
return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
|
|
68107
68108
|
}
|
|
68108
68109
|
function Xe(r6, e) {
|
|
68109
|
-
return
|
|
68110
|
+
return k(r6, e) && "id" in r6 && typeof r6.id == "string";
|
|
68110
68111
|
}
|
|
68111
68112
|
function be(r6) {
|
|
68112
|
-
let e =
|
|
68113
|
+
let e = A(r6) ?? "undefined/undefined", t = ts(r6);
|
|
68113
68114
|
return t === e ? { reference: e } : { reference: e, display: t };
|
|
68114
68115
|
}
|
|
68115
|
-
function
|
|
68116
|
+
function A(r6) {
|
|
68116
68117
|
if (H(r6)) return r6.reference;
|
|
68117
68118
|
if (Xe(r6)) return `${r6.resourceType}/${r6.id}`;
|
|
68118
68119
|
}
|
|
68119
68120
|
function Se(r6) {
|
|
68120
68121
|
if (r6) return H(r6) ? r6.reference.split("/")[1] : r6.id;
|
|
68121
68122
|
}
|
|
68122
|
-
function
|
|
68123
|
+
function es(r6) {
|
|
68123
68124
|
return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
|
|
68124
68125
|
}
|
|
68125
|
-
function
|
|
68126
|
-
if (
|
|
68127
|
-
let e =
|
|
68126
|
+
function ts(r6) {
|
|
68127
|
+
if (es(r6)) {
|
|
68128
|
+
let e = rs(r6);
|
|
68128
68129
|
if (e) return e;
|
|
68129
68130
|
}
|
|
68130
68131
|
if (r6.resourceType === "Device") {
|
|
68131
|
-
let e =
|
|
68132
|
+
let e = ns(r6);
|
|
68132
68133
|
if (e) return e;
|
|
68133
68134
|
}
|
|
68134
68135
|
if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ye(r6.medicationCodeableConcept);
|
|
@@ -68137,20 +68138,20 @@ function Jo(r6) {
|
|
|
68137
68138
|
if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
|
|
68138
68139
|
if ("code" in r6 && r6.code) {
|
|
68139
68140
|
let e = r6.code;
|
|
68140
|
-
if (Array.isArray(e) && (e = e[0]),
|
|
68141
|
-
if (
|
|
68141
|
+
if (Array.isArray(e) && (e = e[0]), Wr(e)) return Ye(e);
|
|
68142
|
+
if (ps(e)) return e.text;
|
|
68142
68143
|
}
|
|
68143
|
-
return
|
|
68144
|
+
return A(r6) ?? "";
|
|
68144
68145
|
}
|
|
68145
|
-
function
|
|
68146
|
+
function rs(r6) {
|
|
68146
68147
|
let e = r6.name;
|
|
68147
68148
|
if (e && e.length > 0) return et(e[0]);
|
|
68148
68149
|
}
|
|
68149
|
-
function
|
|
68150
|
+
function ns(r6) {
|
|
68150
68151
|
let e = r6.deviceName;
|
|
68151
68152
|
if (e && e.length > 0) return e[0].name;
|
|
68152
68153
|
}
|
|
68153
|
-
function
|
|
68154
|
+
function Rt(r6, e) {
|
|
68154
68155
|
let t = new Date(r6);
|
|
68155
68156
|
t.setUTCHours(0, 0, 0, 0);
|
|
68156
68157
|
let n = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
@@ -68167,27 +68168,27 @@ function le(r6, ...e) {
|
|
|
68167
68168
|
for (let n = 0; n < e.length && t; n++) t = t?.extension?.find((i) => i.url === e[n]);
|
|
68168
68169
|
return t;
|
|
68169
68170
|
}
|
|
68170
|
-
function
|
|
68171
|
-
let t =
|
|
68171
|
+
function Ct(r6, e) {
|
|
68172
|
+
let t = Hr(r6);
|
|
68172
68173
|
return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
|
|
68173
68174
|
}
|
|
68174
|
-
function
|
|
68175
|
-
if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ?
|
|
68175
|
+
function Hr(r6) {
|
|
68176
|
+
if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? os(r6) : ss(r6) : r6;
|
|
68176
68177
|
}
|
|
68177
|
-
function
|
|
68178
|
+
function os(r6) {
|
|
68178
68179
|
let e = r6.length;
|
|
68179
68180
|
if (e === 0) return;
|
|
68180
68181
|
let t, n = 0;
|
|
68181
68182
|
for (let i = 0; i < e; i++) {
|
|
68182
|
-
let o2 = r6[i], s =
|
|
68183
|
+
let o2 = r6[i], s = Hr(o2);
|
|
68183
68184
|
s !== o2 && !t && (t = Array.from(r6)), s === void 0 ? t && (t[i] = null) : (t && (t[i] = s), n++);
|
|
68184
68185
|
}
|
|
68185
68186
|
if (n !== 0) return t ?? r6;
|
|
68186
68187
|
}
|
|
68187
|
-
function
|
|
68188
|
+
function ss(r6) {
|
|
68188
68189
|
let e, t = 0;
|
|
68189
68190
|
for (let n in r6) {
|
|
68190
|
-
let i = r6[n], o2 =
|
|
68191
|
+
let i = r6[n], o2 = Hr(i);
|
|
68191
68192
|
o2 !== i && !e && (e = { ...r6 }), o2 === void 0 ? e && delete e[n] : (e && (e[n] = o2), t++);
|
|
68192
68193
|
}
|
|
68193
68194
|
if (t !== 0) return e ?? r6;
|
|
@@ -68203,14 +68204,14 @@ function re(r6) {
|
|
|
68203
68204
|
return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
|
|
68204
68205
|
}
|
|
68205
68206
|
function pe(r6, e, t) {
|
|
68206
|
-
return r6 === e || C(r6) && C(e) ? true : C(r6) || C(e) ? false : Array.isArray(r6) && Array.isArray(e) ?
|
|
68207
|
+
return r6 === e || C(r6) && C(e) ? true : C(r6) || C(e) ? false : Array.isArray(r6) && Array.isArray(e) ? as(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? cs(r6, e, t) : (E(r6) || E(e), false);
|
|
68207
68208
|
}
|
|
68208
|
-
function
|
|
68209
|
+
function as(r6, e) {
|
|
68209
68210
|
if (r6.length !== e.length) return false;
|
|
68210
68211
|
for (let t = 0; t < r6.length; t++) if (!pe(r6[t], e[t])) return false;
|
|
68211
68212
|
return true;
|
|
68212
68213
|
}
|
|
68213
|
-
function
|
|
68214
|
+
function cs(r6, e, t) {
|
|
68214
68215
|
let n = /* @__PURE__ */ new Set();
|
|
68215
68216
|
for (let i of Object.keys(r6)) n.add(i);
|
|
68216
68217
|
for (let i of Object.keys(e)) n.add(i);
|
|
@@ -68224,40 +68225,40 @@ function rs(r6, e, t) {
|
|
|
68224
68225
|
function E(r6) {
|
|
68225
68226
|
return r6 !== null && typeof r6 == "object";
|
|
68226
68227
|
}
|
|
68227
|
-
function
|
|
68228
|
+
function ui(r6) {
|
|
68228
68229
|
return r6.every(Be);
|
|
68229
68230
|
}
|
|
68230
68231
|
function Be(r6) {
|
|
68231
68232
|
return typeof r6 == "string";
|
|
68232
68233
|
}
|
|
68233
|
-
function
|
|
68234
|
+
function qr(r6) {
|
|
68234
68235
|
return E(r6) && "code" in r6 && typeof r6.code == "string";
|
|
68235
68236
|
}
|
|
68236
|
-
function
|
|
68237
|
-
return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(
|
|
68237
|
+
function Wr(r6) {
|
|
68238
|
+
return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(qr);
|
|
68238
68239
|
}
|
|
68239
|
-
function
|
|
68240
|
+
function ps(r6) {
|
|
68240
68241
|
return E(r6) && "text" in r6 && typeof r6.text == "string";
|
|
68241
68242
|
}
|
|
68242
|
-
var
|
|
68243
|
-
for (let r6 = 0; r6 < 256; r6++)
|
|
68244
|
-
function
|
|
68245
|
-
let e =
|
|
68246
|
-
for (let i = 0; i < t.length; i++) n[i] =
|
|
68243
|
+
var li = [];
|
|
68244
|
+
for (let r6 = 0; r6 < 256; r6++) li.push(r6.toString(16).padStart(2, "0"));
|
|
68245
|
+
function pi(r6) {
|
|
68246
|
+
let e = fi(r6), t = new Uint8Array(e), n = new Array(t.length);
|
|
68247
|
+
for (let i = 0; i < t.length; i++) n[i] = li[t[i]];
|
|
68247
68248
|
return n.join("");
|
|
68248
68249
|
}
|
|
68249
|
-
function
|
|
68250
|
-
let e =
|
|
68250
|
+
function di(r6) {
|
|
68251
|
+
let e = fi(r6), t = new Uint8Array(e), n = new Array(t.length);
|
|
68251
68252
|
for (let i = 0; i < t.length; i++) n[i] = String.fromCodePoint(t[i]);
|
|
68252
68253
|
return window.btoa(n.join(""));
|
|
68253
68254
|
}
|
|
68254
|
-
function
|
|
68255
|
+
function fi(r6) {
|
|
68255
68256
|
return ArrayBuffer.isView(r6) ? r6.buffer : r6;
|
|
68256
68257
|
}
|
|
68257
|
-
function
|
|
68258
|
+
function M(r6) {
|
|
68258
68259
|
return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
|
|
68259
68260
|
}
|
|
68260
|
-
var
|
|
68261
|
+
var Qr = (r6, e) => new Promise((t, n) => {
|
|
68261
68262
|
e?.signal?.throwIfAborted();
|
|
68262
68263
|
let i = setTimeout(t, r6);
|
|
68263
68264
|
e?.signal?.addEventListener("abort", () => {
|
|
@@ -68273,27 +68274,27 @@ function Ze(r6, e, t) {
|
|
|
68273
68274
|
}
|
|
68274
68275
|
return n.push(r6), n;
|
|
68275
68276
|
}
|
|
68276
|
-
function
|
|
68277
|
+
function Pt(r6) {
|
|
68277
68278
|
return r6.sort((e, t) => e.localeCompare(t));
|
|
68278
68279
|
}
|
|
68279
|
-
function
|
|
68280
|
+
function zr(r6) {
|
|
68280
68281
|
return r6.endsWith("/") ? r6 : r6 + "/";
|
|
68281
68282
|
}
|
|
68282
|
-
function
|
|
68283
|
+
function xs(r6) {
|
|
68283
68284
|
return r6.startsWith("/") ? r6.slice(1) : r6;
|
|
68284
68285
|
}
|
|
68285
68286
|
function G(r6, e) {
|
|
68286
|
-
return new URL(
|
|
68287
|
+
return new URL(xs(e), zr(r6.toString())).toString();
|
|
68287
68288
|
}
|
|
68288
|
-
function
|
|
68289
|
+
function gi(r6, e) {
|
|
68289
68290
|
return G(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
|
|
68290
68291
|
}
|
|
68291
|
-
function
|
|
68292
|
+
function xi(r6) {
|
|
68292
68293
|
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();
|
|
68293
68294
|
}
|
|
68294
|
-
var
|
|
68295
|
-
function
|
|
68296
|
-
return
|
|
68295
|
+
var vs = /^(([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])$/;
|
|
68296
|
+
function Zl(r6) {
|
|
68297
|
+
return vs.test(r6);
|
|
68297
68298
|
}
|
|
68298
68299
|
var g = Object.freeze([]);
|
|
68299
68300
|
function et(r6, e) {
|
|
@@ -68308,9 +68309,9 @@ function et(r6, e) {
|
|
|
68308
68309
|
function Ye(r6) {
|
|
68309
68310
|
if (!r6) return "";
|
|
68310
68311
|
let e = Re(r6.text);
|
|
68311
|
-
return e || (r6.coding ? r6.coding.map((t) =>
|
|
68312
|
+
return e || (r6.coding ? r6.coding.map((t) => Ti(t)).join(", ") : "");
|
|
68312
68313
|
}
|
|
68313
|
-
function
|
|
68314
|
+
function Ti(r6, e) {
|
|
68314
68315
|
let t = Re(r6?.display);
|
|
68315
68316
|
if (t) {
|
|
68316
68317
|
let n = e ? Re(r6?.code) : void 0;
|
|
@@ -68322,32 +68323,32 @@ function Re(r6) {
|
|
|
68322
68323
|
return typeof r6 == "string" ? r6 : void 0;
|
|
68323
68324
|
}
|
|
68324
68325
|
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" };
|
|
68325
|
-
function
|
|
68326
|
+
function Kn(r6) {
|
|
68326
68327
|
let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
|
|
68327
|
-
for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" &&
|
|
68328
|
+
for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && Ei(t.type);
|
|
68328
68329
|
}
|
|
68329
|
-
function
|
|
68330
|
+
function Ei(r6) {
|
|
68330
68331
|
let e = B.types[r6];
|
|
68331
68332
|
return e || (e = { searchParamsDetails: {} }, B.types[r6] = e), !e.searchParams && r6 !== "Binary" && (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" } }), e;
|
|
68332
68333
|
}
|
|
68333
|
-
function
|
|
68334
|
+
function Kr(r6) {
|
|
68334
68335
|
for (let e of r6.base ?? g) {
|
|
68335
|
-
let t =
|
|
68336
|
+
let t = Ei(e);
|
|
68336
68337
|
t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
|
|
68337
68338
|
}
|
|
68338
68339
|
}
|
|
68339
|
-
function
|
|
68340
|
+
function Rr(r6) {
|
|
68340
68341
|
let e = r6.type?.[0]?.code;
|
|
68341
|
-
return e === "BackboneElement" || e === "Element" ?
|
|
68342
|
+
return e === "BackboneElement" || e === "Element" ? Is((r6.base?.path ?? r6.path)?.split(".")) : e;
|
|
68342
68343
|
}
|
|
68343
|
-
function
|
|
68344
|
-
return r6.length === 1 ? r6[0] : r6.map(
|
|
68344
|
+
function Is(r6) {
|
|
68345
|
+
return r6.length === 1 ? r6[0] : r6.map(M).join("");
|
|
68345
68346
|
}
|
|
68346
|
-
function
|
|
68347
|
+
function Et(r6, e, t) {
|
|
68347
68348
|
let n = Qe(r6, t);
|
|
68348
|
-
if (n) return
|
|
68349
|
+
if (n) return Ms(n.elements, e);
|
|
68349
68350
|
}
|
|
68350
|
-
function
|
|
68351
|
+
function Ms(r6, e) {
|
|
68351
68352
|
let t = r6[e] ?? r6[e + "[x]"];
|
|
68352
68353
|
if (t) return t;
|
|
68353
68354
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -68358,7 +68359,7 @@ function ws(r6, e) {
|
|
|
68358
68359
|
}
|
|
68359
68360
|
}
|
|
68360
68361
|
}
|
|
68361
|
-
function
|
|
68362
|
+
function k(r6, e) {
|
|
68362
68363
|
return !(!r6 || typeof r6 != "object" || !("resourceType" in r6) || e && r6.resourceType !== e);
|
|
68363
68364
|
}
|
|
68364
68365
|
function H(r6, e) {
|
|
@@ -68375,30 +68376,30 @@ function qe(r6) {
|
|
|
68375
68376
|
}
|
|
68376
68377
|
}
|
|
68377
68378
|
var ne = () => [];
|
|
68378
|
-
var
|
|
68379
|
-
for (let t of e) if (!t.value) return
|
|
68380
|
-
return
|
|
68379
|
+
var D = { empty: (r6, e) => h(e.every((t) => C(t.value))), hasValue: (r6, e) => h(e.length !== 0), exists: (r6, e, t) => t ? h(e.some((n) => U(t.eval(r6, [n])))) : h(e.length > 0 && e.every((n) => !C(n.value))), all: (r6, e, t) => h(e.every((n) => U(t.eval(r6, [n])))), allTrue: (r6, e) => {
|
|
68380
|
+
for (let t of e) if (!t.value) return h(false);
|
|
68381
|
+
return h(true);
|
|
68381
68382
|
}, anyTrue: (r6, e) => {
|
|
68382
|
-
for (let t of e) if (t.value) return
|
|
68383
|
-
return
|
|
68383
|
+
for (let t of e) if (t.value) return h(true);
|
|
68384
|
+
return h(false);
|
|
68384
68385
|
}, allFalse: (r6, e) => {
|
|
68385
|
-
for (let t of e) if (t.value) return
|
|
68386
|
-
return
|
|
68386
|
+
for (let t of e) if (t.value) return h(false);
|
|
68387
|
+
return h(true);
|
|
68387
68388
|
}, anyFalse: (r6, e) => {
|
|
68388
|
-
for (let t of e) if (!t.value) return
|
|
68389
|
-
return
|
|
68389
|
+
for (let t of e) if (!t.value) return h(true);
|
|
68390
|
+
return h(false);
|
|
68390
68391
|
}, subsetOf: (r6, e, t) => {
|
|
68391
|
-
if (e.length === 0) return
|
|
68392
|
+
if (e.length === 0) return h(true);
|
|
68392
68393
|
let n = t.eval(r6, Ce(r6));
|
|
68393
|
-
return n.length === 0 ?
|
|
68394
|
+
return n.length === 0 ? h(false) : h(e.every((i) => n.some((o2) => o2.value === i.value)));
|
|
68394
68395
|
}, supersetOf: (r6, e, t) => {
|
|
68395
68396
|
let n = t.eval(r6, Ce(r6));
|
|
68396
|
-
return n.length === 0 ?
|
|
68397
|
+
return n.length === 0 ? h(true) : e.length === 0 ? h(false) : h(n.every((i) => e.some((o2) => o2.value === i.value)));
|
|
68397
68398
|
}, count: (r6, e) => [{ type: d.integer, value: e.length }], distinct: (r6, e) => {
|
|
68398
68399
|
let t = [];
|
|
68399
68400
|
for (let n of e) t.some((i) => i.value === n.value) || t.push(n);
|
|
68400
68401
|
return t;
|
|
68401
|
-
}, isDistinct: (r6, e) =>
|
|
68402
|
+
}, isDistinct: (r6, e) => h(e.length === D.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => U(t.eval(r6, [n]))), select: (r6, e, t) => e.flatMap((n) => t.eval({ parent: r6, variables: { $this: n } }, [n])), repeat: ne, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
|
|
68402
68403
|
if (e.length > 1) throw new Error("Expected input length one for single()");
|
|
68403
68404
|
return e.length === 0 ? [] : e.slice(0, 1);
|
|
68404
68405
|
}, first: (r6, e) => e.length === 0 ? [] : e.slice(0, 1), last: (r6, e) => e.length === 0 ? [] : e.slice(-1, e.length), tail: (r6, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (r6, e, t) => {
|
|
@@ -68422,7 +68423,7 @@ var k = { empty: (r6, e) => m(e.every((t) => C(t.value))), hasValue: (r6, e) =>
|
|
|
68422
68423
|
}, union: (r6, e, t) => {
|
|
68423
68424
|
if (!t) return e;
|
|
68424
68425
|
let n = t.eval(r6, Ce(r6));
|
|
68425
|
-
return
|
|
68426
|
+
return Tt([...e, ...n]);
|
|
68426
68427
|
}, combine: (r6, e, t) => {
|
|
68427
68428
|
if (!t) return e;
|
|
68428
68429
|
let n = t.eval(r6, Ce(r6));
|
|
@@ -68435,38 +68436,38 @@ var k = { empty: (r6, e) => m(e.every((t) => C(t.value))), hasValue: (r6, e) =>
|
|
|
68435
68436
|
if (e.length === 0) return [];
|
|
68436
68437
|
let [{ value: t }] = X(e, 1);
|
|
68437
68438
|
if (typeof t == "boolean") return [{ type: d.boolean, value: t }];
|
|
68438
|
-
if (typeof t == "number" && (t === 0 || t === 1)) return
|
|
68439
|
+
if (typeof t == "number" && (t === 0 || t === 1)) return h(!!t);
|
|
68439
68440
|
if (typeof t == "string") {
|
|
68440
68441
|
let n = t.toLowerCase();
|
|
68441
|
-
if (["true", "t", "yes", "y", "1", "1.0"].includes(n)) return
|
|
68442
|
-
if (["false", "f", "no", "n", "0", "0.0"].includes(n)) return
|
|
68442
|
+
if (["true", "t", "yes", "y", "1", "1.0"].includes(n)) return h(true);
|
|
68443
|
+
if (["false", "f", "no", "n", "0", "0.0"].includes(n)) return h(false);
|
|
68443
68444
|
}
|
|
68444
68445
|
return [];
|
|
68445
|
-
}, convertsToBoolean: (r6, e) => e.length === 0 ? [] :
|
|
68446
|
+
}, convertsToBoolean: (r6, e) => e.length === 0 ? [] : h(D.toBoolean(r6, e).length === 1), toInteger: (r6, e) => {
|
|
68446
68447
|
if (e.length === 0) return [];
|
|
68447
68448
|
let [{ value: t }] = X(e, 1);
|
|
68448
68449
|
return typeof t == "number" ? [{ type: d.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: d.integer, value: Number.parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: d.integer, value: t ? 1 : 0 }] : [];
|
|
68449
|
-
}, convertsToInteger: (r6, e) => e.length === 0 ? [] :
|
|
68450
|
+
}, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(D.toInteger(r6, e).length === 1), toDate: (r6, e) => {
|
|
68450
68451
|
if (e.length === 0) return [];
|
|
68451
68452
|
let [{ value: t }] = X(e, 1);
|
|
68452
68453
|
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: d.date, value: qe(t) }] : [];
|
|
68453
|
-
}, convertsToDate: (r6, e) => e.length === 0 ? [] :
|
|
68454
|
+
}, convertsToDate: (r6, e) => e.length === 0 ? [] : h(D.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
|
|
68454
68455
|
if (e.length === 0) return [];
|
|
68455
68456
|
let [{ value: t }] = X(e, 1);
|
|
68456
68457
|
return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: d.dateTime, value: qe(t) }] : [];
|
|
68457
|
-
}, convertsToDateTime: (r6, e) => e.length === 0 ? [] :
|
|
68458
|
+
}, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(D.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
|
|
68458
68459
|
if (e.length === 0) return [];
|
|
68459
68460
|
let [{ value: t }] = X(e, 1);
|
|
68460
68461
|
return typeof t == "number" ? [{ type: d.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: d.decimal, value: Number.parseFloat(t) }] : typeof t == "boolean" ? [{ type: d.decimal, value: t ? 1 : 0 }] : [];
|
|
68461
|
-
}, convertsToDecimal: (r6, e) => e.length === 0 ? [] :
|
|
68462
|
+
}, convertsToDecimal: (r6, e) => e.length === 0 ? [] : h(D.toDecimal(r6, e).length === 1), toQuantity: (r6, e) => {
|
|
68462
68463
|
if (e.length === 0) return [];
|
|
68463
68464
|
let [{ value: t }] = X(e, 1);
|
|
68464
|
-
return
|
|
68465
|
-
}, convertsToQuantity: (r6, e) => e.length === 0 ? [] :
|
|
68465
|
+
return I(t) ? [{ type: d.Quantity, value: t }] : typeof t == "number" ? [{ type: d.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: d.Quantity, value: { value: Number.parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: d.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
|
|
68466
|
+
}, convertsToQuantity: (r6, e) => e.length === 0 ? [] : h(D.toQuantity(r6, e).length === 1), toString: (r6, e) => {
|
|
68466
68467
|
if (e.length === 0) return [];
|
|
68467
68468
|
let [{ value: t }] = X(e, 1);
|
|
68468
|
-
return t == null ? [] :
|
|
68469
|
-
}, convertsToString: (r6, e) => e.length === 0 ? [] :
|
|
68469
|
+
return t == null ? [] : I(t) ? [{ type: d.string, value: `${t.value} '${t.unit}'` }] : [{ type: d.string, value: t.toString() }];
|
|
68470
|
+
}, convertsToString: (r6, e) => e.length === 0 ? [] : h(D.toString(r6, e).length === 1), toTime: (r6, e) => {
|
|
68470
68471
|
if (e.length === 0) return [];
|
|
68471
68472
|
let [{ value: t }] = X(e, 1);
|
|
68472
68473
|
if (typeof t == "string") {
|
|
@@ -68474,7 +68475,7 @@ var k = { empty: (r6, e) => m(e.every((t) => C(t.value))), hasValue: (r6, e) =>
|
|
|
68474
68475
|
if (n) return [{ type: d.time, value: qe("T" + n[1]) }];
|
|
68475
68476
|
}
|
|
68476
68477
|
return [];
|
|
68477
|
-
}, convertsToTime: (r6, e) => e.length === 0 ? [] :
|
|
68478
|
+
}, convertsToTime: (r6, e) => e.length === 0 ? [] : h(D.toTime(r6, e).length === 1), indexOf: (r6, e, t) => q((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => q((i, o2, s) => {
|
|
68478
68479
|
let a = o2, u2 = s ? a + s : i.length;
|
|
68479
68480
|
return a < 0 || a >= i.length ? void 0 : i.substring(a, u2);
|
|
68480
68481
|
}, r6, e, t, n), startsWith: (r6, e, t) => q((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => q((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => q((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => q((t) => t.toUpperCase(), r6, e), lower: (r6, e) => q((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => q((i, o2, s) => i.replaceAll(o2, s), r6, e, t, n), matches: (r6, e, t) => q((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => q((i, o2, s) => i.replaceAll(new RegExp(o2, "g"), s.replaceAll(/\$\{(\w+)\}/g, "$<$1>")), r6, e, t, n), length: (r6, e) => q((t) => t.length, r6, e), toChars: (r6, e) => q((t) => t ? t.split("") : void 0, r6, e), encode: ne, decode: ne, escape: ne, unescape: ne, trim: ne, split: ne, join: (r6, e, t) => {
|
|
@@ -68486,18 +68487,18 @@ var k = { empty: (r6, e) => m(e.every((t) => C(t.value))), hasValue: (r6, e) =>
|
|
|
68486
68487
|
let o2 = Math.pow(10, i);
|
|
68487
68488
|
return Math.round(n * o2) / o2;
|
|
68488
68489
|
}, r6, e, ...t), sqrt: (r6, e) => Y(Math.sqrt, r6, e), truncate: (r6, e) => Y((t) => Math.trunc(t), r6, e), children: ne, descendants: ne, trace: (r6, e, t) => e, now: () => [{ type: d.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: d.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: d.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i) => {
|
|
68489
|
-
let o2 =
|
|
68490
|
+
let o2 = D.toDateTime(r6, t.eval(r6, e));
|
|
68490
68491
|
if (o2.length === 0) throw new Error("Invalid start date");
|
|
68491
|
-
let s =
|
|
68492
|
+
let s = D.toDateTime(r6, n.eval(r6, e));
|
|
68492
68493
|
if (s.length === 0) throw new Error("Invalid end date");
|
|
68493
68494
|
let a = i.eval(r6, e)[0]?.value;
|
|
68494
68495
|
if (a !== "years" && a !== "months" && a !== "days") throw new Error("Invalid units");
|
|
68495
|
-
let u2 =
|
|
68496
|
+
let u2 = Rt(o2[0].value, s[0].value);
|
|
68496
68497
|
return [{ type: d.Quantity, value: { value: u2[a], unit: a } }];
|
|
68497
68498
|
}, is: (r6, e, t) => {
|
|
68498
68499
|
let n = "";
|
|
68499
|
-
return t instanceof L ? n = t.name : t instanceof Z && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: d.boolean, value:
|
|
68500
|
-
}, not: (r6, e) =>
|
|
68500
|
+
return t instanceof L ? n = t.name : t instanceof Z && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: d.boolean, value: bt(i, n) })) : [];
|
|
68501
|
+
}, not: (r6, e) => D.toBoolean(r6, e).map((t) => ({ type: d.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
|
|
68501
68502
|
let n = t.value, i;
|
|
68502
68503
|
if (typeof n == "string") i = n;
|
|
68503
68504
|
else if (typeof n == "object") {
|
|
@@ -68514,7 +68515,7 @@ var k = { empty: (r6, e) => m(e.every((t) => C(t.value))), hasValue: (r6, e) =>
|
|
|
68514
68515
|
return { type: o2, value: { resourceType: o2, id: s } };
|
|
68515
68516
|
}
|
|
68516
68517
|
return { type: d.BackboneElement, value: void 0 };
|
|
68517
|
-
}).filter((t) => !!t.value), as: (r6, e) => e, type: (r6, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: d.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: d.BackboneElement, value: { namespace: "System", name: "Integer" } } :
|
|
68518
|
+
}).filter((t) => !!t.value), as: (r6, e) => e, type: (r6, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: d.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: d.BackboneElement, value: { namespace: "System", name: "Integer" } } : k(t) ? { type: d.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: d.BackboneElement, value: null }), conformsTo: (r6, e, t) => {
|
|
68518
68519
|
let n = t.eval(r6, e)[0].value;
|
|
68519
68520
|
if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/")) throw new Error("Expected a StructureDefinition URL");
|
|
68520
68521
|
let i = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
|
|
@@ -68544,7 +68545,7 @@ function q(r6, e, t, ...n) {
|
|
|
68544
68545
|
}
|
|
68545
68546
|
function Y(r6, e, t, ...n) {
|
|
68546
68547
|
if (t.length === 0) return [];
|
|
68547
|
-
let [{ value: i }] = X(t, 1), o2 =
|
|
68548
|
+
let [{ value: i }] = X(t, 1), o2 = I(i), s = o2 ? i.value : i;
|
|
68548
68549
|
if (typeof s != "number") throw new TypeError("Math function cannot be called with non-number");
|
|
68549
68550
|
let a = r6(s, ...n.map((p) => p.eval(e, t)[0]?.value)), u2 = o2 ? d.Quantity : t[0].type, l2 = o2 ? { ...i, value: a } : a;
|
|
68550
68551
|
return [{ type: u2, value: l2 }];
|
|
@@ -68591,13 +68592,13 @@ var L = class {
|
|
|
68591
68592
|
}
|
|
68592
68593
|
evalValue(e) {
|
|
68593
68594
|
let t = e.value;
|
|
68594
|
-
if (!(!t || typeof t != "object")) return
|
|
68595
|
+
if (!(!t || typeof t != "object")) return k(t, this.name) ? e : Vr(e, this.name);
|
|
68595
68596
|
}
|
|
68596
68597
|
toString() {
|
|
68597
68598
|
return this.name;
|
|
68598
68599
|
}
|
|
68599
68600
|
};
|
|
68600
|
-
var
|
|
68601
|
+
var wt = class {
|
|
68601
68602
|
eval() {
|
|
68602
68603
|
return [];
|
|
68603
68604
|
}
|
|
@@ -68605,7 +68606,7 @@ var At = class {
|
|
|
68605
68606
|
return "{}";
|
|
68606
68607
|
}
|
|
68607
68608
|
};
|
|
68608
|
-
var
|
|
68609
|
+
var Ot = class extends pt {
|
|
68609
68610
|
constructor(t, n, i) {
|
|
68610
68611
|
super(t, n);
|
|
68611
68612
|
c(this, "impl");
|
|
@@ -68618,17 +68619,17 @@ var wt = class extends pt {
|
|
|
68618
68619
|
return this.operator + this.child.toString();
|
|
68619
68620
|
}
|
|
68620
68621
|
};
|
|
68621
|
-
var
|
|
68622
|
+
var he = class extends ce {
|
|
68622
68623
|
constructor(e, t) {
|
|
68623
68624
|
super("as", e, t);
|
|
68624
68625
|
}
|
|
68625
68626
|
eval(e, t) {
|
|
68626
|
-
return
|
|
68627
|
+
return D.ofType(e, this.left.eval(e, t), this.right);
|
|
68627
68628
|
}
|
|
68628
68629
|
};
|
|
68629
|
-
var
|
|
68630
|
+
var w = class extends ce {
|
|
68630
68631
|
};
|
|
68631
|
-
var _ = class extends
|
|
68632
|
+
var _ = class extends w {
|
|
68632
68633
|
constructor(t, n, i, o2) {
|
|
68633
68634
|
super(t, n, i);
|
|
68634
68635
|
c(this, "impl");
|
|
@@ -68639,11 +68640,11 @@ var _ = class extends A {
|
|
|
68639
68640
|
if (i.length !== 1) return [];
|
|
68640
68641
|
let o2 = this.right.eval(t, n);
|
|
68641
68642
|
if (o2.length !== 1) return [];
|
|
68642
|
-
let s = i[0].value, a = o2[0].value, u2 =
|
|
68643
|
-
return typeof p == "boolean" ?
|
|
68643
|
+
let s = i[0].value, a = o2[0].value, u2 = I(s) ? s.value : s, l2 = I(a) ? a.value : a, p = this.impl(u2, l2);
|
|
68644
|
+
return typeof p == "boolean" ? h(p) : I(s) ? [{ type: d.Quantity, value: { ...s, value: p } }] : [b(p)];
|
|
68644
68645
|
}
|
|
68645
68646
|
};
|
|
68646
|
-
var
|
|
68647
|
+
var It = class extends ce {
|
|
68647
68648
|
constructor(e, t) {
|
|
68648
68649
|
super("&", e, t);
|
|
68649
68650
|
}
|
|
@@ -68652,22 +68653,22 @@ var Ot = class extends ce {
|
|
|
68652
68653
|
return o2.length > 0 && o2.every((s) => typeof s.value == "string") ? [{ type: d.string, value: o2.map((s) => s.value).join("") }] : o2;
|
|
68653
68654
|
}
|
|
68654
68655
|
};
|
|
68655
|
-
var
|
|
68656
|
+
var kt = class extends w {
|
|
68656
68657
|
constructor(e, t) {
|
|
68657
68658
|
super("contains", e, t);
|
|
68658
68659
|
}
|
|
68659
68660
|
eval(e, t) {
|
|
68660
68661
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
68661
|
-
return
|
|
68662
|
+
return h(n.some((o2) => o2.value === i[0].value));
|
|
68662
68663
|
}
|
|
68663
68664
|
};
|
|
68664
|
-
var
|
|
68665
|
+
var Dt = class extends w {
|
|
68665
68666
|
constructor(e, t) {
|
|
68666
68667
|
super("in", e, t);
|
|
68667
68668
|
}
|
|
68668
68669
|
eval(e, t) {
|
|
68669
68670
|
let n = J(this.left.eval(e, t)), i = this.right.eval(e, t);
|
|
68670
|
-
return n ?
|
|
68671
|
+
return n ? h(i.some((o2) => Ke(n, o2)[0].value)) : [];
|
|
68671
68672
|
}
|
|
68672
68673
|
};
|
|
68673
68674
|
var Z = class extends ce {
|
|
@@ -68687,46 +68688,46 @@ var Pe = class extends ce {
|
|
|
68687
68688
|
}
|
|
68688
68689
|
eval(e, t) {
|
|
68689
68690
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
68690
|
-
return
|
|
68691
|
+
return Tt([...n, ...i]);
|
|
68691
68692
|
}
|
|
68692
68693
|
};
|
|
68693
|
-
var Vt = class extends
|
|
68694
|
+
var Vt = class extends w {
|
|
68694
68695
|
constructor(e, t) {
|
|
68695
68696
|
super("=", e, t);
|
|
68696
68697
|
}
|
|
68697
68698
|
eval(e, t) {
|
|
68698
68699
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
68699
|
-
return
|
|
68700
|
+
return ti(n, i);
|
|
68700
68701
|
}
|
|
68701
68702
|
};
|
|
68702
|
-
var
|
|
68703
|
+
var Mt = class extends w {
|
|
68703
68704
|
constructor(e, t) {
|
|
68704
68705
|
super("!=", e, t);
|
|
68705
68706
|
}
|
|
68706
68707
|
eval(e, t) {
|
|
68707
68708
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
68708
|
-
return
|
|
68709
|
+
return ri(n, i);
|
|
68709
68710
|
}
|
|
68710
68711
|
};
|
|
68711
|
-
var
|
|
68712
|
+
var _t = class extends w {
|
|
68712
68713
|
constructor(e, t) {
|
|
68713
68714
|
super("~", e, t);
|
|
68714
68715
|
}
|
|
68715
68716
|
eval(e, t) {
|
|
68716
68717
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
68717
|
-
return
|
|
68718
|
+
return Ur(n, i);
|
|
68718
68719
|
}
|
|
68719
68720
|
};
|
|
68720
|
-
var
|
|
68721
|
+
var Lt = class extends w {
|
|
68721
68722
|
constructor(e, t) {
|
|
68722
68723
|
super("!~", e, t);
|
|
68723
68724
|
}
|
|
68724
68725
|
eval(e, t) {
|
|
68725
68726
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
68726
|
-
return
|
|
68727
|
+
return ei(Ur(n, i));
|
|
68727
68728
|
}
|
|
68728
68729
|
};
|
|
68729
|
-
var Ae = class extends
|
|
68730
|
+
var Ae = class extends w {
|
|
68730
68731
|
constructor(e, t) {
|
|
68731
68732
|
super("is", e, t);
|
|
68732
68733
|
}
|
|
@@ -68734,43 +68735,43 @@ var Ae = class extends A {
|
|
|
68734
68735
|
let n = this.left.eval(e, t);
|
|
68735
68736
|
if (n.length !== 1) return [];
|
|
68736
68737
|
let i = this.right.name;
|
|
68737
|
-
return
|
|
68738
|
+
return h(bt(n[0], i));
|
|
68738
68739
|
}
|
|
68739
68740
|
};
|
|
68740
|
-
var
|
|
68741
|
+
var Ft = class extends w {
|
|
68741
68742
|
constructor(e, t) {
|
|
68742
68743
|
super("and", e, t);
|
|
68743
68744
|
}
|
|
68744
68745
|
eval(e, t) {
|
|
68745
68746
|
let n = J(this.left.eval(e, t), "boolean"), i = J(this.right.eval(e, t), "boolean");
|
|
68746
|
-
return n?.value === true && i?.value === true ?
|
|
68747
|
+
return n?.value === true && i?.value === true ? h(true) : n?.value === false || i?.value === false ? h(false) : [];
|
|
68747
68748
|
}
|
|
68748
68749
|
};
|
|
68749
|
-
var
|
|
68750
|
+
var Nt = class extends w {
|
|
68750
68751
|
constructor(e, t) {
|
|
68751
68752
|
super("or", e, t);
|
|
68752
68753
|
}
|
|
68753
68754
|
eval(e, t) {
|
|
68754
68755
|
let n = J(this.left.eval(e, t), "boolean"), i = J(this.right.eval(e, t), "boolean");
|
|
68755
|
-
return n?.value === false && i?.value === false ?
|
|
68756
|
+
return n?.value === false && i?.value === false ? h(false) : n?.value || i?.value ? h(true) : [];
|
|
68756
68757
|
}
|
|
68757
68758
|
};
|
|
68758
|
-
var
|
|
68759
|
+
var Ut = class extends w {
|
|
68759
68760
|
constructor(e, t) {
|
|
68760
68761
|
super("xor", e, t);
|
|
68761
68762
|
}
|
|
68762
68763
|
eval(e, t) {
|
|
68763
68764
|
let n = J(this.left.eval(e, t), "boolean"), i = J(this.right.eval(e, t), "boolean");
|
|
68764
|
-
return !n || !i ? [] :
|
|
68765
|
+
return !n || !i ? [] : h(n.value !== i.value);
|
|
68765
68766
|
}
|
|
68766
68767
|
};
|
|
68767
|
-
var
|
|
68768
|
+
var Bt = class extends w {
|
|
68768
68769
|
constructor(e, t) {
|
|
68769
68770
|
super("implies", e, t);
|
|
68770
68771
|
}
|
|
68771
68772
|
eval(e, t) {
|
|
68772
68773
|
let n = J(this.left.eval(e, t), "boolean"), i = J(this.right.eval(e, t), "boolean");
|
|
68773
|
-
return i?.value === true || n?.value === false ?
|
|
68774
|
+
return i?.value === true || n?.value === false ? h(true) : !n || !i ? [] : h(false);
|
|
68774
68775
|
}
|
|
68775
68776
|
};
|
|
68776
68777
|
var ie = class {
|
|
@@ -68780,7 +68781,7 @@ var ie = class {
|
|
|
68780
68781
|
this.name = e, this.args = t;
|
|
68781
68782
|
}
|
|
68782
68783
|
eval(e, t) {
|
|
68783
|
-
let n =
|
|
68784
|
+
let n = D[this.name];
|
|
68784
68785
|
if (!n) throw new Error("Unrecognized function: " + this.name);
|
|
68785
68786
|
return n(e, t, ...this.args);
|
|
68786
68787
|
}
|
|
@@ -68808,41 +68809,41 @@ var we = class {
|
|
|
68808
68809
|
};
|
|
68809
68810
|
var rt = ["!=", "!~", "<=", ">=", "{}", "->"];
|
|
68810
68811
|
var v = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
|
|
68811
|
-
var
|
|
68812
|
+
var Ns = { parse(r6) {
|
|
68812
68813
|
let e = r6.consumeAndParse();
|
|
68813
68814
|
if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
|
|
68814
68815
|
return e;
|
|
68815
68816
|
} };
|
|
68816
|
-
var
|
|
68817
|
+
var Us = { parse(r6, e) {
|
|
68817
68818
|
let t = r6.consumeAndParse();
|
|
68818
68819
|
if (!r6.match("]")) throw new Error("Parse error: expected `]`");
|
|
68819
68820
|
return new we(e, t);
|
|
68820
68821
|
}, precedence: v.Indexer };
|
|
68821
|
-
var
|
|
68822
|
+
var Bs = { parse(r6, e) {
|
|
68822
68823
|
if (!(e instanceof L)) throw new Error("Unexpected parentheses");
|
|
68823
68824
|
let t = [];
|
|
68824
68825
|
for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
|
|
68825
68826
|
return new ie(e.name, t);
|
|
68826
68827
|
}, precedence: v.FunctionCall };
|
|
68827
|
-
function
|
|
68828
|
+
function qs(r6) {
|
|
68828
68829
|
let e = r6.split(" "), t = Number.parseFloat(e[0]), n = e[1];
|
|
68829
68830
|
return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
|
|
68830
68831
|
}
|
|
68831
68832
|
function nt() {
|
|
68832
|
-
return new dt().registerPrefix("String", { parse: (r6, e) => new W({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new W({ type: d.dateTime, value: qe(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new W({ type: d.Quantity, value:
|
|
68833
|
+
return new dt().registerPrefix("String", { parse: (r6, e) => new W({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new W({ type: d.dateTime, value: qe(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new W({ type: d.Quantity, value: qs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new W({ type: e.value.includes(".") ? d.decimal : d.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new W({ type: d.boolean, value: true }) }).registerPrefix("false", { parse: () => new W({ type: d.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new L(e.value) }).registerPrefix("{}", { parse: () => new wt() }).registerPrefix("(", Ns).registerInfix("[", Us).registerInfix("(", Bs).prefix("+", v.UnaryAdd, (r6, e) => new Ot("+", e, (t) => t)).prefix("-", v.UnarySubtract, (r6, e) => new _("-", e, e, (t, n) => -n)).infixLeft(".", v.Dot, (r6, e, t) => new Z(r6, t)).infixLeft("/", v.Divide, (r6, e, t) => new _("/", r6, t, (n, i) => n / i)).infixLeft("*", v.Multiply, (r6, e, t) => new _("*", r6, t, (n, i) => n * i)).infixLeft("+", v.Add, (r6, e, t) => new _("+", r6, t, (n, i) => n + i)).infixLeft("-", v.Subtract, (r6, e, t) => new _("-", r6, t, (n, i) => n - i)).infixLeft("|", v.Union, (r6, e, t) => new Pe(r6, t)).infixLeft("=", v.Equals, (r6, e, t) => new Vt(r6, t)).infixLeft("!=", v.NotEquals, (r6, e, t) => new Mt(r6, t)).infixLeft("~", v.Equivalent, (r6, e, t) => new _t(r6, t)).infixLeft("!~", v.NotEquivalent, (r6, e, t) => new Lt(r6, t)).infixLeft("<", v.LessThan, (r6, e, t) => new _("<", r6, t, (n, i) => n < i)).infixLeft("<=", v.LessThanOrEquals, (r6, e, t) => new _("<=", r6, t, (n, i) => n <= i)).infixLeft(">", v.GreaterThan, (r6, e, t) => new _(">", r6, t, (n, i) => n > i)).infixLeft(">=", v.GreaterThanOrEquals, (r6, e, t) => new _(">=", r6, t, (n, i) => n >= i)).infixLeft("&", v.Ampersand, (r6, e, t) => new It(r6, t)).infixLeft("and", v.And, (r6, e, t) => new Ft(r6, t)).infixLeft("as", v.As, (r6, e, t) => new he(r6, t)).infixLeft("contains", v.Contains, (r6, e, t) => new kt(r6, t)).infixLeft("div", v.Divide, (r6, e, t) => new _("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", v.In, (r6, e, t) => new Dt(r6, t)).infixLeft("is", v.Is, (r6, e, t) => new Ae(r6, t)).infixLeft("mod", v.Modulo, (r6, e, t) => new _("mod", r6, t, (n, i) => n % i)).infixLeft("or", v.Or, (r6, e, t) => new Nt(r6, t)).infixLeft("xor", v.Xor, (r6, e, t) => new Ut(r6, t)).infixLeft("implies", v.Implies, (r6, e, t) => new Bt(r6, t));
|
|
68833
68834
|
}
|
|
68834
|
-
var
|
|
68835
|
-
var
|
|
68836
|
-
var
|
|
68837
|
-
var
|
|
68838
|
-
var
|
|
68835
|
+
var Ws = nt();
|
|
68836
|
+
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" };
|
|
68837
|
+
var Yr = { contains: m.CONTAINS, exact: m.EXACT, above: m.ABOVE, below: m.BELOW, text: m.TEXT, not: m.NOT, in: m.IN, "not-in": m.NOT_IN, "of-type": m.OF_TYPE, missing: m.MISSING, identifier: m.IDENTIFIER, iterate: m.ITERATE };
|
|
68838
|
+
var Xr = { 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 };
|
|
68839
|
+
var Ks = [m.MISSING, m.PRESENT];
|
|
68839
68840
|
var Ie = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
|
|
68840
|
-
var
|
|
68841
|
-
var
|
|
68841
|
+
var ga = [Ie.READ, Ie.VREAD, Ie.HISTORY, Ie.SEARCH];
|
|
68842
|
+
var kd = { FIRST: "first", APPLICATION: "application" };
|
|
68842
68843
|
function j() {
|
|
68843
68844
|
return typeof window < "u";
|
|
68844
68845
|
}
|
|
68845
|
-
function
|
|
68846
|
+
function Zr() {
|
|
68846
68847
|
return typeof Buffer < "u" ? Buffer : void 0;
|
|
68847
68848
|
}
|
|
68848
68849
|
var oe = { assign(r6) {
|
|
@@ -68858,34 +68859,34 @@ var oe = { assign(r6) {
|
|
|
68858
68859
|
}, getOrigin() {
|
|
68859
68860
|
return j() ? globalThis.location.protocol + "//" + globalThis.location.host + "/" : "";
|
|
68860
68861
|
} };
|
|
68861
|
-
function
|
|
68862
|
+
function Ta(r6) {
|
|
68862
68863
|
if (j()) {
|
|
68863
68864
|
let t = window.atob(r6), n = Uint8Array.from(t, (i) => i.codePointAt(0));
|
|
68864
68865
|
return new window.TextDecoder().decode(n);
|
|
68865
68866
|
}
|
|
68866
|
-
let e =
|
|
68867
|
+
let e = Zr();
|
|
68867
68868
|
if (e) return e.from(r6, "base64").toString("utf-8");
|
|
68868
68869
|
throw new Error("Unable to decode base64");
|
|
68869
68870
|
}
|
|
68870
|
-
function
|
|
68871
|
+
function $t(r6) {
|
|
68871
68872
|
if (j()) {
|
|
68872
68873
|
let t = new window.TextEncoder().encode(r6), n = String.fromCodePoint.apply(null, t);
|
|
68873
68874
|
return window.btoa(n);
|
|
68874
68875
|
}
|
|
68875
|
-
let e =
|
|
68876
|
+
let e = Zr();
|
|
68876
68877
|
if (e) return e.from(r6, "utf8").toString("base64");
|
|
68877
68878
|
throw new Error("Unable to encode base64");
|
|
68878
68879
|
}
|
|
68879
|
-
function
|
|
68880
|
+
function Li(r6) {
|
|
68880
68881
|
r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
|
|
68881
68882
|
let e = r6.replaceAll("-", "+").replaceAll("_", "/");
|
|
68882
|
-
return
|
|
68883
|
+
return Ta(e);
|
|
68883
68884
|
}
|
|
68884
|
-
function
|
|
68885
|
+
function en() {
|
|
68885
68886
|
let r6 = new Uint32Array(28);
|
|
68886
|
-
return crypto.getRandomValues(r6),
|
|
68887
|
+
return crypto.getRandomValues(r6), pi(r6.buffer);
|
|
68887
68888
|
}
|
|
68888
|
-
async function
|
|
68889
|
+
async function Fi(r6) {
|
|
68889
68890
|
return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
|
|
68890
68891
|
}
|
|
68891
68892
|
function se() {
|
|
@@ -68894,8 +68895,8 @@ function se() {
|
|
|
68894
68895
|
return (r6 === "x" ? e : e & 3 | 8).toString(16);
|
|
68895
68896
|
});
|
|
68896
68897
|
}
|
|
68897
|
-
var
|
|
68898
|
-
var
|
|
68898
|
+
var O = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml", OCTET_STREAM: "application/octet-stream" };
|
|
68899
|
+
var tn = class {
|
|
68899
68900
|
constructor() {
|
|
68900
68901
|
c(this, "listeners");
|
|
68901
68902
|
this.listeners = {};
|
|
@@ -68926,7 +68927,7 @@ var en = class {
|
|
|
68926
68927
|
};
|
|
68927
68928
|
var ee = class {
|
|
68928
68929
|
constructor() {
|
|
68929
|
-
c(this, "emitter", new
|
|
68930
|
+
c(this, "emitter", new tn());
|
|
68930
68931
|
}
|
|
68931
68932
|
dispatchEvent(e) {
|
|
68932
68933
|
this.emitter.dispatchEvent(e);
|
|
@@ -68944,76 +68945,76 @@ var ee = class {
|
|
|
68944
68945
|
return this.emitter.listenerCount(e);
|
|
68945
68946
|
}
|
|
68946
68947
|
};
|
|
68947
|
-
var
|
|
68948
|
-
var
|
|
68949
|
-
var
|
|
68950
|
-
function
|
|
68951
|
-
return
|
|
68948
|
+
var rn = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
|
|
68949
|
+
var ka = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
|
|
68950
|
+
var nn = ["DiagnosticReport-update"];
|
|
68951
|
+
function Ui(r6) {
|
|
68952
|
+
return nn.includes(r6);
|
|
68952
68953
|
}
|
|
68953
|
-
function
|
|
68954
|
-
if (
|
|
68954
|
+
function Bi(r6) {
|
|
68955
|
+
if (nn.includes(r6)) throw new f(x(`'context.version' is required for '${r6}'.`));
|
|
68955
68956
|
}
|
|
68956
|
-
var
|
|
68957
|
-
function
|
|
68958
|
-
return
|
|
68957
|
+
var Da = { "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" } } };
|
|
68958
|
+
function Va(r6) {
|
|
68959
|
+
return ka.includes(r6);
|
|
68959
68960
|
}
|
|
68960
|
-
function
|
|
68961
|
+
function qi(r6) {
|
|
68961
68962
|
return !!r6.endpoint;
|
|
68962
68963
|
}
|
|
68963
|
-
function
|
|
68964
|
-
if (!
|
|
68964
|
+
function on(r6) {
|
|
68965
|
+
if (!Gt(r6)) throw new f(x("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
|
|
68965
68966
|
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(",") };
|
|
68966
|
-
return
|
|
68967
|
+
return qi(r6) && (o2.endpoint = r6.endpoint), new URLSearchParams(o2).toString();
|
|
68967
68968
|
}
|
|
68968
|
-
function
|
|
68969
|
+
function Gt(r6) {
|
|
68969
68970
|
if (typeof r6 != "object") return false;
|
|
68970
68971
|
let { channelType: e, mode: t, topic: n, events: i } = r6;
|
|
68971
68972
|
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;
|
|
68972
|
-
for (let o2 of i) if (!
|
|
68973
|
-
return !(
|
|
68973
|
+
for (let o2 of i) if (!rn[o2]) return false;
|
|
68974
|
+
return !(qi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
|
|
68974
68975
|
}
|
|
68975
|
-
function
|
|
68976
|
+
function Ma(r6, e, t, n) {
|
|
68976
68977
|
if (typeof e != "object") throw new f(x(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
|
|
68977
68978
|
if (!(e.id && typeof e.id == "string")) throw new f(x(`context[${t}] is invalid. Resource must contain a valid string ID.`));
|
|
68978
68979
|
if (!e.resourceType) throw new f(x(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
|
|
68979
68980
|
let i = n.resourceType;
|
|
68980
68981
|
if (i !== "*") {
|
|
68981
|
-
if (!
|
|
68982
|
+
if (!Va(e.resourceType)) throw new f(x(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
|
|
68982
68983
|
if (i && e.resourceType !== i) throw new f(x(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i}.`));
|
|
68983
68984
|
}
|
|
68984
68985
|
}
|
|
68985
|
-
function
|
|
68986
|
+
function _a(r6, e, t, n, i) {
|
|
68986
68987
|
if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
|
|
68987
68988
|
if (!H(e.reference)) throw new f(x(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
|
|
68988
|
-
} else
|
|
68989
|
+
} else Ma(r6, e.resource, t, n);
|
|
68989
68990
|
}
|
|
68990
|
-
function
|
|
68991
|
-
let t = /* @__PURE__ */ new Map(), n =
|
|
68991
|
+
function La(r6, e) {
|
|
68992
|
+
let t = /* @__PURE__ */ new Map(), n = Da[r6];
|
|
68992
68993
|
for (let i = 0; i < e.length; i++) {
|
|
68993
68994
|
let o2 = e[i].key;
|
|
68994
68995
|
if (!n[o2]) throw new f(x(`Key '${o2}' not found for event '${r6}'. Make sure to add only valid keys.`));
|
|
68995
|
-
|
|
68996
|
+
_a(r6, e[i], i, n[o2], t);
|
|
68996
68997
|
}
|
|
68997
68998
|
for (let [i, o2] of Object.entries(n)) {
|
|
68998
68999
|
if (!(o2.optional || t.has(i))) throw new f(x(`Missing required key '${i}' on context for '${r6}' event.`));
|
|
68999
69000
|
if (!o2.manyAllowed && (t.get(i) ?? 0) > 1) throw new f(x(`${t.get(i)} context entries with key '${i}' found for the '${r6}' event when schema only allows for 1.`));
|
|
69000
69001
|
}
|
|
69001
69002
|
}
|
|
69002
|
-
function
|
|
69003
|
+
function sn(r6, e, t, n) {
|
|
69003
69004
|
if (!(r6 && typeof r6 == "string")) throw new f(x("Must provide a topic."));
|
|
69004
|
-
if (!
|
|
69005
|
+
if (!rn[e]) throw new f(x(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(rn).join(", ")}`));
|
|
69005
69006
|
if (typeof t != "object") throw new f(x("context must be a context object or array of context objects."));
|
|
69006
|
-
if (
|
|
69007
|
+
if (nn.includes(e) && !n) throw new f(x(`The '${e}' event must contain a 'context.versionId'.`));
|
|
69007
69008
|
let i = Array.isArray(t) ? t : [t];
|
|
69008
|
-
return
|
|
69009
|
+
return La(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: se(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
|
|
69009
69010
|
}
|
|
69010
|
-
var
|
|
69011
|
+
var Ht = class extends ee {
|
|
69011
69012
|
constructor(t) {
|
|
69012
69013
|
super();
|
|
69013
69014
|
c(this, "subRequest");
|
|
69014
69015
|
c(this, "websocket");
|
|
69015
69016
|
if (this.subRequest = t, !t.endpoint) throw new f(x("Subscription request should contain an endpoint."));
|
|
69016
|
-
if (!
|
|
69017
|
+
if (!Gt(t)) throw new f(x("Subscription request failed validation."));
|
|
69017
69018
|
let n = new WebSocket(t.endpoint);
|
|
69018
69019
|
n.addEventListener("open", () => {
|
|
69019
69020
|
this.dispatchEvent({ type: "connect" }), n.addEventListener("message", (i) => {
|
|
@@ -69030,32 +69031,32 @@ var $t = class extends ee {
|
|
|
69030
69031
|
this.websocket.close();
|
|
69031
69032
|
}
|
|
69032
69033
|
};
|
|
69033
|
-
function
|
|
69034
|
-
return JSON.parse(
|
|
69034
|
+
function Fa(r6) {
|
|
69035
|
+
return JSON.parse(Li(r6));
|
|
69035
69036
|
}
|
|
69036
|
-
function
|
|
69037
|
+
function Wi(r6) {
|
|
69037
69038
|
return r6.split(".").length === 3;
|
|
69038
69039
|
}
|
|
69039
|
-
function
|
|
69040
|
+
function Qt(r6) {
|
|
69040
69041
|
let [e, t, n] = r6.split(".");
|
|
69041
|
-
return
|
|
69042
|
+
return Fa(t);
|
|
69042
69043
|
}
|
|
69043
|
-
function
|
|
69044
|
+
function ji(r6) {
|
|
69044
69045
|
try {
|
|
69045
|
-
return typeof
|
|
69046
|
+
return typeof Qt(r6).login_id == "string";
|
|
69046
69047
|
} catch {
|
|
69047
69048
|
return false;
|
|
69048
69049
|
}
|
|
69049
69050
|
}
|
|
69050
|
-
function
|
|
69051
|
+
function $i(r6) {
|
|
69051
69052
|
try {
|
|
69052
|
-
let t =
|
|
69053
|
+
let t = Qt(r6).exp;
|
|
69053
69054
|
return typeof t == "number" ? t * 1e3 : void 0;
|
|
69054
69055
|
} catch {
|
|
69055
69056
|
return;
|
|
69056
69057
|
}
|
|
69057
69058
|
}
|
|
69058
|
-
var
|
|
69059
|
+
var zt = class {
|
|
69059
69060
|
constructor(e) {
|
|
69060
69061
|
c(this, "medplum");
|
|
69061
69062
|
this.medplum = e;
|
|
@@ -69064,17 +69065,17 @@ var Qt = class {
|
|
|
69064
69065
|
return this.medplum.get(`keyvalue/v1/${e}`);
|
|
69065
69066
|
}
|
|
69066
69067
|
async set(e, t) {
|
|
69067
|
-
await this.medplum.put(`keyvalue/v1/${e}`, t,
|
|
69068
|
+
await this.medplum.put(`keyvalue/v1/${e}`, t, O.TEXT);
|
|
69068
69069
|
}
|
|
69069
69070
|
async delete(e) {
|
|
69070
69071
|
await this.medplum.delete(`keyvalue/v1/${e}`);
|
|
69071
69072
|
}
|
|
69072
69073
|
};
|
|
69073
|
-
var
|
|
69074
|
-
|
|
69074
|
+
var Hi;
|
|
69075
|
+
Hi = Symbol.toStringTag;
|
|
69075
69076
|
var F = class {
|
|
69076
69077
|
constructor(e) {
|
|
69077
|
-
c(this,
|
|
69078
|
+
c(this, Hi, "ReadablePromise");
|
|
69078
69079
|
c(this, "suspender");
|
|
69079
69080
|
c(this, "status", "pending");
|
|
69080
69081
|
c(this, "response");
|
|
@@ -69113,7 +69114,7 @@ var st = class {
|
|
|
69113
69114
|
constructor(e, t = "") {
|
|
69114
69115
|
c(this, "storage");
|
|
69115
69116
|
c(this, "prefix", "");
|
|
69116
|
-
this.storage = e ?? globalThis.localStorage ?? new
|
|
69117
|
+
this.storage = e ?? globalThis.localStorage ?? new an(), this.prefix = t;
|
|
69117
69118
|
}
|
|
69118
69119
|
makeKey(e) {
|
|
69119
69120
|
return this.prefix + e;
|
|
@@ -69134,10 +69135,10 @@ var st = class {
|
|
|
69134
69135
|
return t ? JSON.parse(t) : void 0;
|
|
69135
69136
|
}
|
|
69136
69137
|
setObject(e, t) {
|
|
69137
|
-
this.setString(e, t ?
|
|
69138
|
+
this.setString(e, t ? Ct(t) : void 0);
|
|
69138
69139
|
}
|
|
69139
69140
|
};
|
|
69140
|
-
var
|
|
69141
|
+
var an = class {
|
|
69141
69142
|
constructor() {
|
|
69142
69143
|
c(this, "data");
|
|
69143
69144
|
this.data = /* @__PURE__ */ new Map();
|
|
@@ -69162,8 +69163,8 @@ var sn = class {
|
|
|
69162
69163
|
}
|
|
69163
69164
|
};
|
|
69164
69165
|
var je = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
|
|
69165
|
-
var
|
|
69166
|
-
function
|
|
69166
|
+
var Qi = false;
|
|
69167
|
+
function Na() {
|
|
69167
69168
|
if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
|
|
69168
69169
|
je.Event = globalThis.Event, je.ErrorEvent = class extends Event {
|
|
69169
69170
|
constructor(t, n) {
|
|
@@ -69182,17 +69183,17 @@ function Va() {
|
|
|
69182
69183
|
}
|
|
69183
69184
|
};
|
|
69184
69185
|
}
|
|
69185
|
-
function
|
|
69186
|
+
function Ua(r6, e) {
|
|
69186
69187
|
if (!r6) throw new Error(e);
|
|
69187
69188
|
}
|
|
69188
|
-
function
|
|
69189
|
+
function Jt(r6) {
|
|
69189
69190
|
return new r6.constructor(r6.type, r6);
|
|
69190
69191
|
}
|
|
69191
69192
|
var ke = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
|
|
69192
|
-
var
|
|
69193
|
-
var
|
|
69193
|
+
var zi = false;
|
|
69194
|
+
var Kt = class r extends ee {
|
|
69194
69195
|
constructor(t, n, i = {}) {
|
|
69195
|
-
|
|
69196
|
+
Qi || (Na(), Qi = true);
|
|
69196
69197
|
super();
|
|
69197
69198
|
c(this, "_ws");
|
|
69198
69199
|
c(this, "_retryCount", -1);
|
|
@@ -69214,16 +69215,16 @@ var Jt = class r extends ee {
|
|
|
69214
69215
|
c(this, "_handleOpen", (t2) => {
|
|
69215
69216
|
this._debug("open event");
|
|
69216
69217
|
let { minUptime: n2 = ke.minUptime } = this._options;
|
|
69217
|
-
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2),
|
|
69218
|
+
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Ua(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(Jt(t2));
|
|
69218
69219
|
});
|
|
69219
69220
|
c(this, "_handleMessage", (t2) => {
|
|
69220
|
-
this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(
|
|
69221
|
+
this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Jt(t2));
|
|
69221
69222
|
});
|
|
69222
69223
|
c(this, "_handleError", (t2) => {
|
|
69223
|
-
this._debug("error event", t2.message), this._disconnect(void 0, t2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(t2), this._debug("exec error listeners"), this.dispatchEvent(
|
|
69224
|
+
this._debug("error event", t2.message), this._disconnect(void 0, t2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(t2), this._debug("exec error listeners"), this.dispatchEvent(Jt(t2)), this._connect();
|
|
69224
69225
|
});
|
|
69225
69226
|
c(this, "_handleClose", (t2) => {
|
|
69226
|
-
this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(t2), this.dispatchEvent(
|
|
69227
|
+
this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(t2), this.dispatchEvent(Jt(t2));
|
|
69227
69228
|
});
|
|
69228
69229
|
this._url = t, this._protocols = n, this._options = i, this._options.startClosed && (this._shouldReconnect = false), this._options.binaryType ? this._binaryType = this._options.binaryType : this._binaryType = "blob", this._options.debugLogger && (this._debugLogger = this._options.debugLogger), this._connect();
|
|
69229
69230
|
}
|
|
@@ -69324,7 +69325,7 @@ var Jt = class r extends ee {
|
|
|
69324
69325
|
this._connectLock = false;
|
|
69325
69326
|
return;
|
|
69326
69327
|
}
|
|
69327
|
-
!this._options.WebSocket && typeof WebSocket > "u" &&
|
|
69328
|
+
!this._options.WebSocket && typeof WebSocket > "u" && !zi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), zi = true);
|
|
69328
69329
|
let i = this._options.WebSocket || WebSocket;
|
|
69329
69330
|
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);
|
|
69330
69331
|
}).catch((i) => {
|
|
@@ -69356,8 +69357,7 @@ var Jt = class r extends ee {
|
|
|
69356
69357
|
clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
|
|
69357
69358
|
}
|
|
69358
69359
|
};
|
|
69359
|
-
var
|
|
69360
|
-
var _a = [WebSocket.CLOSING, WebSocket.CLOSED];
|
|
69360
|
+
var Ba = [WebSocket.CLOSING, WebSocket.CLOSED];
|
|
69361
69361
|
var at = class extends ee {
|
|
69362
69362
|
constructor(...t) {
|
|
69363
69363
|
super();
|
|
@@ -69374,7 +69374,7 @@ var at = class extends ee {
|
|
|
69374
69374
|
this.criteria.delete(t);
|
|
69375
69375
|
}
|
|
69376
69376
|
};
|
|
69377
|
-
var
|
|
69377
|
+
var cn = class {
|
|
69378
69378
|
constructor(e, t) {
|
|
69379
69379
|
c(this, "criteria");
|
|
69380
69380
|
c(this, "emitter");
|
|
@@ -69382,14 +69382,15 @@ var an = class {
|
|
|
69382
69382
|
c(this, "subscriptionProps");
|
|
69383
69383
|
c(this, "subscriptionId");
|
|
69384
69384
|
c(this, "token");
|
|
69385
|
+
c(this, "tokenExpiry");
|
|
69385
69386
|
c(this, "connecting", false);
|
|
69386
69387
|
this.criteria = e, this.emitter = new at(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
|
|
69387
69388
|
}
|
|
69388
69389
|
clearAttachedSubscription() {
|
|
69389
|
-
this.subscriptionId = void 0, this.token = void 0;
|
|
69390
|
+
this.subscriptionId = void 0, this.token = void 0, this.tokenExpiry = void 0;
|
|
69390
69391
|
}
|
|
69391
69392
|
};
|
|
69392
|
-
var
|
|
69393
|
+
var Yt = class {
|
|
69393
69394
|
constructor(e, t, n) {
|
|
69394
69395
|
c(this, "medplum");
|
|
69395
69396
|
c(this, "ws");
|
|
@@ -69398,18 +69399,19 @@ var Kt = class {
|
|
|
69398
69399
|
c(this, "criteriaEntriesBySubscriptionId");
|
|
69399
69400
|
c(this, "wsClosed");
|
|
69400
69401
|
c(this, "pingTimer");
|
|
69402
|
+
c(this, "tokenRefreshTimer");
|
|
69401
69403
|
c(this, "pingIntervalMs");
|
|
69402
69404
|
c(this, "waitingForPong", false);
|
|
69403
69405
|
c(this, "currentProfile");
|
|
69404
|
-
if (!(e instanceof
|
|
69406
|
+
if (!(e instanceof Xt)) throw new f(x("First arg of constructor should be a `MedplumClient`"));
|
|
69405
69407
|
let i;
|
|
69406
69408
|
try {
|
|
69407
69409
|
i = new URL(t).toString();
|
|
69408
69410
|
} catch {
|
|
69409
69411
|
throw new f(x("Not a valid URL"));
|
|
69410
69412
|
}
|
|
69411
|
-
let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new
|
|
69412
|
-
this.medplum = e, this.ws = o2, this.masterSubEmitter = new at(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ??
|
|
69413
|
+
let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new Kt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
|
|
69414
|
+
this.medplum = e, this.ws = o2, this.masterSubEmitter = new at(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? 5e3, this.currentProfile = e.getProfile(), this.setupListeners();
|
|
69413
69415
|
}
|
|
69414
69416
|
setupListeners() {
|
|
69415
69417
|
let e = this.ws;
|
|
@@ -69450,14 +69452,14 @@ var Kt = class {
|
|
|
69450
69452
|
for (let o2 of this.getAllCriteriaEmitters()) o2.dispatchEvent({ ...i });
|
|
69451
69453
|
}
|
|
69452
69454
|
}), e.addEventListener("error", () => {
|
|
69453
|
-
let t = { type: "error", payload: new f(
|
|
69455
|
+
let t = { type: "error", payload: new f(_n(new Error("WebSocket error"))) };
|
|
69454
69456
|
this.masterSubEmitter?.dispatchEvent(t);
|
|
69455
69457
|
for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
|
|
69456
69458
|
}), e.addEventListener("close", () => {
|
|
69457
69459
|
let t = { type: "close" };
|
|
69458
69460
|
this.masterSubEmitter?.dispatchEvent(t);
|
|
69459
69461
|
for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
|
|
69460
|
-
this.pingTimer && (clearInterval(this.pingTimer), this.pingTimer = void 0, this.waitingForPong = false), this.wsClosed && (this.criteriaEntries.clear(), this.criteriaEntriesBySubscriptionId.clear(), this.masterSubEmitter?.removeAllListeners());
|
|
69462
|
+
this.pingTimer && (clearInterval(this.pingTimer), this.pingTimer = void 0, this.waitingForPong = false), this.tokenRefreshTimer && (clearInterval(this.tokenRefreshTimer), this.tokenRefreshTimer = void 0), this.wsClosed && (this.criteriaEntries.clear(), this.criteriaEntriesBySubscriptionId.clear(), this.masterSubEmitter?.removeAllListeners());
|
|
69461
69463
|
}), e.addEventListener("open", () => {
|
|
69462
69464
|
let t = { type: "open" };
|
|
69463
69465
|
this.masterSubEmitter?.dispatchEvent(t);
|
|
@@ -69468,7 +69470,9 @@ var Kt = class {
|
|
|
69468
69470
|
return;
|
|
69469
69471
|
}
|
|
69470
69472
|
e.send(JSON.stringify({ type: "ping" })), this.waitingForPong = true;
|
|
69471
|
-
}, this.pingIntervalMs))
|
|
69473
|
+
}, this.pingIntervalMs)), this.tokenRefreshTimer ??= setInterval(() => {
|
|
69474
|
+
this.checkTokenExpirations();
|
|
69475
|
+
}, 6e4);
|
|
69472
69476
|
}), this.medplum.addEventListener("change", () => {
|
|
69473
69477
|
let t = this.medplum.getProfile();
|
|
69474
69478
|
this.currentProfile && t === void 0 ? this.ws.close() : t && this.currentProfile?.id !== t.id && this.ws.reconnect(), this.currentProfile = t;
|
|
@@ -69487,11 +69491,12 @@ var Kt = class {
|
|
|
69487
69491
|
}
|
|
69488
69492
|
async getTokenForCriteria(e) {
|
|
69489
69493
|
let t = e?.subscriptionId;
|
|
69490
|
-
t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${
|
|
69491
|
-
let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`), i = n?.find((
|
|
69494
|
+
t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${A(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
|
|
69495
|
+
let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`), i = n?.find((a) => a.name === "token")?.valueString, o2 = n?.find((a) => a.name === "websocket-url")?.valueUrl, s = n?.find((a) => a.name === "expiration")?.valueDateTime;
|
|
69492
69496
|
if (!i) throw new f(x("Failed to get token"));
|
|
69493
69497
|
if (!o2) throw new f(x("Failed to get URL from $get-ws-binding-token"));
|
|
69494
|
-
|
|
69498
|
+
if (!s) throw new f(x("Failed to get expiration from $get-ws-binding-token"));
|
|
69499
|
+
return [t, i, s];
|
|
69495
69500
|
}
|
|
69496
69501
|
maybeGetCriteriaEntry(e, t) {
|
|
69497
69502
|
let n = this.criteriaEntries.get(e);
|
|
@@ -69522,25 +69527,34 @@ var Kt = class {
|
|
|
69522
69527
|
}) : s.bareCriteria = void 0, !s.bareCriteria && s.criteriaWithProps.length === 0 && (this.criteriaEntries.delete(t), this.masterSubEmitter?._removeCriteria(t)), i && this.criteriaEntriesBySubscriptionId.delete(i), o2 && this.ws.readyState === WebSocket.OPEN && this.ws.send(JSON.stringify({ type: "unbind-from-token", payload: { token: o2 } }));
|
|
69523
69528
|
}
|
|
69524
69529
|
async subscribeToCriteria(e) {
|
|
69525
|
-
|
|
69526
|
-
e.connecting = true;
|
|
69527
|
-
try {
|
|
69528
|
-
let [t, n] = await this.getTokenForCriteria(e);
|
|
69529
|
-
e.subscriptionId = t, e.token = n, this.criteriaEntriesBySubscriptionId.set(t, e), this.ws.send(JSON.stringify({ type: "bind-with-token", payload: { token: n } }));
|
|
69530
|
-
} catch (t) {
|
|
69531
|
-
console.error(_e(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
|
|
69532
|
-
}
|
|
69533
|
-
}
|
|
69530
|
+
this.wsClosed && await this.reconnectIfNeeded(), !this.isReconnecting(e) && (e.connecting = true, await this.rebindCriteriaEntry(e));
|
|
69534
69531
|
}
|
|
69535
69532
|
async refreshAllSubscriptions() {
|
|
69536
69533
|
this.criteriaEntriesBySubscriptionId.clear();
|
|
69537
69534
|
for (let e of this.criteriaEntries.values()) for (let t of [...e.bareCriteria ? [e.bareCriteria] : [], ...e.criteriaWithProps]) t.clearAttachedSubscription(), await this.subscribeToCriteria(t);
|
|
69538
69535
|
}
|
|
69536
|
+
isReconnecting(e) {
|
|
69537
|
+
return !!(this.ws.readyState !== WebSocket.OPEN || e.connecting);
|
|
69538
|
+
}
|
|
69539
|
+
async rebindCriteriaEntry(e) {
|
|
69540
|
+
try {
|
|
69541
|
+
let [t, n, i] = await this.getTokenForCriteria(e);
|
|
69542
|
+
e.token = n, e.tokenExpiry = new Date(i).getTime(), e.subscriptionId = t, this.criteriaEntriesBySubscriptionId.set(t, e), this.ws.send(JSON.stringify({ type: "bind-with-token", payload: { token: n } }));
|
|
69543
|
+
} catch (t) {
|
|
69544
|
+
console.error(_e(t)), this.emitError(e, t);
|
|
69545
|
+
}
|
|
69546
|
+
}
|
|
69547
|
+
checkTokenExpirations() {
|
|
69548
|
+
let e = Date.now();
|
|
69549
|
+
for (let t of this.criteriaEntries.values()) for (let n of [...t.bareCriteria ? [t.bareCriteria] : [], ...t.criteriaWithProps]) n.tokenExpiry && n.tokenExpiry - e <= 3e5 && !this.isReconnecting(n) && this.rebindCriteriaEntry(n).catch((i) => {
|
|
69550
|
+
this.masterSubEmitter?.dispatchEvent({ type: "error", payload: i });
|
|
69551
|
+
});
|
|
69552
|
+
}
|
|
69539
69553
|
addCriteria(e, t) {
|
|
69540
69554
|
this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
|
|
69541
69555
|
let n = this.maybeGetCriteriaEntry(e, t);
|
|
69542
69556
|
if (n) return n.refCount += 1, n.emitter;
|
|
69543
|
-
let i = new
|
|
69557
|
+
let i = new cn(e, t);
|
|
69544
69558
|
return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
|
|
69545
69559
|
}
|
|
69546
69560
|
removeCriteria(e, t) {
|
|
@@ -69567,7 +69581,7 @@ var Kt = class {
|
|
|
69567
69581
|
return this.masterSubEmitter || (this.masterSubEmitter = new at(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
|
|
69568
69582
|
}
|
|
69569
69583
|
async reconnectIfNeeded() {
|
|
69570
|
-
|
|
69584
|
+
Ba.includes(this.getWebSocket().readyState) && await new Promise((e) => {
|
|
69571
69585
|
let t = () => {
|
|
69572
69586
|
this.getWebSocket().removeEventListener("open", t), e();
|
|
69573
69587
|
};
|
|
@@ -69575,19 +69589,19 @@ var Kt = class {
|
|
|
69575
69589
|
});
|
|
69576
69590
|
}
|
|
69577
69591
|
};
|
|
69578
|
-
var
|
|
69579
|
-
var
|
|
69580
|
-
var
|
|
69581
|
-
var
|
|
69582
|
-
var
|
|
69583
|
-
var
|
|
69584
|
-
var
|
|
69585
|
-
var
|
|
69586
|
-
var
|
|
69592
|
+
var un = "5.0.15-b702e04";
|
|
69593
|
+
var ja = O.FHIR_JSON + ", */*; q=0.1";
|
|
69594
|
+
var $a = "https://api.medplum.com/";
|
|
69595
|
+
var Ha = 1e3;
|
|
69596
|
+
var Ga = 6e4;
|
|
69597
|
+
var Qa = 0;
|
|
69598
|
+
var za = 3e5;
|
|
69599
|
+
var Ja = "Binary/";
|
|
69600
|
+
var Ji = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
|
|
69587
69601
|
var $e = { 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" };
|
|
69588
|
-
var
|
|
69589
|
-
var
|
|
69590
|
-
var
|
|
69602
|
+
var Ka = { 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" };
|
|
69603
|
+
var Ya = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
|
|
69604
|
+
var Xt = class extends ee {
|
|
69591
69605
|
constructor(t) {
|
|
69592
69606
|
super();
|
|
69593
69607
|
c(this, "options");
|
|
@@ -69626,7 +69640,7 @@ var Yt = class extends ee {
|
|
|
69626
69640
|
c(this, "keyValueClient");
|
|
69627
69641
|
c(this, "logLevel");
|
|
69628
69642
|
if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
|
|
69629
|
-
this.options = t ?? {}, this.fetch = t?.fetch ??
|
|
69643
|
+
this.options = t ?? {}, this.fetch = t?.fetch ?? Xa(), this.storage = t?.storage ?? new st(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = zr(t?.baseUrl ?? $a), this.fhirBaseUrl = G(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = G(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = G(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = G(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = G(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? za, this.logLevel = this.initializeLogLevel(t), this.cacheTime = t?.cacheTime ?? (j() ? Ga : Qa), this.cacheTime > 0 ? this.requestCache = new Ve(t?.resourceCacheSize ?? Ha) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
|
|
69630
69644
|
t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
|
|
69631
69645
|
}).catch((n) => {
|
|
69632
69646
|
console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
|
|
@@ -69697,7 +69711,7 @@ var Yt = class extends ee {
|
|
|
69697
69711
|
return t = t.toString(), this.setRequestBody(o2, n), i && this.setRequestContentType(o2, i), this.invalidateUrl(t), this.request("PUT", t, o2);
|
|
69698
69712
|
}
|
|
69699
69713
|
patch(t, n, i = {}) {
|
|
69700
|
-
return t = t.toString(), this.setRequestBody(i, n), this.setRequestContentType(i,
|
|
69714
|
+
return t = t.toString(), this.setRequestBody(i, n), this.setRequestContentType(i, O.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i);
|
|
69701
69715
|
}
|
|
69702
69716
|
delete(t, n) {
|
|
69703
69717
|
return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
|
|
@@ -69741,7 +69755,7 @@ var Yt = class extends ee {
|
|
|
69741
69755
|
}
|
|
69742
69756
|
async exchangeExternalAccessToken(t, n, i) {
|
|
69743
69757
|
if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
|
|
69744
|
-
let o2 = { grant_type: $e.TokenExchange, subject_token_type:
|
|
69758
|
+
let o2 = { grant_type: $e.TokenExchange, subject_token_type: Ka.AccessToken, client_id: n, subject_token: t };
|
|
69745
69759
|
return i && (o2.membership_id = i), this.fetchTokens(o2);
|
|
69746
69760
|
}
|
|
69747
69761
|
getExternalAuthRedirectUri(t, n, i, o2, s = true) {
|
|
@@ -69759,7 +69773,7 @@ var Yt = class extends ee {
|
|
|
69759
69773
|
}
|
|
69760
69774
|
fhirSearchUrl(t, n) {
|
|
69761
69775
|
let i = this.fhirUrl(t);
|
|
69762
|
-
return n && (i.search =
|
|
69776
|
+
return n && (i.search = xi(n)), i;
|
|
69763
69777
|
}
|
|
69764
69778
|
search(t, n, i) {
|
|
69765
69779
|
let o2 = this.fhirSearchUrl(t, n), s = "search-" + o2.toString(), a = this.getCacheEntry(s, i);
|
|
@@ -69778,7 +69792,7 @@ var Yt = class extends ee {
|
|
|
69778
69792
|
searchResources(t, n, i) {
|
|
69779
69793
|
let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i);
|
|
69780
69794
|
if (a) return a.value;
|
|
69781
|
-
let u2 = new F(this.search(t, n, i).then(
|
|
69795
|
+
let u2 = new F(this.search(t, n, i).then(Yi));
|
|
69782
69796
|
return this.setCacheEntry(s, u2, i), u2;
|
|
69783
69797
|
}
|
|
69784
69798
|
async *searchResourcePages(t, n, i) {
|
|
@@ -69788,7 +69802,7 @@ var Yt = class extends ee {
|
|
|
69788
69802
|
s.has("_count") || s.set("_count", "1000");
|
|
69789
69803
|
let a = await this.search(t, s, i), u2 = a.link?.find((l2) => l2.relation === "next");
|
|
69790
69804
|
if (!a.entry?.length && !u2) break;
|
|
69791
|
-
yield
|
|
69805
|
+
yield Yi(a), o2 = u2?.url ? new URL(u2.url) : void 0;
|
|
69792
69806
|
}
|
|
69793
69807
|
}
|
|
69794
69808
|
valueSetExpand(t, n) {
|
|
@@ -69802,7 +69816,7 @@ var Yt = class extends ee {
|
|
|
69802
69816
|
getCachedReference(t) {
|
|
69803
69817
|
let n = t.reference;
|
|
69804
69818
|
if (!n) return;
|
|
69805
|
-
if (n === "system") return
|
|
69819
|
+
if (n === "system") return Ji;
|
|
69806
69820
|
let [i, o2] = n.split("/");
|
|
69807
69821
|
if (!(!i || !o2)) return this.getCached(i, o2);
|
|
69808
69822
|
}
|
|
@@ -69813,7 +69827,7 @@ var Yt = class extends ee {
|
|
|
69813
69827
|
readReference(t, n) {
|
|
69814
69828
|
let i = t.reference;
|
|
69815
69829
|
if (!i) return new F(Promise.reject(new Error("Missing reference")));
|
|
69816
|
-
if (i === "system") return new F(Promise.resolve(
|
|
69830
|
+
if (i === "system") return new F(Promise.resolve(Ji));
|
|
69817
69831
|
let [o2, s] = i.split("/");
|
|
69818
69832
|
return !o2 || !s ? new F(Promise.reject(new Error("Invalid reference"))) : this.readResource(o2, s, n);
|
|
69819
69833
|
}
|
|
@@ -69821,7 +69835,7 @@ var Yt = class extends ee {
|
|
|
69821
69835
|
return Array.isArray(t) ? this.searchOne("", { _type: t.join(","), url: n }, i) : this.searchOne(t, "url=" + n, i);
|
|
69822
69836
|
}
|
|
69823
69837
|
requestSchema(t, n) {
|
|
69824
|
-
if (
|
|
69838
|
+
if (Qn(t)) return Promise.resolve();
|
|
69825
69839
|
let i = t + "-requestSchema", o2 = this.getCacheEntry(i, void 0);
|
|
69826
69840
|
if (o2) return o2.value;
|
|
69827
69841
|
let s = new F((async () => {
|
|
@@ -69866,13 +69880,13 @@ var Yt = class extends ee {
|
|
|
69866
69880
|
target
|
|
69867
69881
|
}
|
|
69868
69882
|
}`.replaceAll(/\s+/g, " "), u2 = await this.graphql(a);
|
|
69869
|
-
|
|
69870
|
-
for (let l2 of u2.data.SearchParameterList)
|
|
69883
|
+
Ar(u2.data.StructureDefinitionList);
|
|
69884
|
+
for (let l2 of u2.data.SearchParameterList) Kr(l2);
|
|
69871
69885
|
})());
|
|
69872
69886
|
return this.setCacheEntry(i, s, n), s;
|
|
69873
69887
|
}
|
|
69874
69888
|
requestProfileSchema(t, n) {
|
|
69875
|
-
if (!n?.expandProfile &&
|
|
69889
|
+
if (!n?.expandProfile && zn(t)) return Promise.resolve();
|
|
69876
69890
|
let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o2 = this.getCacheEntry(i, void 0);
|
|
69877
69891
|
if (o2) return o2.value;
|
|
69878
69892
|
let s = new F((async () => {
|
|
@@ -69880,14 +69894,14 @@ var Yt = class extends ee {
|
|
|
69880
69894
|
let a = this.fhirUrl("StructureDefinition", "$expand-profile");
|
|
69881
69895
|
a.search = new URLSearchParams({ url: t }).toString();
|
|
69882
69896
|
let u2 = await this.post(a.toString(), {});
|
|
69883
|
-
|
|
69897
|
+
Ar(u2);
|
|
69884
69898
|
} else {
|
|
69885
69899
|
let a = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
|
|
69886
69900
|
if (!a) {
|
|
69887
69901
|
console.warn(`No StructureDefinition found for ${t}!`);
|
|
69888
69902
|
return;
|
|
69889
69903
|
}
|
|
69890
|
-
|
|
69904
|
+
wr(a);
|
|
69891
69905
|
}
|
|
69892
69906
|
})());
|
|
69893
69907
|
return this.setCacheEntry(i, s, n), s;
|
|
@@ -69920,8 +69934,8 @@ var Yt = class extends ee {
|
|
|
69920
69934
|
return s || (s = t), this.cacheResource(s, i), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
|
|
69921
69935
|
}
|
|
69922
69936
|
async createAttachment(t, n, i, o2, s) {
|
|
69923
|
-
let a =
|
|
69924
|
-
if (a.contentType ===
|
|
69937
|
+
let a = Xi(t, n, i, o2);
|
|
69938
|
+
if (a.contentType === O.XML) {
|
|
69925
69939
|
let p = a.data, y2;
|
|
69926
69940
|
p instanceof Blob ? y2 = await new Promise((T, $) => {
|
|
69927
69941
|
let Q2 = new FileReader();
|
|
@@ -69932,13 +69946,13 @@ var Yt = class extends ee {
|
|
|
69932
69946
|
}
|
|
69933
69947
|
T(Q2.result);
|
|
69934
69948
|
}, Q2.readAsText(p, "utf-8");
|
|
69935
|
-
}) : ArrayBuffer.isView(p) ? y2 = new TextDecoder().decode(p) : y2 = p, y2.includes("<ClinicalDocument") && y2.includes("urn:hl7-org:v3") && (a = { ...a, contentType:
|
|
69949
|
+
}) : ArrayBuffer.isView(p) ? y2 = new TextDecoder().decode(p) : y2 = p, y2.includes("<ClinicalDocument") && y2.includes("urn:hl7-org:v3") && (a = { ...a, contentType: O.CDA_XML });
|
|
69936
69950
|
}
|
|
69937
69951
|
let u2 = s ?? (typeof n == "object" ? n : {}), l2 = await this.createBinary(a, u2);
|
|
69938
69952
|
return { contentType: a.contentType, url: l2.url, title: a.filename };
|
|
69939
69953
|
}
|
|
69940
69954
|
createBinary(t, n, i, o2, s) {
|
|
69941
|
-
let a =
|
|
69955
|
+
let a = Xi(t, n, i, o2), u2 = s ?? (typeof n == "object" ? n : {}), { data: l2, contentType: p, filename: y2, securityContext: T, onProgress: $ } = a, Q2 = this.fhirUrl("Binary");
|
|
69942
69956
|
return y2 && Q2.searchParams.set("_filename", y2), T?.reference && this.setRequestHeader(u2, "X-Security-Context", T.reference), $ ? this.uploadwithProgress(Q2, l2, p, $, u2) : this.post(Q2, l2, p, u2);
|
|
69943
69957
|
}
|
|
69944
69958
|
uploadwithProgress(t, n, i, o2, s) {
|
|
@@ -69949,7 +69963,7 @@ var Yt = class extends ee {
|
|
|
69949
69963
|
s?.signal?.removeEventListener("abort", p), T instanceof Error ? u2(T) : a(T);
|
|
69950
69964
|
};
|
|
69951
69965
|
if (l2.responseType = "json", l2.onabort = () => y2(new DOMException("Request aborted", "AbortError")), l2.onerror = () => y2(new Error("Request error")), o2 && (l2.upload.onprogress = (T) => o2(T), l2.upload.onload = (T) => o2(T)), l2.onload = () => {
|
|
69952
|
-
l2.status >= 200 && l2.status < 300 ? y2(l2.response) : y2(new f(
|
|
69966
|
+
l2.status >= 200 && l2.status < 300 ? y2(l2.response) : y2(new f(yt(l2.response || l2.statusText)));
|
|
69953
69967
|
}, l2.open("POST", t), l2.withCredentials = true, l2.setRequestHeader("Authorization", "Bearer " + this.accessToken), l2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), l2.setRequestHeader("Content-Type", i), this.options.extendedMode !== false && l2.setRequestHeader("X-Medplum", "extended"), s?.headers) {
|
|
69954
69968
|
let T = s.headers;
|
|
69955
69969
|
for (let [$, Q2] of Object.entries(T)) l2.setRequestHeader($, Q2);
|
|
@@ -69959,7 +69973,7 @@ var Yt = class extends ee {
|
|
|
69959
69973
|
}
|
|
69960
69974
|
async createPdf(t, n, i, o2) {
|
|
69961
69975
|
if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
|
|
69962
|
-
let s =
|
|
69976
|
+
let s = tc(t, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l2, fonts: p, ...y2 } = s, T = await this.createPdfImpl(u2, l2, p), $ = { ...y2, data: T, contentType: "application/pdf" };
|
|
69963
69977
|
return this.createBinary($, a);
|
|
69964
69978
|
}
|
|
69965
69979
|
createComment(t, n, i) {
|
|
@@ -69997,29 +70011,29 @@ var Yt = class extends ee {
|
|
|
69997
70011
|
return this.post(this.fhirBaseUrl, t, void 0, n);
|
|
69998
70012
|
}
|
|
69999
70013
|
sendEmail(t, n) {
|
|
70000
|
-
return this.post("email/v1/send", t,
|
|
70014
|
+
return this.post("email/v1/send", t, O.JSON, n);
|
|
70001
70015
|
}
|
|
70002
70016
|
graphql(t, n, i, o2) {
|
|
70003
|
-
return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i },
|
|
70017
|
+
return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i }, O.JSON, o2);
|
|
70004
70018
|
}
|
|
70005
70019
|
readResourceGraph(t, n, i, o2) {
|
|
70006
70020
|
return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i}`, o2);
|
|
70007
70021
|
}
|
|
70008
70022
|
pushToAgent(t, n, i, o2, s, a) {
|
|
70009
70023
|
let { waitTimeout: u2, returnAck: l2, ...p } = a ?? {};
|
|
70010
|
-
return this.post(this.fhirUrl("Agent", Se(t), "$push"), { destination: typeof n == "string" ? n :
|
|
70024
|
+
return this.post(this.fhirUrl("Agent", Se(t), "$push"), { destination: typeof n == "string" ? n : A(n), body: i, contentType: o2, waitForResponse: s, ...u2 !== void 0 ? { waitTimeout: u2 } : void 0, ...l2 !== void 0 ? { returnAck: l2 } : void 0 }, O.FHIR_JSON, p);
|
|
70011
70025
|
}
|
|
70012
70026
|
getCdsServices(t) {
|
|
70013
70027
|
return this.get("/cds-services", t);
|
|
70014
70028
|
}
|
|
70015
70029
|
callCdsService(t, n, i) {
|
|
70016
|
-
return this.post(`/cds-services/${t}`, n,
|
|
70030
|
+
return this.post(`/cds-services/${t}`, n, O.JSON, i);
|
|
70017
70031
|
}
|
|
70018
70032
|
getActiveLogin() {
|
|
70019
70033
|
return this.storage.getObject("activeLogin");
|
|
70020
70034
|
}
|
|
70021
70035
|
async setActiveLogin(t) {
|
|
70022
|
-
(!this.sessionDetails?.profile ||
|
|
70036
|
+
(!this.sessionDetails?.profile || A(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
|
|
70023
70037
|
}
|
|
70024
70038
|
getAccessToken() {
|
|
70025
70039
|
return this.accessToken;
|
|
@@ -70028,7 +70042,7 @@ var Yt = class extends ee {
|
|
|
70028
70042
|
return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
|
|
70029
70043
|
}
|
|
70030
70044
|
setAccessToken(t, n) {
|
|
70031
|
-
this.accessToken = t, this.refreshToken = n, this.accessTokenExpires =
|
|
70045
|
+
this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = $i(t), this.medplumServer = ji(t);
|
|
70032
70046
|
}
|
|
70033
70047
|
getLogins() {
|
|
70034
70048
|
return this.storage.getObject("logins") ?? [];
|
|
@@ -70076,7 +70090,7 @@ var Yt = class extends ee {
|
|
|
70076
70090
|
async download(t, n = {}) {
|
|
70077
70091
|
this.refreshPromise && await this.refreshPromise;
|
|
70078
70092
|
let i = t.toString();
|
|
70079
|
-
i.startsWith(
|
|
70093
|
+
i.startsWith(Ja) && (t = this.fhirUrl(i));
|
|
70080
70094
|
let o2 = n.headers;
|
|
70081
70095
|
return o2 || (o2 = {}, n.headers = o2), o2.Accept || (o2.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
|
|
70082
70096
|
}
|
|
@@ -70105,7 +70119,7 @@ var Yt = class extends ee {
|
|
|
70105
70119
|
return i.Prefer = "respond-async", this.request("POST", t, n);
|
|
70106
70120
|
}
|
|
70107
70121
|
get keyValue() {
|
|
70108
|
-
return this.keyValueClient || (this.keyValueClient = new
|
|
70122
|
+
return this.keyValueClient || (this.keyValueClient = new zt(this)), this.keyValueClient;
|
|
70109
70123
|
}
|
|
70110
70124
|
getBundle(t, n) {
|
|
70111
70125
|
return new F((async () => {
|
|
@@ -70123,7 +70137,9 @@ var Yt = class extends ee {
|
|
|
70123
70137
|
if (!(!i || i.requestTime + this.cacheTime < Date.now())) return i;
|
|
70124
70138
|
}
|
|
70125
70139
|
setCacheEntry(t, n, i) {
|
|
70126
|
-
this.isCacheEnabled(i) && this.requestCache.set(t, { requestTime: Date.now(), value: n })
|
|
70140
|
+
this.isCacheEnabled(i) && (this.requestCache.set(t, { requestTime: Date.now(), value: n }), i?.signal && i.signal.addEventListener("abort", () => {
|
|
70141
|
+
this.requestCache.delete(t);
|
|
70142
|
+
}));
|
|
70127
70143
|
}
|
|
70128
70144
|
cacheResource(t, n) {
|
|
70129
70145
|
t?.id && !t.meta?.tag?.some((i) => i.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new F(Promise.resolve(t)), n);
|
|
@@ -70137,17 +70153,17 @@ var Yt = class extends ee {
|
|
|
70137
70153
|
if (s.status === 401) return this.handleUnauthenticated(t, n, i);
|
|
70138
70154
|
if (s.status === 204 || s.status === 304) return;
|
|
70139
70155
|
let u2 = s.headers.get("content-type")?.includes("json");
|
|
70140
|
-
if (s.status === 404 && !u2) throw new f(
|
|
70156
|
+
if (s.status === 404 && !u2) throw new f(Vn);
|
|
70141
70157
|
let l2 = await this.parseBody(s, u2);
|
|
70142
70158
|
if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
|
|
70143
|
-
let p = await
|
|
70159
|
+
let p = await Ki(s, l2);
|
|
70144
70160
|
if (p) return this.request("GET", p, { ...i, body: void 0 });
|
|
70145
70161
|
}
|
|
70146
70162
|
if (s.status === 202 && i.pollStatusOnAccepted) {
|
|
70147
|
-
let y2 = await
|
|
70163
|
+
let y2 = await Ki(s, l2) ?? o2.statusUrl;
|
|
70148
70164
|
if (y2) return this.pollStatus(y2, i, o2);
|
|
70149
70165
|
}
|
|
70150
|
-
if (s.status >= 400) throw new f(
|
|
70166
|
+
if (s.status >= 400) throw new f(yt(l2));
|
|
70151
70167
|
return l2;
|
|
70152
70168
|
}
|
|
70153
70169
|
async parseBody(t, n) {
|
|
@@ -70168,10 +70184,10 @@ var Yt = class extends ee {
|
|
|
70168
70184
|
for (let o2 = 0; o2 <= i; o2++) try {
|
|
70169
70185
|
this.logLevel !== "none" && this.logRequest(t, n);
|
|
70170
70186
|
let s = await this.fetch(t, n);
|
|
70171
|
-
if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !
|
|
70187
|
+
if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !rc(s)) return s;
|
|
70172
70188
|
let a = this.getRetryDelay(o2), u2 = n.maxRetryTime ?? 2e3;
|
|
70173
70189
|
if (a > u2) return s;
|
|
70174
|
-
await
|
|
70190
|
+
await Qr(a, { signal: n.signal });
|
|
70175
70191
|
} catch (s) {
|
|
70176
70192
|
if (s.message === "Failed to fetch" && o2 === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o2 === i) throw s;
|
|
70177
70193
|
}
|
|
@@ -70180,7 +70196,7 @@ var Yt = class extends ee {
|
|
|
70180
70196
|
logRequest(t, n) {
|
|
70181
70197
|
if (console.log(`> ${n.method} ${t}`), this.logLevel === "verbose" && n.headers) {
|
|
70182
70198
|
let i = n.headers;
|
|
70183
|
-
for (let o2 of
|
|
70199
|
+
for (let o2 of Pt(Object.keys(i))) console.log(`> ${o2}: ${i[o2]}`);
|
|
70184
70200
|
}
|
|
70185
70201
|
}
|
|
70186
70202
|
logResponse(t) {
|
|
@@ -70212,7 +70228,7 @@ var Yt = class extends ee {
|
|
|
70212
70228
|
if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o2.headers = { ...n.headers }, delete o2.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
|
|
70213
70229
|
else {
|
|
70214
70230
|
let s = n.pollStatusPeriod ?? 1e3;
|
|
70215
|
-
await
|
|
70231
|
+
await Qr(s, { signal: n.signal }), i.pollCount++;
|
|
70216
70232
|
}
|
|
70217
70233
|
return this.request("GET", t, o2, i);
|
|
70218
70234
|
}
|
|
@@ -70224,20 +70240,20 @@ var Yt = class extends ee {
|
|
|
70224
70240
|
try {
|
|
70225
70241
|
o2.resolve(await this.request(o2.method, G(this.fhirBaseUrl, o2.url), o2.options));
|
|
70226
70242
|
} catch (s) {
|
|
70227
|
-
o2.reject(new f(
|
|
70243
|
+
o2.reject(new f(yt(s)));
|
|
70228
70244
|
}
|
|
70229
70245
|
return;
|
|
70230
70246
|
}
|
|
70231
70247
|
let n = { resourceType: "Bundle", type: "batch", entry: t.map((o2) => ({ request: { method: o2.method, url: o2.url }, resource: o2.options.body ? JSON.parse(o2.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
|
|
70232
70248
|
for (let o2 = 0; o2 < t.length; o2++) {
|
|
70233
70249
|
let s = t[o2], a = i.entry?.[o2];
|
|
70234
|
-
a?.response?.outcome && !
|
|
70250
|
+
a?.response?.outcome && !br(a.response.outcome) ? s.reject(new f(a.response.outcome)) : s.resolve(a?.resource);
|
|
70235
70251
|
}
|
|
70236
70252
|
}
|
|
70237
70253
|
addFetchOptionsDefaults(t) {
|
|
70238
70254
|
Object.entries(this.defaultHeaders).forEach(([n, i]) => {
|
|
70239
70255
|
this.setRequestHeader(t, n, i);
|
|
70240
|
-
}), this.setRequestHeader(t, "Accept",
|
|
70256
|
+
}), this.setRequestHeader(t, "Accept", ja, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", O.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
|
|
70241
70257
|
}
|
|
70242
70258
|
setRequestContentType(t, n) {
|
|
70243
70259
|
this.setRequestHeader(t, "Content-Type", n);
|
|
@@ -70265,13 +70281,13 @@ var Yt = class extends ee {
|
|
|
70265
70281
|
throw this.clear(), this.onUnauthenticated?.(), new f(Me);
|
|
70266
70282
|
}
|
|
70267
70283
|
async startPkce() {
|
|
70268
|
-
let t =
|
|
70284
|
+
let t = en();
|
|
70269
70285
|
sessionStorage.setItem("pkceState", t);
|
|
70270
|
-
let n =
|
|
70286
|
+
let n = en().slice(0, 128);
|
|
70271
70287
|
sessionStorage.setItem("codeVerifier", n);
|
|
70272
70288
|
try {
|
|
70273
|
-
let i = await
|
|
70274
|
-
return { codeChallengeMethod: "S256", codeChallenge:
|
|
70289
|
+
let i = await Fi(n);
|
|
70290
|
+
return { codeChallengeMethod: "S256", codeChallenge: di(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
|
|
70275
70291
|
} catch (i) {
|
|
70276
70292
|
return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method", i), { codeChallengeMethod: "plain", codeChallenge: n };
|
|
70277
70293
|
}
|
|
@@ -70303,10 +70319,10 @@ var Yt = class extends ee {
|
|
|
70303
70319
|
return this.clientId = t, this.fetchTokens({ grant_type: $e.JwtBearer, client_id: t, assertion: n, scope: i });
|
|
70304
70320
|
}
|
|
70305
70321
|
async startJwtAssertionLogin(t) {
|
|
70306
|
-
return this.fetchTokens({ grant_type: $e.ClientCredentials, client_assertion_type:
|
|
70322
|
+
return this.fetchTokens({ grant_type: $e.ClientCredentials, client_assertion_type: Ya.JwtBearer, client_assertion: t });
|
|
70307
70323
|
}
|
|
70308
70324
|
setBasicAuth(t, n) {
|
|
70309
|
-
this.clientId = t, this.clientSecret = n, this.basicAuth =
|
|
70325
|
+
this.clientId = t, this.clientSecret = n, this.basicAuth = $t(t + ":" + n);
|
|
70310
70326
|
}
|
|
70311
70327
|
setLogLevel(t) {
|
|
70312
70328
|
this.logLevel = t, this.options.verbose = t === "verbose";
|
|
@@ -70320,20 +70336,20 @@ var Yt = class extends ee {
|
|
|
70320
70336
|
async fhircastSubscribe(t, n) {
|
|
70321
70337
|
if (!(typeof t == "string" && t !== "")) throw new f(x("Invalid topic provided. Topic must be a valid string."));
|
|
70322
70338
|
if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new f(x("Invalid events provided. Events must be an array of event names containing at least one event."));
|
|
70323
|
-
let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl,
|
|
70339
|
+
let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, on(i), O.FORM_URL_ENCODED))["hub.channel.endpoint"];
|
|
70324
70340
|
if (!s) throw new Error("Invalid response!");
|
|
70325
70341
|
return i.endpoint = s, i;
|
|
70326
70342
|
}
|
|
70327
70343
|
async fhircastUnsubscribe(t) {
|
|
70328
|
-
if (!
|
|
70344
|
+
if (!Gt(t)) throw new f(x("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
|
|
70329
70345
|
if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new f(x("Provided subscription request must have an endpoint in order to unsubscribe."));
|
|
70330
|
-
t.mode = "unsubscribe", await this.post(this.fhircastHubUrl,
|
|
70346
|
+
t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, on(t), O.FORM_URL_ENCODED);
|
|
70331
70347
|
}
|
|
70332
70348
|
fhircastConnect(t) {
|
|
70333
|
-
return new
|
|
70349
|
+
return new Ht(t);
|
|
70334
70350
|
}
|
|
70335
70351
|
async fhircastPublish(t, n, i, o2) {
|
|
70336
|
-
return
|
|
70352
|
+
return Ui(n) ? this.post(this.fhircastHubUrl, sn(t, n, i, o2), O.JSON) : (Bi(n), this.post(this.fhircastHubUrl, sn(t, n, i), O.JSON));
|
|
70337
70353
|
}
|
|
70338
70354
|
async fhircastGetContext(t) {
|
|
70339
70355
|
return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
|
|
@@ -70350,8 +70366,8 @@ var Yt = class extends ee {
|
|
|
70350
70366
|
}
|
|
70351
70367
|
}
|
|
70352
70368
|
async fetchTokens(t) {
|
|
70353
|
-
let n = new URLSearchParams(t), i = { ...this.defaultHeaders, "Content-Type":
|
|
70354
|
-
this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i.Authorization = `Basic ${
|
|
70369
|
+
let n = new URLSearchParams(t), i = { ...this.defaultHeaders, "Content-Type": O.FORM_URL_ENCODED };
|
|
70370
|
+
this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i.Authorization = `Basic ${$t(t.client_id + ":" + t.client_secret)}`));
|
|
70355
70371
|
let o2 = { method: "POST", headers: i, body: n.toString(), credentials: "include" }, s;
|
|
70356
70372
|
try {
|
|
70357
70373
|
s = await this.fetchWithRetry(this.tokenUrl, o2);
|
|
@@ -70364,12 +70380,12 @@ var Yt = class extends ee {
|
|
|
70364
70380
|
}
|
|
70365
70381
|
async verifyTokens(t) {
|
|
70366
70382
|
let n = t.access_token;
|
|
70367
|
-
if (
|
|
70368
|
-
let i =
|
|
70369
|
-
if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new f(
|
|
70383
|
+
if (Wi(n)) {
|
|
70384
|
+
let i = Qt(n);
|
|
70385
|
+
if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new f(Mn);
|
|
70370
70386
|
if (i.cid) {
|
|
70371
|
-
if (i.cid !== this.clientId) throw this.clearActiveLogin(), new f(
|
|
70372
|
-
} else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new f(
|
|
70387
|
+
if (i.cid !== this.clientId) throw this.clearActiveLogin(), new f(vr);
|
|
70388
|
+
} else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new f(vr);
|
|
70373
70389
|
}
|
|
70374
70390
|
return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
|
|
70375
70391
|
}
|
|
@@ -70389,7 +70405,7 @@ var Yt = class extends ee {
|
|
|
70389
70405
|
}
|
|
70390
70406
|
}
|
|
70391
70407
|
getSubscriptionManager() {
|
|
70392
|
-
return this.subscriptionManager || (this.subscriptionManager = new
|
|
70408
|
+
return this.subscriptionManager || (this.subscriptionManager = new Yt(this, gi(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
|
|
70393
70409
|
}
|
|
70394
70410
|
subscribeToCriteria(t, n) {
|
|
70395
70411
|
return this.getSubscriptionManager().addCriteria(t, n);
|
|
@@ -70401,43 +70417,43 @@ var Yt = class extends ee {
|
|
|
70401
70417
|
return this.getSubscriptionManager().getMasterEmitter();
|
|
70402
70418
|
}
|
|
70403
70419
|
};
|
|
70404
|
-
function
|
|
70420
|
+
function Xa() {
|
|
70405
70421
|
if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
|
|
70406
70422
|
return globalThis.fetch.bind(globalThis);
|
|
70407
70423
|
}
|
|
70408
|
-
async function
|
|
70424
|
+
async function Ki(r6, e) {
|
|
70409
70425
|
let t = r6.headers.get("content-location");
|
|
70410
70426
|
if (t) return t;
|
|
70411
70427
|
let n = r6.headers.get("location");
|
|
70412
70428
|
if (n) return n;
|
|
70413
70429
|
if (Ge(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
|
|
70414
70430
|
}
|
|
70415
|
-
function
|
|
70431
|
+
function Yi(r6) {
|
|
70416
70432
|
let e = r6.entry?.map((t) => t.resource) ?? [];
|
|
70417
70433
|
return Object.assign(e, { bundle: r6 });
|
|
70418
70434
|
}
|
|
70419
|
-
function
|
|
70435
|
+
function Za(r6) {
|
|
70420
70436
|
return E(r6) && "data" in r6 && "contentType" in r6;
|
|
70421
70437
|
}
|
|
70422
|
-
function
|
|
70423
|
-
return
|
|
70438
|
+
function Xi(r6, e, t, n) {
|
|
70439
|
+
return Za(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
|
|
70424
70440
|
}
|
|
70425
|
-
function
|
|
70441
|
+
function ec(r6) {
|
|
70426
70442
|
return E(r6) && "docDefinition" in r6;
|
|
70427
70443
|
}
|
|
70428
|
-
function
|
|
70429
|
-
return
|
|
70444
|
+
function tc(r6, e, t, n) {
|
|
70445
|
+
return ec(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
|
|
70430
70446
|
}
|
|
70431
|
-
function
|
|
70447
|
+
function rc(r6) {
|
|
70432
70448
|
return r6.status === 429 || r6.status >= 500;
|
|
70433
70449
|
}
|
|
70434
|
-
var
|
|
70435
|
-
var
|
|
70436
|
-
var
|
|
70437
|
-
var
|
|
70438
|
-
var
|
|
70439
|
-
var
|
|
70440
|
-
var
|
|
70450
|
+
var mc = [...rt, "->", "<<", ">>", "=="];
|
|
70451
|
+
var gc = nt().registerInfix("->", { precedence: v.Arrow }).registerInfix(";", { precedence: v.Semicolon });
|
|
70452
|
+
var _c = " ".repeat(2);
|
|
70453
|
+
var Fc = [...rt, "eq", "ne", "co"];
|
|
70454
|
+
var Nc = { eq: m.EXACT, ne: m.NOT_EQUALS, co: m.CONTAINS, sw: m.STARTS_WITH, ew: void 0, gt: m.GREATER_THAN, lt: m.LESS_THAN, ge: m.GREATER_THAN_OR_EQUALS, le: m.LESS_THAN_OR_EQUALS, ap: m.APPROXIMATELY, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, pr: m.PRESENT, po: void 0, ss: void 0, sb: void 0, in: m.IN, ni: m.NOT_IN, re: m.EQUALS, identifier: m.IDENTIFIER };
|
|
70455
|
+
var Bc = nt();
|
|
70456
|
+
var qc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
|
|
70441
70457
|
var xe = class {
|
|
70442
70458
|
constructor(e = "\r", t = "|", n = "^", i = "~", o2 = "\\", s = "&") {
|
|
70443
70459
|
c(this, "segmentSeparator");
|
|
@@ -70455,7 +70471,7 @@ var xe = class {
|
|
|
70455
70471
|
return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
|
|
70456
70472
|
}
|
|
70457
70473
|
};
|
|
70458
|
-
var
|
|
70474
|
+
var vo = class r2 {
|
|
70459
70475
|
constructor(e, t = new xe()) {
|
|
70460
70476
|
c(this, "context");
|
|
70461
70477
|
c(this, "segments");
|
|
@@ -70481,7 +70497,7 @@ var mo = class r2 {
|
|
|
70481
70497
|
}
|
|
70482
70498
|
buildAck(e) {
|
|
70483
70499
|
let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o2 = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", u2 = n?.getField(10)?.toString() ?? "", l2 = n?.getField(12)?.toString() ?? "2.5.1", p = e?.ackCode ?? "AA";
|
|
70484
|
-
return new r2([new lt(["MSH", this.context.getMsh2(), s, a, i, o2,
|
|
70500
|
+
return new r2([new lt(["MSH", this.context.getMsh2(), s, a, i, o2, jc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", l2], this.context), new lt(["MSA", p, u2, qc[p]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
|
|
70485
70501
|
}
|
|
70486
70502
|
buildAckMessageType(e) {
|
|
70487
70503
|
let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o2 = "ACK";
|
|
@@ -70511,7 +70527,7 @@ var lt = class r3 {
|
|
|
70511
70527
|
c(this, "context");
|
|
70512
70528
|
c(this, "name");
|
|
70513
70529
|
c(this, "fields");
|
|
70514
|
-
this.context = t,
|
|
70530
|
+
this.context = t, ui(e) ? this.fields = e.map((n) => te.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
|
|
70515
70531
|
}
|
|
70516
70532
|
get(e) {
|
|
70517
70533
|
return this.fields[e];
|
|
@@ -70581,13 +70597,13 @@ var te = class r4 {
|
|
|
70581
70597
|
return true;
|
|
70582
70598
|
}
|
|
70583
70599
|
};
|
|
70584
|
-
function
|
|
70600
|
+
function jc(r6) {
|
|
70585
70601
|
let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replaceAll(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
|
|
70586
70602
|
return i > 0 && (n += "." + i.toString()), n;
|
|
70587
70603
|
}
|
|
70588
70604
|
var He = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
|
|
70589
|
-
var
|
|
70590
|
-
var
|
|
70605
|
+
var $c = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
|
|
70606
|
+
var To = class r5 {
|
|
70591
70607
|
constructor(e, t = {}, n = He.INFO, i = {}) {
|
|
70592
70608
|
c(this, "write");
|
|
70593
70609
|
c(this, "metadata");
|
|
@@ -70619,35 +70635,36 @@ var yo = class r5 {
|
|
|
70619
70635
|
log(e, t, n) {
|
|
70620
70636
|
if (e > this.level) return;
|
|
70621
70637
|
let i;
|
|
70622
|
-
if (
|
|
70638
|
+
if (Tr(n)) i = cr(n);
|
|
70623
70639
|
else if (n) {
|
|
70624
70640
|
i = { ...n };
|
|
70625
|
-
for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] =
|
|
70641
|
+
for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] = cr(s));
|
|
70626
70642
|
}
|
|
70627
|
-
this.write(JSON.stringify({ level:
|
|
70643
|
+
this.write(JSON.stringify({ level: $c[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
|
|
70628
70644
|
}
|
|
70629
70645
|
};
|
|
70630
|
-
function
|
|
70646
|
+
function vh(r6) {
|
|
70631
70647
|
let e = He[r6.toUpperCase()];
|
|
70632
70648
|
if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
|
|
70633
70649
|
return e;
|
|
70634
70650
|
}
|
|
70635
|
-
function
|
|
70651
|
+
function cr(r6, e = 0, t = 10) {
|
|
70636
70652
|
if (e >= t) return { error: "Max error depth reached" };
|
|
70637
70653
|
let n = { error: r6.toString(), stack: r6.stack?.split(`
|
|
70638
70654
|
`) };
|
|
70639
|
-
r6.name && r6.name !== "Error" && (n.name = r6.name), r6.message && (n.message = r6.message), "cause" in r6 && r6.cause !== void 0 && (r6.cause instanceof Error ? n.cause =
|
|
70655
|
+
r6.name && r6.name !== "Error" && (n.name = r6.name), r6.message && (n.message = r6.message), "cause" in r6 && r6.cause !== void 0 && (r6.cause instanceof Error ? n.cause = cr(r6.cause, e + 1, t) : n.cause = r6.cause);
|
|
70640
70656
|
let i = Object.getOwnPropertyNames(r6).filter((o2) => !["name", "message", "stack", "cause"].includes(o2));
|
|
70641
70657
|
for (let o2 of i) try {
|
|
70642
70658
|
let s = r6[o2];
|
|
70643
|
-
s instanceof Error ? n[o2] =
|
|
70659
|
+
s instanceof Error ? n[o2] = cr(s, e + 1, t) : n[o2] = s;
|
|
70644
70660
|
} catch {
|
|
70645
70661
|
}
|
|
70646
70662
|
return n;
|
|
70647
70663
|
}
|
|
70648
|
-
var
|
|
70649
|
-
var
|
|
70650
|
-
|
|
70664
|
+
var Sn = `${ft}/fhir/StructureDefinition/patient-preferredPharmacy`;
|
|
70665
|
+
var iu = "https://meta.medplum.com/releases";
|
|
70666
|
+
var pr = /* @__PURE__ */ new Map();
|
|
70667
|
+
function ou(r6) {
|
|
70651
70668
|
let e = r6;
|
|
70652
70669
|
if (!e.tag_name) throw new Error("Manifest missing tag_name");
|
|
70653
70670
|
let t = e.assets;
|
|
@@ -70657,11 +70674,11 @@ function Xc(r6) {
|
|
|
70657
70674
|
if (!n.name) throw new Error("Asset missing name");
|
|
70658
70675
|
}
|
|
70659
70676
|
}
|
|
70660
|
-
async function
|
|
70661
|
-
let n =
|
|
70677
|
+
async function Rn(r6, e, t) {
|
|
70678
|
+
let n = pr.get(e ?? "latest");
|
|
70662
70679
|
if (!n) {
|
|
70663
|
-
let i = e ? `v${e}` : "latest", o2 = new URL(`${
|
|
70664
|
-
if (o2.searchParams.set("a", r6), o2.searchParams.set("c",
|
|
70680
|
+
let i = e ? `v${e}` : "latest", o2 = new URL(`${iu}/${i}.json`);
|
|
70681
|
+
if (o2.searchParams.set("a", r6), o2.searchParams.set("c", un), t) for (let [u2, l2] of Object.entries(t)) o2.searchParams.set(u2, l2);
|
|
70665
70682
|
let s = await fetch(o2.toString());
|
|
70666
70683
|
if (s.status !== 200) {
|
|
70667
70684
|
let u2;
|
|
@@ -70673,24 +70690,24 @@ async function vn(r6, e, t) {
|
|
|
70673
70690
|
throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${u2}`);
|
|
70674
70691
|
}
|
|
70675
70692
|
let a = await s.json();
|
|
70676
|
-
|
|
70693
|
+
ou(a), n = a, pr.set(e ?? "latest", n), e || pr.set(n.tag_name.slice(1), n);
|
|
70677
70694
|
}
|
|
70678
70695
|
return n;
|
|
70679
70696
|
}
|
|
70680
|
-
function
|
|
70697
|
+
function su(r6) {
|
|
70681
70698
|
return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
|
|
70682
70699
|
}
|
|
70683
|
-
async function
|
|
70684
|
-
if (!
|
|
70700
|
+
async function ty(r6, e) {
|
|
70701
|
+
if (!su(e)) return false;
|
|
70685
70702
|
try {
|
|
70686
|
-
await
|
|
70703
|
+
await Rn(r6, e);
|
|
70687
70704
|
} catch {
|
|
70688
70705
|
return false;
|
|
70689
70706
|
}
|
|
70690
70707
|
return true;
|
|
70691
70708
|
}
|
|
70692
|
-
async function
|
|
70693
|
-
let e = await
|
|
70709
|
+
async function ry(r6) {
|
|
70710
|
+
let e = await Rn(r6);
|
|
70694
70711
|
if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
|
|
70695
70712
|
return e.tag_name.slice(1);
|
|
70696
70713
|
}
|
|
@@ -70787,7 +70804,7 @@ var g2 = class extends m2 {
|
|
|
70787
70804
|
return;
|
|
70788
70805
|
}
|
|
70789
70806
|
let p = c2.message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
|
|
70790
|
-
p && (h2.returnAck ===
|
|
70807
|
+
p && (h2.returnAck === kd.APPLICATION && p === "CA" || (h2.resolve(c2.message), this.pendingMessages.delete(a)));
|
|
70791
70808
|
});
|
|
70792
70809
|
}
|
|
70793
70810
|
isClosed() {
|
|
@@ -70802,7 +70819,7 @@ var g2 = class extends m2 {
|
|
|
70802
70819
|
for (this.responseQueueProcessing = true; this.responseQueue.length; ) {
|
|
70803
70820
|
if (this.messagesPerMin) {
|
|
70804
70821
|
let t = D2 / this.messagesPerMin, s = Date.now() - this.lastMessageDispatchedTime;
|
|
70805
|
-
t > s && await
|
|
70822
|
+
t > s && await Qr(t - s);
|
|
70806
70823
|
}
|
|
70807
70824
|
let e = this.responseQueue.shift();
|
|
70808
70825
|
e && this.dispatchEvent(e), this.lastMessageDispatchedTime = Date.now();
|
|
@@ -70822,7 +70839,7 @@ var g2 = class extends m2 {
|
|
|
70822
70839
|
break;
|
|
70823
70840
|
}
|
|
70824
70841
|
if (n === -1) break;
|
|
70825
|
-
let r6 = t.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r6, this.encoding), h2 =
|
|
70842
|
+
let r6 = t.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r6, this.encoding), h2 = vo.parse(a);
|
|
70826
70843
|
e.push(h2), s = n + 1;
|
|
70827
70844
|
}
|
|
70828
70845
|
return this.chunks = s < t.length ? [t.subarray(s)] : [], e;
|
|
@@ -70840,7 +70857,7 @@ var g2 = class extends m2 {
|
|
|
70840
70857
|
let r6;
|
|
70841
70858
|
t?.timeoutMs && (r6 = setTimeout(() => {
|
|
70842
70859
|
this.pendingMessages.delete(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` }] }));
|
|
70843
|
-
}, t.timeoutMs)), this.pendingMessages.set(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ??
|
|
70860
|
+
}, t.timeoutMs)), this.pendingMessages.set(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ?? kd.APPLICATION, timer: r6 }), this.sendImpl(e);
|
|
70844
70861
|
});
|
|
70845
70862
|
}
|
|
70846
70863
|
async close() {
|
|
@@ -70992,7 +71009,7 @@ var A2 = class {
|
|
|
70992
71009
|
let r6 = (h2) => {
|
|
70993
71010
|
n.listen(h2, c2);
|
|
70994
71011
|
}, a = async (h2) => {
|
|
70995
|
-
h2?.code === "EADDRINUSE" && (await
|
|
71012
|
+
h2?.code === "EADDRINUSE" && (await Qr(50), n.close(), r6(i));
|
|
70996
71013
|
};
|
|
70997
71014
|
n.on("error", a), n.once("listening", () => {
|
|
70998
71015
|
n.off("error", a);
|
|
@@ -71245,7 +71262,7 @@ var ByteStreamChannelConnection = class {
|
|
|
71245
71262
|
accessToken: "placeholder",
|
|
71246
71263
|
channel: this.channel.getDefinition().name,
|
|
71247
71264
|
remote: this.remote,
|
|
71248
|
-
contentType:
|
|
71265
|
+
contentType: O.OCTET_STREAM,
|
|
71249
71266
|
body: messageBuffer.toString("hex"),
|
|
71250
71267
|
callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto.randomUUID)()}`
|
|
71251
71268
|
});
|
|
@@ -71381,7 +71398,7 @@ var AgentDicomChannel = class extends BaseChannel {
|
|
|
71381
71398
|
accessToken: "placeholder",
|
|
71382
71399
|
channel: _DcmjsDimseScp.channel.getDefinition().name,
|
|
71383
71400
|
remote: this.association?.getCallingAeTitle(),
|
|
71384
|
-
contentType:
|
|
71401
|
+
contentType: O.JSON,
|
|
71385
71402
|
body: JSON.stringify(payload),
|
|
71386
71403
|
callback: `Agent/${App.instance.agentId}-${(0, import_node_crypto2.randomUUID)()}`
|
|
71387
71404
|
});
|
|
@@ -71435,7 +71452,7 @@ var AgentDicomChannel = class extends BaseChannel {
|
|
|
71435
71452
|
this.server.on("networkError", async (err) => {
|
|
71436
71453
|
this.log.error("Network error: ", { err });
|
|
71437
71454
|
if (err?.code === "EADDRINUSE") {
|
|
71438
|
-
await
|
|
71455
|
+
await Qr(50);
|
|
71439
71456
|
this.server.close();
|
|
71440
71457
|
this.server.listen(port);
|
|
71441
71458
|
}
|
|
@@ -71700,7 +71717,7 @@ var AgentHl7Channel = class extends BaseChannel {
|
|
|
71700
71717
|
sendToRemote(msg) {
|
|
71701
71718
|
const connection = this.connections.get(msg.remote);
|
|
71702
71719
|
if (connection) {
|
|
71703
|
-
const hl7Message =
|
|
71720
|
+
const hl7Message = vo.parse(msg.body);
|
|
71704
71721
|
const msgControlId = hl7Message.getSegment("MSA")?.getField(2)?.toString();
|
|
71705
71722
|
const ackCode = hl7Message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
|
|
71706
71723
|
if (ackCode && isAppLevelAckCode(ackCode) && !shouldSendAppLevelAck({
|
|
@@ -71714,7 +71731,7 @@ var AgentHl7Channel = class extends BaseChannel {
|
|
|
71714
71731
|
return;
|
|
71715
71732
|
}
|
|
71716
71733
|
this.channelLog.info(`[Sending ACK -- ID: ${msgControlId}]: ${hl7Message.toString().replaceAll("\r", "\n")}`);
|
|
71717
|
-
connection.hl7Connection.send(
|
|
71734
|
+
connection.hl7Connection.send(vo.parse(msg.body));
|
|
71718
71735
|
if (msgControlId) {
|
|
71719
71736
|
this.stats?.recordAckReceived(msgControlId);
|
|
71720
71737
|
}
|
|
@@ -71828,7 +71845,7 @@ var AgentHl7ChannelConnection = class {
|
|
|
71828
71845
|
accessToken: "placeholder",
|
|
71829
71846
|
channel: this.channel.getDefinition().name,
|
|
71830
71847
|
remote: this.remote,
|
|
71831
|
-
contentType:
|
|
71848
|
+
contentType: O.HL7_V2,
|
|
71832
71849
|
body: event.message.toString(),
|
|
71833
71850
|
callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto3.randomUUID)()}`
|
|
71834
71851
|
});
|
|
@@ -72226,7 +72243,7 @@ function cleanupLoggerConfig(config, configPathRoot = "config") {
|
|
|
72226
72243
|
warnings.push(`${configPathRoot}.filesToKeep must be a valid integer`);
|
|
72227
72244
|
config.filesToKeep = void 0;
|
|
72228
72245
|
}
|
|
72229
|
-
if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" &&
|
|
72246
|
+
if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && $c[config.logLevel] !== void 0)) {
|
|
72230
72247
|
warnings.push(`${configPathRoot}.logLevel must be a valid log level between LogLevel.NONE and LogLevel.DEBUG`);
|
|
72231
72248
|
config.logLevel = void 0;
|
|
72232
72249
|
}
|
|
@@ -72271,7 +72288,7 @@ function parseLoggerConfigFromArgs(args) {
|
|
|
72271
72288
|
let configValue;
|
|
72272
72289
|
if (settingName === "logLevel") {
|
|
72273
72290
|
try {
|
|
72274
|
-
configValue =
|
|
72291
|
+
configValue = vh(propVal);
|
|
72275
72292
|
} catch (err) {
|
|
72276
72293
|
warnings.push(`Error while parsing ${propName}: ${_e(err)}`);
|
|
72277
72294
|
}
|
|
@@ -72445,7 +72462,7 @@ var import_node_os2 = require("node:os");
|
|
|
72445
72462
|
var import_node_path3 = __toESM(require("node:path"));
|
|
72446
72463
|
var import_node_process = __toESM(require("node:process"));
|
|
72447
72464
|
var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
72448
|
-
var pidLogger = new
|
|
72465
|
+
var pidLogger = new To((msg) => `[PID]: ${msg}`);
|
|
72449
72466
|
var pidFileApps = /* @__PURE__ */ new Set();
|
|
72450
72467
|
var processExitListener = () => {
|
|
72451
72468
|
removeAllPidFiles();
|
|
@@ -72563,7 +72580,7 @@ async function waitForPidFile(appName, timeoutMs = 3e3) {
|
|
|
72563
72580
|
if (Date.now() - startTime > timeoutMs) {
|
|
72564
72581
|
throw new Error("Timeout while waiting for PID file");
|
|
72565
72582
|
}
|
|
72566
|
-
await
|
|
72583
|
+
await Qr(0);
|
|
72567
72584
|
}
|
|
72568
72585
|
}
|
|
72569
72586
|
function removeAllPidFiles() {
|
|
@@ -72594,7 +72611,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path4.resolve)(
|
|
|
72594
72611
|
);
|
|
72595
72612
|
var RELEASES_PATH = (0, import_node_path4.resolve)(__dirname);
|
|
72596
72613
|
async function downloadRelease(version, path4) {
|
|
72597
|
-
const release = await
|
|
72614
|
+
const release = await Rn("agent-upgrader", version);
|
|
72598
72615
|
const downloadUrl = parseDownloadUrl(release, (0, import_node_os3.platform)());
|
|
72599
72616
|
const { body } = await fetch(downloadUrl);
|
|
72600
72617
|
if (!body) {
|
|
@@ -72681,8 +72698,8 @@ var _App = class _App {
|
|
|
72681
72698
|
_App.instance = this;
|
|
72682
72699
|
this.medplum = medplum;
|
|
72683
72700
|
this.agentId = agentId;
|
|
72684
|
-
this.log = options?.mainLogger ?? new
|
|
72685
|
-
this.channelLog = options?.channelLogger ?? new
|
|
72701
|
+
this.log = options?.mainLogger ?? new To((msg) => console.log(msg), void 0, logLevel);
|
|
72702
|
+
this.channelLog = options?.channelLogger ?? new To((msg) => console.log(msg), void 0, logLevel);
|
|
72686
72703
|
}
|
|
72687
72704
|
async start() {
|
|
72688
72705
|
this.log.info("Medplum service starting...");
|
|
@@ -72704,7 +72721,7 @@ var _App = class _App {
|
|
|
72704
72721
|
if ((0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH)) {
|
|
72705
72722
|
const upgradeFile = (0, import_node_fs4.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
|
|
72706
72723
|
const upgradeDetails = JSON.parse(upgradeFile);
|
|
72707
|
-
if (
|
|
72724
|
+
if (un.startsWith(upgradeDetails.targetVersion)) {
|
|
72708
72725
|
await this.sendToWebSocket({
|
|
72709
72726
|
type: "agent:upgrade:response",
|
|
72710
72727
|
statusCode: 200,
|
|
@@ -72712,7 +72729,7 @@ var _App = class _App {
|
|
|
72712
72729
|
});
|
|
72713
72730
|
this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
|
|
72714
72731
|
} else {
|
|
72715
|
-
const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${
|
|
72732
|
+
const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${un}`;
|
|
72716
72733
|
await this.sendToWebSocket({
|
|
72717
72734
|
type: "agent:error",
|
|
72718
72735
|
body: errMsg,
|
|
@@ -72740,7 +72757,7 @@ var _App = class _App {
|
|
|
72740
72757
|
if (attempt === maxAttempts) {
|
|
72741
72758
|
throw new Error("Too many unsuccessful attempts to create agent PID file");
|
|
72742
72759
|
}
|
|
72743
|
-
await
|
|
72760
|
+
await Qr(500);
|
|
72744
72761
|
}
|
|
72745
72762
|
}
|
|
72746
72763
|
}
|
|
@@ -72774,7 +72791,7 @@ var _App = class _App {
|
|
|
72774
72791
|
webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
72775
72792
|
webSocketUrl.pathname = "/ws/agent";
|
|
72776
72793
|
this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
|
|
72777
|
-
this.webSocket = new
|
|
72794
|
+
this.webSocket = new Kt(webSocketUrl.toString(), void 0, {
|
|
72778
72795
|
WebSocket: wrapper_default,
|
|
72779
72796
|
binaryType: "nodebuffer"
|
|
72780
72797
|
});
|
|
@@ -72812,7 +72829,7 @@ var _App = class _App {
|
|
|
72812
72829
|
break;
|
|
72813
72830
|
case "agent:heartbeat:request":
|
|
72814
72831
|
this.outstandingHeartbeats = 0;
|
|
72815
|
-
await this.sendToWebSocket({ type: "agent:heartbeat:response", version:
|
|
72832
|
+
await this.sendToWebSocket({ type: "agent:heartbeat:response", version: un });
|
|
72816
72833
|
break;
|
|
72817
72834
|
case "agent:heartbeat:response":
|
|
72818
72835
|
this.outstandingHeartbeats = 0;
|
|
@@ -72838,7 +72855,7 @@ var _App = class _App {
|
|
|
72838
72855
|
case "agent:transmit:request":
|
|
72839
72856
|
if (this.config?.status !== "active") {
|
|
72840
72857
|
this.sendAgentDisabledError(command);
|
|
72841
|
-
} else if (command.contentType ===
|
|
72858
|
+
} else if (command.contentType === O.PING) {
|
|
72842
72859
|
await this.tryPingHost(command);
|
|
72843
72860
|
} else {
|
|
72844
72861
|
this.pushMessage(command);
|
|
@@ -73198,7 +73215,7 @@ IPv6 is currently unsupported.`;
|
|
|
73198
73215
|
this.log.error(errMsg);
|
|
73199
73216
|
throw new Error(errMsg);
|
|
73200
73217
|
}
|
|
73201
|
-
if (!((0, import_node_net4.isIPv4)(message.remote) ||
|
|
73218
|
+
if (!((0, import_node_net4.isIPv4)(message.remote) || Zl(message.remote))) {
|
|
73202
73219
|
const errMsg = `Attempted to ping an invalid host.
|
|
73203
73220
|
|
|
73204
73221
|
"${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
|
|
@@ -73230,7 +73247,7 @@ ${result}`);
|
|
|
73230
73247
|
this.addToWebSocketQueue({
|
|
73231
73248
|
type: "agent:transmit:response",
|
|
73232
73249
|
channel: message.channel,
|
|
73233
|
-
contentType:
|
|
73250
|
+
contentType: O.PING,
|
|
73234
73251
|
remote: message.remote,
|
|
73235
73252
|
callback: message.callback,
|
|
73236
73253
|
statusCode: 200,
|
|
@@ -73241,7 +73258,7 @@ ${result}`);
|
|
|
73241
73258
|
this.addToWebSocketQueue({
|
|
73242
73259
|
type: "agent:transmit:response",
|
|
73243
73260
|
channel: message.channel,
|
|
73244
|
-
contentType:
|
|
73261
|
+
contentType: O.TEXT,
|
|
73245
73262
|
remote: message.remote,
|
|
73246
73263
|
callback: message.callback,
|
|
73247
73264
|
statusCode: 400,
|
|
@@ -73250,7 +73267,7 @@ ${result}`);
|
|
|
73250
73267
|
}
|
|
73251
73268
|
}
|
|
73252
73269
|
async tryUpgradeAgent(message) {
|
|
73253
|
-
this.log.info(`Attempting to upgrade from ${
|
|
73270
|
+
this.log.info(`Attempting to upgrade from ${un} to ${message.version ?? "latest"}...`);
|
|
73254
73271
|
if ((0, import_node_os4.platform)() !== "win32") {
|
|
73255
73272
|
const errMsg = "Auto-upgrading is currently only supported on Windows";
|
|
73256
73273
|
this.log.error(errMsg);
|
|
@@ -73273,7 +73290,7 @@ ${result}`);
|
|
|
73273
73290
|
return;
|
|
73274
73291
|
}
|
|
73275
73292
|
let child;
|
|
73276
|
-
if (message.version && !await
|
|
73293
|
+
if (message.version && !await ty("agent-upgrader", message.version)) {
|
|
73277
73294
|
const versionTag = message.version ? `v${message.version}` : "latest";
|
|
73278
73295
|
const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
|
|
73279
73296
|
this.log.error(errMsg);
|
|
@@ -73284,8 +73301,8 @@ ${result}`);
|
|
|
73284
73301
|
});
|
|
73285
73302
|
return;
|
|
73286
73303
|
}
|
|
73287
|
-
const targetVersion = message.version ?? await
|
|
73288
|
-
if (
|
|
73304
|
+
const targetVersion = message.version ?? await ry("agent-upgrader");
|
|
73305
|
+
if (un.startsWith(targetVersion)) {
|
|
73289
73306
|
if (!message?.force) {
|
|
73290
73307
|
this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
|
|
73291
73308
|
await this.sendToWebSocket({
|
|
@@ -73295,7 +73312,7 @@ ${result}`);
|
|
|
73295
73312
|
});
|
|
73296
73313
|
return;
|
|
73297
73314
|
}
|
|
73298
|
-
this.log.info(`Forcing upgrade from ${
|
|
73315
|
+
this.log.info(`Forcing upgrade from ${un} to ${targetVersion}`);
|
|
73299
73316
|
}
|
|
73300
73317
|
if (semver.lt(targetVersion, "4.2.4") && !message.force) {
|
|
73301
73318
|
const errMsg = `WARNING: ${targetVersion} predates the zero-downtime upgrade feature. Downgrading to this version will 1) incur downtime during the downgrade process, as the current agent must stop itself before installing the older agent, and 2) incur downtime on any subsequent upgrade to a later version. We recommend against downgrading to this version, but if you must, reissue the command with force set to true to downgrade.`;
|
|
@@ -73355,11 +73372,11 @@ ${result}`);
|
|
|
73355
73372
|
return;
|
|
73356
73373
|
}
|
|
73357
73374
|
try {
|
|
73358
|
-
this.log.info("Writing upgrade manifest...", { previousVersion:
|
|
73375
|
+
this.log.info("Writing upgrade manifest...", { previousVersion: un, targetVersion });
|
|
73359
73376
|
(0, import_node_fs4.writeFileSync)(
|
|
73360
73377
|
UPGRADE_MANIFEST_PATH,
|
|
73361
73378
|
JSON.stringify({
|
|
73362
|
-
previousVersion:
|
|
73379
|
+
previousVersion: un,
|
|
73363
73380
|
targetVersion,
|
|
73364
73381
|
callback: message.callback ?? null
|
|
73365
73382
|
}),
|
|
@@ -73438,7 +73455,7 @@ ${result}`);
|
|
|
73438
73455
|
channel: message.channel,
|
|
73439
73456
|
remote: message.remote,
|
|
73440
73457
|
callback: message.callback,
|
|
73441
|
-
contentType:
|
|
73458
|
+
contentType: O.TEXT,
|
|
73442
73459
|
statusCode: 400,
|
|
73443
73460
|
body: _e(err)
|
|
73444
73461
|
});
|
|
@@ -73450,7 +73467,7 @@ ${result}`);
|
|
|
73450
73467
|
} catch (err) {
|
|
73451
73468
|
this.log.warn(`${_e(err)} - falling back to default return ACK behavior of 'first'.`);
|
|
73452
73469
|
}
|
|
73453
|
-
const returnAck = msgReturnAck ?? defaultReturnAck ??
|
|
73470
|
+
const returnAck = msgReturnAck ?? defaultReturnAck ?? kd.FIRST;
|
|
73454
73471
|
let pool;
|
|
73455
73472
|
if (this.hl7Clients.has(message.remote)) {
|
|
73456
73473
|
pool = this.hl7Clients.get(message.remote);
|
|
@@ -73476,7 +73493,7 @@ ${result}`);
|
|
|
73476
73493
|
trackingStats: this.logStatsFreqSecs > 0
|
|
73477
73494
|
});
|
|
73478
73495
|
}
|
|
73479
|
-
const requestMsg =
|
|
73496
|
+
const requestMsg = vo.parse(message.body);
|
|
73480
73497
|
const msh10 = requestMsg.getSegment("MSH")?.getField(10);
|
|
73481
73498
|
if (!msh10) {
|
|
73482
73499
|
this.log.error("MSH.10 is missing but required");
|
|
@@ -73494,7 +73511,7 @@ ${result}`);
|
|
|
73494
73511
|
channel: message.channel,
|
|
73495
73512
|
remote: message.remote,
|
|
73496
73513
|
callback: message.callback,
|
|
73497
|
-
contentType:
|
|
73514
|
+
contentType: O.TEXT,
|
|
73498
73515
|
statusCode: 400,
|
|
73499
73516
|
body: _e(err)
|
|
73500
73517
|
});
|
|
@@ -73507,7 +73524,7 @@ ${result}`);
|
|
|
73507
73524
|
channel: message.channel,
|
|
73508
73525
|
remote: message.remote,
|
|
73509
73526
|
callback: message.callback,
|
|
73510
|
-
contentType:
|
|
73527
|
+
contentType: O.HL7_V2,
|
|
73511
73528
|
statusCode: 200,
|
|
73512
73529
|
body: response2.toString()
|
|
73513
73530
|
});
|
|
@@ -73518,7 +73535,7 @@ ${result}`);
|
|
|
73518
73535
|
channel: message.channel,
|
|
73519
73536
|
remote: message.remote,
|
|
73520
73537
|
callback: message.callback,
|
|
73521
|
-
contentType:
|
|
73538
|
+
contentType: O.TEXT,
|
|
73522
73539
|
statusCode: 400,
|
|
73523
73540
|
body: _e(err)
|
|
73524
73541
|
});
|
|
@@ -73548,10 +73565,10 @@ ${result}`);
|
|
|
73548
73565
|
}
|
|
73549
73566
|
const normalizedValue = rawValue.toLowerCase();
|
|
73550
73567
|
if (normalizedValue === "application") {
|
|
73551
|
-
return
|
|
73568
|
+
return kd.APPLICATION;
|
|
73552
73569
|
}
|
|
73553
73570
|
if (normalizedValue === "first") {
|
|
73554
|
-
return
|
|
73571
|
+
return kd.FIRST;
|
|
73555
73572
|
}
|
|
73556
73573
|
throw new Error(`Invalid value for returnAck; expected: 'first' or 'application', received: ${rawValue}`);
|
|
73557
73574
|
}
|
|
@@ -73592,7 +73609,7 @@ async function agentMain(argv) {
|
|
|
73592
73609
|
process.exit(1);
|
|
73593
73610
|
}
|
|
73594
73611
|
const { baseUrl, clientId, clientSecret, agentId } = args;
|
|
73595
|
-
const medplum = new
|
|
73612
|
+
const medplum = new Xt({ baseUrl, clientId });
|
|
73596
73613
|
let loggedIn = false;
|
|
73597
73614
|
while (!loggedIn) {
|
|
73598
73615
|
try {
|
|
@@ -73601,7 +73618,7 @@ async function agentMain(argv) {
|
|
|
73601
73618
|
} catch (err) {
|
|
73602
73619
|
console.error("Failed to login", { err: _e(err) });
|
|
73603
73620
|
console.log("Retrying login in 10 seconds...");
|
|
73604
|
-
await
|
|
73621
|
+
await Qr(RETRY_WAIT_DURATION_MS);
|
|
73605
73622
|
}
|
|
73606
73623
|
}
|
|
73607
73624
|
if (args.logLevel) {
|
|
@@ -73614,7 +73631,7 @@ async function agentMain(argv) {
|
|
|
73614
73631
|
for (const warning of warnings) {
|
|
73615
73632
|
mainLogger.warn(warning);
|
|
73616
73633
|
}
|
|
73617
|
-
const app = new App(medplum, agentId, args.logLevel ?
|
|
73634
|
+
const app = new App(medplum, agentId, args.logLevel ? vh(args.logLevel) : void 0, {
|
|
73618
73635
|
mainLogger,
|
|
73619
73636
|
channelLogger
|
|
73620
73637
|
});
|
|
@@ -73646,7 +73663,7 @@ async function upgraderMain(argv) {
|
|
|
73646
73663
|
if ((0, import_node_os5.platform)() !== "win32") {
|
|
73647
73664
|
throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
|
|
73648
73665
|
}
|
|
73649
|
-
const globalLogger = new
|
|
73666
|
+
const globalLogger = new To((msg) => console.log(msg));
|
|
73650
73667
|
if (!import_node_process3.default.send) {
|
|
73651
73668
|
globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
|
|
73652
73669
|
import_node_process3.default.exit(1);
|
|
@@ -73656,10 +73673,10 @@ async function upgraderMain(argv) {
|
|
|
73656
73673
|
rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
|
|
73657
73674
|
import_node_process3.default.once("disconnect", resolve2);
|
|
73658
73675
|
});
|
|
73659
|
-
if (argv[3] && !
|
|
73676
|
+
if (argv[3] && !su(argv[3])) {
|
|
73660
73677
|
throw new Error("Invalid version specified");
|
|
73661
73678
|
}
|
|
73662
|
-
const version = argv[3] ?? await
|
|
73679
|
+
const version = argv[3] ?? await ry("agent-upgrader");
|
|
73663
73680
|
const binPath = getReleaseBinPath(version);
|
|
73664
73681
|
if (!(0, import_node_fs6.existsSync)(binPath)) {
|
|
73665
73682
|
globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
|
|
@@ -73710,7 +73727,7 @@ async function main(argv) {
|
|
|
73710
73727
|
} else if (argv[2] === "--remove-old-services") {
|
|
73711
73728
|
const logFileFd = (0, import_node_fs7.openSync)(TEMP_LOG_FILE, "a");
|
|
73712
73729
|
let allAgentServices = [];
|
|
73713
|
-
const currentServiceName = `MedplumAgent_${
|
|
73730
|
+
const currentServiceName = `MedplumAgent_${un}`;
|
|
73714
73731
|
while (!allAgentServices.includes(currentServiceName)) {
|
|
73715
73732
|
const output = (0, import_node_child_process3.execSync)('cmd.exe /c sc query type= service state= all | findstr /i "SERVICE_NAME.*MedplumAgent"');
|
|
73716
73733
|
(0, import_node_fs7.appendFileSync)(logFileFd, `${output}\r
|
|
@@ -73720,8 +73737,8 @@ async function main(argv) {
|
|
|
73720
73737
|
${allAgentServices.join("\r\n")}\r
|
|
73721
73738
|
`, { encoding: "utf-8" });
|
|
73722
73739
|
}
|
|
73723
|
-
const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${
|
|
73724
|
-
(0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${
|
|
73740
|
+
const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${un}`);
|
|
73741
|
+
(0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${un}\r
|
|
73725
73742
|
`, {
|
|
73726
73743
|
encoding: "utf-8"
|
|
73727
73744
|
});
|