@ovok/native 1.17.0-dev.2237 → 1.17.0-dev.2241

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.
Files changed (63) hide show
  1. package/lib/commonjs/modules/next/bluetooth/adapters/chosen-patient.js +25 -0
  2. package/lib/commonjs/modules/next/bluetooth/adapters/chosen-patient.js.map +1 -0
  3. package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js +10 -5
  4. package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js.map +1 -1
  5. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js +7 -1
  6. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -1
  7. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js +14 -8
  8. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
  9. package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js +12 -15
  10. package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js.map +1 -1
  11. package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js +2 -1
  12. package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js.map +1 -1
  13. package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js +2 -1
  14. package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
  15. package/lib/module/modules/next/bluetooth/adapters/chosen-patient.js +22 -0
  16. package/lib/module/modules/next/bluetooth/adapters/chosen-patient.js.map +1 -0
  17. package/lib/module/modules/next/bluetooth/adapters/live-supersession.js +11 -6
  18. package/lib/module/modules/next/bluetooth/adapters/live-supersession.js.map +1 -1
  19. package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js +7 -1
  20. package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -1
  21. package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js +14 -8
  22. package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
  23. package/lib/module/modules/next/bluetooth/adapters/series-saving.js +12 -15
  24. package/lib/module/modules/next/bluetooth/adapters/series-saving.js.map +1 -1
  25. package/lib/module/modules/next/bluetooth/create-bluetooth.js +2 -1
  26. package/lib/module/modules/next/bluetooth/create-bluetooth.js.map +1 -1
  27. package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js +2 -1
  28. package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
  29. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/chosen-patient.d.ts +10 -0
  30. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/chosen-patient.d.ts.map +1 -0
  31. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts +2 -1
  32. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +5 -3
  35. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts +8 -5
  37. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts +4 -1
  39. package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +1 -0
  41. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +4 -1
  43. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
  45. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  46. package/lib/typescript/module/src/modules/next/bluetooth/adapters/chosen-patient.d.ts +10 -0
  47. package/lib/typescript/module/src/modules/next/bluetooth/adapters/chosen-patient.d.ts.map +1 -0
  48. package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts +2 -1
  49. package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -1
  50. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -1
  51. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +5 -3
  52. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
  53. package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts +8 -5
  54. package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -1
  55. package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts +4 -1
  56. package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
  57. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +1 -0
  58. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  59. package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +4 -1
  60. package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
  61. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
  62. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  63. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { MeasurementTypeKey, seriesObservations } from "@ovok/core/next";
3
+ import { GUEST_PATIENT_ID, MeasurementTypeKey, seriesObservations } from "@ovok/core/next";
4
4
  import { DeviceError } from "../core/errors.js";
5
5
  import { sourceIdsOf } from "./reading-source-id.js";
6
6
  import { TO_OVOK_UNIT } from "./reading-values.js";
@@ -39,18 +39,12 @@ const isSeriesReading = reading => reading.series !== undefined;
39
39
  /** The field Ovok keeps a metric's series in; `undefined` for a metric it keeps none for. */
40
40
  const seriesFieldOf = metric => SERIES_FIELDS[metric];
41
41
 
