@ovok/core 0.4.36 → 0.4.38

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