@ovok/core 0.4.10 → 0.4.11

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 (47) hide show
  1. package/README.md +34 -1
  2. package/dist/client/change-history/index.d.ts +2 -0
  3. package/dist/client/change-history/index.js +18 -0
  4. package/dist/client/change-history/methods.d.ts +4 -0
  5. package/dist/client/change-history/methods.js +25 -0
  6. package/dist/client/change-history/types.d.ts +34 -0
  7. package/dist/client/change-history/types.js +2 -0
  8. package/dist/client/consent/index.d.ts +2 -0
  9. package/dist/client/consent/index.js +18 -0
  10. package/dist/client/consent/methods.d.ts +6 -0
  11. package/dist/client/consent/methods.js +20 -0
  12. package/dist/client/consent/types.d.ts +26 -0
  13. package/dist/client/consent/types.js +7 -0
  14. package/dist/client/errors/ovok-error-utils.d.ts +10 -0
  15. package/dist/client/errors/ovok-error-utils.js +150 -0
  16. package/dist/client/errors/ovok-error.d.ts +16 -0
  17. package/dist/client/errors/ovok-error.js +67 -122
  18. package/dist/client/notifications/index.d.ts +2 -0
  19. package/dist/client/notifications/index.js +18 -0
  20. package/dist/client/notifications/methods.d.ts +7 -0
  21. package/dist/client/notifications/methods.js +29 -0
  22. package/dist/client/notifications/types.d.ts +90 -0
  23. package/dist/client/notifications/types.js +2 -0
  24. package/dist/client/ovok-client.d.ts +4 -1
  25. package/dist/client/ovok-client.js +14 -2
  26. package/dist/client/signals/methods.d.ts +15 -1
  27. package/dist/client/signals/methods.js +36 -0
  28. package/dist/client/signals/types.d.ts +16 -0
  29. package/dist/client/slim/methods.d.ts +20 -8
  30. package/dist/client/slim/methods.js +34 -1
  31. package/dist/client/slim/types.d.ts +51 -1
  32. package/dist/conformance/api-requirements.js +25 -1
  33. package/dist/conformance/capability-requirements.js +1 -1
  34. package/dist/hooks/account-hooks.d.ts +19 -0
  35. package/dist/hooks/account-hooks.js +92 -0
  36. package/dist/hooks/api-hooks.d.ts +1 -0
  37. package/dist/hooks/api-hooks.js +1 -0
  38. package/dist/hooks/index.d.ts +2 -0
  39. package/dist/hooks/index.js +31 -2
  40. package/dist/hooks/notification-hooks.d.ts +32 -0
  41. package/dist/hooks/notification-hooks.js +144 -0
  42. package/dist/hooks/notification-invalidation.d.ts +3 -0
  43. package/dist/hooks/notification-invalidation.js +23 -0
  44. package/dist/hooks/signals-alert-hooks.js +2 -0
  45. package/dist/index.d.ts +3 -0
  46. package/dist/index.js +3 -0
  47. package/package.json +1 -1
