@ovok/core 0.4.3 → 0.4.4

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 (54) hide show
  1. package/README.md +182 -4
  2. package/dist/client/auth/errors.d.ts +3 -0
  3. package/dist/client/auth/errors.js +11 -0
  4. package/dist/client/auth/methods/index.d.ts +1 -0
  5. package/dist/client/auth/methods/index.js +1 -0
  6. package/dist/client/auth/methods/registerPractitioner.d.ts +4 -0
  7. package/dist/client/auth/methods/registerPractitioner.js +15 -0
  8. package/dist/client/auth/types/RegisterPractitionerBody.d.ts +2 -0
  9. package/dist/client/auth/types/RegisterPractitionerBody.js +2 -0
  10. package/dist/client/email/index.d.ts +2 -0
  11. package/dist/client/email/index.js +18 -0
  12. package/dist/client/email/methods.d.ts +3 -0
  13. package/dist/client/email/methods.js +6 -0
  14. package/dist/client/email/types.d.ts +21 -0
  15. package/dist/client/email/types.js +2 -0
  16. package/dist/client/errors/ovok-error.d.ts +6 -0
  17. package/dist/client/errors/ovok-error.js +158 -26
  18. package/dist/client/errors/rate-limit-error.js +4 -0
  19. package/dist/client/invites/index.d.ts +3 -0
  20. package/dist/client/invites/index.js +19 -0
  21. package/dist/client/invites/methods.d.ts +8 -0
  22. package/dist/client/invites/methods.js +30 -0
  23. package/dist/client/invites/parse-accept-invite-link.d.ts +3 -0
  24. package/dist/client/invites/parse-accept-invite-link.js +23 -0
  25. package/dist/client/invites/types.d.ts +19 -0
  26. package/dist/client/invites/types.js +8 -0
  27. package/dist/client/ovok-client.d.ts +3 -1
  28. package/dist/client/ovok-client.js +4 -0
  29. package/dist/client/patient-sharing/methods.d.ts +2 -2
  30. package/dist/client/patient-sharing/methods.js +7 -1
  31. package/dist/client/patient-sharing/types.d.ts +30 -3
  32. package/dist/client/platform/methods.d.ts +2 -1
  33. package/dist/client/platform/methods.js +4 -0
  34. package/dist/client/platform/types.d.ts +10 -1
  35. package/dist/client/platform/types.js +15 -2
  36. package/dist/client/signals/errors.js +3 -104
  37. package/dist/client/signals/methods.d.ts +3 -2
  38. package/dist/client/signals/methods.js +3 -2
  39. package/dist/client/signals/types.d.ts +1 -1
  40. package/dist/conformance/api-requirements.js +13 -0
  41. package/dist/conformance/capability-requirements.js +1 -1
  42. package/dist/hooks/email-hooks.d.ts +3 -0
  43. package/dist/hooks/email-hooks.js +46 -0
  44. package/dist/hooks/index.d.ts +3 -1
  45. package/dist/hooks/index.js +9 -2
  46. package/dist/hooks/invites-hooks.d.ts +5 -0
  47. package/dist/hooks/invites-hooks.js +11 -0
  48. package/dist/hooks/patient-sharing-hooks.d.ts +2 -2
  49. package/dist/hooks/platform-hooks.d.ts +5 -1
  50. package/dist/hooks/platform-hooks.js +3 -1
  51. package/dist/index.d.ts +5 -0
  52. package/dist/index.js +3 -0
  53. package/dist/types/ValidationError.d.ts +2 -2
  54. package/package.json +1 -1
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAcceptInviteLink = parseAcceptInviteLink;
4
+ /** Reads an invite link without making a request; callers should remove its code from browser history. */
5
+ function parseAcceptInviteLink(url) {
6
+ let parsed;
7
+ try {
8
+ parsed = url instanceof URL ? url : new URL(url, "https://ovok.invalid");
9
+ }
10
+ catch (_a) {
11
+ return null;
12
+ }
13
+ const inviteId = parsed.searchParams.get("invite");
14
+ const code = parsed.searchParams.get("code");
15
+ if (!inviteId ||
16
+ !/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(inviteId) ||
17
+ !code ||
18
+ code.length < 16 ||
19
+ code.length > 128) {
20
+ return null;
21
+ }
22
+ return { inviteId, code };
23
+ }
@@ -0,0 +1,19 @@
1
+ import { PatientSharingPractitionerShare } from "../patient-sharing/types";
2
+ export type InviteBody = {
3
+ email: string;
4
+ firstName: string;
5
+ lastName: string;
6
+ };
7
+ export type InviteSent = {
8
+ status: "sent";
9
+ };
10
+ export type AcceptInviteBody = {
11
+ inviteId: string;
12
+ code: string;
13
+ };
14
+ export type AcceptInviteResult = PatientSharingPractitionerShare;
15
+ export declare const OVOK_INVITE_ERROR_CODES: {
16
+ readonly invitationNotConfigured: "invitation_not_configured";
17
+ readonly appUrlNotConfigured: "app_url_not_configured";
18
+ readonly practitionerWithoutAccessPolicy: "practitioner_without_access_policy";
19
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OVOK_INVITE_ERROR_CODES = void 0;
4
+ exports.OVOK_INVITE_ERROR_CODES = {
5
+ invitationNotConfigured: "invitation_not_configured",
6
+ appUrlNotConfigured: "app_url_not_configured",
7
+ practitionerWithoutAccessPolicy: "practitioner_without_access_policy",
8
+ };
@@ -6,7 +6,9 @@ import * as authMethods from "./auth/methods";
6
6
  import * as botMethods from "./bot/methods";
7
7
  import * as carehubMethods from "./carehub/methods";
8
8
  import * as aiMethods from "./chat/ai/methods";
9
+ import * as emailMethods from "./email";
9
10
  import * as experienceMethods from "./experience/methods";
11
+ import * as inviteMethods from "./invites/methods";
10
12
  import * as observationMethods from "./observation/methods";
11
13
  import { GenerateObservationBodyParams } from "./observation/types/generate-observation-body/GenerateObservationBodyParams";
12
14
  import { OfflineMeasurementFlushOptions, OfflineMeasurementFlushResult, OfflineMeasurementQueueOptions } from "./offline";
@@ -60,7 +62,7 @@ export declare class OvokClient extends MedplumClient {
60
62
  */
61
63
  getSubscriptionManager(): SubscriptionManager;
62
64
  }
63
- type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof carehubMethods & typeof platformMethods & typeof experienceMethods & typeof patientMethods & typeof patientSharingMethods & typeof signalsMethods;
65
+ type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof carehubMethods & typeof emailMethods & typeof platformMethods & typeof experienceMethods & typeof inviteMethods & typeof patientMethods & typeof patientSharingMethods & typeof signalsMethods;
64
66
  type Omitted<T> = Omit<T, "executeBot">;
65
67
  declare module "./ovok-client" {
66
68
  interface OvokClient extends Omitted<Methods> {
@@ -42,8 +42,10 @@ const authMethods = __importStar(require("./auth/methods"));
42
42
  const botMethods = __importStar(require("./bot/methods"));
43
43
  const carehubMethods = __importStar(require("./carehub/methods"));
44
44
  const aiMethods = __importStar(require("./chat/ai/methods"));
45
+ const emailMethods = __importStar(require("./email"));
45
46
  const rate_limit_error_1 = require("./errors/rate-limit-error");
46
47
  const experienceMethods = __importStar(require("./experience/methods"));
48
+ const inviteMethods = __importStar(require("./invites/methods"));
47
49
  const observationMethods = __importStar(require("./observation/methods"));
48
50
  const observation_bundle_utils_1 = require("./observation/observation-bundle-utils");
49
51
  const offline_1 = require("./offline");
@@ -73,8 +75,10 @@ class OvokClient extends core_1.MedplumClient {
73
75
  this.bindMethods(aiFhirMethods);
74
76
  this.bindMethods(botMethods);
75
77
  this.bindMethods(carehubMethods);
78
+ this.bindMethods(emailMethods);
76
79
  this.bindMethods(platformMethods);
77
80
  this.bindMethods(experienceMethods);
81
+ this.bindMethods(inviteMethods);
78
82
  this.bindMethods(patientMethods);
79
83
  this.bindMethods(patientSharingMethods);
80
84
  this.bindMethods(signalsMethods, (error) => (0, errors_1.mapSignalsError)((0, rate_limit_error_1.mapRateLimitError)(error), { signalsRequest: true }));
@@ -1,8 +1,8 @@
1
1
  import { OvokClient } from "../ovok-client";
2
- import { CreatePatientSharingInvite, PatientSharingInvite, PatientSharingSettings, PatientSharingShare, PatientSharingShares, RedeemPatientSharingInvite } from "./types";
2
+ import { CreatePatientSharingInvite, PatientSharingInvite, PatientSharingSettings, PatientSharingShare, PatientSharingShares, RedeemPatientSharingInvite, PatientSharingSettingsUpdate } from "./types";
3
3
  export declare function createPatientSharingInvite(this: OvokClient, body: CreatePatientSharingInvite): Promise<PatientSharingInvite>;
4
4
  export declare function redeemPatientSharingInvite(this: OvokClient, body: RedeemPatientSharingInvite): Promise<PatientSharingShare>;
5
5
  export declare function listPatientSharing(this: OvokClient): Promise<PatientSharingShares>;
6
6
  export declare function revokePatientSharing(this: OvokClient, consentId: string): Promise<void>;
7
7
  export declare function getPatientSharingSettings(this: OvokClient): Promise<PatientSharingSettings>;
8
- export declare function updatePatientSharingSettings(this: OvokClient, settings: PatientSharingSettings): Promise<PatientSharingSettings>;
8
+ export declare function updatePatientSharingSettings(this: OvokClient, settings: PatientSharingSettingsUpdate): Promise<PatientSharingSettings>;
@@ -14,7 +14,13 @@ function redeemPatientSharingInvite(body) {
14
14
  return this.post("/v1/patient-sharing/invites/redeem", body);
15
15
  }
16
16
  function listPatientSharing() {
17
- return this.get("/v1/patient-sharing/shares");
17
+ return this.get("/v1/patient-sharing/shares").then((shares) => {
18
+ var _a;
19
+ return ({
20
+ ...shares,
21
+ practitioners: (_a = shares.practitioners) !== null && _a !== void 0 ? _a : [],
22
+ });
23
+ });
18
24
  }
19
25
  async function revokePatientSharing(consentId) {
20
26
  await this.delete(`/v1/patient-sharing/shares/${segment(consentId)}`);
@@ -5,18 +5,45 @@ export type PatientSharingInvite = {
5
5
  };
6
6
  export type PatientSharingShare = {
7
7
  consentId: string;
8
- [key: string]: unknown;
8
+ sharer: PatientSharingParty;
9
+ recipient: PatientSharingParty;
10
+ codes: string[];
11
+ startedAt: string | null;
12
+ endsAt: string | null;
13
+ };
14
+ export type PatientSharingParty = {
15
+ patientId: string;
16
+ name: string | null;
17
+ };
18
+ export type PatientSharingPractitionerShare = {
19
+ consentId: string;
20
+ sharer: PatientSharingParty;
21
+ practitioner: {
22
+ practitionerId: string;
23
+ name: string | null;
24
+ };
25
+ startedAt: string | null;
26
+ endsAt: string | null;
9
27
  };
10
28
  export type PatientSharingShares = {
11
29
  outgoing: PatientSharingShare[];
12
30
  incoming: PatientSharingShare[];
31
+ practitioners: PatientSharingPractitionerShare[];
13
32
  };
14
33
  export type CreatePatientSharingInvite = {
15
34
  codes: string[];
16
- endsAt: string;
35
+ endsAt: string | null;
17
36
  };
18
37
  export type RedeemPatientSharingInvite = {
19
38
  inviteId: string;
20
39
  code: string;
21
40
  };
22
- export type PatientSharingSettings = Record<string, unknown>;
41
+ export type PatientSharingSettings = {
42
+ enabled: boolean;
43
+ accessPolicyId: string | null;
44
+ practitionerSharingEnabled: boolean;
45
+ };
46
+ export type PatientSharingSettingsUpdate = {
47
+ enabled: boolean;
48
+ practitionerSharingEnabled?: boolean | null;
49
+ };
@@ -1,5 +1,5 @@
1
1
  import { OvokClient } from "../ovok-client";
2
- import { OvokAccount, OvokAdministeredProject, OvokCreateProject, OvokCreatedProject, OvokI18nDocument, OvokI18nValue, OvokInviteProjectMember, OvokLocalization, OvokLocalizationQuery, OvokLocalizationUpdate, OvokLocales, OvokPage, OvokPatientObservations, OvokProjectFeature, OvokProjectFeatures, OvokProjectMember, OvokProjectMemberResponse, OvokProjectSettings, OvokProjectSettingKey, OvokRemoveProjectMemberResponse, OvokUpdateProjectMember } from "./types";
2
+ import { OvokAccount, OvokAdministeredProject, OvokCreateProject, OvokCreatedProject, OvokI18nDocument, OvokI18nValue, OvokInviteProjectMember, OvokLocalization, OvokLocalizationQuery, OvokLocalizationUpdate, OvokLocales, OvokPage, OvokPatientObservations, OvokProjectFeature, OvokProjectFeatures, OvokProjectMember, OvokProjectMemberResponse, OvokProjectSettings, OvokProjectSettingKey, OvokProjectTextSettingKey, OvokRemoveProjectMemberResponse, OvokUpdateProjectMember } from "./types";
3
3
  export declare function getAccounts(this: OvokClient): Promise<OvokAccount[]>;
4
4
  export declare function listAdministeredProjects(this: OvokClient, params?: {
5
5
  page?: number;
@@ -24,6 +24,7 @@ export declare function getProjectFeatures(this: OvokClient): Promise<OvokProjec
24
24
  export declare function updateProjectFeatures(this: OvokClient, features: OvokProjectFeature[]): Promise<OvokProjectFeatures>;
25
25
  export declare function getProjectSettings(this: OvokClient): Promise<OvokProjectSettings>;
26
26
  export declare function updateProjectSetting(this: OvokClient, key: OvokProjectSettingKey, enabled: boolean): Promise<OvokProjectSettings>;
27
+ export declare function updateProjectTextSetting(this: OvokClient, key: OvokProjectTextSettingKey, value: string | null): Promise<OvokProjectSettings>;
27
28
  export declare function getLocales(this: OvokClient): Promise<OvokLocales>;
28
29
  export declare function updateLocales(this: OvokClient, locales: OvokLocales): Promise<OvokLocales>;
29
30
  export declare function listLocalizations(this: OvokClient, language: string, params?: OvokLocalizationQuery): Promise<{
@@ -13,6 +13,7 @@ exports.getProjectFeatures = getProjectFeatures;
13
13
  exports.updateProjectFeatures = updateProjectFeatures;
14
14
  exports.getProjectSettings = getProjectSettings;
15
15
  exports.updateProjectSetting = updateProjectSetting;
16
+ exports.updateProjectTextSetting = updateProjectTextSetting;
16
17
  exports.getLocales = getLocales;
17
18
  exports.updateLocales = updateLocales;
18
19
  exports.listLocalizations = listLocalizations;
@@ -73,6 +74,9 @@ async function getProjectSettings() {
73
74
  async function updateProjectSetting(key, enabled) {
74
75
  return (await this.put(`/v1/project/settings/${segment(key)}`, { enabled }));
75
76
  }
77
+ async function updateProjectTextSetting(key, value) {
78
+ return (await this.put(`/v1/project/settings/values/${segment(key)}`, { value }));
79
+ }
76
80
  async function getLocales() {
77
81
  return this.get("/locales");
78
82
  }
@@ -68,11 +68,20 @@ export type OvokProjectFeatures = {
68
68
  export type OvokProjectFeaturesUpdate = {
69
69
  features: OvokProjectFeature[];
70
70
  };
71
- export declare const OVOK_PROJECT_SETTING_KEYS: readonly ["CONTENT_ENABLED", "MAILING_ENABLED", "PATIENT_INVITATION_ENABLED", "PATIENT_REGISTRATION_ENABLED", "PATIENT_LOGIN_ENABLED", "PRACTITIONER_INVITATION_ENABLED", "PRACTITIONER_REGISTRATION_ENABLED", "PRACTITIONER_LOGIN_ENABLED", "IOT_ENABLED", "CLINICIAN_INVITE_ON_BUSINESS_EMAIL"];
71
+ export declare const OVOK_PROJECT_SETTING_KEYS: readonly ["CONTENT_ENABLED", "MAILING_ENABLED", "PATIENT_INVITATION_ENABLED", "PATIENT_REGISTRATION_ENABLED", "PATIENT_LOGIN_ENABLED", "PRACTITIONER_INVITATION_ENABLED", "PRACTITIONER_REGISTRATION_ENABLED", "PRACTITIONER_LOGIN_ENABLED", "CLINICIAN_INVITE_ON_BUSINESS_EMAIL"];
72
72
  export type OvokProjectSettingKey = (typeof OVOK_PROJECT_SETTING_KEYS)[number];
73
+ export declare const OVOK_PROJECT_TEXT_SETTING_KEYS: readonly ["PATIENT_APP_URL", "PRACTITIONER_APP_URL", "PATIENT_SIGNUP_URL", "CLINICIAN_DASHBOARD_URL", "DEFAULT_PRACTITIONER_ACCESS_POLICY", "CLINICIAN_INVITE_ACCESS_POLICY"];
74
+ export type OvokProjectTextSettingKey = (typeof OVOK_PROJECT_TEXT_SETTING_KEYS)[number];
75
+ export declare const OVOK_PROJECT_TEXT_SETTING_ERROR_CODES: {
76
+ readonly invalidValue: "INVALID_SETTING_VALUE";
77
+ readonly appUrlNotAllowed: "APP_URL_NOT_ALLOWED";
78
+ readonly unknownSetting: "UNKNOWN_SETTING";
79
+ readonly appUrlNotConfigured: "app_url_not_configured";
80
+ };
73
81
  export type OvokProjectSettings = {
74
82
  projectId: string;
75
83
  settings: Record<OvokProjectSettingKey, boolean>;
84
+ values: Record<OvokProjectTextSettingKey, string | null>;
76
85
  };
77
86
  export type OvokLocales = {
78
87
  languages: string[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OVOK_PROJECT_SETTING_KEYS = exports.OVOK_PROJECT_FEATURE_VALUES = void 0;
3
+ exports.OVOK_PROJECT_TEXT_SETTING_ERROR_CODES = exports.OVOK_PROJECT_TEXT_SETTING_KEYS = exports.OVOK_PROJECT_SETTING_KEYS = exports.OVOK_PROJECT_FEATURE_VALUES = void 0;
4
4
  exports.OVOK_PROJECT_FEATURE_VALUES = [
5
5
  "ai",
6
6
  "aws-comprehend",
@@ -23,6 +23,19 @@ exports.OVOK_PROJECT_SETTING_KEYS = [
23
23
  "PRACTITIONER_INVITATION_ENABLED",
24
24
  "PRACTITIONER_REGISTRATION_ENABLED",
25
25
  "PRACTITIONER_LOGIN_ENABLED",
26
- "IOT_ENABLED",
27
26
  "CLINICIAN_INVITE_ON_BUSINESS_EMAIL",
28
27
  ];
28
+ exports.OVOK_PROJECT_TEXT_SETTING_KEYS = [
29
+ "PATIENT_APP_URL",
30
+ "PRACTITIONER_APP_URL",
31
+ "PATIENT_SIGNUP_URL",
32
+ "CLINICIAN_DASHBOARD_URL",
33
+ "DEFAULT_PRACTITIONER_ACCESS_POLICY",
34
+ "CLINICIAN_INVITE_ACCESS_POLICY",
35
+ ];
36
+ exports.OVOK_PROJECT_TEXT_SETTING_ERROR_CODES = {
37
+ invalidValue: "INVALID_SETTING_VALUE",
38
+ appUrlNotAllowed: "APP_URL_NOT_ALLOWED",
39
+ unknownSetting: "UNKNOWN_SETTING",
40
+ appUrlNotConfigured: "app_url_not_configured",
41
+ };
@@ -51,21 +51,14 @@ function mapSignalsError(error, options = {}) {
51
51
  if (isSignalsError(error)) {
52
52
  return error;
53
53
  }
54
- const payload = responsePayload(error);
55
- const code = responseCode(payload);
56
- const parsed = (0, ovok_error_1.parseOvokError)(payload !== null && payload !== void 0 ? payload : error);
57
- const message = (parsed.message === "[object Object]" || parsed.message === "undefined") &&
58
- error instanceof Error
59
- ? error.message
60
- : parsed.message;
61
- const status = responseStatus(error, payload);
54
+ const { code, fieldErrors, message, status } = (0, ovok_error_1.readOvokError)(error);
62
55
  if (code && SIGNALS_ERROR_CODES.has(code)) {
63
56
  const knownCode = code;
64
57
  const resolvedStatus = status !== null && status !== void 0 ? status : SIGNALS_ERROR_STATUSES[knownCode];
65
58
  if (resolvedStatus !== undefined) {
66
59
  return new SignalsError(knownCode, resolvedStatus, message, {
67
60
  cause: error,
68
- fieldErrors: parsed.fieldErrors,
61
+ fieldErrors,
69
62
  });
70
63
  }
71
64
  }
@@ -84,102 +77,8 @@ function mapSignalsError(error, options = {}) {
84
77
  : "validation_error";
85
78
  return new SignalsError(validationCode, status, message, {
86
79
  cause: error,
87
- fieldErrors: parsed.fieldErrors,
80
+ fieldErrors,
88
81
  });
89
82
  }
90
83
  return error;
91
84
  }
92
- function responsePayload(error) {
93
- var _a, _b;
94
- const root = asRecord(error);
95
- const candidates = [
96
- root === null || root === void 0 ? void 0 : root.body,
97
- root === null || root === void 0 ? void 0 : root.data,
98
- (_a = asRecord(root === null || root === void 0 ? void 0 : root.response)) === null || _a === void 0 ? void 0 : _a.data,
99
- (_b = asRecord(root === null || root === void 0 ? void 0 : root.response)) === null || _b === void 0 ? void 0 : _b.body,
100
- root === null || root === void 0 ? void 0 : root.outcome,
101
- ];
102
- for (const candidate of candidates) {
103
- const parsed = parseJson(candidate);
104
- if (parsed !== undefined) {
105
- return parsed;
106
- }
107
- }
108
- if (error instanceof Error) {
109
- const parsed = parseJson(error.message);
110
- if (parsed !== undefined) {
111
- return parsed;
112
- }
113
- }
114
- return error;
115
- }
116
- function responseCode(payload) {
117
- var _a, _b, _c, _d, _e, _f;
118
- const root = asRecord(payload);
119
- const error = asRecord(root === null || root === void 0 ? void 0 : root.error);
120
- const directCode = (_b = (_a = (typeof (root === null || root === void 0 ? void 0 : root.error) === "string" ? root.error : undefined)) !== null && _a !== void 0 ? _a : (typeof (root === null || root === void 0 ? void 0 : root.code) === "string" ? root.code : undefined)) !== null && _b !== void 0 ? _b : (typeof (error === null || error === void 0 ? void 0 : error.code) === "string" ? error.code : undefined);
121
- if (directCode) {
122
- return directCode;
123
- }
124
- const outcome = (_d = (_c = asRecord(root === null || root === void 0 ? void 0 : root.outcome)) !== null && _c !== void 0 ? _c : root) !== null && _d !== void 0 ? _d : {};
125
- const issues = Array.isArray(outcome.issue) ? outcome.issue : [];
126
- for (const issue of issues) {
127
- const issueRecord = asRecord(issue);
128
- const details = asRecord(issueRecord === null || issueRecord === void 0 ? void 0 : issueRecord.details);
129
- const coding = Array.isArray(details === null || details === void 0 ? void 0 : details.coding) ? details.coding : [];
130
- for (const entry of coding) {
131
- const entryCode = (_e = asRecord(entry)) === null || _e === void 0 ? void 0 : _e.code;
132
- if (typeof entryCode === "string" && entryCode.startsWith("signals_")) {
133
- return entryCode;
134
- }
135
- }
136
- const diagnostic = parseJson(issueRecord === null || issueRecord === void 0 ? void 0 : issueRecord.diagnostics);
137
- const diagnosticRecord = asRecord(diagnostic);
138
- const diagnosticCode = (_f = diagnosticRecord === null || diagnosticRecord === void 0 ? void 0 : diagnosticRecord.error) !== null && _f !== void 0 ? _f : diagnosticRecord === null || diagnosticRecord === void 0 ? void 0 : diagnosticRecord.code;
139
- if (typeof diagnosticCode === "string") {
140
- return diagnosticCode;
141
- }
142
- }
143
- return undefined;
144
- }
145
- function responseStatus(error, payload) {
146
- var _a, _b, _c, _d, _e, _f;
147
- const root = asRecord(error);
148
- const response = asRecord(root === null || root === void 0 ? void 0 : root.response);
149
- const body = asRecord(payload);
150
- const status = (_d = (_c = (_b = (_a = root === null || root === void 0 ? void 0 : root.status) !== null && _a !== void 0 ? _a : root === null || root === void 0 ? void 0 : root.statusCode) !== null && _b !== void 0 ? _b : response === null || response === void 0 ? void 0 : response.status) !== null && _c !== void 0 ? _c : body === null || body === void 0 ? void 0 : body.status) !== null && _d !== void 0 ? _d : body === null || body === void 0 ? void 0 : body.statusCode;
151
- if (typeof status === "number") {
152
- return status;
153
- }
154
- const outcome = (_e = asRecord(body === null || body === void 0 ? void 0 : body.outcome)) !== null && _e !== void 0 ? _e : body;
155
- const issues = Array.isArray(outcome === null || outcome === void 0 ? void 0 : outcome.issue) ? outcome.issue : [];
156
- for (const issue of issues) {
157
- const issueCode = (_f = asRecord(issue)) === null || _f === void 0 ? void 0 : _f.code;
158
- if (issueCode === "conflict") {
159
- return 409;
160
- }
161
- if (issueCode === "forbidden") {
162
- return 403;
163
- }
164
- if (issueCode === "not-found") {
165
- return 404;
166
- }
167
- }
168
- return undefined;
169
- }
170
- function parseJson(value) {
171
- if (typeof value !== "string") {
172
- return value;
173
- }
174
- try {
175
- return JSON.parse(value);
176
- }
177
- catch (_a) {
178
- return undefined;
179
- }
180
- }
181
- function asRecord(value) {
182
- return value && typeof value === "object"
183
- ? value
184
- : undefined;
185
- }
@@ -1,8 +1,9 @@
1
1
  import { OvokClient } from "../ovok-client";
2
2
  import { EnableSignalsResponse, SetSignalsThresholdBody, SignalsAlert, SignalsAlertsPage, SignalsAlertsQuery, SignalsSettingsPatch, SignalsSettingsResponse, SignalsThreshold, SignalsThresholds } from "./types";
3
3
  /**
4
- * Enables Signals for an existing patient. The operation is idempotent; observations saved through Ovok are
5
- * forwarded by the backend, so callers should not submit the same readings to Signals separately.
4
+ * Enables Signals for an existing patient. The operation is idempotent; retry after 409 or 503.
5
+ * Observations saved through Ovok are forwarded by the backend, so callers should not submit
6
+ * the same readings to Signals separately.
6
7
  */
7
8
  export declare function enableSignalsForPatient(this: OvokClient, patientId: string): Promise<EnableSignalsResponse>;
8
9
  export declare function getSignalsThresholds(this: OvokClient, patientId: string): Promise<SignalsThresholds>;
@@ -12,8 +12,9 @@ exports.getSignalsSettings = getSignalsSettings;
12
12
  exports.updateSignalsSettings = updateSignalsSettings;
13
13
  const segment = (value) => encodeURIComponent(value);
14
14
  /**
15
- * Enables Signals for an existing patient. The operation is idempotent; observations saved through Ovok are
16
- * forwarded by the backend, so callers should not submit the same readings to Signals separately.
15
+ * Enables Signals for an existing patient. The operation is idempotent; retry after 409 or 503.
16
+ * Observations saved through Ovok are forwarded by the backend, so callers should not submit
17
+ * the same readings to Signals separately.
17
18
  */
18
19
  function enableSignalsForPatient(patientId) {
19
20
  return this.post(`/fhir/Patient/${segment(patientId)}/$enable-signals`);
@@ -53,7 +53,7 @@ export type SignalsSettingsPatch = Partial<SignalsSettings>;
53
53
  export type EnableSignalsResponse = {
54
54
  patientId: string;
55
55
  signalsPatientId: string;
56
- enabled: boolean;
56
+ enabled: true;
57
57
  };
58
58
  export type SignalsErrorCode = "signals_threshold_not_editable" | "signals_patient_not_enrolled" | "signals_conflict" | "signals_code_not_medical" | "signals_reason_required" | "signals_episodes_disabled" | "signals_bad_request" | "signals_shared_tenant" | "signals_audit_failed" | "signals_write_mismatch" | "signals_unavailable" | "signals_undo_failed" | "signals_mint_failed" | "signals_forbidden" | "signals_not_found" | "validation_error";
59
59
  export type SignalsFieldError = ValidationError;
@@ -22,6 +22,7 @@ exports.OVOK_CORE_API_REQUIREMENTS = {
22
22
  { method: "POST", path: "/auth/tenant/Practitioner/login/token", group: "Auth" },
23
23
  { method: "POST", path: "/auth/tenant/Practitioner/login/mfa", group: "Auth" },
24
24
  { method: "POST", path: "/auth/tenant/Patient/register", group: "Auth" },
25
+ { method: "POST", path: "/auth/tenant/Practitioner/register", group: "Auth" },
25
26
  { method: "POST", path: "/auth/external/google", group: "Auth" },
26
27
  { method: "POST", path: "/auth/external/apple", group: "Auth" },
27
28
  { method: "PATCH", path: "/v2/auth/change-password", group: "Auth" },
@@ -79,6 +80,18 @@ exports.OVOK_CORE_API_REQUIREMENTS = {
79
80
  { method: "PATCH", path: "/v1/projects/me/features", group: "Projects" },
80
81
  { method: "GET", path: "/v1/project/settings", group: "Projects" },
81
82
  { method: "PUT", path: "/v1/project/settings/:key", group: "Projects" },
83
+ { method: "PUT", path: "/v1/project/settings/values/:key", group: "Projects" },
84
+ { method: "GET", path: "/v1/email/templates", group: "Email" },
85
+ { method: "GET", path: "/v1/patient-sharing/settings", group: "PatientSharing" },
86
+ { method: "PUT", path: "/v1/patient-sharing/settings", group: "PatientSharing" },
87
+ { method: "GET", path: "/v1/patient-sharing/shares", group: "PatientSharing" },
88
+ { method: "DELETE", path: "/v1/patient-sharing/shares/:consentId", group: "PatientSharing" },
89
+ { method: "POST", path: "/v1/patient-sharing/invites", group: "PatientSharing" },
90
+ { method: "POST", path: "/v1/patient-sharing/invites/redeem", group: "PatientSharing" },
91
+ { method: "POST", path: "/v1/invites/practitioner", group: "Invites" },
92
+ { method: "POST", path: "/v1/invites/patient", group: "Invites" },
93
+ { method: "POST", path: "/v1/invites/practitioner/accept", group: "Invites" },
94
+ { method: "POST", path: "/v1/invites/patient/accept", group: "Invites" },
82
95
  { method: "GET", path: "/locales", group: "Localization" },
83
96
  { method: "PATCH", path: "/locales", group: "Localization" },
84
97
  { method: "GET", path: "/localization/:language", group: "Localization" },
@@ -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.3",
51
+ version: "0.4.4",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
@@ -0,0 +1,3 @@
1
+ import { OvokEmailTemplates } from "../client/email";
2
+ import { OvokRequestState } from "./api-hooks";
3
+ export declare const useEmailTemplates: () => OvokRequestState<OvokEmailTemplates>;
@@ -0,0 +1,46 @@
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.useEmailTemplates = void 0;
38
+ const React = __importStar(require("react"));
39
+ const api_hooks_1 = require("./api-hooks");
40
+ const index_1 = require("./index");
41
+ const useEmailTemplates = () => {
42
+ const client = (0, index_1.useClient)();
43
+ const load = React.useCallback(() => client.getEmailTemplates(), [client]);
44
+ return (0, api_hooks_1.useOvokRequest)(load);
45
+ };
46
+ exports.useEmailTemplates = useEmailTemplates;
@@ -8,7 +8,9 @@ export declare const OvokProvider: (props: React.PropsWithChildren<{
8
8
  export { observationsToMeasurements, useEcgRecording, useObservations, useSaveMeasurement, useUrineTests, } from "./observation-hooks";
9
9
  export { useAdministeredProjects, useCarehubDeviceTelemetry, useCarehubDevices, useCarehubNotifications, useCarehubPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentCarehubNotifications, } from "./api-hooks";
10
10
  export { useConsentSignature, useContent, useCreateVideoCallAppointment, useCreateVideoCallUserAccess, useDocuments, useVideoCallAccess, useVideoCallAppointments, } from "./experience-hooks";
11
- export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, } from "./platform-hooks";
11
+ export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, useUpdateProjectTextSetting, } from "./platform-hooks";
12
+ export { useEmailTemplates } from "./email-hooks";
13
+ export { useAcceptInvite, useInvitePatient, useInvitePractitioner, } from "./invites-hooks";
12
14
  export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientMeasurement, usePatientMeasurementHistory, usePatientDashboard, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
13
15
  export { useCreatePatientSharingInvite, usePatientSharing, usePatientSharingSettings, useRedeemPatientSharingInvite, useRevokePatientSharing, useUpdatePatientSharingSettings, } from "./patient-sharing-hooks";
14
16
  export { useAcknowledgeSignalsAlert, useEnableSignalsForPatient, useRemoveSignalsThreshold, useSetSignalsThreshold, useSignalsAlert, useSignalsAlerts, useSignalsSettings, useSignalsThresholds, useUpdateSignalsSettings, } from "./signals-hooks";
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useUpdateLocalization = exports.useUpdateI18nextDocument = exports.useLocalizations = exports.useLocales = exports.useI18nextDocument = exports.useVideoCallAppointments = exports.useVideoCallAccess = exports.useDocuments = exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useContent = exports.useConsentSignature = exports.useRecentCarehubNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useCarehubPatients = exports.useCarehubNotifications = exports.useCarehubDevices = exports.useCarehubDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
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 = void 0;
37
+ exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useInvitePractitioner = exports.useInvitePatient = exports.useAcceptInvite = exports.useEmailTemplates = exports.useUpdateProjectTextSetting = exports.useUpdateLocalization = exports.useUpdateI18nextDocument = exports.useLocalizations = exports.useLocales = exports.useI18nextDocument = exports.useVideoCallAppointments = exports.useVideoCallAccess = exports.useDocuments = exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useContent = exports.useConsentSignature = exports.useRecentCarehubNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useCarehubPatients = exports.useCarehubNotifications = exports.useCarehubDevices = exports.useCarehubDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
38
+ exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.usePatientSharingSettings = exports.usePatientSharing = exports.useCreatePatientSharingInvite = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.usePatientMeasurementHistory = exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = void 0;
39
39
  /*
40
40
  * The only React-dependent module in the package.
41
41
  *
@@ -104,6 +104,13 @@ Object.defineProperty(exports, "useLocales", { enumerable: true, get: function (
104
104
  Object.defineProperty(exports, "useLocalizations", { enumerable: true, get: function () { return platform_hooks_1.useLocalizations; } });
105
105
  Object.defineProperty(exports, "useUpdateI18nextDocument", { enumerable: true, get: function () { return platform_hooks_1.useUpdateI18nextDocument; } });
106
106
  Object.defineProperty(exports, "useUpdateLocalization", { enumerable: true, get: function () { return platform_hooks_1.useUpdateLocalization; } });
107
+ Object.defineProperty(exports, "useUpdateProjectTextSetting", { enumerable: true, get: function () { return platform_hooks_1.useUpdateProjectTextSetting; } });
108
+ var email_hooks_1 = require("./email-hooks");
109
+ Object.defineProperty(exports, "useEmailTemplates", { enumerable: true, get: function () { return email_hooks_1.useEmailTemplates; } });
110
+ var invites_hooks_1 = require("./invites-hooks");
111
+ Object.defineProperty(exports, "useAcceptInvite", { enumerable: true, get: function () { return invites_hooks_1.useAcceptInvite; } });
112
+ Object.defineProperty(exports, "useInvitePatient", { enumerable: true, get: function () { return invites_hooks_1.useInvitePatient; } });
113
+ Object.defineProperty(exports, "useInvitePractitioner", { enumerable: true, get: function () { return invites_hooks_1.useInvitePractitioner; } });
107
114
  var patient_hooks_1 = require("./patient-hooks");
108
115
  Object.defineProperty(exports, "useCurrentPatientProfile", { enumerable: true, get: function () { return patient_hooks_1.useCurrentPatientProfile; } });
109
116
  Object.defineProperty(exports, "useExtractQuestionnaireObservations", { enumerable: true, get: function () { return patient_hooks_1.useExtractQuestionnaireObservations; } });
@@ -0,0 +1,5 @@
1
+ import { AcceptInviteBody, AcceptInviteResult, InviteBody, InviteSent } from "../client/invites";
2
+ import { OvokMutationState } from "./api-hooks";
3
+ export declare const useInvitePractitioner: () => OvokMutationState<InviteBody, InviteSent>;
4
+ export declare const useInvitePatient: () => OvokMutationState<InviteBody, InviteSent>;
5
+ export declare const useAcceptInvite: () => OvokMutationState<AcceptInviteBody, AcceptInviteResult>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useAcceptInvite = exports.useInvitePatient = exports.useInvitePractitioner = void 0;
5
+ const api_hooks_1 = require("./api-hooks");
6
+ const useInvitePractitioner = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.invitePractitioner(body));
7
+ exports.useInvitePractitioner = useInvitePractitioner;
8
+ const useInvitePatient = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.invitePatient(body));
9
+ exports.useInvitePatient = useInvitePatient;
10
+ const useAcceptInvite = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.acceptInvite(body));
11
+ exports.useAcceptInvite = useAcceptInvite;
@@ -1,8 +1,8 @@
1
- import { CreatePatientSharingInvite, PatientSharingInvite, PatientSharingSettings, PatientSharingShare, PatientSharingShares, RedeemPatientSharingInvite } from "../client/patient-sharing";
1
+ import { CreatePatientSharingInvite, PatientSharingInvite, PatientSharingSettings, PatientSharingSettingsUpdate, PatientSharingShare, PatientSharingShares, RedeemPatientSharingInvite } from "../client/patient-sharing";
2
2
  import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
3
  export declare const usePatientSharing: () => OvokRequestState<PatientSharingShares>;
4
4
  export declare const useCreatePatientSharingInvite: () => OvokMutationState<CreatePatientSharingInvite, PatientSharingInvite>;
5
5
  export declare const useRedeemPatientSharingInvite: () => OvokMutationState<RedeemPatientSharingInvite, PatientSharingShare>;
6
6
  export declare const useRevokePatientSharing: () => OvokMutationState<string, void>;
7
7
  export declare const usePatientSharingSettings: () => OvokRequestState<PatientSharingSettings>;
8
- export declare const useUpdatePatientSharingSettings: () => OvokMutationState<PatientSharingSettings, PatientSharingSettings>;
8
+ export declare const useUpdatePatientSharingSettings: () => OvokMutationState<PatientSharingSettingsUpdate, PatientSharingSettings>;
@@ -1,4 +1,4 @@
1
- import { OvokI18nDocument, OvokLocalization, OvokLocalizationQuery, OvokLocalizationUpdate, OvokI18nValue, OvokLocales } from "../client/platform/types";
1
+ import { OvokI18nDocument, OvokLocalization, OvokLocalizationQuery, OvokLocalizationUpdate, OvokI18nValue, OvokLocales, OvokProjectSettings, OvokProjectTextSettingKey } from "../client/platform/types";
2
2
  import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
3
  export declare const useLocales: () => OvokRequestState<OvokLocales>;
4
4
  export declare const useLocalizations: (language: string, params?: OvokLocalizationQuery) => OvokRequestState<{
@@ -15,3 +15,7 @@ export declare const useUpdateI18nextDocument: () => OvokMutationState<{
15
15
  language: string;
16
16
  document: Record<string, OvokI18nValue>;
17
17
  }, void>;
18
+ export declare const useUpdateProjectTextSetting: () => OvokMutationState<{
19
+ key: OvokProjectTextSettingKey;
20
+ value: string | null;
21
+ }, OvokProjectSettings>;