@ovok/core 0.4.5 → 0.4.7

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.
@@ -1,18 +1,18 @@
1
- export type CarehubPage<T> = {
1
+ export type SlimPage<T> = {
2
2
  total: number;
3
3
  page: number;
4
4
  count: number;
5
5
  resources: T[];
6
6
  };
7
- export type CarehubResidentState = "active" | "archived" | "discharged" | "discharged-recent";
8
- export type CarehubHumanName = {
7
+ export type SlimResidentState = "active" | "archived" | "discharged" | "discharged-recent";
8
+ export type SlimHumanName = {
9
9
  use: "official" | "nickname" | "maiden";
10
10
  given?: string[];
11
11
  family?: string;
12
12
  };
13
- export type CarehubPatient = {
13
+ export type SlimPatient = {
14
14
  id: string;
15
- name: CarehubHumanName[];
15
+ name: SlimHumanName[];
16
16
  gender?: "male" | "female" | "other" | "unknown";
17
17
  birthDate?: string;
18
18
  deviceId: string | null;
@@ -21,15 +21,15 @@ export type CarehubPatient = {
21
21
  floor?: string;
22
22
  room?: string;
23
23
  bed?: string;
24
- residentState: CarehubResidentState;
24
+ residentState: SlimResidentState;
25
25
  admissionDate?: string;
26
26
  dischargeDate?: string;
27
27
  };
28
- export type CarehubPatientListItem = {
28
+ export type SlimPatientListItem = {
29
29
  id: string;
30
30
  name: string;
31
31
  nickname: string | null;
32
- residentState: CarehubResidentState;
32
+ residentState: SlimResidentState;
33
33
  admissionDate: string | null;
34
34
  dischargeDate: string | null;
35
35
  organizationId: string | null;
@@ -41,21 +41,21 @@ export type CarehubPatientListItem = {
41
41
  medicalSettings: string | null;
42
42
  bedActivitySettings: string | null;
43
43
  };
44
- export type CarehubPatientListQuery = {
44
+ export type SlimPatientListQuery = {
45
45
  page?: number;
46
46
  count?: number;
47
47
  sortBy?: string;
48
48
  orderBy?: "ASC" | "DESC";
49
49
  search?: string;
50
- residentState?: CarehubResidentState | "all";
50
+ residentState?: SlimResidentState | "all";
51
51
  includeDischargedRecent?: boolean;
52
52
  organizationId?: string;
53
53
  hasDevice?: boolean;
54
54
  medicalSettings?: string;
55
55
  bedActivitySettings?: string;
56
56
  };
57
- export type CarehubCreatePatient = {
58
- name: CarehubHumanName[];
57
+ export type SlimCreatePatient = {
58
+ name: SlimHumanName[];
59
59
  gender?: "male" | "female" | "other" | "unknown";
60
60
  birthDate?: string;
61
61
  deviceId?: string | null;
@@ -63,11 +63,11 @@ export type CarehubCreatePatient = {
63
63
  locationId?: string;
64
64
  admissionDate?: string;
65
65
  };
66
- export type CarehubUpdatePatient = Partial<CarehubCreatePatient> & {
67
- residentState?: CarehubResidentState;
66
+ export type SlimUpdatePatient = Partial<SlimCreatePatient> & {
67
+ residentState?: SlimResidentState;
68
68
  dischargeDate?: string;
69
69
  };
70
- export type CarehubDevice = {
70
+ export type SlimDevice = {
71
71
  name: string;
72
72
  status?: "active" | "inactive" | "entered-in-error" | "unknown";
73
73
  statusReason: Array<{
@@ -85,7 +85,7 @@ export type CarehubDevice = {
85
85
  room?: string;
86
86
  bed?: string;
87
87
  };
88
- export type CarehubDeviceListItem = {
88
+ export type SlimDeviceListItem = {
89
89
  id: string;
90
90
  name: string;
91
91
  thingsboardId?: string;
@@ -99,7 +99,7 @@ export type CarehubDeviceListItem = {
99
99
  lastActivityTime?: string | null;
100
100
  createdAt?: string | null;
101
101
  };
102
- export type CarehubDeviceListQuery = {
102
+ export type SlimDeviceListQuery = {
103
103
  page?: number;
104
104
  count?: number;
105
105
  sortBy?: string;
@@ -111,32 +111,32 @@ export type CarehubDeviceListQuery = {
111
111
  patientId?: string;
112
112
  active?: boolean;
113
113
  };
114
- export type CarehubCreateDevice = {
114
+ export type SlimCreateDevice = {
115
115
  name: string;
116
116
  thingsboardId?: string;
117
117
  organizationId?: string;
118
118
  locationId?: string;
119
119
  patientId?: string;
120
120
  };
121
- export type CarehubUpdateDevice = {
121
+ export type SlimUpdateDevice = {
122
122
  name: string;
123
123
  thingsboardId?: string;
124
124
  organizationId?: string | null;
125
125
  locationId?: string | null;
126
126
  patientId?: string | null;
127
127
  };
128
- export type CarehubAssignDevice = {
128
+ export type SlimAssignDevice = {
129
129
  deviceId: string;
130
130
  projectId: string;
131
131
  locationId?: string;
132
132
  };
133
- export type CarehubTelemetryValue = {
133
+ export type SlimTelemetryValue = {
134
134
  value: string | number | boolean | null;
135
135
  ts: number | null;
136
136
  };
137
- export type CarehubTelemetrySummary = Record<string, CarehubTelemetryValue>;
138
- export type CarehubAlertSummary = Record<string, unknown>;
139
- export type CarehubLiveQuery = {
137
+ export type SlimTelemetrySummary = Record<string, SlimTelemetryValue>;
138
+ export type SlimAlertSummary = Record<string, unknown>;
139
+ export type SlimLiveQuery = {
140
140
  page?: number;
141
141
  count?: number;
142
142
  sortBy?: string;
@@ -145,36 +145,36 @@ export type CarehubLiveQuery = {
145
145
  deviceId?: string;
146
146
  organizationId?: string;
147
147
  effectiveSleepStatus?: string;
148
- residentState?: CarehubResidentState;
148
+ residentState?: SlimResidentState;
149
149
  includeUnassigned?: boolean;
150
150
  };
151
- export type CarehubLiveTelemetry = {
151
+ export type SlimLiveTelemetry = {
152
152
  total: number;
153
153
  page: number;
154
154
  count: number;
155
- telemetry: Record<string, CarehubTelemetrySummary>;
156
- alerts: Record<string, CarehubAlertSummary>;
155
+ telemetry: Record<string, SlimTelemetrySummary>;
156
+ alerts: Record<string, SlimAlertSummary>;
157
157
  };
158
- export type CarehubDeviceTelemetry = {
158
+ export type SlimDeviceTelemetry = {
159
159
  deviceId: string;
160
- telemetry?: CarehubTelemetrySummary;
161
- alerts?: CarehubAlertSummary;
160
+ telemetry?: SlimTelemetrySummary;
161
+ alerts?: SlimAlertSummary;
162
162
  };
163
- export type CarehubObservationIds = {
163
+ export type SlimObservationIds = {
164
164
  heartRate: string | null;
165
165
  respiratoryRate: string | null;
166
166
  sleepStatus: string | null;
167
167
  presenceStatus: string | null;
168
168
  batch?: string | null;
169
169
  };
170
- export type CarehubNotification = {
170
+ export type SlimNotification = {
171
171
  commId: string;
172
172
  status: string;
173
173
  authoredOn: string;
174
174
  type: string;
175
175
  [key: string]: unknown;
176
176
  };
177
- export type CarehubNotificationsQuery = {
177
+ export type SlimNotificationsQuery = {
178
178
  patient?: string;
179
179
  device?: string;
180
180
  status?: string;
@@ -185,26 +185,26 @@ export type CarehubNotificationsQuery = {
185
185
  page?: number;
186
186
  count?: number;
187
187
  };
188
- export type CarehubNotificationsResponse = CarehubPage<CarehubNotification> & {
188
+ export type SlimNotificationsResponse = SlimPage<SlimNotification> & {
189
189
  truncated: {
190
190
  reason: "result-cap" | "scan-budget";
191
191
  limit: number;
192
192
  } | null;
193
193
  };
194
- export type CarehubRecentNotificationsResponse = {
195
- recent: CarehubNotification[];
194
+ export type SlimRecentNotificationsResponse = {
195
+ recent: SlimNotification[];
196
196
  total: number;
197
197
  warm: boolean;
198
198
  source: "redis" | "medplum";
199
199
  };
200
- export type CarehubThreshold = {
200
+ export type SlimThreshold = {
201
201
  id?: string;
202
202
  projectId?: string;
203
203
  status: "active" | "retired";
204
204
  date?: string;
205
205
  settings: Record<string, unknown>;
206
206
  };
207
- export type CarehubTrendPoint = {
207
+ export type SlimTrendPoint = {
208
208
  timestamp: string;
209
209
  timestampMs: number;
210
210
  data: number | null;
@@ -221,17 +221,17 @@ export type CarehubTrendPoint = {
221
221
  deviceModel?: string;
222
222
  deviceId?: string;
223
223
  };
224
- export type CarehubTrends = {
225
- heartRate?: Record<string, CarehubTrendPoint[]>;
226
- respiratoryRate?: Record<string, CarehubTrendPoint[]>;
224
+ export type SlimTrends = {
225
+ heartRate?: Record<string, SlimTrendPoint[]>;
226
+ respiratoryRate?: Record<string, SlimTrendPoint[]>;
227
227
  };
228
- export type CarehubSleepMetric = {
228
+ export type SlimSleepMetric = {
229
229
  current: number | string | null;
230
230
  average: number | string | null;
231
231
  diff: number | null;
232
232
  };
233
- export type CarehubSleepStatistics = Record<string, Record<string, CarehubSleepMetric>>;
234
- export type CarehubLocation = {
233
+ export type SlimSleepStatistics = Record<string, Record<string, SlimSleepMetric>>;
234
+ export type SlimLocation = {
235
235
  id: string;
236
236
  name: string;
237
237
  floor?: string;
@@ -244,7 +244,7 @@ export type CarehubLocation = {
244
244
  deviceId?: string;
245
245
  patientId?: string;
246
246
  };
247
- export type CarehubLocationQuery = {
247
+ export type SlimLocationQuery = {
248
248
  search?: string;
249
249
  floor?: string;
250
250
  room?: string;
@@ -254,19 +254,19 @@ export type CarehubLocationQuery = {
254
254
  page?: number;
255
255
  count?: number;
256
256
  };
257
- export type CarehubCreateLocation = {
257
+ export type SlimCreateLocation = {
258
258
  name: string;
259
259
  floor?: string;
260
260
  room?: string;
261
261
  bed?: string;
262
262
  organizationId?: string;
263
263
  };
264
- export type CarehubUpdateLocation = CarehubCreateLocation & {
264
+ export type SlimUpdateLocation = SlimCreateLocation & {
265
265
  organizationId?: string | null;
266
266
  deviceId?: string | null;
267
267
  patientId?: string;
268
268
  };
269
- export type CarehubZone = {
269
+ export type SlimZone = {
270
270
  zoneId: string;
271
271
  zoneName: string;
272
272
  deviceCount: number;
@@ -274,7 +274,7 @@ export type CarehubZone = {
274
274
  activeDeviceCount: number;
275
275
  inactiveDeviceCount: number;
276
276
  };
277
- export type CarehubZoneDetail = {
277
+ export type SlimZoneDetail = {
278
278
  id: string;
279
279
  name: string;
280
280
  locations: Array<{
@@ -293,13 +293,13 @@ export type CarehubZoneDetail = {
293
293
  }>;
294
294
  }>;
295
295
  };
296
- export type CarehubExportPdf = {
296
+ export type SlimExportPdf = {
297
297
  documentReference: Record<string, unknown>;
298
298
  binary: Record<string, unknown>;
299
299
  downloadUrl: string;
300
300
  expiresAt?: string;
301
301
  };
302
- export type CarehubExportPdfRequest = {
302
+ export type SlimExportPdfRequest = {
303
303
  code: string;
304
304
  mailTo?: string[];
305
305
  timeZone?: string;
@@ -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.5",
51
+ version: "0.4.7",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
@@ -1,7 +1,7 @@
1
1
  import { CapabilityStatement } from "@medplum/fhirtypes";
2
- import { CarehubDeviceListItem, CarehubDeviceListQuery, CarehubDeviceTelemetry, CarehubNotificationsQuery, CarehubNotificationsResponse, CarehubPage, CarehubPatientListItem, CarehubPatientListQuery, CarehubRecentNotificationsResponse } from "../client/carehub/types";
3
2
  import { OvokClient, OvokFhirVersion } from "../client/ovok-client";
4
3
  import { OvokAdministeredProject, OvokProjectFeatures, OvokProjectSettings } from "../client/platform/types";
4
+ import { SlimDeviceListItem, SlimDeviceListQuery, SlimDeviceTelemetry, SlimNotificationsQuery, SlimNotificationsResponse, SlimPage, SlimPatientListItem, SlimPatientListQuery, SlimRecentNotificationsResponse } from "../client/slim/types";
5
5
  import { OvokPublicApiEndpoint } from "../conformance/capability";
6
6
  export type OvokRequestState<T> = {
7
7
  data: T | undefined;
@@ -29,11 +29,11 @@ export declare const usePublicApiEndpoints: (version?: OvokFhirVersion) => OvokR
29
29
  export declare const useAdministeredProjects: (params?: {
30
30
  page?: number;
31
31
  count?: number;
32
- }) => OvokRequestState<CarehubPage<OvokAdministeredProject>>;
32
+ }) => OvokRequestState<SlimPage<OvokAdministeredProject>>;
33
33
  export declare const useProjectSettings: () => OvokRequestState<OvokProjectSettings>;
34
34
  export declare const useProjectFeatures: () => OvokRequestState<OvokProjectFeatures>;
35
- export declare const useCarehubPatients: (params?: CarehubPatientListQuery) => OvokRequestState<CarehubPage<CarehubPatientListItem>>;
36
- export declare const useCarehubDevices: (params?: CarehubDeviceListQuery) => OvokRequestState<CarehubPage<CarehubDeviceListItem>>;
37
- export declare const useCarehubDeviceTelemetry: (deviceId?: string) => OvokRequestState<CarehubDeviceTelemetry>;
38
- export declare const useCarehubNotifications: (params?: CarehubNotificationsQuery) => OvokRequestState<CarehubNotificationsResponse>;
39
- export declare const useRecentCarehubNotifications: (count?: number) => OvokRequestState<CarehubRecentNotificationsResponse>;
35
+ export declare const useSlimPatients: (params?: SlimPatientListQuery) => OvokRequestState<SlimPage<SlimPatientListItem>>;
36
+ export declare const useSlimDevices: (params?: SlimDeviceListQuery) => OvokRequestState<SlimPage<SlimDeviceListItem>>;
37
+ export declare const useSlimDeviceTelemetry: (deviceId?: string) => OvokRequestState<SlimDeviceTelemetry>;
38
+ export declare const useSlimNotifications: (params?: SlimNotificationsQuery) => OvokRequestState<SlimNotificationsResponse>;
39
+ export declare const useRecentSlimNotifications: (count?: number) => OvokRequestState<SlimRecentNotificationsResponse>;
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useRecentCarehubNotifications = exports.useCarehubNotifications = exports.useCarehubDeviceTelemetry = exports.useCarehubDevices = exports.useCarehubPatients = exports.useProjectFeatures = exports.useProjectSettings = exports.useAdministeredProjects = exports.usePublicApiEndpoints = exports.useCapabilityStatement = void 0;
37
+ exports.useRecentSlimNotifications = exports.useSlimNotifications = 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.useOvokMutation = useOvokMutation;
40
40
  const React = __importStar(require("react"));
@@ -142,38 +142,38 @@ const useProjectFeatures = () => {
142
142
  return useOvokRequest(load);
143
143
  };
144
144
  exports.useProjectFeatures = useProjectFeatures;
145
- const useCarehubPatients = (params = {}) => {
145
+ const useSlimPatients = (params = {}) => {
146
146
  const client = (0, index_1.useClient)();
147
147
  const serialized = JSON.stringify(params);
148
- const load = React.useCallback(() => client.listCarehubPatients(params), [client, serialized]);
148
+ const load = React.useCallback(() => client.listSlimPatients(params), [client, serialized]);
149
149
  return useOvokRequest(load);
150
150
  };
151
- exports.useCarehubPatients = useCarehubPatients;
152
- const useCarehubDevices = (params = {}) => {
151
+ exports.useSlimPatients = useSlimPatients;
152
+ const useSlimDevices = (params = {}) => {
153
153
  const client = (0, index_1.useClient)();
154
154
  const serialized = JSON.stringify(params);
155
- const load = React.useCallback(() => client.listCarehubDevices(params), [client, serialized]);
155
+ const load = React.useCallback(() => client.listSlimDevices(params), [client, serialized]);
156
156
  return useOvokRequest(load);
157
157
  };
158
- exports.useCarehubDevices = useCarehubDevices;
159
- const useCarehubDeviceTelemetry = (deviceId) => {
158
+ exports.useSlimDevices = useSlimDevices;
159
+ const useSlimDeviceTelemetry = (deviceId) => {
160
160
  const client = (0, index_1.useClient)();
161
161
  const load = React.useCallback(() => deviceId
162
- ? client.getCarehubDeviceTelemetry(deviceId)
162
+ ? client.getSlimDeviceTelemetry(deviceId)
163
163
  : Promise.reject(new Error("deviceId is required")), [client, deviceId]);
164
164
  return useOvokRequest(load, deviceId !== undefined);
165
165
  };
166
- exports.useCarehubDeviceTelemetry = useCarehubDeviceTelemetry;
167
- const useCarehubNotifications = (params = {}) => {
166
+ exports.useSlimDeviceTelemetry = useSlimDeviceTelemetry;
167
+ const useSlimNotifications = (params = {}) => {
168
168
  const client = (0, index_1.useClient)();
169
169
  const serialized = JSON.stringify(params);
170
- const load = React.useCallback(() => client.listCarehubNotifications(params), [client, serialized]);
170
+ const load = React.useCallback(() => client.listSlimNotifications(params), [client, serialized]);
171
171
  return useOvokRequest(load);
172
172
  };
173
- exports.useCarehubNotifications = useCarehubNotifications;
174
- const useRecentCarehubNotifications = (count) => {
173
+ exports.useSlimNotifications = useSlimNotifications;
174
+ const useRecentSlimNotifications = (count) => {
175
175
  const client = (0, index_1.useClient)();
176
- const load = React.useCallback(() => client.getRecentCarehubNotifications(count), [client, count]);
176
+ const load = React.useCallback(() => client.getRecentSlimNotifications(count), [client, count]);
177
177
  return useOvokRequest(load);
178
178
  };
179
- exports.useRecentCarehubNotifications = useRecentCarehubNotifications;
179
+ exports.useRecentSlimNotifications = useRecentSlimNotifications;
@@ -6,7 +6,7 @@ export declare const OvokProvider: (props: React.PropsWithChildren<{
6
6
  client: OvokClient;
7
7
  }>) => React.JSX.Element;
8
8
  export { observationsToMeasurements, useEcgRecording, useObservations, useSaveMeasurement, useUrineTests, } from "./observation-hooks";
9
- export { useAdministeredProjects, useCarehubDeviceTelemetry, useCarehubDevices, useCarehubNotifications, useCarehubPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentCarehubNotifications, } from "./api-hooks";
9
+ export { useAdministeredProjects, useSlimDeviceTelemetry, useSlimDevices, useSlimNotifications, useSlimPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentSlimNotifications, } from "./api-hooks";
10
10
  export { useConsentSignature, useContent, useCreateVideoCallAppointment, useCreateVideoCallUserAccess, useDocuments, useVideoCallAccess, useVideoCallAppointments, } from "./experience-hooks";
11
11
  export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, useUpdateProjectTextSetting, } from "./platform-hooks";
12
12
  export { useEmailTemplates } from "./email-hooks";
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useInvitePractitioner = exports.useInvitePatient = exports.useAcceptInvite = exports.useEmailTemplates = exports.useUpdateProjectTextSetting = exports.useUpdateLocalization = exports.useUpdateI18nextDocument = exports.useLocalizations = exports.useLocales = exports.useI18nextDocument = exports.useVideoCallAppointments = exports.useVideoCallAccess = exports.useDocuments = exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useContent = exports.useConsentSignature = exports.useRecentCarehubNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useCarehubPatients = exports.useCarehubNotifications = exports.useCarehubDevices = exports.useCarehubDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
37
+ exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useInvitePractitioner = exports.useInvitePatient = exports.useAcceptInvite = exports.useEmailTemplates = exports.useUpdateProjectTextSetting = exports.useUpdateLocalization = exports.useUpdateI18nextDocument = exports.useLocalizations = exports.useLocales = exports.useI18nextDocument = exports.useVideoCallAppointments = exports.useVideoCallAccess = exports.useDocuments = exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useContent = exports.useConsentSignature = exports.useRecentSlimNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useSlimPatients = exports.useSlimNotifications = exports.useSlimDevices = exports.useSlimDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
38
38
  exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.usePatientSharingSettings = exports.usePatientSharing = exports.useCreatePatientSharingInvite = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.usePatientMeasurementHistory = exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = void 0;
39
39
  /*
40
40
  * The only React-dependent module in the package.
@@ -79,17 +79,17 @@ Object.defineProperty(exports, "useSaveMeasurement", { enumerable: true, get: fu
79
79
  Object.defineProperty(exports, "useUrineTests", { enumerable: true, get: function () { return observation_hooks_1.useUrineTests; } });
80
80
  var api_hooks_1 = require("./api-hooks");
81
81
  Object.defineProperty(exports, "useAdministeredProjects", { enumerable: true, get: function () { return api_hooks_1.useAdministeredProjects; } });
82
- Object.defineProperty(exports, "useCarehubDeviceTelemetry", { enumerable: true, get: function () { return api_hooks_1.useCarehubDeviceTelemetry; } });
83
- Object.defineProperty(exports, "useCarehubDevices", { enumerable: true, get: function () { return api_hooks_1.useCarehubDevices; } });
84
- Object.defineProperty(exports, "useCarehubNotifications", { enumerable: true, get: function () { return api_hooks_1.useCarehubNotifications; } });
85
- Object.defineProperty(exports, "useCarehubPatients", { enumerable: true, get: function () { return api_hooks_1.useCarehubPatients; } });
82
+ Object.defineProperty(exports, "useSlimDeviceTelemetry", { enumerable: true, get: function () { return api_hooks_1.useSlimDeviceTelemetry; } });
83
+ Object.defineProperty(exports, "useSlimDevices", { enumerable: true, get: function () { return api_hooks_1.useSlimDevices; } });
84
+ Object.defineProperty(exports, "useSlimNotifications", { enumerable: true, get: function () { return api_hooks_1.useSlimNotifications; } });
85
+ Object.defineProperty(exports, "useSlimPatients", { enumerable: true, get: function () { return api_hooks_1.useSlimPatients; } });
86
86
  Object.defineProperty(exports, "useCapabilityStatement", { enumerable: true, get: function () { return api_hooks_1.useCapabilityStatement; } });
87
87
  Object.defineProperty(exports, "useOvokMutation", { enumerable: true, get: function () { return api_hooks_1.useOvokMutation; } });
88
88
  Object.defineProperty(exports, "useOvokRequest", { enumerable: true, get: function () { return api_hooks_1.useOvokRequest; } });
89
89
  Object.defineProperty(exports, "useProjectFeatures", { enumerable: true, get: function () { return api_hooks_1.useProjectFeatures; } });
90
90
  Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return api_hooks_1.useProjectSettings; } });
91
91
  Object.defineProperty(exports, "usePublicApiEndpoints", { enumerable: true, get: function () { return api_hooks_1.usePublicApiEndpoints; } });
92
- Object.defineProperty(exports, "useRecentCarehubNotifications", { enumerable: true, get: function () { return api_hooks_1.useRecentCarehubNotifications; } });
92
+ Object.defineProperty(exports, "useRecentSlimNotifications", { enumerable: true, get: function () { return api_hooks_1.useRecentSlimNotifications; } });
93
93
  var experience_hooks_1 = require("./experience-hooks");
94
94
  Object.defineProperty(exports, "useConsentSignature", { enumerable: true, get: function () { return experience_hooks_1.useConsentSignature; } });
95
95
  Object.defineProperty(exports, "useContent", { enumerable: true, get: function () { return experience_hooks_1.useContent; } });
@@ -0,0 +1,37 @@
1
+ import { SignalsAlert, SignalsAlertsQuery, SignalsRawAlert, SignalsRawAlertsQuery } from "../client/signals";
2
+ import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
+ type SignalsAlertsHookQuery = Omit<SignalsAlertsQuery, "cursor"> & {
4
+ episodes?: true;
5
+ };
6
+ type SignalsRawAlertsHookQuery = Omit<SignalsRawAlertsQuery, "cursor"> & {
7
+ episodes: false;
8
+ };
9
+ /** Which grain an alert hook reads: episodes unless `episodes` is `false`. */
10
+ export type SignalsAlertGrain = {
11
+ episodes?: boolean;
12
+ };
13
+ export type SignalsAlertsHookState<TAlert = SignalsAlert> = {
14
+ items: TAlert[];
15
+ loading: boolean;
16
+ error: Error | undefined;
17
+ reload: () => void;
18
+ hasMore: boolean;
19
+ loadMore: () => Promise<void>;
20
+ };
21
+ export declare function useSignalsAlerts(query: SignalsRawAlertsHookQuery): SignalsAlertsHookState<SignalsRawAlert>;
22
+ export declare function useSignalsAlerts(query?: SignalsAlertsHookQuery): SignalsAlertsHookState<SignalsAlert>;
23
+ /** One episode by id, or one raw alert with `{ episodes: false }`. */
24
+ export declare function useSignalsAlert(id: string | undefined, grain: {
25
+ episodes: false;
26
+ }): OvokRequestState<SignalsRawAlert>;
27
+ export declare function useSignalsAlert(id?: string, grain?: {
28
+ episodes?: true;
29
+ }): OvokRequestState<SignalsAlert>;
30
+ /** Acknowledges an episode, or a raw alert with `{ episodes: false }`. */
31
+ export declare function useAcknowledgeSignalsAlert(grain: {
32
+ episodes: false;
33
+ }): OvokMutationState<string, SignalsRawAlert>;
34
+ export declare function useAcknowledgeSignalsAlert(grain?: {
35
+ episodes?: true;
36
+ }): OvokMutationState<string, SignalsAlert>;
37
+ export {};
@@ -0,0 +1,146 @@
1
+ "use strict";
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
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.useSignalsAlerts = useSignalsAlerts;
38
+ exports.useSignalsAlert = useSignalsAlert;
39
+ exports.useAcknowledgeSignalsAlert = useAcknowledgeSignalsAlert;
40
+ const React = __importStar(require("react"));
41
+ const api_hooks_1 = require("./api-hooks");
42
+ const index_1 = require("./index");
43
+ function useSignalsAlerts(query = {}) {
44
+ const client = (0, index_1.useClient)();
45
+ const queryKey = JSON.stringify(query);
46
+ const querySnapshot = React.useMemo(() => JSON.parse(queryKey), [queryKey]);
47
+ const listPage = React.useCallback((cursor) => {
48
+ const at = cursor === undefined ? {} : { cursor };
49
+ if (querySnapshot.episodes === false) {
50
+ const { episodes: _grain, ...filters } = querySnapshot;
51
+ return client.listSignalsRawAlerts({ ...filters, ...at });
52
+ }
53
+ const { episodes: _grain, ...filters } = querySnapshot;
54
+ return client.listSignalsAlerts({ ...filters, ...at });
55
+ }, [client, querySnapshot]);
56
+ const [items, setItems] = React.useState([]);
57
+ const [nextCursor, setNextCursor] = React.useState(null);
58
+ const [loading, setLoading] = React.useState(true);
59
+ const [error, setError] = React.useState();
60
+ const [revision, setRevision] = React.useState(0);
61
+ const generation = React.useRef(0);
62
+ const loadingRef = React.useRef(false);
63
+ React.useEffect(() => {
64
+ const requestGeneration = generation.current + 1;
65
+ generation.current = requestGeneration;
66
+ loadingRef.current = true;
67
+ setItems([]);
68
+ setNextCursor(null);
69
+ setError(undefined);
70
+ setLoading(true);
71
+ listPage()
72
+ .then((page) => {
73
+ if (generation.current === requestGeneration) {
74
+ setItems(page.items);
75
+ setNextCursor(page.nextCursor);
76
+ }
77
+ })
78
+ .catch((reason) => {
79
+ if (generation.current === requestGeneration) {
80
+ setError(toError(reason));
81
+ }
82
+ })
83
+ .finally(() => {
84
+ if (generation.current === requestGeneration) {
85
+ loadingRef.current = false;
86
+ setLoading(false);
87
+ }
88
+ });
89
+ return () => {
90
+ generation.current += 1;
91
+ };
92
+ }, [listPage, revision]);
93
+ const loadMore = React.useCallback(async () => {
94
+ if (nextCursor === null || loadingRef.current) {
95
+ return;
96
+ }
97
+ const requestGeneration = generation.current;
98
+ loadingRef.current = true;
99
+ setLoading(true);
100
+ setError(undefined);
101
+ try {
102
+ const page = await listPage(nextCursor);
103
+ if (generation.current === requestGeneration) {
104
+ setItems((current) => [...current, ...page.items]);
105
+ setNextCursor(page.nextCursor);
106
+ }
107
+ }
108
+ catch (reason) {
109
+ if (generation.current === requestGeneration) {
110
+ setError(toError(reason));
111
+ }
112
+ }
113
+ finally {
114
+ if (generation.current === requestGeneration) {
115
+ loadingRef.current = false;
116
+ setLoading(false);
117
+ }
118
+ }
119
+ }, [listPage, nextCursor]);
120
+ const reload = React.useCallback(() => {
121
+ setRevision((current) => current + 1);
122
+ }, []);
123
+ return {
124
+ items,
125
+ loading,
126
+ error,
127
+ reload,
128
+ hasMore: nextCursor !== null,
129
+ loadMore,
130
+ };
131
+ }
132
+ function useSignalsAlert(id, grain = {}) {
133
+ const client = (0, index_1.useClient)();
134
+ const episodes = grain.episodes !== false;
135
+ const load = React.useCallback(() => episodes
136
+ ? client.getSignalsAlert(id)
137
+ : client.getSignalsRawAlert(id), [client, id, episodes]);
138
+ return (0, api_hooks_1.useOvokRequest)(load, id !== undefined);
139
+ }
140
+ function useAcknowledgeSignalsAlert(grain = {}) {
141
+ const episodes = grain.episodes !== false;
142
+ return (0, api_hooks_1.useOvokMutation)((client, id) => episodes
143
+ ? client.acknowledgeSignalsAlert(id)
144
+ : client.acknowledgeSignalsRawAlert(id));
145
+ }
146
+ const toError = (error) => error instanceof Error ? error : new Error(String(error));