@@ -0,0 +1,92 @@
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.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
+ 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(() => client.listChangeHistory(params), [client, serialized]);
45
+ return (0, api_hooks_1.useOvokRequest)(load);
46
+ };
47
+ exports.useChangeHistory = useChangeHistory;
48
+ const useLegalConsent = () => {
49
+ const client = (0, index_1.useClient)();
50
+ const load = React.useCallback(() => client.getLegalConsent(), [client]);
51
+ return (0, api_hooks_1.useOvokRequest)(load);
52
+ };
53
+ exports.useLegalConsent = useLegalConsent;
54
+ const useSetLegalConsent = () => (0, api_hooks_1.useOvokMutation)((client, accepted) => client.setLegalConsent(accepted));
55
+ exports.useSetLegalConsent = useSetLegalConsent;
56
+ const useMedicalConsent = () => {
57
+ const client = (0, index_1.useClient)();
58
+ const load = React.useCallback(() => client.getMedicalConsent(), [client]);
59
+ return (0, api_hooks_1.useOvokRequest)(load);
60
+ };
61
+ exports.useMedicalConsent = useMedicalConsent;
62
+ const useSetMedicalConsent = () => (0, api_hooks_1.useOvokMutation)((client, accepted) => client.setMedicalConsent(accepted));
63
+ exports.useSetMedicalConsent = useSetMedicalConsent;
64
+ const useSlimThresholdV2 = () => {
65
+ const client = (0, index_1.useClient)();
66
+ const load = React.useCallback(() => client.getSlimThresholdV2(), [client]);
67
+ return (0, api_hooks_1.useOvokRequest)(load);
68
+ };
69
+ exports.useSlimThresholdV2 = useSlimThresholdV2;
70
+ const useSlimPatientThresholdV2 = (patientId) => {
71
+ const client = (0, index_1.useClient)();
72
+ const load = React.useCallback(() => patientId
73
+ ? client.getSlimPatientThresholdV2(patientId)
74
+ : Promise.reject(new Error("patientId is required")), [client, patientId]);
75
+ return (0, api_hooks_1.useOvokRequest)(load, patientId !== undefined);
76
+ };
77
+ exports.useSlimPatientThresholdV2 = useSlimPatientThresholdV2;
78
+ const useUpdateSlimThresholdV2 = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.updateSlimThresholdV2(body));
79
+ exports.useUpdateSlimThresholdV2 = useUpdateSlimThresholdV2;
80
+ const useUpdateSlimPatientThresholdV2 = () => (0, api_hooks_1.useOvokMutation)(async (client, params) => {
81
+ await client.updateSlimPatientThresholdV2(params.patientId, params.body);
82
+ return client.getSlimPatientThresholdV2(params.patientId);
83
+ });
84
+ exports.useUpdateSlimPatientThresholdV2 = useUpdateSlimPatientThresholdV2;
85
+ const useUnconfirmedLimits = () => {
86
+ const client = (0, index_1.useClient)();
87
+ const load = React.useCallback(() => client.listUnconfirmedLimits(), [client]);
88
+ return (0, api_hooks_1.useOvokRequest)(load);
89
+ };
90
+ exports.useUnconfirmedLimits = useUnconfirmedLimits;
91
+ const useRepushUnconfirmedLimits = () => (0, api_hooks_1.useOvokMutation)((client) => client.repushUnconfirmedLimits());
92
+ exports.useRepushUnconfirmedLimits = useRepushUnconfirmedLimits;
@@ -35,5 +35,6 @@ export declare const useProjectFeatures: () => OvokRequestState<OvokProjectFeatu
35
35
  export declare const useSlimPatients: (params?: SlimPatientListQuery) => OvokRequestState<SlimPage<SlimPatientListItem>>;
36
36
  export declare const useSlimDevices: (params?: SlimDeviceListQuery) => OvokRequestState<SlimPage<SlimDeviceListItem>>;
37
37
  export declare const useSlimDeviceTelemetry: (deviceId?: string) => OvokRequestState<SlimDeviceTelemetry>;
38
+ /** @deprecated Use useSlimOutOfBedNotifications, useSlimAlarms, or useSlimMedicalNotifications. */
38
39
  export declare const useSlimNotifications: (params?: SlimNotificationsQuery) => OvokRequestState<SlimNotificationsResponse>;
39
40
  export declare const useRecentSlimNotifications: (count?: number) => OvokRequestState<SlimRecentNotificationsResponse>;
@@ -164,6 +164,7 @@ const useSlimDeviceTelemetry = (deviceId) => {
164
164
  return useOvokRequest(load, deviceId !== undefined);
165
165
  };
166
166
  exports.useSlimDeviceTelemetry = useSlimDeviceTelemetry;
167
+ /** @deprecated Use useSlimOutOfBedNotifications, useSlimAlarms, or useSlimMedicalNotifications. */
167
168
  const useSlimNotifications = (params = {}) => {
168
169
  const client = (0, index_1.useClient)();
169
170
  const serialized = JSON.stringify(params);
@@ -11,6 +11,8 @@ export type { OvokMutationState, OvokRequestState } from "./api-hooks";
11
11
  export { useConsentSignature, useContent, useCreateVideoCallAppointment, useCreateVideoCallUserAccess, useDocuments, useVideoCallAccess, useVideoCallAppointments, } from "./experience-hooks";
12
12
  export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, useUpdateProjectTextSetting, } from "./platform-hooks";
13
13
  export { useEmailTemplates } from "./email-hooks";
