@ovok/core 0.4.37 → 0.4.39

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 (99) hide show
  1. package/dist/client/auth/account-storage.d.ts +1 -0
  2. package/dist/client/auth/account-storage.js +2 -1
  3. package/dist/{utils → client}/auth/exchange-code.d.ts +1 -1
  4. package/dist/{utils → client}/auth/generate-code-challenge-and-verifier.js +5 -17
  5. package/dist/{utils → client}/auth/handle-tenant-code.d.ts +1 -1
  6. package/dist/{utils → client}/auth/handle-tenant-code.js +1 -1
  7. package/dist/client/auth/methods/appleLogin.js +2 -6
  8. package/dist/client/auth/methods/changePassword.js +2 -1
  9. package/dist/client/auth/methods/getSessions.js +2 -1
  10. package/dist/client/auth/methods/googleLogin.js +2 -6
  11. package/dist/client/auth/methods/login.js +26 -44
  12. package/dist/client/auth/methods/logout.js +2 -1
  13. package/dist/client/auth/methods/requestDeleteUser.js +5 -4
  14. package/dist/client/auth/methods/revokeSessions.js +2 -1
  15. package/dist/client/auth/methods/socialLogin.d.ts +7 -0
  16. package/dist/client/auth/methods/socialLogin.js +11 -0
  17. package/dist/client/auth/session-fetch.js +10 -12
  18. package/dist/client/auth/session-http.js +8 -19
  19. package/dist/client/auth/sha256.d.ts +2 -0
  20. package/dist/client/auth/sha256.js +65 -0
  21. package/dist/{utils → client}/auth/start-login.d.ts +2 -2
  22. package/dist/client/change-history/methods.js +2 -1
  23. package/dist/client/cms/methods.js +16 -28
  24. package/dist/client/consent/methods.js +3 -2
  25. package/dist/client/email/methods.js +2 -1
  26. package/dist/client/errors/ovok-error-utils.d.ts +6 -0
  27. package/dist/client/errors/ovok-error-utils.js +10 -1
  28. package/dist/client/errors/ovok-error.js +6 -13
  29. package/dist/client/errors/rate-limit-error.js +2 -6
  30. package/dist/client/experience/methods.js +13 -12
  31. package/dist/client/invites/methods.js +8 -12
  32. package/dist/client/notifications/methods.js +4 -3
  33. package/dist/client/observation/fhir-systems.d.ts +4 -0
  34. package/dist/client/observation/fhir-systems.js +7 -0
  35. package/dist/client/observation/methods/generateObservationBodiesByMeasurement.js +23 -29
  36. package/dist/client/observation/methods/getLatestObservationsByCodes.js +6 -9
  37. package/dist/client/observation/methods/observationsToMeasurements.js +44 -91
  38. package/dist/client/observation/services/base-observation-service.js +4 -3
  39. package/dist/client/observation/services/blood-pressure.js +1 -4
  40. package/dist/client/observation/services/{baby-sleep.d.ts → component-observation-services.d.ts} +18 -13
  41. package/dist/client/observation/services/component-observation-services.js +69 -0
  42. package/dist/client/observation/services/creator.d.ts +1 -2
  43. package/dist/client/observation/services/creator.js +14 -18
  44. package/dist/client/observation/services/ecg-observation-fragments.js +5 -6
  45. package/dist/client/observation/services/ecg.js +3 -2
  46. package/dist/client/observation/services/lipid-panel.js +8 -12
  47. package/dist/client/observation/services/measurement-time.d.ts +4 -0
  48. package/dist/client/observation/services/measurement-time.js +6 -0
  49. package/dist/client/observation/services/single-value-services.d.ts +5 -0
  50. package/dist/client/observation/services/single-value-services.js +6 -1
  51. package/dist/client/observation/services/uric-acid-service.js +6 -7
  52. package/dist/client/observation/types/generate-measurement/HealthConnectTypes.d.ts +2 -458
  53. package/dist/client/observation/types/generate-measurement/HealthConnectTypes.js +0 -6
  54. package/dist/client/offline/offline-measurement-queue.js +31 -28
  55. package/dist/client/ovok-client.d.ts +13 -2
  56. package/dist/client/ovok-client.js +95 -45
  57. package/dist/client/patient/methods.js +25 -25
  58. package/dist/client/patient-sharing/methods.js +4 -3
  59. package/dist/client/platform/methods.js +17 -16
  60. package/dist/client/platform/types.d.ts +3 -6
  61. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +2 -1
  62. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +2 -1
  63. package/dist/client/request-options.d.ts +2 -0
  64. package/dist/client/request-options.js +6 -0
  65. package/dist/client/signals/errors.js +2 -6
  66. package/dist/client/signals/methods.js +14 -13
  67. package/dist/client/slim/live-read.d.ts +4 -0
  68. package/dist/client/slim/live-read.js +87 -0
  69. package/dist/client/slim/methods.d.ts +3 -0
  70. package/dist/client/slim/methods.js +63 -146
  71. package/dist/client/storage.js +3 -2
  72. package/dist/conformance/capability-requirements.js +1 -1
  73. package/dist/conformance/capability.js +8 -7
  74. package/dist/hooks/account-hooks.js +1 -1
  75. package/dist/hooks/api-hooks.d.ts +5 -6
  76. package/dist/hooks/api-hooks.js +10 -24
  77. package/dist/hooks/cms-hooks.js +8 -13
  78. package/dist/hooks/experience-hooks.js +1 -1
  79. package/dist/hooks/index.d.ts +2 -2
  80. package/dist/hooks/index.js +4 -4
  81. package/dist/hooks/invites-hooks.js +0 -1
  82. package/dist/hooks/notification-hooks.d.ts +4 -1
  83. package/dist/hooks/notification-hooks.js +28 -35
  84. package/dist/hooks/notification-invalidation.d.ts +1 -1
  85. package/dist/hooks/notification-note-hooks.js +13 -28
  86. package/dist/hooks/observation-hooks.js +2 -4
  87. package/dist/hooks/patient-hooks.js +1 -1
  88. package/dist/hooks/patient-sharing-hooks.js +1 -2
  89. package/dist/hooks/poll-hooks.js +10 -8
  90. package/dist/hooks/signals-alert-hooks.js +4 -6
  91. package/package.json +1 -1
  92. package/dist/client/observation/services/baby-sleep.js +0 -69
  93. package/dist/client/observation/services/respiratory-therapy.d.ts +0 -28
  94. package/dist/client/observation/services/respiratory-therapy.js +0 -69
  95. package/dist/utils/auth/sha256.d.ts +0 -8
  96. package/dist/utils/auth/sha256.js +0 -300
  97. /package/dist/{utils → client}/auth/exchange-code.js +0 -0
  98. /package/dist/{utils → client}/auth/generate-code-challenge-and-verifier.d.ts +0 -0
  99. /package/dist/{utils → client}/auth/start-login.js +0 -0
