@ovok/core 0.4.45 → 0.4.46
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/README.md +5 -2
- package/dist/client/errors/ovok-error.js +6 -6
- package/dist/client/errors/problem-code.d.ts +1 -0
- package/dist/client/errors/problem-code.js +10 -1
- package/dist/client/ovok-client.d.ts +2 -1
- package/dist/client/ovok-client.js +2 -0
- package/dist/client/wearables/index.d.ts +2 -0
- package/dist/client/wearables/index.js +18 -0
- package/dist/client/wearables/methods.d.ts +11 -0
- package/dist/client/wearables/methods.js +50 -0
- package/dist/client/wearables/types.d.ts +38 -0
- package/dist/client/wearables/types.js +2 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +9 -1
- package/dist/hooks/wearable-invalidation.d.ts +5 -0
- package/dist/hooks/wearable-invalidation.js +22 -0
- package/dist/hooks/wearables-hooks.d.ts +12 -0
- package/dist/hooks/wearables-hooks.js +79 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Core TypeScript SDK for healthcare applications. Provides authentication, AI-FHI
|
|
|
18
18
|
- 🧩 Typed accounts, projects, localization, and patient-observation APIs
|
|
19
19
|
- 🏥 Typed Slim patient, device, telemetry, notification, and monitoring APIs
|
|
20
20
|
- 🚨 Typed Signals thresholds, alerts, and project settings APIs
|
|
21
|
+
- ⌚ Typed cloud wearable-provider configuration and patient connections
|
|
21
22
|
|
|
22
23
|
## Installation
|
|
23
24
|
|
|
@@ -374,7 +375,9 @@ try {
|
|
|
374
375
|
|
|
375
376
|
The client also exposes typed application APIs for consent signatures, document upload credentials,
|
|
376
377
|
document download endpoints, CMS content, LiveKit video calls, translation, AI chat, and AI FHIR
|
|
377
|
-
search. These methods are additive and do not change the
|
|
378
|
+
search, and cloud wearable-provider connections. These methods are additive and do not change the
|
|
379
|
+
native observation or offline contracts. See the [wearable connection guide](docs/integrations/wearable-connections.md)
|
|
380
|
+
for provider setup, patient consent, and the app-return flow.
|
|
378
381
|
|
|
379
382
|
```ts
|
|
380
383
|
const content = await client.searchContent("blog", "en-US", { search: "welcome" });
|
|
@@ -398,7 +401,7 @@ download elements; the backend remains responsible for authorization and signed
|
|
|
398
401
|
|
|
399
402
|
The package exports additive hooks for capability discovery, project configuration, patient profile
|
|
400
403
|
and health data, questionnaires, scheduling resources, Slim lists, telemetry, notifications,
|
|
401
|
-
documents, content, video consultations, and localization. Every request hook returns `data`,
|
|
404
|
+
documents, content, video consultations, wearable connections, and localization. Every request hook returns `data`,
|
|
402
405
|
`loading`, `error`, and `reload`; mutations expose `data`, `loading`, `error`, `mutate`, and `reset`.
|
|
403
406
|
|
|
404
407
|
```tsx
|
|
@@ -29,7 +29,7 @@ const HTTP_REASON_PHRASES = new Set([
|
|
|
29
29
|
]);
|
|
30
30
|
/** Reads the error details Medplum preserves from Ovok's non-FHIR responses. */
|
|
31
31
|
const readOvokError = (error) => {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
32
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
33
33
|
if (error instanceof OvokApiError) {
|
|
34
34
|
return {
|
|
35
35
|
status: error.status,
|
|
@@ -62,17 +62,17 @@ const readOvokError = (error) => {
|
|
|
62
62
|
? bareMessage
|
|
63
63
|
: undefined;
|
|
64
64
|
const writtenCode = (_h = (0, ovok_error_utils_1.stringValue)(nestedError === null || nestedError === void 0 ? void 0 : nestedError.code)) !== null && _h !== void 0 ? _h : (0, ovok_error_utils_1.codeValue)(payload === null || payload === void 0 ? void 0 : payload.error);
|
|
65
|
-
const code = (_l = (_k = (_j = (0, problem_code_1.conditionCode)((0, problem_code_1.ownCode)(payload === null || payload === void 0 ? void 0 : payload.code), writtenCode)) !== null && _j !== void 0 ? _j : writtenCode) !== null && _k !== void 0 ? _k : bareCode) !== null && _l !== void 0 ? _l : (0, ovok_error_utils_1.codeFromOutcome)((_m = payload === null || payload === void 0 ? void 0 : payload.outcome) !== null && _m !== void 0 ? _m : payload);
|
|
66
65
|
const type = (0, problem_code_1.problemTypeOf)(payload === null || payload === void 0 ? void 0 : payload.type);
|
|
66
|
+
const code = (_o = (_l = (_k = (_j = (0, problem_code_1.conditionCode)((0, problem_code_1.ownCode)(payload === null || payload === void 0 ? void 0 : payload.code), writtenCode)) !== null && _j !== void 0 ? _j : writtenCode) !== null && _k !== void 0 ? _k : bareCode) !== null && _l !== void 0 ? _l : (0, ovok_error_utils_1.codeFromOutcome)((_m = payload === null || payload === void 0 ? void 0 : payload.outcome) !== null && _m !== void 0 ? _m : payload)) !== null && _o !== void 0 ? _o : (0, problem_code_1.problemCodeOf)(type);
|
|
67
67
|
const traceId = (0, ovok_error_utils_1.stringValue)(payload === null || payload === void 0 ? void 0 : payload.traceId);
|
|
68
|
-
const status = (
|
|
68
|
+
const status = (_w = (_u = (_t = (_s = (_r = (_q = (_p = metadata.status) !== null && _p !== void 0 ? _p : (0, ovok_error_utils_1.numberValue)(root === null || root === void 0 ? void 0 : root.status)) !== null && _q !== void 0 ? _q : (0, ovok_error_utils_1.numberValue)(root === null || root === void 0 ? void 0 : root.statusCode)) !== null && _r !== void 0 ? _r : (0, ovok_error_utils_1.numberValue)(response === null || response === void 0 ? void 0 : response.status)) !== null && _s !== void 0 ? _s : (0, ovok_error_utils_1.numberValue)(payload === null || payload === void 0 ? void 0 : payload.status)) !== null && _t !== void 0 ? _t : (0, ovok_error_utils_1.numberValue)(payload === null || payload === void 0 ? void 0 : payload.statusCode)) !== null && _u !== void 0 ? _u : (0, ovok_error_utils_1.statusFromOutcome)((_v = payload === null || payload === void 0 ? void 0 : payload.outcome) !== null && _v !== void 0 ? _v : payload)) !== null && _w !== void 0 ? _w : (code ? STATUS_BY_BARE_CODE[code] : undefined);
|
|
69
69
|
const fieldErrors = (0, field_errors_1.readFieldErrors)(payload);
|
|
70
70
|
const missing = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.missing)
|
|
71
71
|
? payload.missing.filter((entry) => typeof entry === "string")
|
|
72
72
|
: [];
|
|
73
73
|
const retryAfterSec = (0, ovok_error_utils_1.numberValue)(payload === null || payload === void 0 ? void 0 : payload.retryAfterSec);
|
|
74
|
-
const retryAfterMs = (
|
|
75
|
-
const requestId = (
|
|
74
|
+
const retryAfterMs = (_y = (_x = metadata.retryAfterMs) !== null && _x !== void 0 ? _x : (0, ovok_error_utils_1.numberValue)(payload === null || payload === void 0 ? void 0 : payload.retryAfterMs)) !== null && _y !== void 0 ? _y : (retryAfterSec === undefined ? undefined : retryAfterSec * 1000);
|
|
75
|
+
const requestId = (_z = metadata.requestId) !== null && _z !== void 0 ? _z : (0, ovok_error_utils_1.stringValue)(payload === null || payload === void 0 ? void 0 : payload.requestId);
|
|
76
76
|
return {
|
|
77
77
|
status,
|
|
78
78
|
code,
|
|
@@ -115,7 +115,7 @@ function mapOvokApiError(error, options = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
const details = (0, exports.readOvokError)(error);
|
|
117
117
|
const typedStatuses = options.includeAccessErrors
|
|
118
|
-
? [403, 404, 409, 410, 422, 424, 503]
|
|
118
|
+
? [403, 404, 409, 410, 422, 424, 501, 503]
|
|
119
119
|
: [409, 410, 422, 424, 503];
|
|
120
120
|
return typedStatuses.includes((_a = details.status) !== null && _a !== void 0 ? _a : 0)
|
|
121
121
|
? new OvokApiError(details, error)
|
|
@@ -2,3 +2,4 @@ export declare const ownCode: (value: unknown) => string | undefined;
|
|
|
2
2
|
/** Core sends a throw site's code upper-cased in `code` and as written in `error`: keep the written form. */
|
|
3
3
|
export declare const conditionCode: (problemCode: string | undefined, writtenCode: string | undefined) => string | undefined;
|
|
4
4
|
export declare const problemTypeOf: (value: unknown) => string | undefined;
|
|
5
|
+
export declare const problemCodeOf: (type: string | undefined) => string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.problemTypeOf = exports.conditionCode = exports.ownCode = void 0;
|
|
3
|
+
exports.problemCodeOf = exports.problemTypeOf = exports.conditionCode = exports.ownCode = void 0;
|
|
4
4
|
const ovok_error_utils_1 = require("./ovok-error-utils");
|
|
5
5
|
const PROBLEM_TYPE_PREFIX = "https://docs.ovok.com/errors/";
|
|
6
6
|
// The codes Core gives an error by its status alone: they name no condition, so `code` stays undefined for them.
|
|
@@ -43,3 +43,12 @@ const problemTypeOf = (value) => {
|
|
|
43
43
|
return (type === null || type === void 0 ? void 0 : type.startsWith(PROBLEM_TYPE_PREFIX)) ? type : undefined;
|
|
44
44
|
};
|
|
45
45
|
exports.problemTypeOf = problemTypeOf;
|
|
46
|
+
const problemCodeOf = (type) => {
|
|
47
|
+
const slug = type === null || type === void 0 ? void 0 : type.slice(PROBLEM_TYPE_PREFIX.length);
|
|
48
|
+
if (!slug) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const code = slug.replace(/-/g, "_").toUpperCase();
|
|
52
|
+
return STATUS_ONLY_CODES.has(code) ? undefined : code;
|
|
53
|
+
};
|
|
54
|
+
exports.problemCodeOf = problemCodeOf;
|
|
@@ -23,6 +23,7 @@ import * as platformMethods from "./platform/methods";
|
|
|
23
23
|
import * as questionnaireResponseMethods from "./questionnaire-response/methods";
|
|
24
24
|
import * as signalsMethods from "./signals/methods";
|
|
25
25
|
import * as slimMethods from "./slim/methods";
|
|
26
|
+
import * as wearableMethods from "./wearables/methods";
|
|
26
27
|
export { MAX_CONDITIONAL_OBSERVATION_ENTRIES, MAX_OBSERVATION_BUNDLE_BYTES, } from "./observation/observation-bundle-utils";
|
|
27
28
|
export type { OvokUnauthenticatedReason } from "./auth/session-fetch";
|
|
28
29
|
export type SaveObservationsResult = {
|
|
@@ -146,7 +147,7 @@ export declare class OvokClient extends MedplumClient {
|
|
|
146
147
|
*/
|
|
147
148
|
getSubscriptionManager(): SubscriptionManager;
|
|
148
149
|
}
|
|
149
|
-
type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof slimMethods & typeof emailMethods & typeof cmsMethods & typeof changeHistoryMethods & typeof consentMethods & typeof platformMethods & typeof experienceMethods & typeof inviteMethods & typeof notificationMethods & typeof patientMethods & typeof patientSharingMethods & typeof signalsMethods;
|
|
150
|
+
type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof slimMethods & typeof emailMethods & typeof cmsMethods & typeof changeHistoryMethods & typeof consentMethods & typeof platformMethods & typeof experienceMethods & typeof inviteMethods & typeof notificationMethods & typeof patientMethods & typeof patientSharingMethods & typeof wearableMethods & typeof signalsMethods;
|
|
150
151
|
type Omitted<T> = Omit<T, "executeBot">;
|
|
151
152
|
declare module "./ovok-client" {
|
|
152
153
|
interface OvokClient extends Omitted<Methods> {
|
|
@@ -66,6 +66,7 @@ const request_options_1 = require("./request-options");
|
|
|
66
66
|
const errors_2 = require("./signals/errors");
|
|
67
67
|
const signalsMethods = __importStar(require("./signals/methods"));
|
|
68
68
|
const slimMethods = __importStar(require("./slim/methods"));
|
|
69
|
+
const wearableMethods = __importStar(require("./wearables/methods"));
|
|
69
70
|
var observation_bundle_utils_2 = require("./observation/observation-bundle-utils");
|
|
70
71
|
Object.defineProperty(exports, "MAX_CONDITIONAL_OBSERVATION_ENTRIES", { enumerable: true, get: function () { return observation_bundle_utils_2.MAX_CONDITIONAL_OBSERVATION_ENTRIES; } });
|
|
71
72
|
Object.defineProperty(exports, "MAX_OBSERVATION_BUNDLE_BYTES", { enumerable: true, get: function () { return observation_bundle_utils_2.MAX_OBSERVATION_BUNDLE_BYTES; } });
|
|
@@ -143,6 +144,7 @@ class OvokClient extends core_1.MedplumClient {
|
|
|
143
144
|
this.bindMethods(notificationMethods, (error) => (0, ovok_error_1.mapOvokApiError)((0, rate_limit_error_1.mapRateLimitError)(error), { includeAccessErrors: true }));
|
|
144
145
|
this.bindMethods(patientMethods);
|
|
145
146
|
this.bindMethods(patientSharingMethods);
|
|
147
|
+
this.bindMethods(wearableMethods, (error) => (0, ovok_error_1.mapOvokApiError)((0, rate_limit_error_1.mapRateLimitError)(error), { includeAccessErrors: true }));
|
|
146
148
|
this.bindMethods(signalsMethods, (error) => {
|
|
147
149
|
const mapped = (0, errors_2.mapSignalsError)((0, rate_limit_error_1.mapRateLimitError)(error), {
|
|
148
150
|
signalsRequest: true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./methods"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
2
|
+
import { OvokClient } from "../ovok-client";
|
|
3
|
+
import { CreateWearableProviderRequest, UpdateWearableProviderRequest, WearableConnectionAuthorization, WearableConnections, WearableProvider, WearableProviderSettings, WearableProviderSettingsList } from "./types";
|
|
4
|
+
export declare function listWearableProviders(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettingsList>;
|
|
5
|
+
export declare function getWearableProvider(this: OvokClient, provider: WearableProvider, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettings>;
|
|
6
|
+
export declare function createWearableProvider(this: OvokClient, body: CreateWearableProviderRequest, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettings>;
|
|
7
|
+
export declare function updateWearableProvider(this: OvokClient, provider: WearableProvider, body: UpdateWearableProviderRequest, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettings>;
|
|
8
|
+
export declare function deleteWearableProvider(this: OvokClient, provider: WearableProvider, requestOptions?: MedplumRequestOptions): Promise<void>;
|
|
9
|
+
export declare function listWearableConnections(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<WearableConnections>;
|
|
10
|
+
export declare function authorizeWearableConnection(this: OvokClient, provider: WearableProvider, requestOptions?: MedplumRequestOptions): Promise<WearableConnectionAuthorization>;
|
|
11
|
+
export declare function deleteWearableConnection(this: OvokClient, provider: WearableProvider, requestOptions?: MedplumRequestOptions): Promise<void>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listWearableProviders = listWearableProviders;
|
|
4
|
+
exports.getWearableProvider = getWearableProvider;
|
|
5
|
+
exports.createWearableProvider = createWearableProvider;
|
|
6
|
+
exports.updateWearableProvider = updateWearableProvider;
|
|
7
|
+
exports.deleteWearableProvider = deleteWearableProvider;
|
|
8
|
+
exports.listWearableConnections = listWearableConnections;
|
|
9
|
+
exports.authorizeWearableConnection = authorizeWearableConnection;
|
|
10
|
+
exports.deleteWearableConnection = deleteWearableConnection;
|
|
11
|
+
const request_options_1 = require("../request-options");
|
|
12
|
+
const providerPath = (provider) => `/v1/wearables/providers/${encodeURIComponent(provider)}`;
|
|
13
|
+
const connectionPath = (provider) => `/v1/wearables/connections/${encodeURIComponent(provider)}`;
|
|
14
|
+
const invalidateProviderSettings = (client, provider) => {
|
|
15
|
+
client.invalidateUrl("/v1/wearables/providers");
|
|
16
|
+
if (provider) {
|
|
17
|
+
client.invalidateUrl(providerPath(provider));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function listWearableProviders(requestOptions) {
|
|
21
|
+
return this.get("/v1/wearables/providers", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
22
|
+
}
|
|
23
|
+
function getWearableProvider(provider, requestOptions) {
|
|
24
|
+
return this.get(providerPath(provider), ...(0, request_options_1.optionalArg)(requestOptions));
|
|
25
|
+
}
|
|
26
|
+
function createWearableProvider(body, requestOptions) {
|
|
27
|
+
return this.post("/v1/wearables/providers", body, undefined, requestOptions).then((settings) => {
|
|
28
|
+
invalidateProviderSettings(this, body.provider);
|
|
29
|
+
return settings;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function updateWearableProvider(provider, body, requestOptions) {
|
|
33
|
+
const settings = await this.patch(providerPath(provider), body, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
34
|
+
invalidateProviderSettings(this, provider);
|
|
35
|
+
return settings;
|
|
36
|
+
}
|
|
37
|
+
async function deleteWearableProvider(provider, requestOptions) {
|
|
38
|
+
await this.delete(providerPath(provider), ...(0, request_options_1.optionalArg)(requestOptions));
|
|
39
|
+
invalidateProviderSettings(this, provider);
|
|
40
|
+
}
|
|
41
|
+
function listWearableConnections(requestOptions) {
|
|
42
|
+
return this.get("/v1/wearables/connections", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
43
|
+
}
|
|
44
|
+
function authorizeWearableConnection(provider, requestOptions) {
|
|
45
|
+
return this.post(`${connectionPath(provider)}/authorize`, undefined, undefined, requestOptions);
|
|
46
|
+
}
|
|
47
|
+
async function deleteWearableConnection(provider, requestOptions) {
|
|
48
|
+
await this.delete(connectionPath(provider), ...(0, request_options_1.optionalArg)(requestOptions));
|
|
49
|
+
this.invalidateUrl("/v1/wearables/connections");
|
|
50
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type WearableProvider = "oura" | "whoop" | "strava" | "withings" | "polar" | "suunto" | "garmin" | "ultrahuman";
|
|
2
|
+
export type WearableErrorCode = "PROVIDER_CONFIGURED" | "PROVIDER_NOT_CONFIGURED" | "SUBSCRIPTION_KEY_REQUIRED" | "SUBSCRIPTION_KEY_NOT_USED" | "PROVIDER_NOT_AVAILABLE" | "APP_URL_NOT_CONFIGURED" | "CONNECTION_NOT_FOUND" | "STATE_STORE_UNAVAILABLE" | "FEATURE_NOT_CONFIGURED" | "PROJECT_CONTEXT_REQUIRED" | "PATIENT_PROFILE_REQUIRED";
|
|
3
|
+
export type WearableProviderSettings = {
|
|
4
|
+
provider: WearableProvider;
|
|
5
|
+
configured: boolean;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
clientId: string | null;
|
|
8
|
+
redirectUri: string | null;
|
|
9
|
+
};
|
|
10
|
+
export type WearableProviderSettingsList = {
|
|
11
|
+
providers: WearableProviderSettings[];
|
|
12
|
+
};
|
|
13
|
+
export type CreateWearableProviderRequest = {
|
|
14
|
+
provider: WearableProvider;
|
|
15
|
+
clientId: string;
|
|
16
|
+
secret: string;
|
|
17
|
+
subscriptionKey: string | null;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type UpdateWearableProviderRequest = {
|
|
21
|
+
clientId?: string;
|
|
22
|
+
secret?: string;
|
|
23
|
+
subscriptionKey?: string | null;
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type WearableConnection = {
|
|
27
|
+
provider: WearableProvider;
|
|
28
|
+
connection: {
|
|
29
|
+
connectedAt: string;
|
|
30
|
+
} | null;
|
|
31
|
+
};
|
|
32
|
+
export type WearableConnections = {
|
|
33
|
+
connections: WearableConnection[];
|
|
34
|
+
};
|
|
35
|
+
export type WearableConnectionAuthorization = {
|
|
36
|
+
provider: WearableProvider;
|
|
37
|
+
authorizationUrl: string;
|
|
38
|
+
};
|
|
@@ -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.
|
|
51
|
+
version: "0.4.46",
|
|
52
52
|
},
|
|
53
53
|
fhirVersion: "4.0.1",
|
|
54
54
|
format: ["json"],
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ export { useCmsDocument, useCmsDocuments, useLegalPage, useReleaseNotes, useTran
|
|
|
21
21
|
export { useAcceptInvite, useInvitePatient, useInvitePractitioner, } from "./invites-hooks";
|
|
22
22
|
export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientMeasurement, usePatientMeasurementHistory, usePatientDashboard, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
|
|
23
23
|
export { useCreatePatientSharingInvite, usePatientSharing, usePatientSharingSettings, useRedeemPatientSharingInvite, useRevokePatientSharing, useUpdatePatientSharingSettings, } from "./patient-sharing-hooks";
|
|
24
|
+
export { useAuthorizeWearableConnection, useCreateWearableProvider, useDeleteWearableConnection, useDeleteWearableProvider, useUpdateWearableProvider, useWearableConnections, useWearableProviders, } from "./wearables-hooks";
|
|
24
25
|
export { useAcknowledgeSignalsAlert, useEnableSignalsForPatient, useRemoveSignalsThreshold, useSetSignalsThreshold, useSignalsAlert, useSignalsAlerts, useSignalsSettings, useSignalsThresholds, useUpdateSignalsSettings, } from "./signals-hooks";
|
package/dist/hooks/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.useSlimPatientThresholdV2 = 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.useOvokPoll = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useSlimPatients = 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.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.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.useAcknowledgeSlimMedicalNotification = exports.useAcknowledgeSlimAlarm = exports.useUpdateSignalsNote = exports.useUpdateNotificationNote = exports.useSignalsRawAlertNotes = exports.useSignalsAlertNotes = exports.useNotificationNotes = exports.useDeleteSignalsNote = exports.useDeleteNotificationNote = exports.useCreateSignalsRawAlertNote = exports.useCreateSignalsAlertNote = exports.useCreateNotificationNote = exports.useSlimOutOfBedNotifications = exports.useSlimNotifications = exports.useSlimMedicalNotifications = exports.useSlimAlarms = exports.useRecentSlimNotifications = exports.useRecentOutOfBed = exports.useRecentAlarms = exports.useUpdateSlimThresholdV2 = exports.useUpdateSlimPatientThresholdV2 = exports.useUnconfirmedLimits = exports.useSlimThresholdV2 = 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 = exports.useRedeemPatientSharingInvite = void 0;
|
|
39
|
+
exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useWearableProviders = exports.useWearableConnections = exports.useUpdateWearableProvider = exports.useDeleteWearableProvider = exports.useDeleteWearableConnection = exports.useCreateWearableProvider = exports.useAuthorizeWearableConnection = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = void 0;
|
|
40
40
|
/*
|
|
41
41
|
* The only React-dependent module in the package.
|
|
42
42
|
*
|
|
@@ -176,6 +176,14 @@ Object.defineProperty(exports, "usePatientSharingSettings", { enumerable: true,
|
|
|
176
176
|
Object.defineProperty(exports, "useRedeemPatientSharingInvite", { enumerable: true, get: function () { return patient_sharing_hooks_1.useRedeemPatientSharingInvite; } });
|
|
177
177
|
Object.defineProperty(exports, "useRevokePatientSharing", { enumerable: true, get: function () { return patient_sharing_hooks_1.useRevokePatientSharing; } });
|
|
178
178
|
Object.defineProperty(exports, "useUpdatePatientSharingSettings", { enumerable: true, get: function () { return patient_sharing_hooks_1.useUpdatePatientSharingSettings; } });
|
|
179
|
+
var wearables_hooks_1 = require("./wearables-hooks");
|
|
180
|
+
Object.defineProperty(exports, "useAuthorizeWearableConnection", { enumerable: true, get: function () { return wearables_hooks_1.useAuthorizeWearableConnection; } });
|
|
181
|
+
Object.defineProperty(exports, "useCreateWearableProvider", { enumerable: true, get: function () { return wearables_hooks_1.useCreateWearableProvider; } });
|
|
182
|
+
Object.defineProperty(exports, "useDeleteWearableConnection", { enumerable: true, get: function () { return wearables_hooks_1.useDeleteWearableConnection; } });
|
|
183
|
+
Object.defineProperty(exports, "useDeleteWearableProvider", { enumerable: true, get: function () { return wearables_hooks_1.useDeleteWearableProvider; } });
|
|
184
|
+
Object.defineProperty(exports, "useUpdateWearableProvider", { enumerable: true, get: function () { return wearables_hooks_1.useUpdateWearableProvider; } });
|
|
185
|
+
Object.defineProperty(exports, "useWearableConnections", { enumerable: true, get: function () { return wearables_hooks_1.useWearableConnections; } });
|
|
186
|
+
Object.defineProperty(exports, "useWearableProviders", { enumerable: true, get: function () { return wearables_hooks_1.useWearableProviders; } });
|
|
179
187
|
var signals_hooks_1 = require("./signals-hooks");
|
|
180
188
|
Object.defineProperty(exports, "useAcknowledgeSignalsAlert", { enumerable: true, get: function () { return signals_hooks_1.useAcknowledgeSignalsAlert; } });
|
|
181
189
|
Object.defineProperty(exports, "useEnableSignalsForPatient", { enumerable: true, get: function () { return signals_hooks_1.useEnableSignalsForPatient; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OvokClient } from "../client/ovok-client";
|
|
2
|
+
type WearableChange = "providers" | "connections";
|
|
3
|
+
export declare const subscribeToWearableChanges: (client: OvokClient, change: WearableChange, reload: () => void) => (() => void);
|
|
4
|
+
export declare const notifyWearableChanges: (client: OvokClient, change: WearableChange) => void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notifyWearableChanges = exports.subscribeToWearableChanges = void 0;
|
|
4
|
+
const listeners = new WeakMap();
|
|
5
|
+
const subscribeToWearableChanges = (client, change, reload) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const listener = (updated) => {
|
|
8
|
+
if (updated === change) {
|
|
9
|
+
reload();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const clientListeners = (_a = listeners.get(client)) !== null && _a !== void 0 ? _a : new Set();
|
|
13
|
+
clientListeners.add(listener);
|
|
14
|
+
listeners.set(client, clientListeners);
|
|
15
|
+
return () => clientListeners.delete(listener);
|
|
16
|
+
};
|
|
17
|
+
exports.subscribeToWearableChanges = subscribeToWearableChanges;
|
|
18
|
+
const notifyWearableChanges = (client, change) => {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = listeners.get(client)) === null || _a === void 0 ? void 0 : _a.forEach((listener) => listener(change));
|
|
21
|
+
};
|
|
22
|
+
exports.notifyWearableChanges = notifyWearableChanges;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateWearableProviderRequest, UpdateWearableProviderRequest, WearableConnectionAuthorization, WearableConnections, WearableProvider, WearableProviderSettings, WearableProviderSettingsList } from "../client/wearables";
|
|
2
|
+
import { OvokMutationState, OvokRequestState } from "./api-hooks";
|
|
3
|
+
export declare const useWearableProviders: () => OvokRequestState<WearableProviderSettingsList>;
|
|
4
|
+
export declare const useWearableConnections: () => OvokRequestState<WearableConnections>;
|
|
5
|
+
export declare const useCreateWearableProvider: () => OvokMutationState<CreateWearableProviderRequest, WearableProviderSettings>;
|
|
6
|
+
export declare const useUpdateWearableProvider: () => OvokMutationState<{
|
|
7
|
+
provider: WearableProvider;
|
|
8
|
+
body: UpdateWearableProviderRequest;
|
|
9
|
+
}, WearableProviderSettings>;
|
|
10
|
+
export declare const useDeleteWearableProvider: () => OvokMutationState<WearableProvider, void>;
|
|
11
|
+
export declare const useAuthorizeWearableConnection: () => OvokMutationState<WearableProvider, WearableConnectionAuthorization>;
|
|
12
|
+
export declare const useDeleteWearableConnection: () => OvokMutationState<WearableProvider, void>;
|
|
@@ -0,0 +1,79 @@
|
|
|
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.useDeleteWearableConnection = exports.useAuthorizeWearableConnection = exports.useDeleteWearableProvider = exports.useUpdateWearableProvider = exports.useCreateWearableProvider = exports.useWearableConnections = exports.useWearableProviders = void 0;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const api_hooks_1 = require("./api-hooks");
|
|
40
|
+
const wearable_invalidation_1 = require("./wearable-invalidation");
|
|
41
|
+
const index_1 = require("./index");
|
|
42
|
+
const useWearableProviders = () => {
|
|
43
|
+
const client = (0, index_1.useClient)();
|
|
44
|
+
const state = (0, api_hooks_1.useOvokClientRequest)((current, signal) => current.listWearableProviders({ signal }));
|
|
45
|
+
React.useEffect(() => (0, wearable_invalidation_1.subscribeToWearableChanges)(client, "providers", state.reload), [client, state.reload]);
|
|
46
|
+
return state;
|
|
47
|
+
};
|
|
48
|
+
exports.useWearableProviders = useWearableProviders;
|
|
49
|
+
const useWearableConnections = () => {
|
|
50
|
+
const client = (0, index_1.useClient)();
|
|
51
|
+
const state = (0, api_hooks_1.useOvokClientRequest)((current, signal) => current.listWearableConnections({ signal }));
|
|
52
|
+
React.useEffect(() => (0, wearable_invalidation_1.subscribeToWearableChanges)(client, "connections", state.reload), [client, state.reload]);
|
|
53
|
+
return state;
|
|
54
|
+
};
|
|
55
|
+
exports.useWearableConnections = useWearableConnections;
|
|
56
|
+
const useCreateWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (client, body) => {
|
|
57
|
+
const settings = await client.createWearableProvider(body);
|
|
58
|
+
(0, wearable_invalidation_1.notifyWearableChanges)(client, "providers");
|
|
59
|
+
return settings;
|
|
60
|
+
});
|
|
61
|
+
exports.useCreateWearableProvider = useCreateWearableProvider;
|
|
62
|
+
const useUpdateWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (client, { provider, body }) => {
|
|
63
|
+
const settings = await client.updateWearableProvider(provider, body);
|
|
64
|
+
(0, wearable_invalidation_1.notifyWearableChanges)(client, "providers");
|
|
65
|
+
return settings;
|
|
66
|
+
});
|
|
67
|
+
exports.useUpdateWearableProvider = useUpdateWearableProvider;
|
|
68
|
+
const useDeleteWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (client, provider) => {
|
|
69
|
+
await client.deleteWearableProvider(provider);
|
|
70
|
+
(0, wearable_invalidation_1.notifyWearableChanges)(client, "providers");
|
|
71
|
+
});
|
|
72
|
+
exports.useDeleteWearableProvider = useDeleteWearableProvider;
|
|
73
|
+
const useAuthorizeWearableConnection = () => (0, api_hooks_1.useOvokMutation)((client, provider) => client.authorizeWearableConnection(provider));
|
|
74
|
+
exports.useAuthorizeWearableConnection = useAuthorizeWearableConnection;
|
|
75
|
+
const useDeleteWearableConnection = () => (0, api_hooks_1.useOvokMutation)(async (client, provider) => {
|
|
76
|
+
await client.deleteWearableConnection(provider);
|
|
77
|
+
(0, wearable_invalidation_1.notifyWearableChanges)(client, "connections");
|
|
78
|
+
});
|
|
79
|
+
exports.useDeleteWearableConnection = useDeleteWearableConnection;
|
package/dist/index.d.ts
CHANGED
|
@@ -958,6 +958,7 @@ export * from "./client/slim/paging";
|
|
|
958
958
|
export * from "./client/experience/types";
|
|
959
959
|
export * from "./client/patient/types";
|
|
960
960
|
export * from "./client/patient-sharing";
|
|
961
|
+
export * from "./client/wearables";
|
|
961
962
|
export { SignalsError, isSignalsError, mapSignalsError } from "./client/signals/errors";
|
|
962
963
|
export * from "./client/storage";
|
|
963
964
|
export * from "./client/questionnaire-response/methods";
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ __exportStar(require("./client/slim/paging"), exports);
|
|
|
77
77
|
__exportStar(require("./client/experience/types"), exports);
|
|
78
78
|
__exportStar(require("./client/patient/types"), exports);
|
|
79
79
|
__exportStar(require("./client/patient-sharing"), exports);
|
|
80
|
+
__exportStar(require("./client/wearables"), exports);
|
|
80
81
|
var errors_1 = require("./client/signals/errors");
|
|
81
82
|
Object.defineProperty(exports, "SignalsError", { enumerable: true, get: function () { return errors_1.SignalsError; } });
|
|
82
83
|
Object.defineProperty(exports, "isSignalsError", { enumerable: true, get: function () { return errors_1.isSignalsError; } });
|