14
+ export { useChangeHistory, useLegalConsent, useMedicalConsent, useRepushUnconfirmedLimits, useSetLegalConsent, useSetMedicalConsent, useSlimPatientThresholdV2, useSlimThresholdV2, useUnconfirmedLimits, useUpdateSlimPatientThresholdV2, useUpdateSlimThresholdV2, } from "./account-hooks";
15
+ export { useCreateNotificationNote, useCreateSignalsAlertNote, useCreateSignalsRawAlertNote, useDeleteNotificationNote, useDeleteSignalsNote, useNotificationNotes, useRecentAlarms, useRecentOutOfBed, useSignalsAlertNotes, useSignalsRawAlertNotes, useSlimAlarms, useSlimMedicalNotifications, useSlimOutOfBedNotifications, useUpdateNotificationNote, useUpdateSignalsNote, } from "./notification-hooks";
14
16
  export { useCmsDocument, useCmsDocuments, useLegalPage, useReleaseNotes, useTranslations, } from "./cms-hooks";
15
17
  export { useAcceptInvite, useInvitePatient, useInvitePractitioner, } from "./invites-hooks";
16
18
  export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientMeasurement, usePatientMeasurementHistory, usePatientDashboard, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
@@ -34,8 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useAcceptInvite = exports.useTranslations = exports.useReleaseNotes = exports.useLegalPage = exports.useCmsDocuments = exports.useCmsDocument = 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
- 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 = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useInvitePractitioner = exports.useInvitePatient = void 0;
37
+ exports.useSetMedicalConsent = exports.useSetLegalConsent = exports.useRepushUnconfirmedLimits = exports.useMedicalConsent = exports.useLegalConsent = exports.useChangeHistory = 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
+ 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 = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useInvitePractitioner = exports.useInvitePatient = exports.useAcceptInvite = exports.useTranslations = exports.useReleaseNotes = exports.useLegalPage = exports.useCmsDocuments = exports.useCmsDocument = exports.useUpdateSignalsNote = exports.useUpdateNotificationNote = exports.useSlimOutOfBedNotifications = exports.useSlimMedicalNotifications = exports.useSlimAlarms = exports.useSignalsRawAlertNotes = exports.useSignalsAlertNotes = exports.useRecentOutOfBed = exports.useRecentAlarms = exports.useNotificationNotes = exports.useDeleteSignalsNote = exports.useDeleteNotificationNote = exports.useCreateSignalsRawAlertNote = exports.useCreateSignalsAlertNote = exports.useCreateNotificationNote = exports.useUpdateSlimThresholdV2 = exports.useUpdateSlimPatientThresholdV2 = exports.useUnconfirmedLimits = exports.useSlimThresholdV2 = exports.useSlimPatientThresholdV2 = void 0;
39
+ exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = void 0;
39
40
  /*
40
41
  * The only React-dependent module in the package.
41
42
  *
@@ -107,6 +108,34 @@ Object.defineProperty(exports, "useUpdateLocalization", { enumerable: true, get:
107
108
  Object.defineProperty(exports, "useUpdateProjectTextSetting", { enumerable: true, get: function () { return platform_hooks_1.useUpdateProjectTextSetting; } });
108
109
  var email_hooks_1 = require("./email-hooks");
109
110
  Object.defineProperty(exports, "useEmailTemplates", { enumerable: true, get: function () { return email_hooks_1.useEmailTemplates; } });
111
+ var account_hooks_1 = require("./account-hooks");
112
+ Object.defineProperty(exports, "useChangeHistory", { enumerable: true, get: function () { return account_hooks_1.useChangeHistory; } });
113
+ Object.defineProperty(exports, "useLegalConsent", { enumerable: true, get: function () { return account_hooks_1.useLegalConsent; } });
114
+ Object.defineProperty(exports, "useMedicalConsent", { enumerable: true, get: function () { return account_hooks_1.useMedicalConsent; } });
115
+ Object.defineProperty(exports, "useRepushUnconfirmedLimits", { enumerable: true, get: function () { return account_hooks_1.useRepushUnconfirmedLimits; } });
116
+ Object.defineProperty(exports, "useSetLegalConsent", { enumerable: true, get: function () { return account_hooks_1.useSetLegalConsent; } });
117
+ Object.defineProperty(exports, "useSetMedicalConsent", { enumerable: true, get: function () { return account_hooks_1.useSetMedicalConsent; } });
118
+ Object.defineProperty(exports, "useSlimPatientThresholdV2", { enumerable: true, get: function () { return account_hooks_1.useSlimPatientThresholdV2; } });
119
+ Object.defineProperty(exports, "useSlimThresholdV2", { enumerable: true, get: function () { return account_hooks_1.useSlimThresholdV2; } });
120
+ Object.defineProperty(exports, "useUnconfirmedLimits", { enumerable: true, get: function () { return account_hooks_1.useUnconfirmedLimits; } });
121
+ Object.defineProperty(exports, "useUpdateSlimPatientThresholdV2", { enumerable: true, get: function () { return account_hooks_1.useUpdateSlimPatientThresholdV2; } });
122
+ Object.defineProperty(exports, "useUpdateSlimThresholdV2", { enumerable: true, get: function () { return account_hooks_1.useUpdateSlimThresholdV2; } });
123
+ var notification_hooks_1 = require("./notification-hooks");
124
+ Object.defineProperty(exports, "useCreateNotificationNote", { enumerable: true, get: function () { return notification_hooks_1.useCreateNotificationNote; } });
125
+ Object.defineProperty(exports, "useCreateSignalsAlertNote", { enumerable: true, get: function () { return notification_hooks_1.useCreateSignalsAlertNote; } });
126
+ Object.defineProperty(exports, "useCreateSignalsRawAlertNote", { enumerable: true, get: function () { return notification_hooks_1.useCreateSignalsRawAlertNote; } });
127
+ Object.defineProperty(exports, "useDeleteNotificationNote", { enumerable: true, get: function () { return notification_hooks_1.useDeleteNotificationNote; } });
128
+ Object.defineProperty(exports, "useDeleteSignalsNote", { enumerable: true, get: function () { return notification_hooks_1.useDeleteSignalsNote; } });
129
+ Object.defineProperty(exports, "useNotificationNotes", { enumerable: true, get: function () { return notification_hooks_1.useNotificationNotes; } });
130
+ Object.defineProperty(exports, "useRecentAlarms", { enumerable: true, get: function () { return notification_hooks_1.useRecentAlarms; } });
131
+ Object.defineProperty(exports, "useRecentOutOfBed", { enumerable: true, get: function () { return notification_hooks_1.useRecentOutOfBed; } });
132
+ Object.defineProperty(exports, "useSignalsAlertNotes", { enumerable: true, get: function () { return notification_hooks_1.useSignalsAlertNotes; } });
133
+ Object.defineProperty(exports, "useSignalsRawAlertNotes", { enumerable: true, get: function () { return notification_hooks_1.useSignalsRawAlertNotes; } });
134
+ Object.defineProperty(exports, "useSlimAlarms", { enumerable: true, get: function () { return notification_hooks_1.useSlimAlarms; } });
135
+ Object.defineProperty(exports, "useSlimMedicalNotifications", { enumerable: true, get: function () { return notification_hooks_1.useSlimMedicalNotifications; } });
136
+ Object.defineProperty(exports, "useSlimOutOfBedNotifications", { enumerable: true, get: function () { return notification_hooks_1.useSlimOutOfBedNotifications; } });
137
+ Object.defineProperty(exports, "useUpdateNotificationNote", { enumerable: true, get: function () { return notification_hooks_1.useUpdateNotificationNote; } });
138
+ Object.defineProperty(exports, "useUpdateSignalsNote", { enumerable: true, get: function () { return notification_hooks_1.useUpdateSignalsNote; } });
110
139
  var cms_hooks_1 = require("./cms-hooks");
111
140
  Object.defineProperty(exports, "useCmsDocument", { enumerable: true, get: function () { return cms_hooks_1.useCmsDocument; } });
112
141
  Object.defineProperty(exports, "useCmsDocuments", { enumerable: true, get: function () { return cms_hooks_1.useCmsDocuments; } });
@@ -0,0 +1,32 @@
1
+ import { CreateNotificationNote, NotificationNote, NotificationNotes, SlimAlarmQuery, SlimAlarmsPage, SlimMedicalNotificationsQuery, SlimMedicalNotificationsPage, SlimRecentAlarms, SlimRecentOutOfBed, UpdateNotificationNote } from "../client/notifications";
2
+ import { NotificationTargetKind } from "../client/notifications/types";
3
+ import { SlimNotificationsQuery, SlimNotificationsResponse } from "../client/slim/types";
4
+ import { OvokMutationState, OvokRequestState } from "./api-hooks";
5
+ export declare const useSlimAlarms: (params?: SlimAlarmQuery) => OvokRequestState<SlimAlarmsPage>;
6
+ export declare const useRecentAlarms: (count?: number) => OvokRequestState<SlimRecentAlarms>;
7
+ export declare const useRecentOutOfBed: (count?: number) => OvokRequestState<SlimRecentOutOfBed>;
8
+ export declare const useSlimOutOfBedNotifications: (params?: Omit<SlimNotificationsQuery, "type">) => OvokRequestState<SlimNotificationsResponse>;
9
+ /** Fetches every cursor page; a short page is not treated as the end of the feed. */
10
+ export declare const useSlimMedicalNotifications: (params?: Omit<SlimMedicalNotificationsQuery, "cursor">) => OvokRequestState<SlimMedicalNotificationsPage>;
11
+ export declare const useNotificationNotes: (kind: NotificationTargetKind, id?: string) => OvokRequestState<NotificationNotes>;
12
+ export declare const useCreateNotificationNote: () => OvokMutationState<CreateNotificationNote, NotificationNote>;
13
+ export declare const useUpdateNotificationNote: () => OvokMutationState<{
14
+ noteId: string;
15
+ body: UpdateNotificationNote;
16
+ }, NotificationNote>;
17
+ export declare const useDeleteNotificationNote: () => OvokMutationState<string, void>;
18
+ export declare const useSignalsAlertNotes: (episodeId?: string) => OvokRequestState<NotificationNotes>;
19
+ export declare const useSignalsRawAlertNotes: (alertId?: string) => OvokRequestState<NotificationNotes>;
20
+ export declare const useCreateSignalsAlertNote: () => OvokMutationState<{
21
+ episodeId: string;
22
+ text: string;
23
+ }, NotificationNote>;
24
+ export declare const useCreateSignalsRawAlertNote: () => OvokMutationState<{
25
+ alertId: string;
26
+ text: string;
27
+ }, NotificationNote>;
28
+ export declare const useUpdateSignalsNote: () => OvokMutationState<{
29
+ noteId: string;
30
+ body: UpdateNotificationNote;
31
+ }, NotificationNote>;
32
+ export declare const useDeleteSignalsNote: () => OvokMutationState<string, void>;
@@ -0,0 +1,144 @@
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.useDeleteSignalsNote = exports.useUpdateSignalsNote = exports.useCreateSignalsRawAlertNote = exports.useCreateSignalsAlertNote = exports.useSignalsRawAlertNotes = exports.useSignalsAlertNotes = exports.useDeleteNotificationNote = exports.useUpdateNotificationNote = exports.useCreateNotificationNote = exports.useNotificationNotes = exports.useSlimMedicalNotifications = exports.useSlimOutOfBedNotifications = exports.useRecentOutOfBed = exports.useRecentAlarms = exports.useSlimAlarms = void 0;
38
+ const React = __importStar(require("react"));
39
+ const api_hooks_1 = require("./api-hooks");
40
+ const notification_invalidation_1 = require("./notification-invalidation");
41
+ const index_1 = require("./index");
42
+ const useSlimAlarms = (params = {}) => {
43
+ const client = (0, index_1.useClient)();
44
+ const serialized = JSON.stringify(params);
45
+ const [revision, setRevision] = React.useState(0);
46
+ const load = React.useCallback(() => client.listSlimAlarms(params), [client, serialized, revision]);
47
+ const state = (0, api_hooks_1.useOvokRequest)(load);
48
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, state.reload), [client, state.reload]);
49
+ return { ...state, reload: () => setRevision((value) => value + 1) };
50
+ };
51
+ exports.useSlimAlarms = useSlimAlarms;
52
+ const useRecentAlarms = (count) => {
53
+ const client = (0, index_1.useClient)();
54
+ const load = React.useCallback(() => client.getRecentAlarms(count), [client, count]);
55
+ return (0, api_hooks_1.useOvokRequest)(load);
56
+ };
57
+ exports.useRecentAlarms = useRecentAlarms;
58
+ const useRecentOutOfBed = (count) => {
59
+ const client = (0, index_1.useClient)();
60
+ const load = React.useCallback(() => client.getRecentOutOfBed(count), [client, count]);
61
+ return (0, api_hooks_1.useOvokRequest)(load);
62
+ };
63
+ exports.useRecentOutOfBed = useRecentOutOfBed;
64
+ const useSlimOutOfBedNotifications = (params = {}) => {
65
+ const client = (0, index_1.useClient)();
66
+ const serialized = JSON.stringify(params);
67
+ const state = (0, api_hooks_1.useOvokRequest)(React.useCallback(() => client.listSlimOutOfBedNotifications(params), [client, serialized]));
68
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, state.reload), [client, state.reload]);
69
+ return state;
70
+ };
71
+ exports.useSlimOutOfBedNotifications = useSlimOutOfBedNotifications;
72
+ /** Fetches every cursor page; a short page is not treated as the end of the feed. */
73
+ const useSlimMedicalNotifications = (params = {}) => {
74
+ const client = (0, index_1.useClient)();
75
+ const serialized = JSON.stringify(params);
76
+ const load = React.useCallback(async () => {
77
+ var _a;
78
+ const items = [];
79
+ let cursor;
80
+ const seen = new Set();
81
+ do {
82
+ const page = await client.listSlimMedicalNotifications({ ...params, cursor });
83
+ items.push(...page.items);
84
+ cursor = (_a = page.nextCursor) !== null && _a !== void 0 ? _a : undefined;
85
+ if (cursor && seen.has(cursor)) {
86
+ throw new Error("Medical notification paging returned a repeated cursor.");
87
+ }
88
+ if (cursor) {
89
+ seen.add(cursor);
90
+ }
91
+ } while (cursor !== undefined);
92
+ return { items, nextCursor: null };
93
+ }, [client, serialized]);
94
+ const state = (0, api_hooks_1.useOvokRequest)(load);
95
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, state.reload), [client, state.reload]);
96
+ return state;
97
+ };
98
+ exports.useSlimMedicalNotifications = useSlimMedicalNotifications;
99
+ const useNotificationNotes = (kind, id) => {
100
+ const client = (0, index_1.useClient)();
101
+ const [revision, setRevision] = React.useState(0);
102
+ const load = React.useCallback(() => (id ? client.listNotificationNotes(kind, id) : Promise.reject(new Error("id is required"))), [client, kind, id, revision]);
103
+ const state = (0, api_hooks_1.useOvokRequest)(load, id !== undefined);
104
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, () => setRevision((value) => value + 1)), [client, kind, id]);
105
+ return state;
106
+ };
107
+ exports.useNotificationNotes = useNotificationNotes;
108
+ function useNoteMutation(request) {
109
+ return (0, api_hooks_1.useOvokMutation)(async (client, params) => {
110
+ const result = await request(client, params);
111
+ (0, notification_invalidation_1.notifyNotificationChanges)(client);
112
+ return result;
113
+ });
114
+ }
115
+ const useCreateNotificationNote = () => useNoteMutation((client, body) => client.createNotificationNote(body));
116
+ exports.useCreateNotificationNote = useCreateNotificationNote;
117
+ const useUpdateNotificationNote = () => useNoteMutation((client, params) => client.updateNotificationNote(params.noteId, params.body));
118
+ exports.useUpdateNotificationNote = useUpdateNotificationNote;
119
+ const useDeleteNotificationNote = () => useNoteMutation((client, noteId) => client.deleteNotificationNote(noteId));
120
+ exports.useDeleteNotificationNote = useDeleteNotificationNote;
121
+ const useSignalsAlertNotes = (episodeId) => {
122
+ const client = (0, index_1.useClient)();
123
+ const [revision, setRevision] = React.useState(0);
124
+ const load = React.useCallback(() => (episodeId ? client.listSignalsAlertNotes(episodeId) : Promise.reject(new Error("episodeId is required"))), [client, episodeId, revision]);
125
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, () => setRevision((value) => value + 1)), [client, episodeId]);
126
+ return (0, api_hooks_1.useOvokRequest)(load, episodeId !== undefined);
127
+ };
128
+ exports.useSignalsAlertNotes = useSignalsAlertNotes;
129
+ const useSignalsRawAlertNotes = (alertId) => {
130
+ const client = (0, index_1.useClient)();
131
+ const [revision, setRevision] = React.useState(0);
132
+ const load = React.useCallback(() => (alertId ? client.listSignalsRawAlertNotes(alertId) : Promise.reject(new Error("alertId is required"))), [client, alertId, revision]);
133
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, () => setRevision((value) => value + 1)), [client, alertId]);
134
+ return (0, api_hooks_1.useOvokRequest)(load, alertId !== undefined);
135
+ };
136
+ exports.useSignalsRawAlertNotes = useSignalsRawAlertNotes;
137
+ const useCreateSignalsAlertNote = () => useNoteMutation((client, params) => client.createSignalsAlertNote(params.episodeId, { text: params.text }));
138
+ exports.useCreateSignalsAlertNote = useCreateSignalsAlertNote;
139
+ const useCreateSignalsRawAlertNote = () => useNoteMutation((client, params) => client.createSignalsRawAlertNote(params.alertId, { text: params.text }));
140
+ exports.useCreateSignalsRawAlertNote = useCreateSignalsRawAlertNote;
141
+ const useUpdateSignalsNote = () => useNoteMutation((client, params) => client.updateSignalsNote(params.noteId, params.body));
142
+ exports.useUpdateSignalsNote = useUpdateSignalsNote;
143
+ const useDeleteSignalsNote = () => useNoteMutation((client, noteId) => client.deleteSignalsNote(noteId));
144
+ exports.useDeleteSignalsNote = useDeleteSignalsNote;
@@ -0,0 +1,3 @@
1
+ import { OvokClient } from "../client/ovok-client";
2
+ export declare function subscribeToNotificationChanges(client: OvokClient, listener: () => void): () => void;
3
+ export declare function notifyNotificationChanges(client: OvokClient): void;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribeToNotificationChanges = subscribeToNotificationChanges;
4
+ exports.notifyNotificationChanges = notifyNotificationChanges;
5
+ const listeners = new WeakMap();
6
+ function subscribeToNotificationChanges(client, listener) {
7
+ var _a;
8
+ const current = (_a = listeners.get(client)) !== null && _a !== void 0 ? _a : new Set();
9
+ current.add(listener);
10
+ listeners.set(client, current);
11
+ return () => {
12
+ current.delete(listener);
13
+ if (current.size === 0) {
14
+ listeners.delete(client);
15
+ }
16
+ };
17
+ }
18
+ function notifyNotificationChanges(client) {
19
+ var _a;
20
+ for (const listener of (_a = listeners.get(client)) !== null && _a !== void 0 ? _a : []) {
21
+ listener();
22
+ }
23
+ }
@@ -39,6 +39,7 @@ exports.useSignalsAlert = useSignalsAlert;
39
39
  exports.useAcknowledgeSignalsAlert = useAcknowledgeSignalsAlert;