@@ -78,106 +78,24 @@ exports.inviteSlimPractitioner = inviteSlimPractitioner;
78
78
  exports.deleteSlimUser = deleteSlimUser;
79
79
  exports.getSlimHealth = getSlimHealth;
80
80
  const query_string_1 = require("../query-string");
81
- const inFlightLiveReads = new Map();
82
- const dedupeLiveRead = (client, path, load, options) => {
83
- var _a, _b, _c, _d, _e, _f, _g;
84
- const signal = (_a = options === null || options === void 0 ? void 0 : options.signal) !== null && _a !== void 0 ? _a : undefined;
85
- const canShare = Object.keys(options !== null && options !== void 0 ? options : {}).every((key) => key === "signal" || key === "cache");
86
- if (!canShare) {
87
- return load(signal);
88
- }
89
- if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
90
- return Promise.reject((_b = signal.reason) !== null && _b !== void 0 ? _b : abortError());
91
- }
92
- const login = client.getActiveLogin();
93
- const key = [
94
- client.getBaseUrl(),
95
- (_d = (_c = login === null || login === void 0 ? void 0 : login.profile) === null || _c === void 0 ? void 0 : _c.reference) !== null && _d !== void 0 ? _d : "",
96
- (_f = (_e = login === null || login === void 0 ? void 0 : login.project) === null || _e === void 0 ? void 0 : _e.reference) !== null && _f !== void 0 ? _f : "",
97
- (_g = options === null || options === void 0 ? void 0 : options.cache) !== null && _g !== void 0 ? _g : "reload",
98
- path,
99
- ].join("\0");
100
- let inFlight = inFlightLiveReads.get(key);
101
- if (!inFlight) {
102
- const controller = new AbortController();
103
- const sharedRead = {
104
- controller,
105
- promise: Promise.resolve(),
106
- subscribers: 0,
107
- settled: false,
108
- };
109
- let request;
110
- try {
111
- request = load(signal ? controller.signal : undefined);
112
- }
113
- catch (error) {
114
- request = Promise.reject(error);
115
- }
116
- sharedRead.promise = request.finally(() => {
117
- if (inFlightLiveReads.get(key) === sharedRead) {
118
- inFlightLiveReads.delete(key);
119
- }
120
- sharedRead.settled = true;
121
- });
122
- inFlight = sharedRead;
123
- inFlightLiveReads.set(key, sharedRead);
124
- void sharedRead.promise.catch(() => undefined);
125
- }
126
- const shared = inFlight;
127
- return new Promise((resolve, reject) => {
128
- let active = true;
129
- shared.subscribers += 1;
130
- const release = () => {
131
- if (!active) {
132
- return false;
133
- }
134
- active = false;
135
- signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
136
- shared.subscribers -= 1;
137
- if (!shared.settled && shared.subscribers === 0) {
138
- shared.controller.abort();
139
- }
140
- return true;
141
- };
142
- const onAbort = () => {
143
- var _a;
144
- if (release()) {
145
- reject((_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : abortError());
146
- }
147
- };
148
- signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
149
- shared.promise.then((value) => {
150
- if (release()) {
151
- resolve(value);
152
- }
153
- }, (error) => {
154
- if (release()) {
155
- reject(error);
156
- }
157
- });
158
- });
159
- };
160
- const abortError = () => {
161
- const error = new Error("The request was aborted.");
162
- error.name = "AbortError";
163
- return error;
164
- };
81
+ const request_options_1 = require("../request-options");
82
+ const live_read_1 = require("./live-read");
165
83
  const validateLiveCount = (params) => {
166
84
  if (params.count !== undefined && (!Number.isInteger(params.count) || params.count < 1 || params.count > 100)) {
167
85
  throw new RangeError("count must be an integer from 1 to 100.");
168
86
  }
169
87
  };
