@ovok/native 1.17.0-dev.2239 → 1.17.0-dev.2243
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/lib/commonjs/modules/next/bluetooth/adapters/chosen-patient.js +25 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/chosen-patient.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js +10 -5
- package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js +14 -8
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js +2 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js +6 -3
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js +2 -1
- package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js +2 -1
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/chosen-patient.js +22 -0
- package/lib/module/modules/next/bluetooth/adapters/chosen-patient.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/live-supersession.js +10 -5
- package/lib/module/modules/next/bluetooth/adapters/live-supersession.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js +14 -8
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/reading-values.js +2 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-values.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js +6 -3
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js.map +1 -1
- package/lib/module/modules/next/bluetooth/create-bluetooth.js +2 -1
- package/lib/module/modules/next/bluetooth/create-bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js +2 -1
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/chosen-patient.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/chosen-patient.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +5 -3
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts +5 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/chosen-patient.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/chosen-patient.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts +2 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +5 -3
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts +5 -2
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.chosenPatientOf = void 0;
|
|
7
|
+
var _errors = require("../core/errors.js");
|
|
8
|
+
/**
|
|
9
|
+
* Names the patient a reading is saved for, when the person measuring isn't the patient (a clinician): read at every
|
|
10
|
+
* save, so it follows whoever is chosen now. `undefined` means nobody is chosen, and the reading is not saved.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** The patient `savesFor` names, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
14
|
+
const chosenPatientOf = savesFor => {
|
|
15
|
+
if (!savesFor) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const patientId = savesFor();
|
|
19
|
+
if (!patientId) {
|
|
20
|
+
throw new _errors.DeviceError("save-failed", "Choose the patient being measured before saving a reading");
|
|
21
|
+
}
|
|
22
|
+
return patientId;
|
|
23
|
+
};
|
|
24
|
+
exports.chosenPatientOf = chosenPatientOf;
|
|
25
|
+
//# sourceMappingURL=chosen-patient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","chosenPatientOf","savesFor","undefined","patientId","DeviceError","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/chosen-patient.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;;AAGA;AACA,MAAMC,eAAe,GAAIC,QAA8B,IAAyB;EAC9E,IAAI,CAACA,QAAQ,EAAE;IACb,OAAOC,SAAS;EAClB;EAEA,MAAMC,SAAS,GAAGF,QAAQ,CAAC,CAAC;EAE5B,IAAI,CAACE,SAAS,EAAE;IACd,MAAM,IAAIC,mBAAW,CAAC,aAAa,EAAE,2DAA2D,CAAC;EACnG;EAEA,OAAOD,SAAS;AAClB,CAAC;AAACE,OAAA,CAAAL,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -12,8 +12,7 @@ var _seriesSaving = require("./series-saving.js");
|
|
|
12
12
|
const LIVE_SLOT_MS = 1_000;
|
|
13
13
|
|
|
14
14
|
/** The observations a live recording was saved as, rebuilt from its span alone; a single stand-in value gives each its identifiers. */
|
|
15
|
-
const observationsOfSpan = async (client, address, span) => {
|
|
16
|
-
const patientId = await (0, _seriesSaving.ownPatientId)(client);
|
|
15
|
+
const observationsOfSpan = async (client, address, span, patientId) => {
|
|
17
16
|
const sourceId = (0, _readingSourceId.liveSourceId)(address, span);
|
|
18
17
|
if (span.channel === null) {
|
|
19
18
|
const field = (0, _seriesSaving.seriesFieldOf)(span.metric);
|
|
@@ -51,9 +50,15 @@ const deleteTargetsOf = observations => observations.flatMap(({
|
|
|
51
50
|
}] : []));
|
|
52
51
|
|
|
53
52
|
/** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
/** Deletes the live recordings a stored reading replaces, for `patientId` when given, else the signed-in patient or guest. */
|
|
54
|
+
const replaceLiveRecordings = async (client, reading, patientId) => {
|
|
55
|
+
const spans = reading.supersedes ?? [];
|
|
56
|
+
if (spans.length === 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const owner = patientId ?? (await (0, _seriesSaving.ownPatientId)(client));
|
|
60
|
+
for (const span of spans) {
|
|
61
|
+
for (const target of deleteTargetsOf(await observationsOfSpan(client, reading.source.address, span, owner))) {
|
|
57
62
|
await client.outbox.enqueueDelete(target);
|
|
58
63
|
}
|
|
59
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_next","require","_readingSourceId","_seriesSaving","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","
|
|
1
|
+
{"version":3,"names":["_next","require","_readingSourceId","_seriesSaving","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","sourceId","liveSourceId","channel","field","seriesFieldOf","metric","seriesObservationsOf","start","from","intervalMs","values","measurement","measurementTypeKey","MeasurementTypeKey","ecg","diagramPoints","duration","recordedAt","measurements","build","deleteTargetsOf","observations","flatMap","identifier","system","value","SEGMENT_IDENTIFIER_SYSTEM","replaceLiveRecordings","reading","spans","supersedes","length","owner","ownPatientId","target","source","outbox","enqueueDelete","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/live-supersession.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAA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;AACA;AACA,MAAME,qBAAqB,GAAG,MAAAA,CAAO/B,MAA0B,EAAEgC,OAAgB,EAAE7B,SAAkB,KAAoB;EACvH,MAAM8B,KAAK,GAAGD,OAAO,CAACE,UAAU,IAAI,EAAE;EAEtC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IACtB;EACF;EAEA,MAAMC,KAAK,GAAGjC,SAAS,KAAK,MAAM,IAAAkC,0BAAY,EAACrC,MAAM,CAAC,CAAC;EAEvD,KAAK,MAAME,IAAI,IAAI+B,KAAK,EAAE;IACxB,KAAK,MAAMK,MAAM,IAAId,eAAe,CAAC,MAAMzB,kBAAkB,CAACC,MAAM,EAAEgC,OAAO,CAACO,MAAM,CAACtC,OAAO,EAAEC,IAAI,EAAEkC,KAAK,CAAC,CAAC,EAAE;MAC3G,MAAMpC,MAAM,CAACwC,MAAM,CAACC,aAAa,CAACH,MAAM,CAAC;IAC3C;EACF;AACF,CAAC;AAACI,OAAA,CAAAX,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ovokReadingSink = void 0;
|
|
7
7
|
var _next = require("@ovok/core/next");
|
|
8
8
|
var _errors = require("../core/errors.js");
|
|
9
|
+
var _chosenPatient = require("./chosen-patient.js");
|
|
9
10
|
var _ecgMeasurements = require("./ecg-measurements.js");
|
|
10
11
|
var _liveSupersession = require("./live-supersession.js");
|
|
11
12
|
var _readingSourceId = require("./reading-source-id.js");
|
|
@@ -139,7 +140,7 @@ const unsupported = what => new _errors.DeviceError("unsupported", `Ovok cannot
|
|
|
139
140
|
/** Live numbers are saved as series and a live ECG as a recording; any other live trace has no place in Ovok yet. */
|
|
140
141
|
const isUnsavableLive = reading => reading.live !== undefined && reading.series === undefined && reading.type !== "ecg";
|
|
141
142
|
const hasValues = reading => Object.keys(reading.values).length > 0;
|
|
142
|
-
const saveMeasurements = async (client, reading, device) => {
|
|
143
|
+
const saveMeasurements = async (client, reading, device, patientId) => {
|
|
143
144
|
const measurements = MEASUREMENTS[reading.type]?.(reading) ?? [];
|
|
144
145
|
if (measurements.length === 0) {
|
|
145
146
|
throw unsupported(`a ${reading.type} reading of this shape`);
|
|
@@ -150,7 +151,10 @@ const saveMeasurements = async (client, reading, device) => {
|
|
|
150
151
|
measurement,
|
|
151
152
|
...(0, _readingSourceId.sourceIdsOf)(reading, device.sn, index),
|
|
152
153
|
effectiveDateTime: reading.takenAt ?? undefined,
|
|
153
|
-
device
|
|
154
|
+
device,
|
|
155
|
+
...(patientId && {
|
|
156
|
+
patientId
|
|
157
|
+
})
|
|
154
158
|
}));
|
|
155
159
|
}
|
|
156
160
|
return results;
|
|
@@ -168,23 +172,25 @@ const receiptOf = results => {
|
|
|
168
172
|
};
|
|
169
173
|
|
|
170
174
|
/**
|
|
171
|
-
* Saves readings
|
|
172
|
-
* series also saves it; a stored record then removes the live recordings it
|
|
175
|
+
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
176
|
+
* patient `savesFor` names. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
177
|
+
* replaces, once it is saved.
|
|
173
178
|
*/
|
|
174
|
-
const ovokReadingSink = client => ({
|
|
179
|
+
const ovokReadingSink = (client, savesFor) => ({
|
|
175
180
|
save: async (reading, device) => {
|
|
176
181
|
if (isUnsavableLive(reading)) {
|
|
177
182
|
throw unsupported(`a live ${reading.live?.metric} recording`);
|
|
178
183
|
}
|
|
184
|
+
const patientId = (0, _chosenPatient.chosenPatientOf)(savesFor);
|
|
179
185
|
const target = deviceOf(reading, device);
|
|
180
186
|
const results = [];
|
|
181
187
|
if ((0, _seriesSaving.isSeriesReading)(reading)) {
|
|
182
|
-
results.push(await (0, _seriesSaving.saveSeries)(client, reading, target));
|
|
188
|
+
results.push(await (0, _seriesSaving.saveSeries)(client, reading, target, patientId));
|
|
183
189
|
}
|
|
184
190
|
if (!(0, _seriesSaving.isSeriesReading)(reading) || hasValues(reading)) {
|
|
185
|
-
results.push(...(await saveMeasurements(client, reading, target)));
|
|
191
|
+
results.push(...(await saveMeasurements(client, reading, target, patientId)));
|
|
186
192
|
}
|
|
187
|
-
await (0, _liveSupersession.replaceLiveRecordings)(client, reading);
|
|
193
|
+
await (0, _liveSupersession.replaceLiveRecordings)(client, reading, patientId);
|
|
188
194
|
return receiptOf(results);
|
|
189
195
|
}
|
|
190
196
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_next","require","_errors","_ecgMeasurements","_liveSupersession","_readingSourceId","_readingValues","_seriesSaving","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","MeasurementTypeKey","systolic","ovokValueOf","diastolic","meanArterialPressure","heartRate","valueOf","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","ecgMeasurements","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","DeviceError","isUnsavableLive","live","series","type","hasValues","keys","length","saveMeasurements","client","measurements","results","index","entries","push","save","sourceIdsOf","effectiveDateTime","receiptOf","queueIds","result","status","queueId","ovokReadingSink","target","isSeriesReading","saveSeries","replaceLiveRecordings","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAgBA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,
|
|
1
|
+
{"version":3,"names":["_next","require","_errors","_chosenPatient","_ecgMeasurements","_liveSupersession","_readingSourceId","_readingValues","_seriesSaving","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","MeasurementTypeKey","systolic","ovokValueOf","diastolic","meanArterialPressure","heartRate","valueOf","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","ecgMeasurements","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","DeviceError","isUnsavableLive","live","series","type","hasValues","keys","length","saveMeasurements","client","patientId","measurements","results","index","entries","push","save","sourceIdsOf","effectiveDateTime","receiptOf","queueIds","result","status","queueId","ovokReadingSink","savesFor","chosenPatientOf","target","isSeriesReading","saveSeries","replaceLiveRecordings","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAgBA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,aAAA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AAgB,8BAAe,EAACD,QAAQ,CAAC;IAC3C,MAAME,MAAM,GAAGhD,QAAQ,CAACpE,OAAO,EAAEqE,MAAM,CAAC;IACxC,MAAMgC,OAAiC,GAAG,EAAE;IAE5C,IAAI,IAAAgB,6BAAe,EAACrH,OAAO,CAAC,EAAE;MAC5BqG,OAAO,CAACG,IAAI,CAAC,MAAM,IAAAc,wBAAU,EAACpB,MAAM,EAAElG,OAAO,EAAEoH,MAAM,EAAEjB,SAAS,CAAC,CAAC;IACpE;IAEA,IAAI,CAAC,IAAAkB,6BAAe,EAACrH,OAAO,CAAC,IAAI8F,SAAS,CAAC9F,OAAO,CAAC,EAAE;MACnDqG,OAAO,CAACG,IAAI,CAAC,IAAI,MAAMP,gBAAgB,CAACC,MAAM,EAAElG,OAAO,EAAEoH,MAAM,EAAEjB,SAAS,CAAC,CAAC,CAAC;IAC/E;IAEA,MAAM,IAAAoB,uCAAqB,EAACrB,MAAM,EAAElG,OAAO,EAAEmG,SAAS,CAAC;IAEvD,OAAOS,SAAS,CAACP,OAAO,CAAC;EAC3B;AACF,CAAC,CAAC;AAACmB,OAAA,CAAAP,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ const KG_PER_POUND = 0.45359237;
|
|
|
9
9
|
const KG_PER_STONE = 6.35029318;
|
|
10
10
|
const MMHG_PER_KPA = 7.50062;
|
|
11
11
|
const FAHRENHEIT_ZERO_IN_CELSIUS_STEPS = 32;
|
|
12
|
+
const SECONDS_PER_MINUTE = 60;
|
|
12
13
|
|
|
13
14
|
/** A device's UCUM unit to the unit Ovok stores the value in: mg/dL, kg, °C, mmHg, L, L/s, % or per minute. */
|
|
14
15
|
const TO_OVOK_UNIT = exports.TO_OVOK_UNIT = {
|
|
@@ -23,6 +24,7 @@ const TO_OVOK_UNIT = exports.TO_OVOK_UNIT = {
|
|
|
23
24
|
kPa: value => value * MMHG_PER_KPA,
|
|
24
25
|
L: value => value,
|
|
25
26
|
"L/s": value => value,
|
|
27
|
+
"L/min": value => value / SECONDS_PER_MINUTE,
|
|
26
28
|
"%": value => value,
|
|
27
29
|
"/min": value => value
|
|
28
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MG_PER_DL_PER_MMOL_PER_L","KG_PER_POUND","KG_PER_STONE","MMHG_PER_KPA","FAHRENHEIT_ZERO_IN_CELSIUS_STEPS","TO_OVOK_UNIT","exports","value","kg","Cel","kPa","L","valueOf","reading","metric","values","ovokValueOf","quantity","unit"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/reading-values.ts"],"mappings":";;;;;;AAGA,MAAMA,wBAAwB,GAAG,OAAO;AACxC,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,OAAO;AAC5B,MAAMC,gCAAgC,GAAG,EAAE;;
|
|
1
|
+
{"version":3,"names":["MG_PER_DL_PER_MMOL_PER_L","KG_PER_POUND","KG_PER_STONE","MMHG_PER_KPA","FAHRENHEIT_ZERO_IN_CELSIUS_STEPS","SECONDS_PER_MINUTE","TO_OVOK_UNIT","exports","value","kg","Cel","kPa","L","valueOf","reading","metric","values","ovokValueOf","quantity","unit"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/reading-values.ts"],"mappings":";;;;;;AAGA,MAAMA,wBAAwB,GAAG,OAAO;AACxC,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,OAAO;AAC5B,MAAMC,gCAAgC,GAAG,EAAE;AAC3C,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA,MAAMC,YAAuD,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC9D,OAAO,EAAGE,KAAK,IAAKA,KAAK;EACzB,QAAQ,EAAGA,KAAK,IAAKA,KAAK,GAAGR,wBAAwB;EACrDS,EAAE,EAAGD,KAAK,IAAKA,KAAK;EACpB,SAAS,EAAGA,KAAK,IAAKA,KAAK,GAAGP,YAAY;EAC1C,YAAY,EAAGO,KAAK,IAAKA,KAAK,GAAGN,YAAY;EAC7CQ,GAAG,EAAGF,KAAK,IAAKA,KAAK;EACrB,QAAQ,EAAGA,KAAK,IAAM,CAACA,KAAK,GAAGJ,gCAAgC,IAAI,CAAC,GAAI,CAAC;EACzE,QAAQ,EAAGI,KAAK,IAAKA,KAAK;EAC1BG,GAAG,EAAGH,KAAK,IAAKA,KAAK,GAAGL,YAAY;EACpCS,CAAC,EAAGJ,KAAK,IAAKA,KAAK;EACnB,KAAK,EAAGA,KAAK,IAAKA,KAAK;EACvB,OAAO,EAAGA,KAAK,IAAKA,KAAK,GAAGH,kBAAkB;EAC9C,GAAG,EAAGG,KAAK,IAAKA,KAAK;EACrB,MAAM,EAAGA,KAAK,IAAKA;AACrB,CAAC;AAED,MAAMK,OAAO,GAAGA,CAACC,OAAgB,EAAEC,MAAkB,KAAyBD,OAAO,CAACE,MAAM,CAACD,MAAM,CAAC,EAAEP,KAAK;;AAE3G;AAAAD,OAAA,CAAAM,OAAA,GAAAA,OAAA;AACA,MAAMI,WAAW,GAAGA,CAACH,OAAgB,EAAEC,MAAkB,KAAyB;EAChF,MAAMG,QAAQ,GAAGJ,OAAO,CAACE,MAAM,CAACD,MAAM,CAAC;EAEvC,OAAOG,QAAQ,IAAIZ,YAAY,CAACY,QAAQ,CAACC,IAAI,CAAC,GAAGD,QAAQ,CAACV,KAAK,CAAC;AAClE,CAAC;AAACD,OAAA,CAAAU,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -70,9 +70,12 @@ const seriesObservationsOf = (field, {
|
|
|
70
70
|
...rest
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. It is
|
|
75
|
+
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
76
|
+
*/
|
|
74
77
|
exports.seriesObservationsOf = seriesObservationsOf;
|
|
75
|
-
const saveSeries = async (client, reading, device) => {
|
|
78
|
+
const saveSeries = async (client, reading, device, patientId) => {
|
|
76
79
|
const {
|
|
77
80
|
series
|
|
78
81
|
} = reading;
|
|
@@ -85,7 +88,7 @@ const saveSeries = async (client, reading, device) => {
|
|
|
85
88
|
...series,
|
|
86
89
|
values: series.values.map(value => value === null ? null : toOvokUnit(value))
|
|
87
90
|
}, {
|
|
88
|
-
patientId: await ownPatientId(client),
|
|
91
|
+
patientId: patientId ?? (await ownPatientId(client)),
|
|
89
92
|
...(0, _readingSourceId.sourceIdsOf)(reading, device.sn),
|
|
90
93
|
device
|
|
91
94
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_next","require","_errors","_readingSourceId","_readingValues","SERIES_FIELDS","heart_rate","type","MeasurementTypeKey","heartRate","property","pulse_rate","bloodOxygenPulseRate","spo2","respiration_rate","respiratoryRate","body_temperature","temperature","unsupported","what","DeviceError","isSeriesReading","reading","series","undefined","exports","seriesFieldOf","metric","ownPatientId","session","reference","current","profile","slice","indexOf","GUEST_PATIENT_ID","seriesObservationsOf","field","start","intervalMs","values","rest","seriesObservations","measurementTypeKey","periodMs","saveSeries","client","device","toOvokUnit","TO_OVOK_UNIT","unit","observations","map","value","
|
|
1
|
+
{"version":3,"names":["_next","require","_errors","_readingSourceId","_readingValues","SERIES_FIELDS","heart_rate","type","MeasurementTypeKey","heartRate","property","pulse_rate","bloodOxygenPulseRate","spo2","respiration_rate","respiratoryRate","body_temperature","temperature","unsupported","what","DeviceError","isSeriesReading","reading","series","undefined","exports","seriesFieldOf","metric","ownPatientId","session","reference","current","profile","slice","indexOf","GUEST_PATIENT_ID","seriesObservationsOf","field","start","intervalMs","values","rest","seriesObservations","measurementTypeKey","periodMs","saveSeries","client","device","patientId","toOvokUnit","TO_OVOK_UNIT","unit","observations","map","value","sourceIdsOf","sn","measurements","saveObservations"],"sourceRoot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,EAChG;IAAEN,SAAS,EAAEA,SAAS,KAAK,MAAMpB,YAAY,CAACkB,MAAM,CAAC,CAAC;IAAE,GAAG,IAAAS,4BAAW,EAACjC,OAAO,EAAEyB,MAAM,CAACS,EAAE,CAAC;IAAET;EAAO,CACrG,CAAC;EAED,OAAOD,MAAM,CAACW,YAAY,CAACC,gBAAgB,CAACN,YAAY,CAAC;AAC3D,CAAC;AAAC3B,OAAA,CAAAoB,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -20,13 +20,14 @@ var _builtIn = require("./families/built-in.js");
|
|
|
20
20
|
const createBluetooth = ({
|
|
21
21
|
ovok,
|
|
22
22
|
storage,
|
|
23
|
+
savesFor,
|
|
23
24
|
...overrides
|
|
24
25
|
}) => {
|
|
25
26
|
const outbox = (0, _ovokOutboxWatch.ovokOutboxWatch)(ovok.outbox, overrides.logger);
|
|
26
27
|
return new _bluetooth.Bluetooth({
|
|
27
28
|
central: (0, _blePlxCentral.blePlxCentral)(new _reactNativeBlePlx.BleManager()),
|
|
28
29
|
store: (0, _storagePairedDevices.storagePairedDevices)(storage),
|
|
29
|
-
sink: (0, _ovokReadingSink.ovokReadingSink)(ovok),
|
|
30
|
+
sink: (0, _ovokReadingSink.ovokReadingSink)(ovok, savesFor),
|
|
30
31
|
permissions: (0, _osPermissions.osBluetoothPermissions)(),
|
|
31
32
|
models: _builtIn.BUILT_IN_MODELS,
|
|
32
33
|
protocols: _builtIn.BUILT_IN_PROTOCOLS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeBlePlx","require","_androidForegroundService","_blePlxCentral","_osPermissions","_ovokOutboxWatch","_ovokReadingSink","_reactNativeLifecycle","_storagePairedDevices","_bluetooth","_builtIn","createBluetooth","ovok","storage","overrides","outbox","ovokOutboxWatch","logger","Bluetooth","central","blePlxCentral","BleManager","store","storagePairedDevices","sink","ovokReadingSink","permissions","osBluetoothPermissions","models","BUILT_IN_MODELS","protocols","BUILT_IN_PROTOCOLS","lifecycle","reactNativeLifecycle","keepAlive","androidForegroundService","exports"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/create-bluetooth.ts"],"mappings":";;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNativeBlePlx","require","_androidForegroundService","_blePlxCentral","_osPermissions","_ovokOutboxWatch","_ovokReadingSink","_reactNativeLifecycle","_storagePairedDevices","_bluetooth","_builtIn","createBluetooth","ovok","storage","savesFor","overrides","outbox","ovokOutboxWatch","logger","Bluetooth","central","blePlxCentral","BleManager","store","storagePairedDevices","sink","ovokReadingSink","permissions","osBluetoothPermissions","models","BUILT_IN_MODELS","protocols","BUILT_IN_PROTOCOLS","lifecycle","reactNativeLifecycle","keepAlive","androidForegroundService","exports"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/create-bluetooth.ts"],"mappings":";;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAEA;;AAaA;AACA,MAAMU,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAEC,QAAQ;EAAE,GAAGC;AAAkC,CAAC,KAAgB;EACxG,MAAMC,MAAM,GAAG,IAAAC,gCAAe,EAACL,IAAI,CAACI,MAAM,EAAED,SAAS,CAACG,MAAM,CAAC;EAE7D,OAAO,IAAIC,oBAAS,CAAC;IACnBC,OAAO,EAAE,IAAAC,4BAAa,EAAC,IAAIC,6BAAU,CAAC,CAAC,CAAC;IACxCC,KAAK,EAAE,IAAAC,0CAAoB,EAACX,OAAO,CAAC;IACpCY,IAAI,EAAE,IAAAC,gCAAe,EAACd,IAAI,EAAEE,QAAQ,CAAC;IACrCa,WAAW,EAAE,IAAAC,qCAAsB,EAAC,CAAC;IACrCC,MAAM,EAAEC,wBAAe;IACvBC,SAAS,EAAEC,2BAAkB;IAC7BC,SAAS,EAAE,IAAAC,0CAAoB,EAAC,CAAC;IACjCC,SAAS,EAAE,IAAAC,kDAAwB,EAAC,CAAC,CAAC,EAAE;MAAEpB,MAAM;MAAEE,MAAM,EAAEH,SAAS,CAACG;IAAO,CAAC,CAAC;IAC7EF,MAAM;IACN,GAAGD;EACL,CAAC,CAAC;AACJ,CAAC;AAACsB,OAAA,CAAA1B,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -24,11 +24,12 @@ const browserBluetooth = () => globalThis.navigator?.bluetooth;
|
|
|
24
24
|
const createWebBluetooth = ({
|
|
25
25
|
ovok,
|
|
26
26
|
storage,
|
|
27
|
+
savesFor,
|
|
27
28
|
...overrides
|
|
28
29
|
}) => new _bluetooth.Bluetooth({
|
|
29
30
|
central: (0, _webBluetoothCentral.webBluetoothCentral)(browserBluetooth()),
|
|
30
31
|
store: (0, _storagePairedDevices.storagePairedDevices)(storage),
|
|
31
|
-
sink: (0, _ovokReadingSink.ovokReadingSink)(ovok),
|
|
32
|
+
sink: (0, _ovokReadingSink.ovokReadingSink)(ovok, savesFor),
|
|
32
33
|
outbox: (0, _ovokOutboxWatch.ovokOutboxWatch)(ovok.outbox, overrides.logger),
|
|
33
34
|
permissions: chooserPermissions,
|
|
34
35
|
models: _builtIn.BUILT_IN_MODELS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ovokOutboxWatch","require","_ovokReadingSink","_storagePairedDevices","_webBluetoothCentral","_bluetooth","_builtIn","chooserPermissions","check","request","openSettings","undefined","browserBluetooth","globalThis","navigator","bluetooth","createWebBluetooth","ovok","storage","overrides","Bluetooth","central","webBluetoothCentral","store","storagePairedDevices","sink","ovokReadingSink","outbox","ovokOutboxWatch","logger","permissions","models","BUILT_IN_MODELS","protocols","BUILT_IN_PROTOCOLS","autoSync","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["_ovokOutboxWatch","require","_ovokReadingSink","_storagePairedDevices","_webBluetoothCentral","_bluetooth","_builtIn","chooserPermissions","check","request","openSettings","undefined","browserBluetooth","globalThis","navigator","bluetooth","createWebBluetooth","ovok","storage","savesFor","overrides","Bluetooth","central","webBluetoothCentral","store","storagePairedDevices","sink","ovokReadingSink","outbox","ovokOutboxWatch","logger","permissions","models","BUILT_IN_MODELS","protocols","BUILT_IN_PROTOCOLS","autoSync","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth.ts"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AAEA;;AAaA;AACA,MAAMM,kBAAwC,GAAG;EAC/CC,KAAK,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC5BC,OAAO,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC9BC,YAAY,EAAE,MAAAA,CAAA,KAAYC;AAC5B,CAAC;AAED,MAAMC,gBAAgB,GAAGA,CAAA,KACtBC,UAAU,CAAkDC,SAAS,EAAEC,SAAS;;AAEnF;AACA,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAEC,QAAQ;EAAE,GAAGC;AAAqC,CAAC,KAC9F,IAAIC,oBAAS,CAAC;EACZC,OAAO,EAAE,IAAAC,wCAAmB,EAACX,gBAAgB,CAAC,CAAC,CAAC;EAChDY,KAAK,EAAE,IAAAC,0CAAoB,EAACP,OAAO,CAAC;EACpCQ,IAAI,EAAE,IAAAC,gCAAe,EAACV,IAAI,EAAEE,QAAQ,CAAC;EACrCS,MAAM,EAAE,IAAAC,gCAAe,EAACZ,IAAI,CAACW,MAAM,EAAER,SAAS,CAACU,MAAM,CAAC;EACtDC,WAAW,EAAExB,kBAAkB;EAC/ByB,MAAM,EAAEC,wBAAe;EACvBC,SAAS,EAAEC,2BAAkB;EAC7BC,QAAQ,EAAE,KAAK;EACf,GAAGhB;AACL,CAAC,CAAC;AAACiB,OAAA,CAAArB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DeviceError } from "../core/errors.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Names the patient a reading is saved for, when the person measuring isn't the patient (a clinician): read at every
|
|
7
|
+
* save, so it follows whoever is chosen now. `undefined` means nobody is chosen, and the reading is not saved.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** The patient `savesFor` names, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
11
|
+
const chosenPatientOf = savesFor => {
|
|
12
|
+
if (!savesFor) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const patientId = savesFor();
|
|
16
|
+
if (!patientId) {
|
|
17
|
+
throw new DeviceError("save-failed", "Choose the patient being measured before saving a reading");
|
|
18
|
+
}
|
|
19
|
+
return patientId;
|
|
20
|
+
};
|
|
21
|
+
export { chosenPatientOf };
|
|
22
|
+
//# sourceMappingURL=chosen-patient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DeviceError","chosenPatientOf","savesFor","undefined","patientId"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/chosen-patient.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,mBAAgB;;AAE5C;AACA;AACA;AACA;;AAGA;AACA,MAAMC,eAAe,GAAIC,QAA8B,IAAyB;EAC9E,IAAI,CAACA,QAAQ,EAAE;IACb,OAAOC,SAAS;EAClB;EAEA,MAAMC,SAAS,GAAGF,QAAQ,CAAC,CAAC;EAE5B,IAAI,CAACE,SAAS,EAAE;IACd,MAAM,IAAIJ,WAAW,CAAC,aAAa,EAAE,2DAA2D,CAAC;EACnG;EAEA,OAAOI,SAAS;AAClB,CAAC;AAED,SAASH,eAAe","ignoreList":[]}
|
|
@@ -9,8 +9,7 @@ import { ownPatientId, seriesFieldOf, seriesObservationsOf } from "./series-savi
|
|
|
9
9
|
const LIVE_SLOT_MS = 1_000;
|
|
10
10
|
|
|
11
11
|
/** The observations a live recording was saved as, rebuilt from its span alone; a single stand-in value gives each its identifiers. */
|
|
12
|
-
const observationsOfSpan = async (client, address, span) => {
|
|
13
|
-
const patientId = await ownPatientId(client);
|
|
12
|
+
const observationsOfSpan = async (client, address, span, patientId) => {
|
|
14
13
|
const sourceId = liveSourceId(address, span);
|
|
15
14
|
if (span.channel === null) {
|
|
16
15
|
const field = seriesFieldOf(span.metric);
|
|
@@ -48,9 +47,15 @@ const deleteTargetsOf = observations => observations.flatMap(({
|
|
|
48
47
|
}] : []));
|
|
49
48
|
|
|
50
49
|
/** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/** Deletes the live recordings a stored reading replaces, for `patientId` when given, else the signed-in patient or guest. */
|
|
51
|
+
const replaceLiveRecordings = async (client, reading, patientId) => {
|
|
52
|
+
const spans = reading.supersedes ?? [];
|
|
53
|
+
if (spans.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const owner = patientId ?? (await ownPatientId(client));
|
|
57
|
+
for (const span of spans) {
|
|
58
|
+
for (const target of deleteTargetsOf(await observationsOfSpan(client, reading.source.address, span, owner))) {
|
|
54
59
|
await client.outbox.enqueueDelete(target);
|
|
55
60
|
}
|
|
56
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","SEGMENT_IDENTIFIER_SYSTEM","liveSourceId","ownPatientId","seriesFieldOf","seriesObservationsOf","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","sourceId","channel","field","metric","start","from","intervalMs","values","measurement","measurementTypeKey","ecg","diagramPoints","duration","recordedAt","measurements","build","deleteTargetsOf","observations","flatMap","identifier","system","value","replaceLiveRecordings","reading","supersedes","target","source","outbox","enqueueDelete"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/live-supersession.ts"],"mappings":";;AAAA,SAAyBA,kBAAkB,EAAQC,yBAAyB,QAAQ,iBAAiB;AAMrG,SAASC,YAAY,QAAQ,wBAAqB;AAClD,SAASC,YAAY,EAAEC,aAAa,EAAEC,oBAAoB,QAAQ,oBAAiB;;AAEnF;;AAGA,MAAMC,YAAY,GAAG,KAAK;;AAE1B;AACA,MAAMC,kBAAkB,GAAG,MAAAA,CAAOC,MAA0B,EAAEC,OAAe,EAAEC,IAAc,KAA6B;
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","SEGMENT_IDENTIFIER_SYSTEM","liveSourceId","ownPatientId","seriesFieldOf","seriesObservationsOf","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","sourceId","channel","field","metric","start","from","intervalMs","values","measurement","measurementTypeKey","ecg","diagramPoints","duration","recordedAt","measurements","build","deleteTargetsOf","observations","flatMap","identifier","system","value","replaceLiveRecordings","reading","spans","supersedes","length","owner","target","source","outbox","enqueueDelete"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/live-supersession.ts"],"mappings":";;AAAA,SAAyBA,kBAAkB,EAAQC,yBAAyB,QAAQ,iBAAiB;AAMrG,SAASC,YAAY,QAAQ,wBAAqB;AAClD,SAASC,YAAY,EAAEC,aAA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,CAAO1B,MAA0B,EAAE2B,OAAgB,EAAExB,SAAkB,KAAoB;EACvH,MAAMyB,KAAK,GAAGD,OAAO,CAACE,UAAU,IAAI,EAAE;EAEtC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IACtB;EACF;EAEA,MAAMC,KAAK,GAAG5B,SAAS,KAAK,MAAMR,YAAY,CAACK,MAAM,CAAC,CAAC;EAEvD,KAAK,MAAME,IAAI,IAAI0B,KAAK,EAAE;IACxB,KAAK,MAAMI,MAAM,IAAIZ,eAAe,CAAC,MAAMrB,kBAAkB,CAACC,MAAM,EAAE2B,OAAO,CAACM,MAAM,CAAChC,OAAO,EAAEC,IAAI,EAAE6B,KAAK,CAAC,CAAC,EAAE;MAC3G,MAAM/B,MAAM,CAACkC,MAAM,CAACC,aAAa,CAACH,MAAM,CAAC;IAC3C;EACF;AACF,CAAC;AAED,SAASN,qBAAqB","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { MeasurementTypeKey } from "@ovok/core/next";
|
|
4
4
|
import { DeviceError } from "../core/errors.js";
|
|
5
|
+
import { chosenPatientOf } from "./chosen-patient.js";
|
|
5
6
|
import { ecgMeasurements } from "./ecg-measurements.js";
|
|
6
7
|
import { replaceLiveRecordings } from "./live-supersession.js";
|
|
7
8
|
import { sourceIdsOf } from "./reading-source-id.js";
|
|
@@ -135,7 +136,7 @@ const unsupported = what => new DeviceError("unsupported", `Ovok cannot save ${w
|
|
|
135
136
|
/** Live numbers are saved as series and a live ECG as a recording; any other live trace has no place in Ovok yet. */
|
|
136
137
|
const isUnsavableLive = reading => reading.live !== undefined && reading.series === undefined && reading.type !== "ecg";
|
|
137
138
|
const hasValues = reading => Object.keys(reading.values).length > 0;
|
|
138
|
-
const saveMeasurements = async (client, reading, device) => {
|
|
139
|
+
const saveMeasurements = async (client, reading, device, patientId) => {
|
|
139
140
|
const measurements = MEASUREMENTS[reading.type]?.(reading) ?? [];
|
|
140
141
|
if (measurements.length === 0) {
|
|
141
142
|
throw unsupported(`a ${reading.type} reading of this shape`);
|
|
@@ -146,7 +147,10 @@ const saveMeasurements = async (client, reading, device) => {
|
|
|
146
147
|
measurement,
|
|
147
148
|
...sourceIdsOf(reading, device.sn, index),
|
|
148
149
|
effectiveDateTime: reading.takenAt ?? undefined,
|
|
149
|
-
device
|
|
150
|
+
device,
|
|
151
|
+
...(patientId && {
|
|
152
|
+
patientId
|
|
153
|
+
})
|
|
150
154
|
}));
|
|
151
155
|
}
|
|
152
156
|
return results;
|
|
@@ -164,23 +168,25 @@ const receiptOf = results => {
|
|
|
164
168
|
};
|
|
165
169
|
|
|
166
170
|
/**
|
|
167
|
-
* Saves readings
|
|
168
|
-
* series also saves it; a stored record then removes the live recordings it
|
|
171
|
+
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
172
|
+
* patient `savesFor` names. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
173
|
+
* replaces, once it is saved.
|
|
169
174
|
*/
|
|
170
|
-
const ovokReadingSink = client => ({
|
|
175
|
+
const ovokReadingSink = (client, savesFor) => ({
|
|
171
176
|
save: async (reading, device) => {
|
|
172
177
|
if (isUnsavableLive(reading)) {
|
|
173
178
|
throw unsupported(`a live ${reading.live?.metric} recording`);
|
|
174
179
|
}
|
|
180
|
+
const patientId = chosenPatientOf(savesFor);
|
|
175
181
|
const target = deviceOf(reading, device);
|
|
176
182
|
const results = [];
|
|
177
183
|
if (isSeriesReading(reading)) {
|
|
178
|
-
results.push(await saveSeries(client, reading, target));
|
|
184
|
+
results.push(await saveSeries(client, reading, target, patientId));
|
|
179
185
|
}
|
|
180
186
|
if (!isSeriesReading(reading) || hasValues(reading)) {
|
|
181
|
-
results.push(...(await saveMeasurements(client, reading, target)));
|
|
187
|
+
results.push(...(await saveMeasurements(client, reading, target, patientId)));
|
|
182
188
|
}
|
|
183
|
-
await replaceLiveRecordings(client, reading);
|
|
189
|
+
await replaceLiveRecordings(client, reading, patientId);
|
|
184
190
|
return receiptOf(results);
|
|
185
191
|
}
|
|
186
192
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","DeviceError","ecgMeasurements","replaceLiveRecordings","sourceIdsOf","ovokValueOf","valueOf","isSeriesReading","saveSeries","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","systolic","diastolic","meanArterialPressure","heartRate","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","isUnsavableLive","live","series","type","hasValues","keys","length","saveMeasurements","client","measurements","results","index","entries","push","save","effectiveDateTime","receiptOf","queueIds","result","status","queueId","ovokReadingSink","target"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;AAAA,SAQEA,kBAAkB,QAKb,iBAAiB;AAGxB,SAASC,WAAW,QAAQ,mBAAgB;AAM5C,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,qBAAqB,QAA4B,wBAAqB;AAC/E,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,WAAW,EAAEC,OAAO,QAAQ,qBAAkB;AACvD,SAASC,eAAe,EAAqBC,UAAU,QAAQ,oBAAiB;AAEhF,MAAMC,OAAO,GAAGA,CAACC,OAAgB,EAAEC,IAAY,KAC7CD,OAAO,CAACE,WAAW,CAACC,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACH,IAAI,KAAKA,IAAI,IAAIG,IAAI,CAACC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,GAAGC,SAAS;AAE7F,MAAMC,aAAa,GAAIP,OAAgB,KAAgC;EACrEQ,kBAAkB,
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","DeviceError","chosenPatientOf","ecgMeasurements","replaceLiveRecordings","sourceIdsOf","ovokValueOf","valueOf","isSeriesReading","saveSeries","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","systolic","diastolic","meanArterialPressure","heartRate","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","isUnsavableLive","live","series","type","hasValues","keys","length","saveMeasurements","client","patientId","measurements","results","index","entries","push","save","effectiveDateTime","receiptOf","queueIds","result","status","queueId","ovokReadingSink","savesFor","target"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;AAAA,SAQEA,kBAAkB,QAKb,iBAAiB;AAGxB,SAASC,WAAW,QAAQ,mBAAgB;AAM5C,SAASC,eAAe,QAAkB,qBAAkB;AAC5D,SAASC,eAAe,QAA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C3C,MAAMC,MAAM,GAAG7C,QAAQ,CAAChE,OAAO,EAAEiE,MAAM,CAAC;IACxC,MAAM+B,OAAiC,GAAG,EAAE;IAE5C,IAAInG,eAAe,CAACG,OAAO,CAAC,EAAE;MAC5BgG,OAAO,CAACG,IAAI,CAAC,MAAMrG,UAAU,CAAC+F,MAAM,EAAE7F,OAAO,EAAE6G,MAAM,EAAEf,SAAS,CAAC,CAAC;IACpE;IAEA,IAAI,CAACjG,eAAe,CAACG,OAAO,CAAC,IAAIyF,SAAS,CAACzF,OAAO,CAAC,EAAE;MACnDgG,OAAO,CAACG,IAAI,CAAC,IAAI,MAAMP,gBAAgB,CAACC,MAAM,EAAE7F,OAAO,EAAE6G,MAAM,EAAEf,SAAS,CAAC,CAAC,CAAC;IAC/E;IAEA,MAAMrG,qBAAqB,CAACoG,MAAM,EAAE7F,OAAO,EAAE8F,SAAS,CAAC;IAEvD,OAAOQ,SAAS,CAACN,OAAO,CAAC;EAC3B;AACF,CAAC,CAAC;AAEF,SAASW,eAAe","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ const KG_PER_POUND = 0.45359237;
|
|
|
5
5
|
const KG_PER_STONE = 6.35029318;
|
|
6
6
|
const MMHG_PER_KPA = 7.50062;
|
|
7
7
|
const FAHRENHEIT_ZERO_IN_CELSIUS_STEPS = 32;
|
|
8
|
+
const SECONDS_PER_MINUTE = 60;
|
|
8
9
|
|
|
9
10
|
/** A device's UCUM unit to the unit Ovok stores the value in: mg/dL, kg, °C, mmHg, L, L/s, % or per minute. */
|
|
10
11
|
const TO_OVOK_UNIT = {
|
|
@@ -19,6 +20,7 @@ const TO_OVOK_UNIT = {
|
|
|
19
20
|
kPa: value => value * MMHG_PER_KPA,
|
|
20
21
|
L: value => value,
|
|
21
22
|
"L/s": value => value,
|
|
23
|
+
"L/min": value => value / SECONDS_PER_MINUTE,
|
|
22
24
|
"%": value => value,
|
|
23
25
|
"/min": value => value
|
|
24
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MG_PER_DL_PER_MMOL_PER_L","KG_PER_POUND","KG_PER_STONE","MMHG_PER_KPA","FAHRENHEIT_ZERO_IN_CELSIUS_STEPS","TO_OVOK_UNIT","value","kg","Cel","kPa","L","valueOf","reading","metric","values","ovokValueOf","quantity","unit"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/reading-values.ts"],"mappings":";;AAGA,MAAMA,wBAAwB,GAAG,OAAO;AACxC,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,OAAO;AAC5B,MAAMC,gCAAgC,GAAG,EAAE;;
|
|
1
|
+
{"version":3,"names":["MG_PER_DL_PER_MMOL_PER_L","KG_PER_POUND","KG_PER_STONE","MMHG_PER_KPA","FAHRENHEIT_ZERO_IN_CELSIUS_STEPS","SECONDS_PER_MINUTE","TO_OVOK_UNIT","value","kg","Cel","kPa","L","valueOf","reading","metric","values","ovokValueOf","quantity","unit"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/reading-values.ts"],"mappings":";;AAGA,MAAMA,wBAAwB,GAAG,OAAO;AACxC,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,OAAO;AAC5B,MAAMC,gCAAgC,GAAG,EAAE;AAC3C,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA,MAAMC,YAAuD,GAAG;EAC9D,OAAO,EAAGC,KAAK,IAAKA,KAAK;EACzB,QAAQ,EAAGA,KAAK,IAAKA,KAAK,GAAGP,wBAAwB;EACrDQ,EAAE,EAAGD,KAAK,IAAKA,KAAK;EACpB,SAAS,EAAGA,KAAK,IAAKA,KAAK,GAAGN,YAAY;EAC1C,YAAY,EAAGM,KAAK,IAAKA,KAAK,GAAGL,YAAY;EAC7CO,GAAG,EAAGF,KAAK,IAAKA,KAAK;EACrB,QAAQ,EAAGA,KAAK,IAAM,CAACA,KAAK,GAAGH,gCAAgC,IAAI,CAAC,GAAI,CAAC;EACzE,QAAQ,EAAGG,KAAK,IAAKA,KAAK;EAC1BG,GAAG,EAAGH,KAAK,IAAKA,KAAK,GAAGJ,YAAY;EACpCQ,CAAC,EAAGJ,KAAK,IAAKA,KAAK;EACnB,KAAK,EAAGA,KAAK,IAAKA,KAAK;EACvB,OAAO,EAAGA,KAAK,IAAKA,KAAK,GAAGF,kBAAkB;EAC9C,GAAG,EAAGE,KAAK,IAAKA,KAAK;EACrB,MAAM,EAAGA,KAAK,IAAKA;AACrB,CAAC;AAED,MAAMK,OAAO,GAAGA,CAACC,OAAgB,EAAEC,MAAkB,KAAyBD,OAAO,CAACE,MAAM,CAACD,MAAM,CAAC,EAAEP,KAAK;;AAE3G;AACA,MAAMS,WAAW,GAAGA,CAACH,OAAgB,EAAEC,MAAkB,KAAyB;EAChF,MAAMG,QAAQ,GAAGJ,OAAO,CAACE,MAAM,CAACD,MAAM,CAAC;EAEvC,OAAOG,QAAQ,IAAIX,YAAY,CAACW,QAAQ,CAACC,IAAI,CAAC,GAAGD,QAAQ,CAACV,KAAK,CAAC;AAClE,CAAC;AAED,SAASS,WAAW,EAAEV,YAAY,EAAEM,OAAO","ignoreList":[]}
|
|
@@ -64,8 +64,11 @@ const seriesObservationsOf = (field, {
|
|
|
64
64
|
...rest
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. It is
|
|
69
|
+
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
70
|
+
*/
|
|
71
|
+
const saveSeries = async (client, reading, device, patientId) => {
|
|
69
72
|
const {
|
|
70
73
|
series
|
|
71
74
|
} = reading;
|
|
@@ -78,7 +81,7 @@ const saveSeries = async (client, reading, device) => {
|
|
|
78
81
|
...series,
|
|
79
82
|
values: series.values.map(value => value === null ? null : toOvokUnit(value))
|
|
80
83
|
}, {
|
|
81
|
-
patientId: await ownPatientId(client),
|
|
84
|
+
patientId: patientId ?? (await ownPatientId(client)),
|
|
82
85
|
...sourceIdsOf(reading, device.sn),
|
|
83
86
|
device
|
|
84
87
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GUEST_PATIENT_ID","MeasurementTypeKey","seriesObservations","DeviceError","sourceIdsOf","TO_OVOK_UNIT","SERIES_FIELDS","heart_rate","type","heartRate","property","pulse_rate","bloodOxygenPulseRate","spo2","respiration_rate","respiratoryRate","body_temperature","temperature","unsupported","what","isSeriesReading","reading","series","undefined","seriesFieldOf","metric","ownPatientId","session","reference","current","profile","slice","indexOf","seriesObservationsOf","field","start","intervalMs","values","rest","measurementTypeKey","periodMs","saveSeries","client","device","toOvokUnit","unit","observations","map","value","
|
|
1
|
+
{"version":3,"names":["GUEST_PATIENT_ID","MeasurementTypeKey","seriesObservations","DeviceError","sourceIdsOf","TO_OVOK_UNIT","SERIES_FIELDS","heart_rate","type","heartRate","property","pulse_rate","bloodOxygenPulseRate","spo2","respiration_rate","respiratoryRate","body_temperature","temperature","unsupported","what","isSeriesReading","reading","series","undefined","seriesFieldOf","metric","ownPatientId","session","reference","current","profile","slice","indexOf","seriesObservationsOf","field","start","intervalMs","values","rest","measurementTypeKey","periodMs","saveSeries","client","device","patientId","toOvokUnit","unit","observations","map","value","sn","measurements","saveObservations"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/series-saving.ts"],"mappings":";;AAAA,SAEEA,gBAAgB,EAChBC,kBAAkB,EAGlBC,kBAAkB,QAEb,iBAAiB;AAExB,SAASC,WAAW,QAAQ,mBAAgB;AAI5C,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,YAAY,QAAQ,qBAAkB;;AAI/C;;AAGA;;AAGA;;AAGA,MAAMC,aAAuD,GAAG;EAC9DC,UAAU,EAAE;IAAEC,IAAI,EAAEP,kBAAkB,CAACQ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19
19
|
storage,
|
|
20
|
+
savesFor,
|
|
20
21
|
...overrides
|
|
21
22
|
}) => {
|
|
22
23
|
const outbox = ovokOutboxWatch(ovok.outbox, overrides.logger);
|
|
23
24
|
return new Bluetooth({
|
|
24
25
|
central: blePlxCentral(new BleManager()),
|
|
25
26
|
store: storagePairedDevices(storage),
|
|
26
|
-
sink: ovokReadingSink(ovok),
|
|
27
|
+
sink: ovokReadingSink(ovok, savesFor),
|
|
27
28
|
permissions: osBluetoothPermissions(),
|
|
28
29
|
models: BUILT_IN_MODELS,
|
|
29
30
|
protocols: BUILT_IN_PROTOCOLS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BleManager","androidForegroundService","blePlxCentral","osBluetoothPermissions","ovokOutboxWatch","ovokReadingSink","reactNativeLifecycle","storagePairedDevices","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","createBluetooth","ovok","storage","overrides","outbox","logger","central","store","sink","permissions","models","protocols","lifecycle","keepAlive"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/create-bluetooth.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,sBAAsB;AAEjD,SAASC,wBAAwB,QAAQ,0CAAuC;AAChF,SAASC,aAAa,QAAQ,+BAA4B;
|
|
1
|
+
{"version":3,"names":["BleManager","androidForegroundService","blePlxCentral","osBluetoothPermissions","ovokOutboxWatch","ovokReadingSink","reactNativeLifecycle","storagePairedDevices","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","createBluetooth","ovok","storage","savesFor","overrides","outbox","logger","central","store","sink","permissions","models","protocols","lifecycle","keepAlive"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/create-bluetooth.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,sBAAsB;AAEjD,SAASC,wBAAwB,QAAQ,0CAAuC;AAChF,SAASC,aAAa,QAAQ,+BAA4B;AAE1D,SAASC,sBAAsB,QAAQ,8BAA2B;AAClE,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAAyBC,eAAe,QAAQ,iCAA8B;AAC9E,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAA0B,qBAAkB;AAC9D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,wBAAqB;;AAEzE;;AAaA;AACA,MAAMC,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAEC,QAAQ;EAAE,GAAGC;AAAkC,CAAC,KAAgB;EACxG,MAAMC,MAAM,GAAGZ,eAAe,CAACQ,IAAI,CAACI,MAAM,EAAED,SAAS,CAACE,MAAM,CAAC;EAE7D,OAAO,IAAIT,SAAS,CAAC;IACnBU,OAAO,EAAEhB,aAAa,CAAC,IAAIF,UAAU,CAAC,CAAC,CAAC;IACxCmB,KAAK,EAAEZ,oBAAoB,CAACM,OAAO,CAAC;IACpCO,IAAI,EAAEf,eAAe,CAACO,IAAI,EAAEE,QAAQ,CAAC;IACrCO,WAAW,EAAElB,sBAAsB,CAAC,CAAC;IACrCmB,MAAM,EAAEb,eAAe;IACvBc,SAAS,EAAEb,kBAAkB;IAC7Bc,SAAS,EAAElB,oBAAoB,CAAC,CAAC;IACjCmB,SAAS,EAAExB,wBAAwB,CAAC,CAAC,CAAC,EAAE;MAAEe,MAAM;MAAEC,MAAM,EAAEF,SAAS,CAACE;IAAO,CAAC,CAAC;IAC7ED,MAAM;IACN,GAAGD;EACL,CAAC,CAAC;AACJ,CAAC;AAED,SAASJ,eAAe","ignoreList":[]}
|
|
@@ -21,11 +21,12 @@ const browserBluetooth = () => globalThis.navigator?.bluetooth;
|
|
|
21
21
|
const createWebBluetooth = ({
|
|
22
22
|
ovok,
|
|
23
23
|
storage,
|
|
24
|
+
savesFor,
|
|
24
25
|
...overrides
|
|
25
26
|
}) => new Bluetooth({
|
|
26
27
|
central: webBluetoothCentral(browserBluetooth()),
|
|
27
28
|
store: storagePairedDevices(storage),
|
|
28
|
-
sink: ovokReadingSink(ovok),
|
|
29
|
+
sink: ovokReadingSink(ovok, savesFor),
|
|
29
30
|
outbox: ovokOutboxWatch(ovok.outbox, overrides.logger),
|
|
30
31
|
permissions: chooserPermissions,
|
|
31
32
|
models: BUILT_IN_MODELS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ovokOutboxWatch","ovokReadingSink","storagePairedDevices","webBluetoothCentral","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","chooserPermissions","check","request","openSettings","undefined","browserBluetooth","globalThis","navigator","bluetooth","createWebBluetooth","ovok","storage","overrides","central","store","sink","outbox","logger","permissions","models","protocols","autoSync"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["ovokOutboxWatch","ovokReadingSink","storagePairedDevices","webBluetoothCentral","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","chooserPermissions","check","request","openSettings","undefined","browserBluetooth","globalThis","navigator","bluetooth","createWebBluetooth","ovok","storage","savesFor","overrides","central","store","sink","outbox","logger","permissions","models","protocols","autoSync"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth.ts"],"mappings":";;AAGA,SAASA,eAAe,QAAQ,kCAA+B;AAC/D,SAAyBC,eAAe,QAAQ,kCAA+B;AAC/E,SAASC,oBAAoB,QAAQ,uCAAoC;AACzE,SAAuBC,mBAAmB,QAAQ,sCAAmC;AACrF,SAASC,SAAS,QAA0B,sBAAmB;AAE/D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,yBAAsB;;AAE1E;;AAaA;AACA,MAAMC,kBAAwC,GAAG;EAC/CC,KAAK,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC5BC,OAAO,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC9BC,YAAY,EAAE,MAAAA,CAAA,KAAYC;AAC5B,CAAC;AAED,MAAMC,gBAAgB,GAAGA,CAAA,KACtBC,UAAU,CAAkDC,SAAS,EAAEC,SAAS;;AAEnF;AACA,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAEC,QAAQ;EAAE,GAAGC;AAAqC,CAAC,KAC9F,IAAIhB,SAAS,CAAC;EACZiB,OAAO,EAAElB,mBAAmB,CAACS,gBAAgB,CAAC,CAAC,CAAC;EAChDU,KAAK,EAAEpB,oBAAoB,CAACgB,OAAO,CAAC;EACpCK,IAAI,EAAEtB,eAAe,CAACgB,IAAI,EAAEE,QAAQ,CAAC;EACrCK,MAAM,EAAExB,eAAe,CAACiB,IAAI,CAACO,MAAM,EAAEJ,SAAS,CAACK,MAAM,CAAC;EACtDC,WAAW,EAAEnB,kBAAkB;EAC/BoB,MAAM,EAAEtB,eAAe;EACvBuB,SAAS,EAAEtB,kBAAkB;EAC7BuB,QAAQ,EAAE,KAAK;EACf,GAAGT;AACL,CAAC,CAAC;AAEJ,SAASJ,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names the patient a reading is saved for, when the person measuring isn't the patient (a clinician): read at every
|
|
3
|
+
* save, so it follows whoever is chosen now. `undefined` means nobody is chosen, and the reading is not saved.
|
|
4
|
+
*/
|
|
5
|
+
type SavesFor = () => string | undefined;
|
|
6
|
+
/** The patient `savesFor` names, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
7
|
+
declare const chosenPatientOf: (savesFor: SavesFor | undefined) => string | undefined;
|
|
8
|
+
export { chosenPatientOf };
|
|
9
|
+
export type { SavesFor };
|
|
10
|
+
//# sourceMappingURL=chosen-patient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chosen-patient.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/chosen-patient.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,KAAK,QAAQ,GAAG,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzC,qHAAqH;AACrH,QAAA,MAAM,eAAe,GAAI,UAAU,QAAQ,GAAG,SAAS,KAAG,MAAM,GAAG,SAYlE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -3,7 +3,8 @@ import { Reading } from "../core/reading";
|
|
|
3
3
|
/** What queues the deletions: the outbox, with the measurements API and the session that name what to delete. */
|
|
4
4
|
type SupersessionClient = Pick<Ovok, "measurements" | "outbox" | "session">;
|
|
5
5
|
/** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
|
|
6
|
-
|
|
6
|
+
/** Deletes the live recordings a stored reading replaces, for `patientId` when given, else the signed-in patient or guest. */
|
|
7
|
+
declare const replaceLiveRecordings: (client: SupersessionClient, reading: Reading, patientId?: string) => Promise<void>;
|
|
7
8
|
export { replaceLiveRecordings };
|
|
8
9
|
export type { SupersessionClient };
|
|
9
10
|
//# sourceMappingURL=live-supersession.d.ts.map
|
package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-supersession.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/live-supersession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,IAAI,EAA6B,MAAM,iBAAiB,CAAC;AAItG,OAAO,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKpD,iHAAiH;AACjH,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"live-supersession.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/live-supersession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,IAAI,EAA6B,MAAM,iBAAiB,CAAC;AAItG,OAAO,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKpD,iHAAiH;AACjH,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;AAyB5E,gIAAgI;AAChI,8HAA8H;AAC9H,QAAA,MAAM,qBAAqB,GAAU,QAAQ,kBAAkB,EAAE,SAAS,OAAO,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAcnH,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ReadingSink } from "../core/ports";
|
|
2
|
+
import { SavesFor } from "./chosen-patient";
|
|
2
3
|
import { SupersessionClient } from "./live-supersession";
|
|
3
4
|
/** What the sink saves with: the measurements API, the outbox that deletes, and the session that names the patient. */
|
|
4
5
|
type OvokSinkClient = SupersessionClient;
|
|
5
6
|
/**
|
|
6
|
-
* Saves readings
|
|
7
|
-
* series also saves it; a stored record then removes the live recordings it
|
|
7
|
+
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
8
|
+
* patient `savesFor` names. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
9
|
+
* replaces, once it is saved.
|
|
8
10
|
*/
|
|
9
|
-
declare const ovokReadingSink: (client: OvokSinkClient) => ReadingSink;
|
|
11
|
+
declare const ovokReadingSink: (client: OvokSinkClient, savesFor?: SavesFor) => ReadingSink;
|
|
10
12
|
export { ovokReadingSink };
|
|
11
13
|
export type { OvokSinkClient };
|
|
12
14
|
//# sourceMappingURL=ovok-reading-sink.d.ts.map
|
package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ovok-reading-sink.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ovok-reading-sink.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAmB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAyB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAwIhF,uHAAuH;AACvH,KAAK,cAAc,GAAG,kBAAkB,CAAC;AA6CzC;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,EAAE,WAAW,QAAQ,KAAG,WAsBrE,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reading-values.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/reading-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"reading-values.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/reading-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAS1C,+GAA+G;AAC/G,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAe3D,CAAC;AAEF,QAAA,MAAM,OAAO,GAAI,SAAS,OAAO,EAAE,QAAQ,UAAU,KAAG,MAAM,GAAG,SAA0C,CAAC;AAE5G,iHAAiH;AACjH,QAAA,MAAM,WAAW,GAAI,SAAS,OAAO,EAAE,QAAQ,UAAU,KAAG,MAAM,GAAG,SAIpE,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -21,8 +21,11 @@ declare const ownPatientId: ({ session }: Pick<Ovok, "session">) => Promise<stri
|
|
|
21
21
|
declare const seriesObservationsOf: (field: SeriesField, { start, intervalMs, values }: Pick<Series, "start" | "intervalMs" | "values">, rest: Pick<SeriesObservationParams, "patientId" | "sourceId" | "formerSourceIds"> & {
|
|
22
22
|
device?: MeasurementDevice;
|
|
23
23
|
}) => import("@medplum/fhirtypes").Observation[];
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. It is
|
|
26
|
+
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
27
|
+
*/
|
|
28
|
+
declare const saveSeries: (client: SeriesClient, reading: SeriesReading, device: MeasurementDevice, patientId?: string) => Promise<SaveObservationsResult>;
|
|
26
29
|
export { isSeriesReading, ownPatientId, saveSeries, seriesFieldOf, seriesObservationsOf };
|
|
27
30
|
export type { MeasurementDevice, SeriesClient };
|
|
28
31
|
//# sourceMappingURL=series-saving.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series-saving.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/series-saving.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,IAAI,EACJ,sBAAsB,EAEtB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKlD,KAAK,iBAAiB,GAAG,WAAW,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAExE,2EAA2E;AAC3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For } from "./adapters/chosen-patient";
|
|
2
3
|
import { OvokSinkClient } from "./adapters/ovok-reading-sink";
|
|
3
4
|
import { Bluetooth, BluetoothOptions } from "./core/bluetooth";
|
|
4
5
|
/** What `createBluetooth` needs; every port can be swapped, for tests or a custom store or sink. */
|
|
5
6
|
type CreateBluetoothOptions = {
|
|
6
7
|
/** The Ovok client readings are saved through. */
|
|
7
8
|
ovok: OvokSinkClient;
|
|
9
|
+
/** The patient readings are saved for when the person measuring isn't the patient, such as a clinician; see `SavesFor`. */
|
|
10
|
+
savesFor?: SavesFor;
|
|
8
11
|
/** Where paired devices are kept between app starts. */
|
|
9
12
|
storage: OvokStorage;
|
|
10
13
|
} & Partial<BluetoothOptions>;
|
|
11
14
|
/** Bluetooth for a React Native app, over `react-native-ble-plx`, saving readings to Ovok and syncing in the background. */
|
|
12
|
-
declare const createBluetooth: ({ ovok, storage, ...overrides }: CreateBluetoothOptions) => Bluetooth;
|
|
15
|
+
declare const createBluetooth: ({ ovok, storage, savesFor, ...overrides }: CreateBluetoothOptions) => Bluetooth;
|
|
13
16
|
export { createBluetooth };
|
|
14
17
|
export type { CreateBluetoothOptions };
|
|
15
18
|
//# sourceMappingURL=create-bluetooth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/create-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/create-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAG/E,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,oGAAoG;AACpG,KAAK,sBAAsB,GAAG;IAE5B,kDAAkD;IAClD,IAAI,EAAE,cAAc,CAAC;IAErB,2HAA2H;IAC3H,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9B,4HAA4H;AAC5H,QAAA,MAAM,eAAe,GAAI,2CAA2C,sBAAsB,KAAG,SAe5F,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -11,5 +11,6 @@ export { blePlxCentral } from "./adapters/ble-plx-central";
|
|
|
11
11
|
export { osBluetoothPermissions } from "./adapters/os-permissions";
|
|
12
12
|
export { reactNativeLifecycle } from "./adapters/react-native-lifecycle";
|
|
13
13
|
export { createBluetooth } from "./create-bluetooth";
|
|
14
|
+
export type { SavesFor } from "./adapters/chosen-patient";
|
|
14
15
|
export type { CreateBluetoothOptions } from "./create-bluetooth";
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { OvokStorage } from "@ovok/core/next";
|
|
2
|
+
import { SavesFor } from "../adapters/chosen-patient";
|
|
2
3
|
import { OvokSinkClient } from "../adapters/ovok-reading-sink";
|
|
3
4
|
import { Bluetooth, BluetoothOptions } from "../core/bluetooth";
|
|
4
5
|
/** What `createWebBluetooth` needs; every port can be swapped, for tests or a custom store or sink. */
|
|
5
6
|
type CreateWebBluetoothOptions = {
|
|
6
7
|
/** The Ovok client readings are saved through. */
|
|
7
8
|
ovok: OvokSinkClient;
|
|
9
|
+
/** The patient readings are saved for when the person measuring isn't the patient, such as a clinician; see `SavesFor`. */
|
|
10
|
+
savesFor?: SavesFor;
|
|
8
11
|
/** Where paired devices are kept between visits. */
|
|
9
12
|
storage: OvokStorage;
|
|
10
13
|
} & Partial<BluetoothOptions>;
|
|
11
14
|
/** Bluetooth in a browser, over Web Bluetooth, saving readings to Ovok; loads no React Native module. */
|
|
12
|
-
declare const createWebBluetooth: ({ ovok, storage, ...overrides }: CreateWebBluetoothOptions) => Bluetooth;
|
|
15
|
+
declare const createWebBluetooth: ({ ovok, storage, savesFor, ...overrides }: CreateWebBluetoothOptions) => Bluetooth;
|
|
13
16
|
export { createWebBluetooth };
|
|
14
17
|
export type { CreateWebBluetoothOptions };
|
|
15
18
|
//# sourceMappingURL=create-web-bluetooth.d.ts.map
|
package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-web-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/create-web-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-web-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/create-web-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAmB,MAAM,+BAA+B,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIhE,uGAAuG;AACvG,KAAK,yBAAyB,GAAG;IAE/B,kDAAkD;IAClD,IAAI,EAAE,cAAc,CAAC;IAErB,2HAA2H;IAC3H,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,oDAAoD;IACpD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAY9B,yGAAyG;AACzG,QAAA,MAAM,kBAAkB,GAAI,2CAA2C,yBAAyB,KAAG,SAW/F,CAAC;AAEL,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -8,5 +8,6 @@ export * from "../shared";
|
|
|
8
8
|
export { webBluetoothCentral } from "../adapters/web-bluetooth-central";
|
|
9
9
|
export type { WebBluetooth } from "../adapters/web-bluetooth-central";
|
|
10
10
|
export { createWebBluetooth } from "./create-web-bluetooth";
|
|
11
|
+
export type { SavesFor } from "../adapters/chosen-patient";
|
|
11
12
|
export type { CreateWebBluetoothOptions } from "./create-web-bluetooth";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names the patient a reading is saved for, when the person measuring isn't the patient (a clinician): read at every
|
|
3
|
+
* save, so it follows whoever is chosen now. `undefined` means nobody is chosen, and the reading is not saved.
|
|
4
|
+
*/
|
|
5
|
+
type SavesFor = () => string | undefined;
|
|
6
|
+
/** The patient `savesFor` names, or `undefined` for the signed-in patient or guest; throws when nobody is chosen. */
|
|
7
|
+
declare const chosenPatientOf: (savesFor: SavesFor | undefined) => string | undefined;
|
|
8
|
+
export { chosenPatientOf };
|
|
9
|
+
export type { SavesFor };
|
|
10
|
+
//# sourceMappingURL=chosen-patient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chosen-patient.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/chosen-patient.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,KAAK,QAAQ,GAAG,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzC,qHAAqH;AACrH,QAAA,MAAM,eAAe,GAAI,UAAU,QAAQ,GAAG,SAAS,KAAG,MAAM,GAAG,SAYlE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -3,7 +3,8 @@ import { Reading } from "../core/reading";
|
|
|
3
3
|
/** What queues the deletions: the outbox, with the measurements API and the session that name what to delete. */
|
|
4
4
|
type SupersessionClient = Pick<Ovok, "measurements" | "outbox" | "session">;
|
|
5
5
|
/** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
|
|
6
|
-
|
|
6
|
+
/** Deletes the live recordings a stored reading replaces, for `patientId` when given, else the signed-in patient or guest. */
|
|
7
|
+
declare const replaceLiveRecordings: (client: SupersessionClient, reading: Reading, patientId?: string) => Promise<void>;
|
|
7
8
|
export { replaceLiveRecordings };
|
|
8
9
|
export type { SupersessionClient };
|
|
9
10
|
//# sourceMappingURL=live-supersession.d.ts.map
|
package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-supersession.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/live-supersession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,IAAI,EAA6B,MAAM,iBAAiB,CAAC;AAItG,OAAO,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKpD,iHAAiH;AACjH,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"live-supersession.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/live-supersession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,IAAI,EAA6B,MAAM,iBAAiB,CAAC;AAItG,OAAO,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKpD,iHAAiH;AACjH,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;AAyB5E,gIAAgI;AAChI,8HAA8H;AAC9H,QAAA,MAAM,qBAAqB,GAAU,QAAQ,kBAAkB,EAAE,SAAS,OAAO,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAcnH,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ReadingSink } from "../core/ports";
|
|
2
|
+
import { SavesFor } from "./chosen-patient";
|
|
2
3
|
import { SupersessionClient } from "./live-supersession";
|
|
3
4
|
/** What the sink saves with: the measurements API, the outbox that deletes, and the session that names the patient. */
|
|
4
5
|
type OvokSinkClient = SupersessionClient;
|
|
5
6
|
/**
|
|
6
|
-
* Saves readings
|
|
7
|
-
* series also saves it; a stored record then removes the live recordings it
|
|
7
|
+
* Saves readings through the Ovok measurements API, queueing them offline: for the signed-in account, or for the
|
|
8
|
+
* patient `savesFor` names. A reading with a series also saves it; a stored record then removes the live recordings it
|
|
9
|
+
* replaces, once it is saved.
|
|
8
10
|
*/
|
|
9
|
-
declare const ovokReadingSink: (client: OvokSinkClient) => ReadingSink;
|
|
11
|
+
declare const ovokReadingSink: (client: OvokSinkClient, savesFor?: SavesFor) => ReadingSink;
|
|
10
12
|
export { ovokReadingSink };
|
|
11
13
|
export type { OvokSinkClient };
|
|
12
14
|
//# sourceMappingURL=ovok-reading-sink.d.ts.map
|
package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ovok-reading-sink.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ovok-reading-sink.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAmB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAyB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAwIhF,uHAAuH;AACvH,KAAK,cAAc,GAAG,kBAAkB,CAAC;AA6CzC;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,EAAE,WAAW,QAAQ,KAAG,WAsBrE,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reading-values.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/reading-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"reading-values.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/reading-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAS1C,+GAA+G;AAC/G,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAe3D,CAAC;AAEF,QAAA,MAAM,OAAO,GAAI,SAAS,OAAO,EAAE,QAAQ,UAAU,KAAG,MAAM,GAAG,SAA0C,CAAC;AAE5G,iHAAiH;AACjH,QAAA,MAAM,WAAW,GAAI,SAAS,OAAO,EAAE,QAAQ,UAAU,KAAG,MAAM,GAAG,SAIpE,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -21,8 +21,11 @@ declare const ownPatientId: ({ session }: Pick<Ovok, "session">) => Promise<stri
|
|
|
21
21
|
declare const seriesObservationsOf: (field: SeriesField, { start, intervalMs, values }: Pick<Series, "start" | "intervalMs" | "values">, rest: Pick<SeriesObservationParams, "patientId" | "sourceId" | "formerSourceIds"> & {
|
|
22
22
|
device?: MeasurementDevice;
|
|
23
23
|
}) => import("@medplum/fhirtypes").Observation[];
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. It is
|
|
26
|
+
* saved for `patientId` when given, otherwise for the signed-in patient or the guest.
|
|
27
|
+
*/
|
|
28
|
+
declare const saveSeries: (client: SeriesClient, reading: SeriesReading, device: MeasurementDevice, patientId?: string) => Promise<SaveObservationsResult>;
|
|
26
29
|
export { isSeriesReading, ownPatientId, saveSeries, seriesFieldOf, seriesObservationsOf };
|
|
27
30
|
export type { MeasurementDevice, SeriesClient };
|
|
28
31
|
//# sourceMappingURL=series-saving.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series-saving.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/series-saving.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,IAAI,EACJ,sBAAsB,EAEtB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKlD,KAAK,iBAAiB,GAAG,WAAW,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAExE,2EAA2E;AAC3E,KAAK,YAAY,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC;AAE3D,qCAAqC;AACrC,KAAK,aAAa,GAAG,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD,yFAAyF;AACzF,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAYlE,QAAA,MAAM,eAAe,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,aAA6C,CAAC;AAErG,6FAA6F;AAC7F,QAAA,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,WAAW,GAAG,SAAgD,CAAC;AAEvG,oGAAoG;AACpG,QAAA,MAAM,YAAY,GAAU,aAAa,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,KAAG,OAAO,CAAC,MAAM,CAI9E,CAAC;AAEF,+FAA+F;AAC/F,QAAA,MAAM,oBAAoB,GACxB,OAAO,WAAW,EAClB,+BAA+B,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC,EAC9E,MAAM,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAC,GAAG;IAAE,M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E,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAAE,+CAKhH,CAAC;AAEL;;;GAGG;AACH,QAAA,MAAM,UAAU,GACd,QAAQ,YAAY,EACpB,SAAS,aAAa,EACtB,QAAQ,iBAAiB,EACzB,YAAY,MAAM,KACjB,OAAO,CAAC,sBAAsB,CAgBhC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC;AAC1F,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { OvokStorage } from "@ovok/core/next";
|
|
2
|
+
import { SavesFor } from "./adapters/chosen-patient";
|
|
2
3
|
import { OvokSinkClient } from "./adapters/ovok-reading-sink";
|
|
3
4
|
import { Bluetooth, BluetoothOptions } from "./core/bluetooth";
|
|
4
5
|
/** What `createBluetooth` needs; every port can be swapped, for tests or a custom store or sink. */
|
|
5
6
|
type CreateBluetoothOptions = {
|
|
6
7
|
/** The Ovok client readings are saved through. */
|
|
7
8
|
ovok: OvokSinkClient;
|
|
9
|
+
/** The patient readings are saved for when the person measuring isn't the patient, such as a clinician; see `SavesFor`. */
|
|
10
|
+
savesFor?: SavesFor;
|
|
8
11
|
/** Where paired devices are kept between app starts. */
|
|
9
12
|
storage: OvokStorage;
|
|
10
13
|
} & Partial<BluetoothOptions>;
|
|
11
14
|
/** Bluetooth for a React Native app, over `react-native-ble-plx`, saving readings to Ovok and syncing in the background. */
|
|
12
|
-
declare const createBluetooth: ({ ovok, storage, ...overrides }: CreateBluetoothOptions) => Bluetooth;
|
|
15
|
+
declare const createBluetooth: ({ ovok, storage, savesFor, ...overrides }: CreateBluetoothOptions) => Bluetooth;
|
|
13
16
|
export { createBluetooth };
|
|
14
17
|
export type { CreateBluetoothOptions };
|
|
15
18
|
//# sourceMappingURL=create-bluetooth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/create-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/create-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAG/E,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,oGAAoG;AACpG,KAAK,sBAAsB,GAAG;IAE5B,kDAAkD;IAClD,IAAI,EAAE,cAAc,CAAC;IAErB,2HAA2H;IAC3H,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9B,4HAA4H;AAC5H,QAAA,MAAM,eAAe,GAAI,2CAA2C,sBAAsB,KAAG,SAe5F,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -11,5 +11,6 @@ export { blePlxCentral } from "./adapters/ble-plx-central";
|
|
|
11
11
|
export { osBluetoothPermissions } from "./adapters/os-permissions";
|
|
12
12
|
export { reactNativeLifecycle } from "./adapters/react-native-lifecycle";
|
|
13
13
|
export { createBluetooth } from "./create-bluetooth";
|
|
14
|
+
export type { SavesFor } from "./adapters/chosen-patient";
|
|
14
15
|
export type { CreateBluetoothOptions } from "./create-bluetooth";
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/next/bluetooth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { OvokStorage } from "@ovok/core/next";
|
|
2
|
+
import { SavesFor } from "../adapters/chosen-patient";
|
|
2
3
|
import { OvokSinkClient } from "../adapters/ovok-reading-sink";
|
|
3
4
|
import { Bluetooth, BluetoothOptions } from "../core/bluetooth";
|
|
4
5
|
/** What `createWebBluetooth` needs; every port can be swapped, for tests or a custom store or sink. */
|
|
5
6
|
type CreateWebBluetoothOptions = {
|
|
6
7
|
/** The Ovok client readings are saved through. */
|
|
7
8
|
ovok: OvokSinkClient;
|
|
9
|
+
/** The patient readings are saved for when the person measuring isn't the patient, such as a clinician; see `SavesFor`. */
|
|
10
|
+
savesFor?: SavesFor;
|
|
8
11
|
/** Where paired devices are kept between visits. */
|
|
9
12
|
storage: OvokStorage;
|
|
10
13
|
} & Partial<BluetoothOptions>;
|
|
11
14
|
/** Bluetooth in a browser, over Web Bluetooth, saving readings to Ovok; loads no React Native module. */
|
|
12
|
-
declare const createWebBluetooth: ({ ovok, storage, ...overrides }: CreateWebBluetoothOptions) => Bluetooth;
|
|
15
|
+
declare const createWebBluetooth: ({ ovok, storage, savesFor, ...overrides }: CreateWebBluetoothOptions) => Bluetooth;
|
|
13
16
|
export { createWebBluetooth };
|
|
14
17
|
export type { CreateWebBluetoothOptions };
|
|
15
18
|
//# sourceMappingURL=create-web-bluetooth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-web-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/create-web-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-web-bluetooth.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/create-web-bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAmB,MAAM,+BAA+B,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIhE,uGAAuG;AACvG,KAAK,yBAAyB,GAAG;IAE/B,kDAAkD;IAClD,IAAI,EAAE,cAAc,CAAC;IAErB,2HAA2H;IAC3H,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,oDAAoD;IACpD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAY9B,yGAAyG;AACzG,QAAA,MAAM,kBAAkB,GAAI,2CAA2C,yBAAyB,KAAG,SAW/F,CAAC;AAEL,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -8,5 +8,6 @@ export * from "../shared";
|
|
|
8
8
|
export { webBluetoothCentral } from "../adapters/web-bluetooth-central";
|
|
9
9
|
export type { WebBluetooth } from "../adapters/web-bluetooth-central";
|
|
10
10
|
export { createWebBluetooth } from "./create-web-bluetooth";
|
|
11
|
+
export type { SavesFor } from "../adapters/chosen-patient";
|
|
11
12
|
export type { CreateWebBluetoothOptions } from "./create-web-bluetooth";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/web/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|