40
40
  const React = __importStar(require("react"));
41
41
  const api_hooks_1 = require("./api-hooks");
42
+ const notification_invalidation_1 = require("./notification-invalidation");
42
43
  const index_1 = require("./index");
43
44
  function useSignalsAlerts(query = {}) {
44
45
  const client = (0, index_1.useClient)();
@@ -60,6 +61,7 @@ function useSignalsAlerts(query = {}) {
60
61
  const [revision, setRevision] = React.useState(0);
61
62
  const generation = React.useRef(0);
62
63
  const loadingRef = React.useRef(false);
64
+ React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, () => setRevision((value) => value + 1)), [client]);
63
65
  React.useEffect(() => {
64
66
  const requestGeneration = generation.current + 1;
65
67
  generation.current = requestGeneration;
package/dist/index.d.ts CHANGED
@@ -941,9 +941,12 @@ export * from "./conformance/capability-requirements";
941
941
  export * from "./conformance/api-requirements";
942
942
  export * from "./conformance/capability";
943
943
  export * from "./client/platform/types";
944
+ export * from "./client/change-history";
945
+ export * from "./client/consent";
944
946
  export * from "./client/email";
945
947
  export * from "./client/cms";
946
948
  export * from "./client/invites";
949
+ export * from "./client/notifications";
947
950
  export * from "./client/slim/types";
948
951
  export * from "./client/experience/types";
949
952
  export * from "./client/patient/types";
package/dist/index.js CHANGED
@@ -62,9 +62,12 @@ __exportStar(require("./conformance/capability-requirements"), exports);
62
62
  __exportStar(require("./conformance/api-requirements"), exports);
63
63
  __exportStar(require("./conformance/capability"), exports);
64
64
  __exportStar(require("./client/platform/types"), exports);
65
+ __exportStar(require("./client/change-history"), exports);
66
+ __exportStar(require("./client/consent"), exports);
65
67
  __exportStar(require("./client/email"), exports);
66
68
  __exportStar(require("./client/cms"), exports);
67
69
  __exportStar(require("./client/invites"), exports);
70
+ __exportStar(require("./client/notifications"), exports);
68
71
  __exportStar(require("./client/slim/types"), exports);
69
72
  __exportStar(require("./client/experience/types"), exports);
70
73
  __exportStar(require("./client/patient/types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",