170
88
  async function listSlimPatients(params = {}, requestOptions) {
171
- return this.get(`/v1/slim/patient${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
89
+ return this.get(`/v1/slim/patient${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
172
90
  }
173
91
  async function getSlimPatient(patientId, requestOptions) {
174
- return this.get(`/v1/slim/patient/${encodeURIComponent(patientId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
92
+ return this.get(`/v1/slim/patient/${encodeURIComponent(patientId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
175
93
  }
176
94
  async function getSlimPatientEverything(patientId, requestOptions) {
177
- return this.get(`/v1/slim/patient/${encodeURIComponent(patientId)}/$everything`, ...(requestOptions === undefined ? [] : [requestOptions]));
95
+ return this.get(`/v1/slim/patient/${encodeURIComponent(patientId)}/$everything`, ...(0, request_options_1.optionalArg)(requestOptions));
178
96
  }
179
97
  async function getSlimPatientCurrentVitals(patientId, requestOptions) {
180
- return this.get(`/v1/slim/patient/${encodeURIComponent(patientId)}/current-vitals`, ...(requestOptions === undefined ? [] : [requestOptions]));
98
+ return this.get(`/v1/slim/patient/${encodeURIComponent(patientId)}/current-vitals`, ...(0, request_options_1.optionalArg)(requestOptions));
181
99
  }
182
100
  async function createSlimPatient(body, requestOptions) {
183
101
  return this.post("/v1/slim/patient", body, undefined, requestOptions);
@@ -186,13 +104,13 @@ async function updateSlimPatient(patientId, body, requestOptions) {
186
104
  return (await this.put(`/v1/slim/patient/${encodeURIComponent(patientId)}`, body, undefined, requestOptions));
187
105
  }
188
106
  async function deleteSlimPatient(patientId, requestOptions) {
189
- await this.delete(`/v1/slim/patient/${encodeURIComponent(patientId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
107
+ await this.delete(`/v1/slim/patient/${encodeURIComponent(patientId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
190
108
  }
191
109
  async function listSlimDevices(params = {}, requestOptions) {
192
- return this.get(`/v1/slim/device${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
110
+ return this.get(`/v1/slim/device${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
193
111
  }
194
112
  async function getSlimDevice(deviceId, requestOptions) {
195
- return this.get(`/v1/slim/device/${encodeURIComponent(deviceId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
113
+ return this.get(`/v1/slim/device/${encodeURIComponent(deviceId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
196
114
  }
197
115
  async function createSlimDevice(body, requestOptions) {
198
116
  return this.post("/v1/slim/device", body, undefined, requestOptions);
@@ -201,72 +119,70 @@ async function updateSlimDevice(deviceId, body, requestOptions) {
201
119
  return (await this.put(`/v1/slim/device/${encodeURIComponent(deviceId)}`, body, undefined, requestOptions));
202
120
  }
203
121
  async function deleteSlimDevice(deviceId, requestOptions) {
204
- await this.delete(`/v1/slim/device/${encodeURIComponent(deviceId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
122
+ await this.delete(`/v1/slim/device/${encodeURIComponent(deviceId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
205
123
  }
206
124
  async function assignSlimDeviceToProject(body, requestOptions) {
207
125
  return (await this.put("/v1/slim/device/assign/project", body, undefined, requestOptions));
208
126
  }
209
127
  async function listSlimLiveDevices(params = {}, requestOptions) {
210
128
  validateLiveCount(params);
211
- const path = `/v1/slim/device/live${(0, query_string_1.toQueryString)(params)}`;
212
- return dedupeLiveRead(this, path, (signal) => this.get(path, { cache: "reload", ...requestOptions, ...(signal ? { signal } : {}) }), requestOptions);
129
+ return (0, live_read_1.liveGet)(this, `/v1/slim/device/live${(0, query_string_1.toQueryString)(params)}`, requestOptions);
213
130
  }
214
131
  async function listSlimLiveTelemetry(params = {}, requestOptions) {
215
132
  validateLiveCount(params);
216
- const path = `/v1/slim/device/live/telemetry${(0, query_string_1.toQueryString)(params)}`;
217
- return dedupeLiveRead(this, path, (signal) => this.get(path, { cache: "reload", ...requestOptions, ...(signal ? { signal } : {}) }), requestOptions);
133
+ return (0, live_read_1.liveGet)(this, `/v1/slim/device/live/telemetry${(0, query_string_1.toQueryString)(params)}`, requestOptions);
218
134
  }
219
135
  async function getSlimDeviceSleepStatus(deviceId, requestOptions) {
220
- const path = `/v1/slim/device/live/cloudwatch/${encodeURIComponent(deviceId)}`;
221
- return dedupeLiveRead(this, path, (signal) => this.get(path, { cache: "reload", ...requestOptions, ...(signal ? { signal } : {}) }), requestOptions);
136
+ return (0, live_read_1.liveGet)(this, `/v1/slim/device/live/cloudwatch/${encodeURIComponent(deviceId)}`, requestOptions);
222
137
  }
223
138
  async function getSlimDeviceTelemetry(deviceId, requestOptions) {
224
- const path = `/v1/slim/telemetry/${encodeURIComponent(deviceId)}`;
225
- return dedupeLiveRead(this, path, (signal) => this.get(path, { cache: "reload", ...requestOptions, ...(signal ? { signal } : {}) }), requestOptions);
139
+ return (0, live_read_1.liveGet)(this, `/v1/slim/telemetry/${encodeURIComponent(deviceId)}`, requestOptions);
226
140
  }
227
141
  async function listSlimEffectiveObservationIds(requestOptions) {
228
- return this.get("/v1/slim/telemetry/effectiveIds", ...(requestOptions === undefined ? [] : [requestOptions]));
142
+ return this.get("/v1/slim/telemetry/effectiveIds", ...(0, request_options_1.optionalArg)(requestOptions));
229
143
  }
230
144
  async function listSlimLastObservationIds(requestOptions) {
231
- return this.get("/v1/slim/telemetry/lastIds", ...(requestOptions === undefined ? [] : [requestOptions]));
145
+ return this.get("/v1/slim/telemetry/lastIds", ...(0, request_options_1.optionalArg)(requestOptions));
232
146
  }
233
147
  async function getSlimDeviceEffectiveObservationIds(deviceId, requestOptions) {
234
- return this.get(`/v1/slim/telemetry/${encodeURIComponent(deviceId)}/effectiveIds`, ...(requestOptions === undefined ? [] : [requestOptions]));
148
+ return this.get(`/v1/slim/telemetry/${encodeURIComponent(deviceId)}/effectiveIds`, ...(0, request_options_1.optionalArg)(requestOptions));
235
149
  }
236
150
  async function getSlimDeviceLastObservationIds(deviceId, requestOptions) {
237
- return this.get(`/v1/slim/telemetry/${encodeURIComponent(deviceId)}/lastIds`, ...(requestOptions === undefined ? [] : [requestOptions]));
151
+ return this.get(`/v1/slim/telemetry/${encodeURIComponent(deviceId)}/lastIds`, ...(0, request_options_1.optionalArg)(requestOptions));
238
152
  }
239
153
  /** @deprecated Use listSlimOutOfBedNotifications, listSlimAlarms, or listSlimMedicalNotifications. */
240
154
  async function listSlimNotifications(params = {}, requestOptions) {
241
- return this.get(`/v1/slim/notifications${(0, query_string_1.toQueryString)(params)}`, { ...{ cache: "reload" }, ...requestOptions });
155
+ return this.get(`/v1/slim/notifications${(0, query_string_1.toQueryString)(params)}`, { cache: "reload", ...requestOptions });
242
156
  }
243
157
  async function getRecentSlimNotifications(count, requestOptions) {
244
- return this.get(`/v1/slim/notifications/recent${(0, query_string_1.toQueryString)({ count })}`, { ...{ cache: "reload" }, ...requestOptions });
158
+ return this.get(`/v1/slim/notifications/recent${(0, query_string_1.toQueryString)({ count })}`, { cache: "reload", ...requestOptions });
245
159
  }
246
160
  async function listSlimAlarms(params = {}, requestOptions) {
247
- return this.get(`/v1/slim/notifications/alarms${(0, query_string_1.toQueryString)(params)}`, { ...{ cache: "reload" }, ...requestOptions });
161
+ return this.get(`/v1/slim/notifications/alarms${(0, query_string_1.toQueryString)(params)}`, { cache: "reload", ...requestOptions });
248
162
  }
249
163
  async function acknowledgeSlimAlarm(notificationId, requestOptions) {
250
- return (await this.patch(`/v1/slim/notifications/${encodeURIComponent(notificationId)}/ack`, [], ...(requestOptions === undefined ? [] : [requestOptions])));
164
+ return (await this.patch(`/v1/slim/notifications/${encodeURIComponent(notificationId)}/ack`, [], ...(0, request_options_1.optionalArg)(requestOptions)));
251
165
  }
252
166
  async function getRecentSlimAlarms(count, requestOptions) {
253
- return this.get(`/v1/slim/notifications/recent/alarms${(0, query_string_1.toQueryString)({ count })}`, { ...{ cache: "reload" }, ...requestOptions });
167
+ return this.get(`/v1/slim/notifications/recent/alarms${(0, query_string_1.toQueryString)({ count })}`, { cache: "reload", ...requestOptions });
254
168
  }
169
+ /** Same as `getRecentSlimAlarms`. */
255
170
  function getRecentAlarms(count, requestOptions) {
256
- return getRecentSlimAlarms.call(this, count, ...(requestOptions === undefined ? [] : [requestOptions]));
171
+ return getRecentSlimAlarms.call(this, count, ...(0, request_options_1.optionalArg)(requestOptions));
257
172
  }
258
173
  async function getRecentSlimOutOfBed(count, requestOptions) {
259
- return this.get(`/v1/slim/notifications/recent/oob${(0, query_string_1.toQueryString)({ count })}`, { ...{ cache: "reload" }, ...requestOptions });
174
+ return this.get(`/v1/slim/notifications/recent/oob${(0, query_string_1.toQueryString)({ count })}`, { cache: "reload", ...requestOptions });
260
175
  }
176
+ /** Same as `getRecentSlimOutOfBed`. */
261
177
  function getRecentOutOfBed(count, requestOptions) {
262
- return getRecentSlimOutOfBed.call(this, count, ...(requestOptions === undefined ? [] : [requestOptions]));
178
+ return getRecentSlimOutOfBed.call(this, count, ...(0, request_options_1.optionalArg)(requestOptions));
263
179
  }
264
180
  async function listSlimOutOfBedNotifications(params = {}, requestOptions) {
265
- return this.get(`/v1/slim/notifications/oob${(0, query_string_1.toQueryString)(params)}`, { ...{ cache: "reload" }, ...requestOptions });
181
+ return this.get(`/v1/slim/notifications/oob${(0, query_string_1.toQueryString)(params)}`, { cache: "reload", ...requestOptions });
266
182
  }
267
183
  async function listSlimMedicalNotifications(params = {}, requestOptions) {
268
184
  validateMedicalCodes(params.codes);
269
- return this.get(`/v1/slim/notifications/medical${(0, query_string_1.toQueryString)(params)}`, { ...{ cache: "reload" }, ...requestOptions });
185
+ return this.get(`/v1/slim/notifications/medical${(0, query_string_1.toQueryString)(params)}`, { cache: "reload", ...requestOptions });
270
186
  }
271
187
  const MEDICAL_CODE = /^(?:\d{1,7}-\d|PI)$/;
272
188
  function validateMedicalCodes(codes) {
@@ -276,55 +192,56 @@ function validateMedicalCodes(codes) {
276
192
  }
277
193
  }
278
194
  async function getRecentSlimMedicalNotifications(count, requestOptions) {
279
- return this.get(`/v1/slim/notifications/recent/medical${(0, query_string_1.toQueryString)({ count })}`, { ...{ cache: "reload" }, ...requestOptions });
195
+ return this.get(`/v1/slim/notifications/recent/medical${(0, query_string_1.toQueryString)({ count })}`, { cache: "reload", ...requestOptions });
280
196
  }
281
197
  async function getSlimMedicalNotification(episodeId, requestOptions) {
282
- return this.get(`/v1/slim/notifications/medical/${encodeURIComponent(episodeId)}`, { ...{ cache: "reload" }, ...requestOptions });
198
+ return this.get(`/v1/slim/notifications/medical/${encodeURIComponent(episodeId)}`, { cache: "reload", ...requestOptions });
283
199
  }
284
200
  async function acknowledgeSlimMedicalNotification(episodeId, requestOptions) {
285
201
  return this.post(`/v1/slim/notifications/medical/${encodeURIComponent(episodeId)}/ack`, undefined, undefined, requestOptions);
286
202
  }
287
- async function acknowledgeSlimNotification(notificationId, requestOptions) {
288
- return (await this.patch(`/v1/slim/notifications/${encodeURIComponent(notificationId)}/ack`, [], ...(requestOptions === undefined ? [] : [requestOptions])));
203
+ /** Same as `acknowledgeSlimAlarm`. */
204
+ function acknowledgeSlimNotification(notificationId, requestOptions) {
205
+ return acknowledgeSlimAlarm.call(this, notificationId, ...(0, request_options_1.optionalArg)(requestOptions));
289
206
  }
290
207
  async function getSlimThreshold(requestOptions) {
291
- return this.get("/v1/slim/threshold", ...(requestOptions === undefined ? [] : [requestOptions]));
208
+ return this.get("/v1/slim/threshold", ...(0, request_options_1.optionalArg)(requestOptions));
292
209
  }
293
210
  async function updateSlimThreshold(body, requestOptions) {
294
211
  return (await this.put("/v1/slim/threshold", body, undefined, requestOptions));
295
212
  }
296
213
  async function getSlimPatientThreshold(patientId, requestOptions) {
297
- return this.get(`/v1/slim/threshold/patient/${encodeURIComponent(patientId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
214
+ return this.get(`/v1/slim/threshold/patient/${encodeURIComponent(patientId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
298
215
  }
299
216
  async function updateSlimPatientThreshold(patientId, body, requestOptions) {
300
217
  return (await this.put(`/v1/slim/threshold/patient/${encodeURIComponent(patientId)}`, body, undefined, requestOptions));
301
218
  }
302
219
  async function getSlimThresholdV2(requestOptions) {
303
- return this.get("/v2/slim/threshold", ...(requestOptions === undefined ? [] : [requestOptions]));
220
+ return this.get("/v2/slim/threshold", ...(0, request_options_1.optionalArg)(requestOptions));
304
221
  }
305
222
  async function updateSlimThresholdV2(body, requestOptions) {
306
223
  return (await this.put("/v2/slim/threshold", body, undefined, requestOptions));
307
224
  }
308
225
  async function getSlimPatientThresholdV2(patientId, requestOptions) {
309
- return this.get(`/v2/slim/threshold/patient/${encodeURIComponent(patientId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
226
+ return this.get(`/v2/slim/threshold/patient/${encodeURIComponent(patientId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
310
227
  }
311
228
  async function updateSlimPatientThresholdV2(patientId, body, requestOptions) {
312
229
  return (await this.put(`/v2/slim/threshold/patient/${encodeURIComponent(patientId)}`, body, undefined, requestOptions));
313
230
  }
314
231
  async function getSlimTrends(params, requestOptions) {
315
- return this.get(`/v1/slim/trends/graphs${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
232
+ return this.get(`/v1/slim/trends/graphs${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
316
233
  }
317
234
  async function getSlimRealtimeTrends(params, requestOptions) {
318
- return this.get(`/v1/slim/trends/realtime${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
235
+ return this.get(`/v1/slim/trends/realtime${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
319
236
  }
320
237
  async function getSlimSleepStatistics(params, requestOptions) {
321
- return this.get(`/v1/slim/sleep/statistics${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
238
+ return this.get(`/v1/slim/sleep/statistics${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
322
239
  }
323
240
  async function listSlimLocations(params = {}, requestOptions) {
324
- return this.get(`/v1/slim/location${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
241
+ return this.get(`/v1/slim/location${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
325
242
  }
326
243
  async function getSlimLocation(locationId, requestOptions) {
327
- return this.get(`/v1/slim/location/${encodeURIComponent(locationId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
244
+ return this.get(`/v1/slim/location/${encodeURIComponent(locationId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
328
245
  }
329
246
  async function createSlimLocation(body, requestOptions) {
330
247
  return this.post("/v1/slim/location", body, undefined, requestOptions);
@@ -333,55 +250,55 @@ async function updateSlimLocation(locationId, body, requestOptions) {
333
250
  return (await this.put(`/v1/slim/location/${encodeURIComponent(locationId)}`, body, undefined, requestOptions));
334
251
  }
335
252
  async function deleteSlimLocation(locationId, requestOptions) {
336
- await this.delete(`/v1/slim/location/${encodeURIComponent(locationId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
253
+ await this.delete(`/v1/slim/location/${encodeURIComponent(locationId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
337
254
  }
338
255
  async function listSlimZones(params = {}, requestOptions) {
339
- return this.get(`/v1/slim/zones${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
256
+ return this.get(`/v1/slim/zones${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
340
257
  }
341
258
  async function getSlimZone(zoneId, requestOptions) {
342
- return this.get(`/v1/slim/zones/${encodeURIComponent(zoneId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
259
+ return this.get(`/v1/slim/zones/${encodeURIComponent(zoneId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
343
260
  }
344
261
  async function getSlimZoneDeviceCounts(params = {}, requestOptions) {
345
- return this.get(`/v1/slim/zones/device-counts${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
262
+ return this.get(`/v1/slim/zones/device-counts${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
346
263
  }
347
264
  async function exportSlimPatientPdf(body, requestOptions) {
348
265
  return this.post("/v1/slim/export/pdf", body, undefined, requestOptions);
349
266
  }
350
267
  function listSlimProjectUsers(params = {}, requestOptions) {
351
- return this.get(`/v1/slim/project/users${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
268
+ return this.get(`/v1/slim/project/users${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
352
269
  }
353
270
  function createSlimChildProject(body, requestOptions) {
354
271
  return this.post("/v1/slim/project/child", body, undefined, requestOptions);
355
272
  }
356
273
  function getSlimProjectRelationships(requestOptions) {
357
- return this.get("/v1/slim/project/child", ...(requestOptions === undefined ? [] : [requestOptions]));
274
+ return this.get("/v1/slim/project/child", ...(0, request_options_1.optionalArg)(requestOptions));
358
275
  }
359
276
  function getSlimProjectRelationshipsV2(requestOptions) {
360
- return this.get("/v2/slim/project/child", ...(requestOptions === undefined ? [] : [requestOptions]));
277
+ return this.get("/v2/slim/project/child", ...(0, request_options_1.optionalArg)(requestOptions));
361
278
  }
362
279
  function deleteSlimChildProject(subProjectId, requestOptions) {
363
- return this.delete(`/v1/slim/project/child/${encodeURIComponent(subProjectId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
280
+ return this.delete(`/v1/slim/project/child/${encodeURIComponent(subProjectId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
364
281
  }
365
282
  function listSlimProjectUsersById(projectId, params = {}, requestOptions) {
366
- return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}/users${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
283
+ return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}/users${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
367
284
  }
368
285
  function getSlimProjectDeviceCounts(projectId, requestOptions) {
369
- return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}/device-counts`, ...(requestOptions === undefined ? [] : [requestOptions]));
286
+ return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}/device-counts`, ...(0, request_options_1.optionalArg)(requestOptions));
370
287
  }
371
288
  function getSlimProjectPatientCounts(projectId, requestOptions) {
372
- return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}/patient-counts`, ...(requestOptions === undefined ? [] : [requestOptions]));
289
+ return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}/patient-counts`, ...(0, request_options_1.optionalArg)(requestOptions));
373
290
  }
374
291
  function updateSlimProject(projectId, body, requestOptions) {
375
292
  return this.put(`/v1/slim/project/${encodeURIComponent(projectId)}`, body, undefined, requestOptions);
376
293
  }
377
294
  function getSlimProject(projectId, requestOptions) {
378
- return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
295
+ return this.get(`/v1/slim/project/${encodeURIComponent(projectId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
379
296
  }
380
297
  function listSlimPolicies(params = {}, requestOptions) {
381
- return this.get(`/v1/slim/policy${(0, query_string_1.toQueryString)(params)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
298
+ return this.get(`/v1/slim/policy${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
382
299
  }
383
300
  function getSlimPolicy(policyId, requestOptions) {
384
- return this.get(`/v1/slim/policy/${encodeURIComponent(policyId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
301
+ return this.get(`/v1/slim/policy/${encodeURIComponent(policyId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
385
302
  }
386
303
  function createSlimPolicy(body, requestOptions) {
387
304
  return this.post("/v1/slim/policy", body, undefined, requestOptions);
@@ -390,10 +307,10 @@ function updateSlimPolicy(policyId, body, requestOptions) {
390
307
  return this.put(`/v1/slim/policy/${encodeURIComponent(policyId)}`, body, undefined, requestOptions);
391
308
  }
392
309
  async function deleteSlimPolicy(policyId, requestOptions) {
393
- await this.delete(`/v1/slim/policy/${encodeURIComponent(policyId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
310
+ await this.delete(`/v1/slim/policy/${encodeURIComponent(policyId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
394
311
  }
395
312
  function getSlimOrganization(organizationId, requestOptions) {
396
- return this.get(`/v1/slim/organization/${encodeURIComponent(organizationId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
313
+ return this.get(`/v1/slim/organization/${encodeURIComponent(organizationId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
397
314
  }
398
315
  function createSlimOrganization(body, requestOptions) {
399
316
  return this.post("/v1/slim/organization", body, undefined, requestOptions);
@@ -402,14 +319,14 @@ function updateSlimOrganization(organizationId, body, requestOptions) {
402
319
  return this.put(`/v1/slim/organization/${encodeURIComponent(organizationId)}`, body, undefined, requestOptions);
403
320
  }
404
321
  async function deleteSlimOrganization(organizationId, requestOptions) {
405
- await this.delete(`/v1/slim/organization/${encodeURIComponent(organizationId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
322
+ await this.delete(`/v1/slim/organization/${encodeURIComponent(organizationId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
406
323
  }
407
324
  function inviteSlimPractitioner(body, requestOptions) {
408
325
  return this.post("/v1/slim/invite/practitioner", body, undefined, requestOptions);
409
326
  }
410
327
  function deleteSlimUser(profileType, profileId, requestOptions) {
411
- return this.delete(`/v1/slim/user/${encodeURIComponent(profileType)}/${encodeURIComponent(profileId)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
328
+ return this.delete(`/v1/slim/user/${encodeURIComponent(profileType)}/${encodeURIComponent(profileId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
412
329
  }
413
330
  function getSlimHealth(requestOptions) {
414
- return this.get("/v1/slim/health", ...(requestOptions === undefined ? [] : [requestOptions]));
331
+ return this.get("/v1/slim/health", ...(0, request_options_1.optionalArg)(requestOptions));
415
332
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createClientStorage = void 0;
4
+ const ovok_error_utils_1 = require("./errors/ovok-error-utils");
4
5
  /** Bridges an async keychain-like store to Medplum's synchronous storage contract. */
5
6
  const createClientStorage = (store, keys = []) => {
6
7
  const cache = new Map();
@@ -18,13 +19,13 @@ const createClientStorage = (store, keys = []) => {
18
19
  failed = undefined;
19
20
  }
20
21
  catch (error) {
21
- failed = error instanceof Error ? error : new Error(String(error));
22
+ failed = (0, ovok_error_utils_1.toError)(error);
22
23
  throw failed;
23
24
  }
24
25
  };
25
26
  const persist = (operation) => {
26
27
  writes = writes.then(operation, operation).catch((error) => {
27
- failed = error instanceof Error ? error : new Error(String(error));
28
+ failed = (0, ovok_error_utils_1.toError)(error);
28
29
  });
29
30
  };
30
31
  const storage = {
@@ -48,7 +48,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
48
48
  description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
49
49
  software: {
50
50
  name: "@ovok/core",
51
- version: "0.4.37",
51
+ version: "0.4.39",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
@@ -15,16 +15,17 @@ const getOvokPublicApiEndpoints = (statement) => {
15
15
  var _a, _b;
16
16
  const publicApi = (_a = statement.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === exports.OVOK_PUBLIC_API_EXTENSION);
17
17
  return ((_b = publicApi === null || publicApi === void 0 ? void 0 : publicApi.extension) !== null && _b !== void 0 ? _b : []).flatMap((endpoint) => {
18
- var _a, _b, _c;
19
18
  if (endpoint.url !== ENDPOINT_EXTENSION) {
20
19
  return [];
21
20
  }
22
- const method = (_a = endpoint.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === "method");
23
- const path = (_b = endpoint.extension) === null || _b === void 0 ? void 0 : _b.find((extension) => extension.url === "path");
24
- const group = (_c = endpoint.extension) === null || _c === void 0 ? void 0 : _c.find((extension) => extension.url === "group");
25
- const methodValue = method === undefined ? undefined : stringValue(method);
26
- const pathValue = path === undefined ? undefined : stringValue(path);
27
- const groupValue = group === undefined ? undefined : stringValue(group);
21
+ const field = (url) => {
22
+ var _a;
23
+ const extension = (_a = endpoint.extension) === null || _a === void 0 ? void 0 : _a.find((candidate) => candidate.url === url);
24
+ return extension === undefined ? undefined : stringValue(extension);
25
+ };
26
+ const methodValue = field("method");
27
+ const pathValue = field("path");
28
+ const groupValue = field("group");
28
29
  if (methodValue === undefined || pathValue === undefined || groupValue === undefined) {
29
30
  return [];
30
31
  }
@@ -15,7 +15,7 @@ const useSetMedicalConsent = () => (0, api_hooks_1.useOvokMutation)((client, acc
15
15
  exports.useSetMedicalConsent = useSetMedicalConsent;
16
16
  const useSlimThresholdV2 = () => (0, api_hooks_1.useOvokClientRequest)((client, signal) => client.getSlimThresholdV2({ signal }));
17
17
  exports.useSlimThresholdV2 = useSlimThresholdV2;
18
- const useSlimPatientThresholdV2 = (patientId) => (0, api_hooks_1.useOvokClientRequest)((client, signal) => patientId ? client.getSlimPatientThresholdV2(patientId, { signal }) : Promise.reject(new Error("patientId is required")), patientId, patientId !== undefined);
18
+ const useSlimPatientThresholdV2 = (patientId) => (0, api_hooks_1.useOvokClientRequestFor)("patientId", patientId, (client, id, signal) => client.getSlimPatientThresholdV2(id, { signal }));
19
19
  exports.useSlimPatientThresholdV2 = useSlimPatientThresholdV2;
20
20
  const useUpdateSlimThresholdV2 = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.updateSlimThresholdV2(body));
21
21
  exports.useUpdateSlimThresholdV2 = useUpdateSlimThresholdV2;
@@ -1,7 +1,7 @@
1
1
  import { CapabilityStatement } from "@medplum/fhirtypes";
2
2
  import { OvokClient, OvokFhirVersion } from "../client/ovok-client";
3
- import { OvokAdministeredProject, OvokProjectFeatures, OvokProjectSettings } from "../client/platform/types";
4
- import { SlimDeviceListItem, SlimDeviceListQuery, SlimDeviceTelemetry, SlimNotificationsQuery, SlimNotificationsResponse, SlimPage, SlimPatientListItem, SlimPatientListQuery, SlimRecentNotificationsResponse } from "../client/slim/types";
3
+ import { OvokAdministeredProject, OvokPage, OvokProjectFeatures, OvokProjectSettings } from "../client/platform/types";
4
+ import { SlimDeviceListItem, SlimDeviceListQuery, SlimDeviceTelemetry, SlimPage, SlimPatientListItem, SlimPatientListQuery } from "../client/slim/types";
5
5
  import { OvokPublicApiEndpoint } from "../conformance/capability";
6
6
  export type OvokRequestState<T> = {
7
7
  data: T | undefined;
@@ -34,6 +34,8 @@ export declare function useOvokRequestWithUpdater<T>(load: (signal?: AbortSignal
34
34
  * compared by value, so callers can pass a fresh params object each render.
35
35
  */
36
36
  export declare function useOvokClientRequest<T>(request: (client: OvokClient, signal?: AbortSignal) => Promise<T>, inputs?: unknown, enabled?: boolean): OvokRequestState<T>;
37
+ /** Reads by id: waits while `id` is undefined and rejects an empty id with "<name> is required". */
38
+ export declare function useOvokClientRequestFor<T>(name: string, id: string | undefined, request: (client: OvokClient, id: string, signal?: AbortSignal) => Promise<T>): OvokRequestState<T>;
37
39
  /** Generic mutation hook for any typed OvokClient method. */
38
40
  export declare function useOvokMutation<TParams, TData>(mutateRequest: (client: OvokClient, params: TParams) => Promise<TData>): OvokMutationState<TParams, TData>;
39
41
  export declare const useCapabilityStatement: (version?: OvokFhirVersion) => OvokRequestState<CapabilityStatement>;
@@ -41,12 +43,9 @@ export declare const usePublicApiEndpoints: (version?: OvokFhirVersion) => OvokR
41
43
  export declare const useAdministeredProjects: (params?: {
42
44
  page?: number;
43
45
  count?: number;
44
- }) => OvokRequestState<SlimPage<OvokAdministeredProject>>;
46
+ }) => OvokRequestState<OvokPage<OvokAdministeredProject>>;
45
47
  export declare const useProjectSettings: () => OvokRequestState<OvokProjectSettings>;
46
48
  export declare const useProjectFeatures: () => OvokRequestState<OvokProjectFeatures>;
47
49
  export declare const useSlimPatients: (params?: SlimPatientListQuery) => OvokRequestState<SlimPage<SlimPatientListItem>>;
48
50
  export declare const useSlimDevices: (params?: SlimDeviceListQuery) => OvokRequestState<SlimPage<SlimDeviceListItem>>;
49
51
  export declare const useSlimDeviceTelemetry: (deviceId?: string) => OvokRequestState<SlimDeviceTelemetry>;
50
- /** @deprecated Use useSlimOutOfBedNotifications, useSlimAlarms, or useSlimMedicalNotifications. */
51
- export declare const useSlimNotifications: (params?: SlimNotificationsQuery) => OvokRequestState<SlimNotificationsResponse>;
52
- export declare const useRecentSlimNotifications: (count?: number) => OvokRequestState<SlimRecentNotificationsResponse>;
@@ -34,15 +34,15 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useRecentSlimNotifications = exports.useSlimNotifications = exports.useSlimDeviceTelemetry = exports.useSlimDevices = exports.useSlimPatients = exports.useProjectFeatures = exports.useProjectSettings = exports.useAdministeredProjects = exports.usePublicApiEndpoints = exports.useCapabilityStatement = void 0;
37
+ exports.useSlimDeviceTelemetry = exports.useSlimDevices = exports.useSlimPatients = exports.useProjectFeatures = exports.useProjectSettings = exports.useAdministeredProjects = exports.usePublicApiEndpoints = exports.useCapabilityStatement = void 0;
38
38
  exports.useOvokRequest = useOvokRequest;
39
39
  exports.useOvokRequestWithUpdater = useOvokRequestWithUpdater;
40
40
  exports.useOvokClientRequest = useOvokClientRequest;
41
+ exports.useOvokClientRequestFor = useOvokClientRequestFor;
41
42
  exports.useOvokMutation = useOvokMutation;
42
43
  const React = __importStar(require("react"));
43
- const notification_invalidation_1 = require("./notification-invalidation");
44
+ const ovok_error_utils_1 = require("../client/errors/ovok-error-utils");
44
45
  const index_1 = require("./index");
45
- const toError = (error) => error instanceof Error ? error : new Error(String(error));
46
46
  /**
47
47
  * Small request primitive for the typed Ovok hooks. It deliberately does not
48
48
  * add a cache or retry policy: MedplumClient already owns request caching and
@@ -88,7 +88,7 @@ function useOvokRequestWithUpdater(load, enabled = true) {
88
88
  })
89
89
  .catch((reason) => {
90
90
  if (!disposed) {
91
- setError(toError(reason));
91
+ setError((0, ovok_error_utils_1.toError)(reason));
92
92
  setLoading(false);
93
93
  }
94
94
  });
@@ -124,6 +124,10 @@ function useOvokClientRequest(request, inputs, enabled = true) {
124
124
  const load = React.useCallback((signal) => request(client, signal), [client, key]);
125
125
  return useOvokRequest(load, enabled);
126
126
  }
127
+ /** Reads by id: waits while `id` is undefined and rejects an empty id with "<name> is required". */
128
+ function useOvokClientRequestFor(name, id, request) {
129
+ return useOvokClientRequest((client, signal) => (id ? request(client, id, signal) : Promise.reject(new Error(`${name} is required`))), id, id !== undefined);
130
+ }
127
131
  /** Generic mutation hook for any typed OvokClient method. */
128
132
  function useOvokMutation(mutateRequest) {
129
133
  const client = (0, index_1.useClient)();
@@ -139,7 +143,7 @@ function useOvokMutation(mutateRequest) {
139
143
  return value;
140
144
  }
141
145
  catch (reason) {
142
- const requestError = toError(reason);
146
+ const requestError = (0, ovok_error_utils_1.toError)(reason);
143
147
  setError(requestError);
144
148
  throw requestError;
145
149
  }
@@ -168,23 +172,5 @@ const useSlimPatients = (params = {}) => useOvokClientRequest((client, signal) =
168
172
  exports.useSlimPatients = useSlimPatients;
169
173
  const useSlimDevices = (params = {}) => useOvokClientRequest((client, signal) => client.listSlimDevices(params, { signal }), params);
170
174
  exports.useSlimDevices = useSlimDevices;
171
- const useSlimDeviceTelemetry = (deviceId) => useOvokClientRequest((client, signal) => deviceId ? client.getSlimDeviceTelemetry(deviceId, { signal }) : Promise.reject(new Error("deviceId is required")), deviceId, deviceId !== undefined);
175
+ const useSlimDeviceTelemetry = (deviceId) => useOvokClientRequestFor("deviceId", deviceId, (client, id, signal) => client.getSlimDeviceTelemetry(id, { signal }));
172
176
  exports.useSlimDeviceTelemetry = useSlimDeviceTelemetry;
173
- /** @deprecated Use useSlimOutOfBedNotifications, useSlimAlarms, or useSlimMedicalNotifications. */
174
- const useSlimNotifications = (params = {}) => {
175
- const client = (0, index_1.useClient)();
176
- const serialized = JSON.stringify(params);
177
- const load = React.useCallback((signal) => client.listSlimNotifications(params, { signal }), [client, serialized]);
178
- const { updateData, ...state } = useOvokRequestWithUpdater(load);
179
- (0, notification_invalidation_1.useSlimNotificationSync)(client, state.reload, updateData, "resources");
180
- return state;
181
- };
182
- exports.useSlimNotifications = useSlimNotifications;
183
- const useRecentSlimNotifications = (count) => {
184
- const client = (0, index_1.useClient)();
185
- const load = React.useCallback((signal) => client.getRecentSlimNotifications(count, { signal }), [client, count]);
186
- const { updateData, ...state } = useOvokRequestWithUpdater(load);
187
- (0, notification_invalidation_1.useSlimNotificationSync)(client, state.reload, updateData, "recent");
188
- return state;
189
- };
190
- exports.useRecentSlimNotifications = useRecentSlimNotifications;