@ovok/core 0.4.37 → 0.4.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/auth/account-storage.d.ts +1 -0
- package/dist/client/auth/account-storage.js +2 -1
- package/dist/{utils → client}/auth/exchange-code.d.ts +1 -1
- package/dist/{utils → client}/auth/generate-code-challenge-and-verifier.js +5 -17
- package/dist/{utils → client}/auth/handle-tenant-code.d.ts +1 -1
- package/dist/{utils → client}/auth/handle-tenant-code.js +1 -1
- package/dist/client/auth/methods/appleLogin.js +2 -6
- package/dist/client/auth/methods/changePassword.js +2 -1
- package/dist/client/auth/methods/getSessions.js +2 -1
- package/dist/client/auth/methods/googleLogin.js +2 -6
- package/dist/client/auth/methods/login.js +26 -44
- package/dist/client/auth/methods/logout.js +2 -1
- package/dist/client/auth/methods/requestDeleteUser.js +5 -4
- package/dist/client/auth/methods/revokeSessions.js +2 -1
- package/dist/client/auth/methods/socialLogin.d.ts +7 -0
- package/dist/client/auth/methods/socialLogin.js +11 -0
- package/dist/client/auth/session-fetch.js +10 -12
- package/dist/client/auth/session-http.js +8 -19
- package/dist/client/auth/sha256.d.ts +2 -0
- package/dist/client/auth/sha256.js +65 -0
- package/dist/{utils → client}/auth/start-login.d.ts +2 -2
- package/dist/client/change-history/methods.js +2 -1
- package/dist/client/cms/methods.js +16 -28
- package/dist/client/consent/methods.js +3 -2
- package/dist/client/email/methods.js +2 -1
- package/dist/client/errors/ovok-error-utils.d.ts +6 -0
- package/dist/client/errors/ovok-error-utils.js +10 -1
- package/dist/client/errors/ovok-error.js +6 -13
- package/dist/client/errors/rate-limit-error.js +2 -6
- package/dist/client/experience/methods.js +13 -12
- package/dist/client/invites/methods.js +8 -12
- package/dist/client/notifications/methods.js +4 -3
- package/dist/client/observation/fhir-systems.d.ts +4 -0
- package/dist/client/observation/fhir-systems.js +7 -0
- package/dist/client/observation/methods/generateObservationBodiesByMeasurement.js +23 -29
- package/dist/client/observation/methods/getLatestObservationsByCodes.js +6 -9
- package/dist/client/observation/methods/observationsToMeasurements.js +44 -91
- package/dist/client/observation/services/base-observation-service.js +4 -3
- package/dist/client/observation/services/blood-pressure.js +1 -4
- package/dist/client/observation/services/{baby-sleep.d.ts → component-observation-services.d.ts} +18 -13
- package/dist/client/observation/services/component-observation-services.js +69 -0
- package/dist/client/observation/services/creator.d.ts +1 -2
- package/dist/client/observation/services/creator.js +14 -18
- package/dist/client/observation/services/ecg-observation-fragments.js +5 -6
- package/dist/client/observation/services/ecg.js +3 -2
- package/dist/client/observation/services/lipid-panel.js +8 -12
- package/dist/client/observation/services/measurement-time.d.ts +4 -0
- package/dist/client/observation/services/measurement-time.js +6 -0
- package/dist/client/observation/services/single-value-services.d.ts +5 -0
- package/dist/client/observation/services/single-value-services.js +6 -1
- package/dist/client/observation/services/uric-acid-service.js +6 -7
- package/dist/client/observation/types/generate-measurement/HealthConnectTypes.d.ts +2 -458
- package/dist/client/observation/types/generate-measurement/HealthConnectTypes.js +0 -6
- package/dist/client/offline/offline-measurement-queue.js +31 -28
- package/dist/client/ovok-client.d.ts +13 -2
- package/dist/client/ovok-client.js +95 -45
- package/dist/client/patient/methods.js +25 -25
- package/dist/client/patient-sharing/methods.js +4 -3
- package/dist/client/platform/methods.js +17 -16
- package/dist/client/platform/types.d.ts +3 -6
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +2 -1
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +2 -1
- package/dist/client/request-options.d.ts +2 -0
- package/dist/client/request-options.js +6 -0
- package/dist/client/signals/errors.js +2 -6
- package/dist/client/signals/methods.js +14 -13
- package/dist/client/slim/live-read.d.ts +4 -0
- package/dist/client/slim/live-read.js +87 -0
- package/dist/client/slim/methods.d.ts +3 -0
- package/dist/client/slim/methods.js +63 -146
- package/dist/client/storage.js +3 -2
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/conformance/capability.js +8 -7
- package/dist/hooks/account-hooks.js +1 -1
- package/dist/hooks/api-hooks.d.ts +5 -6
- package/dist/hooks/api-hooks.js +10 -24
- package/dist/hooks/cms-hooks.js +8 -13
- package/dist/hooks/experience-hooks.js +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/invites-hooks.js +0 -1
- package/dist/hooks/notification-hooks.d.ts +4 -1
- package/dist/hooks/notification-hooks.js +28 -35
- package/dist/hooks/notification-invalidation.d.ts +1 -1
- package/dist/hooks/notification-note-hooks.js +13 -28
- package/dist/hooks/observation-hooks.js +2 -4
- package/dist/hooks/patient-hooks.js +1 -1
- package/dist/hooks/patient-sharing-hooks.js +1 -2
- package/dist/hooks/poll-hooks.js +10 -8
- package/dist/hooks/signals-alert-hooks.js +4 -6
- package/package.json +1 -1
- package/dist/client/observation/services/baby-sleep.js +0 -69
- package/dist/client/observation/services/respiratory-therapy.d.ts +0 -28
- package/dist/client/observation/services/respiratory-therapy.js +0 -69
- package/dist/utils/auth/sha256.d.ts +0 -8
- package/dist/utils/auth/sha256.js +0 -300
- /package/dist/{utils → client}/auth/exchange-code.js +0 -0
- /package/dist/{utils → client}/auth/generate-code-challenge-and-verifier.d.ts +0 -0
- /package/dist/{utils → client}/auth/start-login.js +0 -0
|
@@ -21,33 +21,34 @@ exports.getI18nextDocument = getI18nextDocument;
|
|
|
21
21
|
exports.updateI18nextDocument = updateI18nextDocument;
|
|
22
22
|
exports.getPatientLastObservations = getPatientLastObservations;
|
|
23
23
|
const query_string_1 = require("../query-string");
|
|
24
|
+
const request_options_1 = require("../request-options");
|
|
24
25
|
async function getAccounts(requestOptions) {
|
|
25
|
-
return this.get("/accounts", ...(
|
|
26
|
+
return this.get("/accounts", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
26
27
|
}
|
|
27
28
|
async function listAdministeredProjects(params = {}, requestOptions) {
|
|
28
|
-
return this.get(`/v1/projects${(0, query_string_1.toQueryString)(params)}`, ...(
|
|
29
|
+
return this.get(`/v1/projects${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
29
30
|
}
|
|
30
31
|
async function listProjectMembers(params = {}, requestOptions) {
|
|
31
|
-
return this.get(`/v1/projects/me/members${(0, query_string_1.toQueryString)(params)}`, ...(
|
|
32
|
+
return this.get(`/v1/projects/me/members${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
32
33
|
}
|
|
33
34
|
async function inviteProjectMember(body, requestOptions) {
|
|
34
35
|
return this.post("/v1/projects/me/members", body, undefined, requestOptions);
|
|
35
36
|
}
|
|
36
37
|
async function updateProjectMember(membershipId, body, requestOptions) {
|
|
37
|
-
return (await this.patch(`/v1/projects/me/members/${encodeURIComponent(membershipId)}`, body, ...(
|
|
38
|
+
return (await this.patch(`/v1/projects/me/members/${encodeURIComponent(membershipId)}`, body, ...(0, request_options_1.optionalArg)(requestOptions)));
|
|
38
39
|
}
|
|
39
40
|
async function removeProjectMember(membershipId, requestOptions) {
|
|
40
|
-
return (await this.delete(`/v1/projects/me/members/${encodeURIComponent(membershipId)}`, ...(
|
|
41
|
+
return (await this.delete(`/v1/projects/me/members/${encodeURIComponent(membershipId)}`, ...(0, request_options_1.optionalArg)(requestOptions)));
|
|
41
42
|
}
|
|
42
43
|
async function getProjectFeatures(requestOptions) {
|
|
43
|
-
return this.get("/v1/projects/me/features", ...(
|
|
44
|
+
return this.get("/v1/projects/me/features", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
44
45
|
}
|
|
45
46
|
async function updateProjectFeatures(features, requestOptions) {
|
|
46
47
|
const body = { features };
|
|
47
|
-
return (await this.patch("/v1/projects/me/features", body, ...(
|
|
48
|
+
return (await this.patch("/v1/projects/me/features", body, ...(0, request_options_1.optionalArg)(requestOptions)));
|
|
48
49
|
}
|
|
49
50
|
async function getProjectSettings(requestOptions) {
|
|
50
|
-
return this.get("/v1/project/settings", ...(
|
|
51
|
+
return this.get("/v1/project/settings", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
51
52
|
}
|
|
52
53
|
async function updateProjectSetting(key, enabled, requestOptions) {
|
|
53
54
|
return (await this.put(`/v1/project/settings/${encodeURIComponent(key)}`, { enabled }, undefined, requestOptions));
|
|
@@ -56,29 +57,29 @@ async function updateProjectTextSetting(key, value, requestOptions) {
|
|
|
56
57
|
return (await this.put(`/v1/project/settings/values/${encodeURIComponent(key)}`, { value }, undefined, requestOptions));
|
|
57
58
|
}
|
|
58
59
|
async function getLocales(requestOptions) {
|
|
59
|
-
return this.get("/locales", ...(
|
|
60
|
+
return this.get("/locales", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
60
61
|
}
|
|
61
62
|
async function updateLocales(locales, requestOptions) {
|
|
62
|
-
return (await this.patch("/locales", locales, ...(
|
|
63
|
+
return (await this.patch("/locales", locales, ...(0, request_options_1.optionalArg)(requestOptions)));
|
|
63
64
|
}
|
|
64
65
|
async function listLocalizations(language, params = {}, requestOptions) {
|
|
65
|
-
return this.get(`/localization/${encodeURIComponent(language)}${(0, query_string_1.toQueryString)(params)}`, ...(
|
|
66
|
+
return this.get(`/localization/${encodeURIComponent(language)}${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
66
67
|
}
|
|
67
68
|
async function getLocalization(language, key, requestOptions) {
|
|
68
|
-
return this.get(`/localization/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, ...(
|
|
69
|
+
return this.get(`/localization/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
69
70
|
}
|
|
70
71
|
async function updateLocalization(language, key, body, requestOptions) {
|
|
71
72
|
return (await this.put(`/localization/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, body, undefined, requestOptions));
|
|
72
73
|
}
|
|
73
74
|
async function deleteLocalization(language, key, requestOptions) {
|
|
74
|
-
await this.delete(`/localization/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, ...(
|
|
75
|
+
await this.delete(`/localization/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
75
76
|
}
|
|
76
77
|
async function getI18nextDocument(language, requestOptions) {
|
|
77
|
-
return this.get(`/localization/i18next/${encodeURIComponent(language)}`, ...(
|
|
78
|
+
return this.get(`/localization/i18next/${encodeURIComponent(language)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
78
79
|
}
|
|
79
80
|
async function updateI18nextDocument(language, document, requestOptions) {
|
|
80
|
-
await this.patch(`/localization/i18next/${encodeURIComponent(language)}`, document, ...(
|
|
81
|
+
await this.patch(`/localization/i18next/${encodeURIComponent(language)}`, document, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
81
82
|
}
|
|
82
83
|
async function getPatientLastObservations(patientId, params, requestOptions) {
|
|
83
|
-
return this.get(`/patient/${encodeURIComponent(patientId)}/observation${(0, query_string_1.toQueryString)(params)}`, ...(
|
|
84
|
+
return this.get(`/patient/${encodeURIComponent(patientId)}/observation${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
84
85
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Bundle, Observation } from "@medplum/fhirtypes";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
count: number;
|
|
6
|
-
resources: T[];
|
|
7
|
-
};
|
|
2
|
+
import { SlimPage } from "../slim/types";
|
|
3
|
+
/** The same page shape as `SlimPage`. */
|
|
4
|
+
export type OvokPage<T> = SlimPage<T>;
|
|
8
5
|
export type OvokAccount = {
|
|
9
6
|
email: string;
|
|
10
7
|
name: string;
|
package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createQuestionnaireResponseWithObservations = createQuestionnaireResponseWithObservations;
|
|
4
|
+
const request_options_1 = require("../../request-options");
|
|
4
5
|
async function createQuestionnaireResponseWithObservations(questionnaireResponse, observations, requestOptions) {
|
|
5
6
|
const bundle = {
|
|
6
7
|
resourceType: "Bundle",
|
|
@@ -24,5 +25,5 @@ async function createQuestionnaireResponseWithObservations(questionnaireResponse
|
|
|
24
25
|
})),
|
|
25
26
|
],
|
|
26
27
|
};
|
|
27
|
-
return this.executeBatch(bundle, ...(
|
|
28
|
+
return this.executeBatch(bundle, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
28
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.submitQuestionnaireResponse = submitQuestionnaireResponse;
|
|
4
|
+
const request_options_1 = require("../../request-options");
|
|
4
5
|
async function submitQuestionnaireResponse(questionnaireResponse, observations = [], requestOptions) {
|
|
5
|
-
return this.createQuestionnaireResponseWithObservations(questionnaireResponse, observations, ...(
|
|
6
|
+
return this.createQuestionnaireResponseWithObservations(questionnaireResponse, observations, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
6
7
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionalArg = void 0;
|
|
4
|
+
/** Forwards an optional trailing argument only when the caller gave one, so call arity stays the same. */
|
|
5
|
+
const optionalArg = (value) => (value === undefined ? [] : [value]);
|
|
6
|
+
exports.optionalArg = optionalArg;
|
|
@@ -4,6 +4,7 @@ exports.SignalsError = void 0;
|
|
|
4
4
|
exports.isSignalsError = isSignalsError;
|
|
5
5
|
exports.mapSignalsError = mapSignalsError;
|
|
6
6
|
const ovok_error_1 = require("../errors/ovok-error");
|
|
7
|
+
const ovok_error_utils_1 = require("../errors/ovok-error-utils");
|
|
7
8
|
const SIGNALS_ERROR_STATUSES = {
|
|
8
9
|
signals_threshold_not_editable: 409,
|
|
9
10
|
signals_patient_not_enrolled: 409,
|
|
@@ -33,12 +34,7 @@ class SignalsError extends Error {
|
|
|
33
34
|
this.status = status;
|
|
34
35
|
this.fieldErrors = (_a = options.fieldErrors) !== null && _a !== void 0 ? _a : [];
|
|
35
36
|
if (options.cause !== undefined) {
|
|
36
|
-
|
|
37
|
-
configurable: true,
|
|
38
|
-
enumerable: false,
|
|
39
|
-
value: options.cause,
|
|
40
|
-
writable: false,
|
|
41
|
-
});
|
|
37
|
+
(0, ovok_error_utils_1.withCause)(this, options.cause);
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
}
|
|
@@ -22,6 +22,7 @@ exports.getSignalsRawAlert = getSignalsRawAlert;
|
|
|
22
22
|
exports.acknowledgeSignalsRawAlert = acknowledgeSignalsRawAlert;
|
|
23
23
|
exports.getSignalsSettings = getSignalsSettings;
|
|
24
24
|
exports.updateSignalsSettings = updateSignalsSettings;
|
|
25
|
+
const request_options_1 = require("../request-options");
|
|
25
26
|
/**
|
|
26
27
|
* Enables Signals for an existing patient. The operation is idempotent; retry after 409 or 503.
|
|
27
28
|
* Observations saved through Ovok are forwarded by the backend, so callers should not submit
|
|
@@ -31,10 +32,10 @@ function enableSignalsForPatient(patientId, requestOptions) {
|
|
|
31
32
|
return this.post(`/fhir/Patient/${encodeURIComponent(patientId)}/$enable-signals`, undefined, undefined, requestOptions);
|
|
32
33
|
}
|
|
33
34
|
function getSignalsThresholds(patientId, requestOptions) {
|
|
34
|
-
return this.get(`/v1/signals/patients/${encodeURIComponent(patientId)}/thresholds`, ...(
|
|
35
|
+
return this.get(`/v1/signals/patients/${encodeURIComponent(patientId)}/thresholds`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
35
36
|
}
|
|
36
37
|
function listUnconfirmedLimits(requestOptions) {
|
|
37
|
-
return this.get("/signals/config/unconfirmed", ...(
|
|
38
|
+
return this.get("/signals/config/unconfirmed", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
38
39
|
}
|
|
39
40
|
function repushUnconfirmedLimits(requestOptions) {
|
|
40
41
|
return this.post("/signals/config/unconfirmed/repush", undefined, undefined, requestOptions);
|
|
@@ -43,7 +44,7 @@ function setSignalsThreshold(patientId, code, body, requestOptions) {
|
|
|
43
44
|
return this.put(`/v1/signals/patients/${encodeURIComponent(patientId)}/thresholds/${encodeURIComponent(code)}`, body, undefined, requestOptions);
|
|
44
45
|
}
|
|
45
46
|
function removeSignalsThreshold(patientId, code, reason, requestOptions) {
|
|
46
|
-
return this.delete(`/v1/signals/patients/${encodeURIComponent(patientId)}/thresholds/${encodeURIComponent(code)}?reason=${encodeURIComponent(reason)}`, ...(
|
|
47
|
+
return this.delete(`/v1/signals/patients/${encodeURIComponent(patientId)}/thresholds/${encodeURIComponent(code)}?reason=${encodeURIComponent(reason)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
47
48
|
}
|
|
48
49
|
// Each route's own filters, in the order they are sent: a key outside the list is never sent, so
|
|
49
50
|
// a wider object passed as an episode query can't turn into a refused request.
|
|
@@ -71,22 +72,22 @@ function serializeSignalsAlertsQuery(query = {}, keys = EPISODE_QUERY_KEYS) {
|
|
|
71
72
|
}
|
|
72
73
|
function listSignalsAlerts(query = {}, requestOptions) {
|
|
73
74
|
const serialized = serializeSignalsAlertsQuery(query);
|
|
74
|
-
return this.get(`/v1/signals/alerts${serialized ? `?${serialized}` : ""}`, {
|
|
75
|
+
return this.get(`/v1/signals/alerts${serialized ? `?${serialized}` : ""}`, { cache: "reload", ...requestOptions });
|
|
75
76
|
}
|
|
76
77
|
function getSignalsAlert(episodeId, requestOptions) {
|
|
77
|
-
return this.get(`/v1/signals/alerts/${encodeURIComponent(episodeId)}`, {
|
|
78
|
+
return this.get(`/v1/signals/alerts/${encodeURIComponent(episodeId)}`, { cache: "reload", ...requestOptions });
|
|
78
79
|
}
|
|
79
80
|
function acknowledgeSignalsAlert(episodeId, requestOptions) {
|
|
80
81
|
return this.post(`/v1/signals/alerts/${encodeURIComponent(episodeId)}/ack`, undefined, undefined, requestOptions);
|
|
81
82
|
}
|
|
82
83
|
function listSignalsAlertNotes(episodeId, requestOptions) {
|
|
83
|
-
return this.get(`/v1/signals/alerts/${encodeURIComponent(episodeId)}/notes`, {
|
|
84
|
+
return this.get(`/v1/signals/alerts/${encodeURIComponent(episodeId)}/notes`, { cache: "reload", ...requestOptions });
|
|
84
85
|
}
|
|
85
86
|
function createSignalsAlertNote(episodeId, body, requestOptions) {
|
|
86
87
|
return this.post(`/v1/signals/alerts/${encodeURIComponent(episodeId)}/notes`, body, undefined, requestOptions);
|
|
87
88
|
}
|
|
88
89
|
function listSignalsRawAlertNotes(alertId, requestOptions) {
|
|
89
|
-
return this.get(`/v1/signals/raw-alerts/${encodeURIComponent(alertId)}/notes`, {
|
|
90
|
+
return this.get(`/v1/signals/raw-alerts/${encodeURIComponent(alertId)}/notes`, { cache: "reload", ...requestOptions });
|
|
90
91
|
}
|
|
91
92
|
function createSignalsRawAlertNote(alertId, body, requestOptions) {
|
|
92
93
|
return this.post(`/v1/signals/raw-alerts/${encodeURIComponent(alertId)}/notes`, body, undefined, requestOptions);
|
|
@@ -95,10 +96,10 @@ function updateSignalsNote(noteId, body, requestOptions) {
|
|
|
95
96
|
return this.put(`/v1/signals/notes/${encodeURIComponent(noteId)}`, body, undefined, requestOptions);
|
|
96
97
|
}
|
|
97
98
|
function patchSignalsNote(noteId, body, requestOptions) {
|
|
98
|
-
return this.patch(`/v1/signals/notes/${encodeURIComponent(noteId)}`, body, ...(
|
|
99
|
+
return this.patch(`/v1/signals/notes/${encodeURIComponent(noteId)}`, body, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
99
100
|
}
|
|
100
101
|
async function deleteSignalsNote(noteId, requestOptions) {
|
|
101
|
-
await this.delete(`/v1/signals/notes/${encodeURIComponent(noteId)}`, ...(
|
|
102
|
+
await this.delete(`/v1/signals/notes/${encodeURIComponent(noteId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
104
105
|
* The project's individual Signals alerts, not episodes: works whether or not the project's
|
|
@@ -106,10 +107,10 @@ async function deleteSignalsNote(noteId, requestOptions) {
|
|
|
106
107
|
*/
|
|
107
108
|
function listSignalsRawAlerts(query = {}, requestOptions) {
|
|
108
109
|
const serialized = serializeSignalsAlertsQuery(query, RAW_ALERT_QUERY_KEYS);
|
|
109
|
-
return this.get(`/v1/signals/raw-alerts${serialized ? `?${serialized}` : ""}`, {
|
|
110
|
+
return this.get(`/v1/signals/raw-alerts${serialized ? `?${serialized}` : ""}`, { cache: "reload", ...requestOptions });
|
|
110
111
|
}
|
|
111
112
|
function getSignalsRawAlert(alertId, requestOptions) {
|
|
112
|
-
return this.get(`/v1/signals/raw-alerts/${encodeURIComponent(alertId)}`, {
|
|
113
|
+
return this.get(`/v1/signals/raw-alerts/${encodeURIComponent(alertId)}`, { cache: "reload", ...requestOptions });
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Acknowledges one alert: it resolves, and `acknowledgedAt` and `acknowledgedActor` record when
|
|
@@ -120,11 +121,11 @@ function acknowledgeSignalsRawAlert(alertId, requestOptions) {
|
|
|
120
121
|
return this.post(`/v1/signals/raw-alerts/${encodeURIComponent(alertId)}/ack`, undefined, undefined, requestOptions);
|
|
121
122
|
}
|
|
122
123
|
function getSignalsSettings(requestOptions) {
|
|
123
|
-
return this.get("/v1/signals/settings", ...(
|
|
124
|
+
return this.get("/v1/signals/settings", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
124
125
|
}
|
|
125
126
|
function updateSignalsSettings(patch, reason, requestOptions) {
|
|
126
127
|
return this.patch("/v1/signals/settings", {
|
|
127
128
|
...patch,
|
|
128
129
|
...(reason !== undefined ? { reason } : {}),
|
|
129
|
-
}, ...(
|
|
130
|
+
}, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
130
131
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
2
|
+
import { OvokClient } from "../ovok-client";
|
|
3
|
+
/** A `cache: "reload"` GET that shares one in-flight request between identical live reads. */
|
|
4
|
+
export declare const liveGet: <T>(client: OvokClient, path: string, requestOptions?: MedplumRequestOptions) => Promise<T>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.liveGet = void 0;
|
|
4
|
+
const ovok_error_utils_1 = require("../errors/ovok-error-utils");
|
|
5
|
+
const inFlightLiveReads = new Map();
|
|
6
|
+
const dedupeLiveRead = (client, path, load, options) => {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8
|
+
const signal = (_a = options === null || options === void 0 ? void 0 : options.signal) !== null && _a !== void 0 ? _a : undefined;
|
|
9
|
+
const canShare = Object.keys(options !== null && options !== void 0 ? options : {}).every((key) => key === "signal" || key === "cache");
|
|
10
|
+
if (!canShare) {
|
|
11
|
+
return load(signal);
|
|
12
|
+
}
|
|
13
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
14
|
+
return Promise.reject((_b = signal.reason) !== null && _b !== void 0 ? _b : abortError());
|
|
15
|
+
}
|
|
16
|
+
const login = client.getActiveLogin();
|
|
17
|
+
const key = [
|
|
18
|
+
client.getBaseUrl(),
|
|
19
|
+
(_d = (_c = login === null || login === void 0 ? void 0 : login.profile) === null || _c === void 0 ? void 0 : _c.reference) !== null && _d !== void 0 ? _d : "",
|
|
20
|
+
(_f = (_e = login === null || login === void 0 ? void 0 : login.project) === null || _e === void 0 ? void 0 : _e.reference) !== null && _f !== void 0 ? _f : "",
|
|
21
|
+
(_g = options === null || options === void 0 ? void 0 : options.cache) !== null && _g !== void 0 ? _g : "reload",
|
|
22
|
+
path,
|
|
23
|
+
].join("\0");
|
|
24
|
+
let inFlight = inFlightLiveReads.get(key);
|
|
25
|
+
if (!inFlight) {
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const sharedRead = {
|
|
28
|
+
controller,
|
|
29
|
+
promise: Promise.resolve(),
|
|
30
|
+
subscribers: 0,
|
|
31
|
+
settled: false,
|
|
32
|
+
};
|
|
33
|
+
let request;
|
|
34
|
+
try {
|
|
35
|
+
request = load(signal ? controller.signal : undefined);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
request = Promise.reject(error);
|
|
39
|
+
}
|
|
40
|
+
sharedRead.promise = request.finally(() => {
|
|
41
|
+
if (inFlightLiveReads.get(key) === sharedRead) {
|
|
42
|
+
inFlightLiveReads.delete(key);
|
|
43
|
+
}
|
|
44
|
+
sharedRead.settled = true;
|
|
45
|
+
});
|
|
46
|
+
inFlight = sharedRead;
|
|
47
|
+
inFlightLiveReads.set(key, sharedRead);
|
|
48
|
+
void sharedRead.promise.catch(() => undefined);
|
|
49
|
+
}
|
|
50
|
+
const shared = inFlight;
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
let active = true;
|
|
53
|
+
shared.subscribers += 1;
|
|
54
|
+
const release = () => {
|
|
55
|
+
if (!active) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
active = false;
|
|
59
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
60
|
+
shared.subscribers -= 1;
|
|
61
|
+
if (!shared.settled && shared.subscribers === 0) {
|
|
62
|
+
shared.controller.abort();
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
const onAbort = () => {
|
|
67
|
+
var _a;
|
|
68
|
+
if (release()) {
|
|
69
|
+
reject((_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : abortError());
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
73
|
+
shared.promise.then((value) => {
|
|
74
|
+
if (release()) {
|
|
75
|
+
resolve(value);
|
|
76
|
+
}
|
|
77
|
+
}, (error) => {
|
|
78
|
+
if (release()) {
|
|
79
|
+
reject(error);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const abortError = () => (0, ovok_error_utils_1.namedError)("AbortError", "The request was aborted.");
|
|
85
|
+
/** A `cache: "reload"` GET that shares one in-flight request between identical live reads. */
|
|
86
|
+
const liveGet = (client, path, requestOptions) => dedupeLiveRead(client, path, (signal) => client.get(path, { cache: "reload", ...requestOptions, ...(signal ? { signal } : {}) }), requestOptions);
|
|
87
|
+
exports.liveGet = liveGet;
|
|
@@ -30,14 +30,17 @@ export declare function getRecentSlimNotifications(this: OvokClient, count?: num
|
|
|
30
30
|
export declare function listSlimAlarms(this: OvokClient, params?: SlimAlarmQuery, requestOptions?: MedplumRequestOptions): Promise<SlimAlarmsPage>;
|
|
31
31
|
export declare function acknowledgeSlimAlarm(this: OvokClient, notificationId: string, requestOptions?: MedplumRequestOptions): Promise<SlimNotification>;
|
|
32
32
|
export declare function getRecentSlimAlarms(this: OvokClient, count?: number, requestOptions?: MedplumRequestOptions): Promise<SlimRecentAlarms>;
|
|
33
|
+
/** Same as `getRecentSlimAlarms`. */
|
|
33
34
|
export declare function getRecentAlarms(this: OvokClient, count?: number, requestOptions?: MedplumRequestOptions): Promise<SlimRecentAlarms>;
|
|
34
35
|
export declare function getRecentSlimOutOfBed(this: OvokClient, count?: number, requestOptions?: MedplumRequestOptions): Promise<SlimRecentOutOfBed>;
|
|
36
|
+
/** Same as `getRecentSlimOutOfBed`. */
|
|
35
37
|
export declare function getRecentOutOfBed(this: OvokClient, count?: number, requestOptions?: MedplumRequestOptions): Promise<SlimRecentOutOfBed>;
|
|
36
38
|
export declare function listSlimOutOfBedNotifications(this: OvokClient, params?: Omit<SlimNotificationsQuery, "type">, requestOptions?: MedplumRequestOptions): Promise<SlimNotificationsResponse>;
|
|
37
39
|
export declare function listSlimMedicalNotifications(this: OvokClient, params?: SlimMedicalNotificationsQuery, requestOptions?: MedplumRequestOptions): Promise<SlimMedicalNotificationsPage>;
|
|
38
40
|
export declare function getRecentSlimMedicalNotifications(this: OvokClient, count?: number, requestOptions?: MedplumRequestOptions): Promise<SlimRecentNotificationsResponse>;
|
|
39
41
|
export declare function getSlimMedicalNotification(this: OvokClient, episodeId: string, requestOptions?: MedplumRequestOptions): Promise<SlimMedicalNotificationDetail>;
|
|
40
42
|
export declare function acknowledgeSlimMedicalNotification(this: OvokClient, episodeId: string, requestOptions?: MedplumRequestOptions): Promise<SlimMedicalNotificationRow>;
|
|
43
|
+
/** Same as `acknowledgeSlimAlarm`. */
|
|
41
44
|
export declare function acknowledgeSlimNotification(this: OvokClient, notificationId: string, requestOptions?: MedplumRequestOptions): Promise<SlimNotification>;
|
|
42
45
|
export declare function getSlimThreshold(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<SlimThreshold>;
|
|
43
46
|
export declare function updateSlimThreshold(this: OvokClient, body: {
|