42
- /** The id of the signed-in patient, which a series is saved for. */
43
- const signedInPatientId = async ({
42
+ /** The patient a series is saved for: the signed-in one, or the guest while nobody is signed in. */
43
+ const ownPatientId = async ({
44
44
  session
45
45
  }) => {
46
- const current = await session.current();
47
- if (!current) {
48
- throw new DeviceError("save-failed", "Sign in to save a series");
49
- }
50
- const {
51
- reference
52
- } = current.profile;
53
- return reference.slice(reference.indexOf("/") + 1);
46
+ const reference = (await session.current())?.profile.reference;
47
+ return reference ? reference.slice(reference.indexOf("/") + 1) : GUEST_PATIENT_ID;
54
48
  };
55
49
 
56
50
  /** The observations that hold one metric's values, one per second or at the interval given. */
@@ -70,8 +64,11 @@ const seriesObservationsOf = (field, {
70
64
  ...rest
71
65
  });
72
66
 
73
- /** Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. */
74
- const saveSeries = async (client, reading, device) => {
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) => {
75
72
  const {
76
73
  series
77
74
  } = reading;
@@ -84,11 +81,11 @@ const saveSeries = async (client, reading, device) => {
84
81
  ...series,
85
82
  values: series.values.map(value => value === null ? null : toOvokUnit(value))
86
83
  }, {
87
- patientId: await signedInPatientId(client),
84
+ patientId: patientId ?? (await ownPatientId(client)),
88
85
  ...sourceIdsOf(reading, device.sn),
89
86
  device
90
87
  });
91
88
  return client.measurements.saveObservations(observations);
92
89
  };
93
- export { isSeriesReading, saveSeries, seriesFieldOf, seriesObservationsOf, signedInPatientId };
90
+ export { isSeriesReading, ownPatientId, saveSeries, seriesFieldOf, seriesObservationsOf };
94
91
  //# sourceMappingURL=series-saving.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["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","signedInPatientId","session","current","reference","profile","slice","indexOf","seriesObservationsOf","field","start","intervalMs","values","rest","measurementTypeKey","periodMs","saveSeries","client","device","toOvokUnit","unit","observations","map","value","patientId","sn","measurements","saveObservations"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/series-saving.ts"],"mappings":";;AAAA,SAAkCA,kBAAkB,EAAgCC,kBAAkB,QAAiC,iBAAiB;AAExJ,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,SAAS;IAAEC,QAAQ,EAAE;EAAY,CAAC;EACzEC,UAAU,EAAE;IAAEH,IAAI,EAAEP,kBAAkB,CAACW,oBAAoB;IAAEF,QAAQ,EAAE;EAAY,CAAC;EACpFG,IAAI,EAAE;IAAEL,IAAI,EAAEP,kBAAkB,CAACW,oBAAoB;IAAEF,QAAQ,EAAE;EAAc,CAAC;EAChFI,gBAAgB,EAAE;IAAEN,IAAI,EAAEP,kBAAkB,CAACc,eAAe;IAAEL,QAAQ,EAAE;EAAkB,CAAC;EAC3FM,gBAAgB,EAAE;IAAER,IAAI,EAAEP,kBAAkB,CAACgB,WAAW;IAAEP,QAAQ,EAAE;EAAW;AACjF,CAAC;AAED,MAAMQ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iB,MAAM,CAACuB,IAAI,CAAC;EAE5C,IAAI,CAACX,KAAK,IAAI,CAACU,UAAU,EAAE;IACzB,MAAM1B,WAAW,CAAC,GAAGI,MAAM,CAACG,MAAM,OAAOH,MAAM,CAACuB,IAAI,EAAE,CAAC;EACzD;EAEA,MAAMC,YAAY,GAAGb,oBAAoB,CACvCC,KAAK,EACL;IAAE,GAAGZ,MAAM;IAAEe,MAAM,EAAEf,MAAM,CAACe,MAAM,CAACU,GAAG,CAAEC,KAAK,IAAMA,KAAK,KAAK,IAAI,GAAG,IAAI,GAAGJ,UAAU,CAACI,KAAK,CAAE;EAAE,CAAC,EAChG;IAAEC,SAAS,EAAE,MAAMvB,iBAAiB,CAACgB,MAAM,CAAC;IAAE,GAAGtC,WAAW,CAACiB,OAAO,EAAEsB,MAAM,CAACO,EAAE,CAAC;IAAEP;EAAO,CAC3F,CAAC;EAED,OAAOD,MAAM,CAACS,YAAY,CAACC,gBAAgB,CAACN,YAAY,CAAC;AAC3D,CAAC;AAED,SAAS1B,eAAe,EAAEqB,UAAU,EAAEjB,aAAa,EAAES,oBAAoB,EAAEP,iBAAiB","ignoreList":[]}
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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,UAAU,EAAEjB,aAAa,EAAES,oBAAoB","ignoreList":[]}
@@ -17,13 +17,14 @@ import { BUILT_IN_MODELS, BUILT_IN_PROTOCOLS } from "./families/built-in.js";
17
17
  const createBluetooth = ({
18
18
  ovok,
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;AAC1D,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;;AAUA;AACA,MAAMC,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAE,GAAGC;AAAkC,CAAC,KAAgB;EAC9F,MAAMC,MAAM,GAAGX,eAAe,CAACQ,IAAI,CAACG,MAAM,EAAED,SAAS,CAACE,MAAM,CAAC;EAE7D,OAAO,IAAIR,SAAS,CAAC;IACnBS,OAAO,EAAEf,aAAa,CAAC,IAAIF,UAAU,CAAC,CAAC,CAAC;IACxCkB,KAAK,EAAEX,oBAAoB,CAACM,OAAO,CAAC;IACpCM,IAAI,EAAEd,eAAe,CAACO,IAAI,CAAC;IAC3BQ,WAAW,EAAEjB,sBAAsB,CAAC,CAAC;IACrCkB,MAAM,EAAEZ,eAAe;IACvBa,SAAS,EAAEZ,kBAAkB;IAC7Ba,SAAS,EAAEjB,oBAAoB,CAAC,CAAC;IACjCkB,SAAS,EAAEvB,wBAAwB,CAAC,CAAC,CAAC,EAAE;MAAEc,MAAM;MAAEC,MAAM,EAAEF,SAAS,CAACE;IAAO,CAAC,CAAC;IAC7ED,MAAM;IACN,GAAGD;EACL,CAAC,CAAC;AACJ,CAAC;AAED,SAASH,eAAe","ignoreList":[]}
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":";;AAEA,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;;AAUA;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;EAAE,GAAGC;AAAqC,CAAC,KACpF,IAAIf,SAAS,CAAC;EACZgB,OAAO,EAAEjB,mBAAmB,CAACS,gBAAgB,CAAC,CAAC,CAAC;EAChDS,KAAK,EAAEnB,oBAAoB,CAACgB,OAAO,CAAC;EACpCI,IAAI,EAAErB,eAAe,CAACgB,IAAI,CAAC;EAC3BM,MAAM,EAAEvB,eAAe,CAACiB,IAAI,CAACM,MAAM,EAAEJ,SAAS,CAACK,MAAM,CAAC;EACtDC,WAAW,EAAElB,kBAAkB;EAC/BmB,MAAM,EAAErB,eAAe;EACvBsB,SAAS,EAAErB,kBAAkB;EAC7BsB,QAAQ,EAAE,KAAK;EACf,GAAGT;AACL,CAAC,CAAC;AAEJ,SAASH,kBAAkB","ignoreList":[]}
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
- declare const replaceLiveRecordings: (client: SupersessionClient, reading: Reading) => Promise<void>;
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
@@ -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;AA0B5E,gIAAgI;AAChI,QAAA,MAAM,qBAAqB,GAAU,QAAQ,kBAAkB,EAAE,SAAS,OAAO,KAAG,OAAO,CAAC,IAAI,CAM/F,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,kBAAkB,EAAE,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 +1 @@
1
- {"version":3,"file":"ovok-outbox-watch.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,cAAc,EAA+B,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC;AAalF,iHAAiH;AACjH,QAAA,MAAM,eAAe,GAAI,QAAQ,aAAa,EAAE,SAAQ,MAAqB,KAAG,WAwB9E,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"ovok-outbox-watch.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAqB,cAAc,EAA+B,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC;AAiBlF,iHAAiH;AACjH,QAAA,MAAM,eAAe,GAAI,QAAQ,aAAa,EAAE,SAAQ,MAAqB,KAAG,WAwB9E,CAAC;AAEH,OAAO,EAAE,eAAe,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 for the signed-in account through the Ovok measurements API, queueing them offline. A reading with a
7
- * series also saves it; a stored record then removes the live recordings it replaces, once it is saved.
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
@@ -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;AAI5C,OAAO,EAAyB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAwIhF,uHAAuH;AACvH,KAAK,cAAc,GAAG,kBAAkB,CAAC;AAuCzC;;;GAGG;AACH,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,KAAG,WAqBhD,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,cAAc,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"}
@@ -15,14 +15,17 @@ type SeriesField = {
15
15
  declare const isSeriesReading: (reading: Reading) => reading is SeriesReading;
16
16
  /** The field Ovok keeps a metric's series in; `undefined` for a metric it keeps none for. */
17
17
  declare const seriesFieldOf: (metric: string) => SeriesField | undefined;
18
- /** The id of the signed-in patient, which a series is saved for. */
19
- declare const signedInPatientId: ({ session }: Pick<Ovok, "session">) => Promise<string>;
18
+ /** The patient a series is saved for: the signed-in one, or the guest while nobody is signed in. */
19
+ declare const ownPatientId: ({ session }: Pick<Ovok, "session">) => Promise<string>;
20
20
  /** The observations that hold one metric's values, one per second or at the interval given. */
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
- /** Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. */
25
- declare const saveSeries: (client: SeriesClient, reading: SeriesReading, device: MeasurementDevice) => Promise<SaveObservationsResult>;
26
- export { isSeriesReading, saveSeries, seriesFieldOf, seriesObservationsOf, signedInPatientId };
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>;
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,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,IAAI,EAAE,sBAAsB,EAAsB,uBAAuB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GAAG,iBAAiB,CAAC,GAAG;IAAE,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;AAO9C,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,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9B,4HAA4H;AAC5H,QAAA,MAAM,eAAe,GAAI,iCAAiC,sBAAsB,KAAG,SAelF,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,sBAAsB,EAAE,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;AAG9C,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,oDAAoD;IACpD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAY9B,yGAAyG;AACzG,QAAA,MAAM,kBAAkB,GAAI,iCAAiC,yBAAyB,KAAG,SAWrF,CAAC;AAEL,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,yBAAyB,EAAE,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
- declare const replaceLiveRecordings: (client: SupersessionClient, reading: Reading) => Promise<void>;
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
@@ -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;AA0B5E,gIAAgI;AAChI,QAAA,MAAM,qBAAqB,GAAU,QAAQ,kBAAkB,EAAE,SAAS,OAAO,KAAG,OAAO,CAAC,IAAI,CAM/F,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,kBAAkB,EAAE,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 +1 @@
1
- {"version":3,"file":"ovok-outbox-watch.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,cAAc,EAA+B,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC;AAalF,iHAAiH;AACjH,QAAA,MAAM,eAAe,GAAI,QAAQ,aAAa,EAAE,SAAQ,MAAqB,KAAG,WAwB9E,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"ovok-outbox-watch.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAqB,cAAc,EAA+B,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC;AAiBlF,iHAAiH;AACjH,QAAA,MAAM,eAAe,GAAI,QAAQ,aAAa,EAAE,SAAQ,MAAqB,KAAG,WAwB9E,CAAC;AAEH,OAAO,EAAE,eAAe,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 for the signed-in account through the Ovok measurements API, queueing them offline. A reading with a
7
- * series also saves it; a stored record then removes the live recordings it replaces, once it is saved.
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
@@ -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;AAI5C,OAAO,EAAyB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAwIhF,uHAAuH;AACvH,KAAK,cAAc,GAAG,kBAAkB,CAAC;AAuCzC;;;GAGG;AACH,QAAA,MAAM,eAAe,GAAI,QAAQ,cAAc,KAAG,WAqBhD,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,cAAc,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"}
@@ -15,14 +15,17 @@ type SeriesField = {
15
15
  declare const isSeriesReading: (reading: Reading) => reading is SeriesReading;
16
16
  /** The field Ovok keeps a metric's series in; `undefined` for a metric it keeps none for. */
17
17
  declare const seriesFieldOf: (metric: string) => SeriesField | undefined;
18
- /** The id of the signed-in patient, which a series is saved for. */
19
- declare const signedInPatientId: ({ session }: Pick<Ovok, "session">) => Promise<string>;
18
+ /** The patient a series is saved for: the signed-in one, or the guest while nobody is signed in. */
19
+ declare const ownPatientId: ({ session }: Pick<Ovok, "session">) => Promise<string>;
20
20
  /** The observations that hold one metric's values, one per second or at the interval given. */
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
- /** Saves a series, in Ovok's unit, under a stable id; saving a longer version of it writes over the earlier one. */
25
- declare const saveSeries: (client: SeriesClient, reading: SeriesReading, device: MeasurementDevice) => Promise<SaveObservationsResult>;
26
- export { isSeriesReading, saveSeries, seriesFieldOf, seriesObservationsOf, signedInPatientId };
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>;
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,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,IAAI,EAAE,sBAAsB,EAAsB,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAIzJ,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,oEAAoE;AACpE,Q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AAW,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,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;AAO9C,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,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9B,4HAA4H;AAC5H,QAAA,MAAM,eAAe,GAAI,iCAAiC,sBAAsB,KAAG,SAelF,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,sBAAsB,EAAE,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;AAG9C,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,oDAAoD;IACpD,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAY9B,yGAAyG;AACzG,QAAA,MAAM,kBAAkB,GAAI,iCAAiC,yBAAyB,KAAG,SAWrF,CAAC;AAEL,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,yBAAyB,EAAE,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/native",
3
- "version": "1.17.0-dev.2237+4bde67c",
3
+ "version": "1.17.0-dev.2241+cceba86",
4
4
  "description": "React native component sdk for OVOK",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -105,7 +105,7 @@
105
105
  "@medplum/react-hooks": "3.2.23",
106
106
  "@opentelemetry/api": "^1.9.1",
107
107
  "@opentelemetry/api-logs": "^0.222.0",
108
- "@ovok/core": "^0.4.52",
108
+ "@ovok/core": "^0.4.55",
109
109
  "@react-native-community/datetimepicker": "^9.1.0",
110
110
  "@react-native-community/netinfo": "^12.0.1",
111
111
  "@react-native-google-signin/google-signin": "^16.1.2",
@@ -190,7 +190,7 @@
190
190
  "@kingstinct/react-native-healthkit": ">=16.2.0",
191
191
  "@opentelemetry/api": "^1.9.1",
192
192
  "@opentelemetry/api-logs": "^0.222.0",
193
- "@ovok/core": ">=0.4.52 || >=0.4.49-0",
193
+ "@ovok/core": ">=0.4.55 || >=0.4.49-0",
194
194
  "@react-native-community/datetimepicker": "*",
195
195
  "@react-native-community/netinfo": "*",
196
196
  "@react-native-google-signin/google-signin": "*",