@ovok/core 0.4.49-dev.495 → 0.4.49-dev.497

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 (243) hide show
  1. package/dist/client/observation/measurement-fields.d.ts +1 -1
  2. package/dist/client/observation/methods/observationsToMeasurements.d.ts +1 -1
  3. package/dist/client/observation/methods/observationsToMeasurements.js +59 -59
  4. package/dist/client/observation/services/base-observation-service.d.ts +1 -1
  5. package/dist/client/observation/services/blood-oxygen.d.ts +1 -1
  6. package/dist/client/observation/services/blood-oxygen.js +7 -7
  7. package/dist/client/observation/services/blood-pressure.d.ts +1 -1
  8. package/dist/client/observation/services/blood-pressure.js +16 -16
  9. package/dist/client/observation/services/component-observation-services.d.ts +1 -1
  10. package/dist/client/observation/services/component-observation-services.js +3 -3
  11. package/dist/client/observation/services/creator.d.ts +1 -1
  12. package/dist/client/observation/services/creator.js +10 -10
  13. package/dist/client/observation/services/ecg-observation-fragments.d.ts +1 -1
  14. package/dist/client/observation/services/ecg.d.ts +1 -1
  15. package/dist/client/observation/services/ecg.js +10 -10
  16. package/dist/client/observation/services/lipid-panel.d.ts +1 -1
  17. package/dist/client/observation/services/lipid-panel.js +13 -13
  18. package/dist/client/observation/services/single-value-services.d.ts +1 -1
  19. package/dist/client/observation/services/single-value-services.js +19 -19
  20. package/dist/client/observation/services/step-count.d.ts +1 -1
  21. package/dist/client/observation/services/step-count.js +5 -5
  22. package/dist/client/observation/services/uric-acid-service.d.ts +1 -1
  23. package/dist/client/observation/services/uric-acid-service.js +7 -7
  24. package/dist/client/offline/offline-measurement-queue.d.ts +1 -2
  25. package/dist/client/wearables/types.d.ts +5 -0
  26. package/dist/conformance/capability-requirements.js +1 -1
  27. package/dist/next/auth/access-token.d.ts +9 -0
  28. package/dist/next/auth/access-token.js +18 -0
  29. package/dist/next/auth/client-credentials.d.ts +16 -0
  30. package/dist/next/auth/client-credentials.js +40 -0
  31. package/dist/next/auth/credentials.d.ts +5 -0
  32. package/dist/next/auth/credentials.js +7 -0
  33. package/dist/next/auth/saved-accounts-store.d.ts +26 -0
  34. package/dist/next/auth/saved-accounts-store.js +93 -0
  35. package/dist/next/auth/session-store.d.ts +12 -0
  36. package/dist/next/auth/session-store.js +33 -0
  37. package/dist/next/auth/session.d.ts +28 -0
  38. package/dist/next/auth/session.js +27 -0
  39. package/dist/next/auth/token-endpoint.d.ts +12 -0
  40. package/dist/next/auth/token-endpoint.js +28 -0
  41. package/dist/next/auth/user-session.d.ts +39 -0
  42. package/dist/next/auth/user-session.js +183 -0
  43. package/dist/next/config/ovok-config.d.ts +42 -0
  44. package/dist/next/config/ovok-config.js +2 -0
  45. package/dist/next/config/settings.d.ts +6 -0
  46. package/dist/next/config/settings.js +74 -0
  47. package/dist/next/errors/error-from-response.d.ts +2 -0
  48. package/dist/next/errors/error-from-response.js +35 -0
  49. package/dist/next/errors/ovok-account-error.d.ts +5 -0
  50. package/dist/next/errors/ovok-account-error.js +13 -0
  51. package/dist/next/errors/ovok-errors.d.ts +42 -0
  52. package/dist/next/errors/ovok-errors.js +74 -0
  53. package/dist/next/http/http-client.d.ts +36 -0
  54. package/dist/next/http/http-client.js +116 -0
  55. package/dist/next/http/retry-after.d.ts +1 -0
  56. package/dist/next/http/retry-after.js +16 -0
  57. package/dist/next/http/retry-policy.d.ts +13 -0
  58. package/dist/next/http/retry-policy.js +27 -0
  59. package/dist/next/http/transmit.d.ts +14 -0
  60. package/dist/next/http/transmit.js +57 -0
  61. package/dist/next/http/url.d.ts +6 -0
  62. package/dist/next/http/url.js +22 -0
  63. package/dist/next/index.d.ts +74 -0
  64. package/dist/next/index.js +35 -0
  65. package/dist/next/ovok.d.ts +54 -0
  66. package/dist/next/ovok.js +77 -0
  67. package/dist/next/paging/bundle-page.d.ts +4 -0
  68. package/dist/next/paging/bundle-page.js +25 -0
  69. package/dist/next/paging/cursor-pages.d.ts +7 -0
  70. package/dist/next/paging/cursor-pages.js +14 -0
  71. package/dist/next/paging/numbered-pages.d.ts +15 -0
  72. package/dist/next/paging/numbered-pages.js +20 -0
  73. package/dist/next/paging/page.d.ts +12 -0
  74. package/dist/next/paging/page.js +17 -0
  75. package/dist/next/resources/accounts/accounts-resource.d.ts +8 -0
  76. package/dist/next/resources/accounts/accounts-resource.js +13 -0
  77. package/dist/next/resources/ai/ai-chat-resource.d.ts +8 -0
  78. package/dist/next/resources/ai/ai-chat-resource.js +12 -0
  79. package/dist/next/resources/ai/ai-resource.d.ts +16 -0
  80. package/dist/next/resources/ai/ai-resource.js +19 -0
  81. package/dist/next/resources/ai/chat-messages-resource.d.ts +9 -0
  82. package/dist/next/resources/ai/chat-messages-resource.js +18 -0
  83. package/dist/next/resources/ai/chat-sessions-resource.d.ts +14 -0
  84. package/dist/next/resources/ai/chat-sessions-resource.js +23 -0
  85. package/dist/next/resources/auth/auth-sessions-resource.d.ts +13 -0
  86. package/dist/next/resources/auth/auth-sessions-resource.js +25 -0
  87. package/dist/next/resources/auth/registration.d.ts +35 -0
  88. package/dist/next/resources/auth/registration.js +24 -0
  89. package/dist/next/resources/auth/social-login.d.ts +8 -0
  90. package/dist/next/resources/auth/social-login.js +7 -0
  91. package/dist/next/resources/auth-resource.d.ts +63 -0
  92. package/dist/next/resources/auth-resource.js +119 -0
  93. package/dist/next/resources/bots/bots-resource.d.ts +10 -0
  94. package/dist/next/resources/bots/bots-resource.js +15 -0
  95. package/dist/next/resources/cms/cms-delivery.d.ts +22 -0
  96. package/dist/next/resources/cms/cms-delivery.js +36 -0
  97. package/dist/next/resources/cms/cms-documents-resource.d.ts +11 -0
  98. package/dist/next/resources/cms/cms-documents-resource.js +17 -0
  99. package/dist/next/resources/cms/cms-resource.d.ts +17 -0
  100. package/dist/next/resources/cms/cms-resource.js +38 -0
  101. package/dist/next/resources/cms/payload-pages.d.ts +6 -0
  102. package/dist/next/resources/cms/payload-pages.js +15 -0
  103. package/dist/next/resources/cms/release-notes-resource.d.ts +10 -0
  104. package/dist/next/resources/cms/release-notes-resource.js +15 -0
  105. package/dist/next/resources/cms/translation-tree.d.ts +3 -0
  106. package/dist/next/resources/cms/translation-tree.js +45 -0
  107. package/dist/next/resources/consent/consent-resource.d.ts +23 -0
  108. package/dist/next/resources/consent/consent-resource.js +43 -0
  109. package/dist/next/resources/content/content-resource.d.ts +19 -0
  110. package/dist/next/resources/content/content-resource.js +41 -0
  111. package/dist/next/resources/documents/documents-resource.d.ts +26 -0
  112. package/dist/next/resources/documents/documents-resource.js +41 -0
  113. package/dist/next/resources/email/email-resource.d.ts +6 -0
  114. package/dist/next/resources/email/email-resource.js +10 -0
  115. package/dist/next/resources/email/email-templates-resource.d.ts +8 -0
  116. package/dist/next/resources/email/email-templates-resource.js +13 -0
  117. package/dist/next/resources/fhir-resource.d.ts +28 -0
  118. package/dist/next/resources/fhir-resource.js +64 -0
  119. package/dist/next/resources/health-resource.d.ts +17 -0
  120. package/dist/next/resources/health-resource.js +14 -0
  121. package/dist/next/resources/invites/invite-flow-resource.d.ts +12 -0
  122. package/dist/next/resources/invites/invite-flow-resource.js +19 -0
  123. package/dist/next/resources/invites/invites-resource.d.ts +22 -0
  124. package/dist/next/resources/invites/invites-resource.js +29 -0
  125. package/dist/next/resources/localization/i18next-resource.d.ts +10 -0
  126. package/dist/next/resources/localization/i18next-resource.js +18 -0
  127. package/dist/next/resources/localization/locales-resource.d.ts +9 -0
  128. package/dist/next/resources/localization/locales-resource.js +16 -0
  129. package/dist/next/resources/localization/localizations-resource.d.ts +17 -0
  130. package/dist/next/resources/localization/localizations-resource.js +27 -0
  131. package/dist/next/resources/measurements/measurements-resource.d.ts +42 -0
  132. package/dist/next/resources/measurements/measurements-resource.js +77 -0
  133. package/dist/next/resources/measurements/observation-builder.d.ts +5 -0
  134. package/dist/next/resources/measurements/observation-builder.js +57 -0
  135. package/dist/next/resources/measurements/save-error.d.ts +5 -0
  136. package/dist/next/resources/measurements/save-error.js +18 -0
  137. package/dist/next/resources/measurements/signed-in-account.d.ts +11 -0
  138. package/dist/next/resources/measurements/signed-in-account.js +26 -0
  139. package/dist/next/resources/patient/fhir-records.d.ts +19 -0
  140. package/dist/next/resources/patient/fhir-records.js +33 -0
  141. package/dist/next/resources/patient/patient-resource.d.ts +21 -0
  142. package/dist/next/resources/patient/patient-resource.js +38 -0
  143. package/dist/next/resources/projects/project-features-resource.d.ts +9 -0
  144. package/dist/next/resources/projects/project-features-resource.js +17 -0
  145. package/dist/next/resources/projects/project-members-resource.d.ts +19 -0
  146. package/dist/next/resources/projects/project-members-resource.js +25 -0
  147. package/dist/next/resources/projects/project-settings-resource.d.ts +10 -0
  148. package/dist/next/resources/projects/project-settings-resource.js +21 -0
  149. package/dist/next/resources/projects/projects-resource.d.ts +20 -0
  150. package/dist/next/resources/projects/projects-resource.js +21 -0
  151. package/dist/next/resources/questionnaires/questionnaires-resource.d.ts +18 -0
  152. package/dist/next/resources/questionnaires/questionnaires-resource.js +36 -0
  153. package/dist/next/resources/session/saved-accounts-resource.d.ts +13 -0
  154. package/dist/next/resources/session/saved-accounts-resource.js +44 -0
  155. package/dist/next/resources/session/session-resource.d.ts +11 -0
  156. package/dist/next/resources/session/session-resource.js +15 -0
  157. package/dist/next/resources/sharing/sharing-invites-resource.d.ts +9 -0
  158. package/dist/next/resources/sharing/sharing-invites-resource.js +17 -0
  159. package/dist/next/resources/sharing/sharing-resource.d.ts +10 -0
  160. package/dist/next/resources/sharing/sharing-resource.js +14 -0
  161. package/dist/next/resources/sharing/sharing-settings-resource.d.ts +9 -0
  162. package/dist/next/resources/sharing/sharing-settings-resource.js +16 -0
  163. package/dist/next/resources/sharing/sharing-shares-resource.d.ts +9 -0
  164. package/dist/next/resources/sharing/sharing-shares-resource.js +27 -0
  165. package/dist/next/resources/signals/signals-gateway-resource.d.ts +14 -0
  166. package/dist/next/resources/signals/signals-gateway-resource.js +44 -0
  167. package/dist/next/resources/signals/signals-resource.d.ts +13 -0
  168. package/dist/next/resources/signals/signals-resource.js +19 -0
  169. package/dist/next/resources/signals/undeliverable-resource.d.ts +26 -0
  170. package/dist/next/resources/signals/undeliverable-resource.js +18 -0
  171. package/dist/next/resources/slim/live-reads.d.ts +13 -0
  172. package/dist/next/resources/slim/live-reads.js +87 -0
  173. package/dist/next/resources/slim/slim-alarms-resource.d.ts +13 -0
  174. package/dist/next/resources/slim/slim-alarms-resource.js +25 -0
  175. package/dist/next/resources/slim/slim-change-history-resource.d.ts +9 -0
  176. package/dist/next/resources/slim/slim-change-history-resource.js +19 -0
  177. package/dist/next/resources/slim/slim-child-projects-resource.d.ts +17 -0
  178. package/dist/next/resources/slim/slim-child-projects-resource.js +22 -0
  179. package/dist/next/resources/slim/slim-devices-resource.d.ts +29 -0
  180. package/dist/next/resources/slim/slim-devices-resource.js +81 -0
  181. package/dist/next/resources/slim/slim-exports-resource.d.ts +8 -0
  182. package/dist/next/resources/slim/slim-exports-resource.js +14 -0
  183. package/dist/next/resources/slim/slim-locations-resource.d.ts +14 -0
  184. package/dist/next/resources/slim/slim-locations-resource.js +30 -0
  185. package/dist/next/resources/slim/slim-medical-notifications-resource.d.ts +18 -0
  186. package/dist/next/resources/slim/slim-medical-notifications-resource.js +46 -0
  187. package/dist/next/resources/slim/slim-notification-notes-resource.d.ts +12 -0
  188. package/dist/next/resources/slim/slim-notification-notes-resource.js +34 -0
  189. package/dist/next/resources/slim/slim-notifications-resource.d.ts +19 -0
  190. package/dist/next/resources/slim/slim-notifications-resource.js +26 -0
  191. package/dist/next/resources/slim/slim-organizations-resource.d.ts +11 -0
  192. package/dist/next/resources/slim/slim-organizations-resource.js +25 -0
  193. package/dist/next/resources/slim/slim-out-of-bed-resource.d.ts +13 -0
  194. package/dist/next/resources/slim/slim-out-of-bed-resource.js +20 -0
  195. package/dist/next/resources/slim/slim-paths.d.ts +6 -0
  196. package/dist/next/resources/slim/slim-paths.js +9 -0
  197. package/dist/next/resources/slim/slim-patient-thresholds-resource.d.ts +10 -0
  198. package/dist/next/resources/slim/slim-patient-thresholds-resource.js +20 -0
  199. package/dist/next/resources/slim/slim-patients-resource.d.ts +20 -0
  200. package/dist/next/resources/slim/slim-patients-resource.js +39 -0
  201. package/dist/next/resources/slim/slim-policies-resource.d.ts +12 -0
  202. package/dist/next/resources/slim/slim-policies-resource.js +29 -0
  203. package/dist/next/resources/slim/slim-practitioners-resource.d.ts +8 -0
  204. package/dist/next/resources/slim/slim-practitioners-resource.js +14 -0
  205. package/dist/next/resources/slim/slim-projects-resource.d.ts +16 -0
  206. package/dist/next/resources/slim/slim-projects-resource.js +35 -0
  207. package/dist/next/resources/slim/slim-queries.d.ts +34 -0
  208. package/dist/next/resources/slim/slim-queries.js +2 -0
  209. package/dist/next/resources/slim/slim-resource.d.ts +39 -0
  210. package/dist/next/resources/slim/slim-resource.js +44 -0
  211. package/dist/next/resources/slim/slim-sleep-resource.d.ts +9 -0
  212. package/dist/next/resources/slim/slim-sleep-resource.js +15 -0
  213. package/dist/next/resources/slim/slim-thresholds-resource.d.ts +11 -0
  214. package/dist/next/resources/slim/slim-thresholds-resource.js +18 -0
  215. package/dist/next/resources/slim/slim-trends-resource.d.ts +11 -0
  216. package/dist/next/resources/slim/slim-trends-resource.js +19 -0
  217. package/dist/next/resources/slim/slim-users-resource.d.ts +11 -0
  218. package/dist/next/resources/slim/slim-users-resource.js +15 -0
  219. package/dist/next/resources/slim/slim-zones-resource.d.ts +12 -0
  220. package/dist/next/resources/slim/slim-zones-resource.js +24 -0
  221. package/dist/next/resources/video-calls/video-call-access-resource.d.ts +11 -0
  222. package/dist/next/resources/video-calls/video-call-access-resource.js +19 -0
  223. package/dist/next/resources/video-calls/video-call-appointments-resource.d.ts +10 -0
  224. package/dist/next/resources/video-calls/video-call-appointments-resource.js +21 -0
  225. package/dist/next/resources/video-calls/video-call-emails-resource.d.ts +10 -0
  226. package/dist/next/resources/video-calls/video-call-emails-resource.js +19 -0
  227. package/dist/next/resources/video-calls/video-calls-resource.d.ts +14 -0
  228. package/dist/next/resources/video-calls/video-calls-resource.js +20 -0
  229. package/dist/next/resources/wearables/wearable-connections-resource.d.ts +12 -0
  230. package/dist/next/resources/wearables/wearable-connections-resource.js +25 -0
  231. package/dist/next/resources/wearables/wearable-providers-resource.d.ts +12 -0
  232. package/dist/next/resources/wearables/wearable-providers-resource.js +27 -0
  233. package/dist/next/resources/wearables/wearables-resource.d.ts +8 -0
  234. package/dist/next/resources/wearables/wearables-resource.js +14 -0
  235. package/dist/next/storage/ovok-storage.d.ts +11 -0
  236. package/dist/next/storage/ovok-storage.js +19 -0
  237. package/dist/types/MeasurementTypes.d.ts +5 -0
  238. package/dist/types/MeasurementTypes.js +21 -0
  239. package/dist/types/index.d.ts +1 -5
  240. package/dist/types/index.js +1 -5
  241. package/next/index.d.ts +1 -0
  242. package/next/index.js +3 -0
  243. package/package.json +3 -2
@@ -0,0 +1,13 @@
1
+ import { SavedAccount } from "../../auth/saved-accounts-store";
2
+ import { UserSession } from "../../auth/user-session";
3
+ import { HttpClient } from "../../http/http-client";
4
+ import { RequestOptions } from "../../http/transmit";
5
+ export declare class SavedAccountsResource {
6
+ private readonly http;
7
+ private readonly session;
8
+ constructor(http: HttpClient, session: UserSession | null);
9
+ list(): Promise<SavedAccount[]>;
10
+ switch(accountId: string): Promise<void>;
11
+ remove(accountId: string, options?: RequestOptions): Promise<void>;
12
+ private userSession;
13
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SavedAccountsResource = void 0;
4
+ const ovok_account_error_1 = require("../../errors/ovok-account-error");
5
+ const ovok_errors_1 = require("../../errors/ovok-errors");
6
+ const CURRENT_SESSION_PATH = "auth/session/current";
7
+ class SavedAccountsResource {
8
+ constructor(http, session) {
9
+ this.http = http;
10
+ this.session = session;
11
+ }
12
+ list() {
13
+ return this.userSession().listSavedAccounts();
14
+ }
15
+ switch(accountId) {
16
+ return this.userSession().switchSavedAccount(accountId);
17
+ }
18
+ async remove(accountId, options) {
19
+ const session = this.userSession();
20
+ const account = await session.getSavedAccount(accountId);
21
+ if (account === null) {
22
+ throw new ovok_account_error_1.OvokAccountError("account_not_found");
23
+ }
24
+ if (!account.expired) {
25
+ const isolatedSession = session.forSavedAccount(account.session);
26
+ try {
27
+ await this.http.withCredentials(isolatedSession).delete(CURRENT_SESSION_PATH, options);
28
+ }
29
+ catch (error) {
30
+ if (!(error instanceof ovok_errors_1.OvokError && error.status === 401) && await isolatedSession.current() !== null) {
31
+ throw error;
32
+ }
33
+ }
34
+ }
35
+ await session.removeSavedAccount(accountId);
36
+ }
37
+ userSession() {
38
+ if (this.session === null) {
39
+ throw new ovok_errors_1.OvokConfigError((0, ovok_errors_1.detailsFor)("Saved accounts need a user session."));
40
+ }
41
+ return this.session;
42
+ }
43
+ }
44
+ exports.SavedAccountsResource = SavedAccountsResource;
@@ -0,0 +1,11 @@
1
+ import type { Session } from "../../auth/session";
2
+ import type { SessionChangeListener, UserSession } from "../../auth/user-session";
3
+ import { HttpClient } from "../../http/http-client";
4
+ import { SavedAccountsResource } from "./saved-accounts-resource";
5
+ export declare class SessionResource {
6
+ private readonly session;
7
+ readonly savedAccounts: SavedAccountsResource;
8
+ constructor(http: HttpClient, session: UserSession | null);
9
+ onChange(listener: SessionChangeListener): () => void;
10
+ }
11
+ export type { Session };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionResource = void 0;
4
+ const saved_accounts_resource_1 = require("./saved-accounts-resource");
5
+ class SessionResource {
6
+ constructor(http, session) {
7
+ this.session = session;
8
+ this.savedAccounts = new saved_accounts_resource_1.SavedAccountsResource(http, session);
9
+ }
10
+ onChange(listener) {
11
+ var _a, _b;
12
+ return (_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.onChange(listener)) !== null && _b !== void 0 ? _b : (() => undefined);
13
+ }
14
+ }
15
+ exports.SessionResource = SessionResource;
@@ -0,0 +1,9 @@
1
+ import type { CreatePatientSharingInvite, PatientSharingInvite, PatientSharingShare, RedeemPatientSharingInvite } from "../../../client/patient-sharing/types";
2
+ import { HttpClient } from "../../http/http-client";
3
+ import { RequestOptions } from "../../http/transmit";
4
+ export declare class SharingInvitesResource {
5
+ private readonly http;
6
+ constructor(http: HttpClient);
7
+ create(body: CreatePatientSharingInvite, options?: RequestOptions): Promise<PatientSharingInvite>;
8
+ redeem(body: RedeemPatientSharingInvite, options?: RequestOptions): Promise<PatientSharingShare>;
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharingInvitesResource = void 0;
4
+ const INVITES_PATH = "v1/patient-sharing/invites";
5
+ const REDEEM_PATH = `${INVITES_PATH}/redeem`;
6
+ class SharingInvitesResource {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ create(body, options) {
11
+ return this.http.post(INVITES_PATH, body, options);
12
+ }
13
+ redeem(body, options) {
14
+ return this.http.post(REDEEM_PATH, body, options);
15
+ }
16
+ }
17
+ exports.SharingInvitesResource = SharingInvitesResource;
@@ -0,0 +1,10 @@
1
+ import { HttpClient } from "../../http/http-client";
2
+ import { SharingInvitesResource } from "./sharing-invites-resource";
3
+ import { SharingSettingsResource } from "./sharing-settings-resource";
4
+ import { SharingSharesResource } from "./sharing-shares-resource";
5
+ export declare class SharingResource {
6
+ readonly invites: SharingInvitesResource;
7
+ readonly shares: SharingSharesResource;
8
+ readonly settings: SharingSettingsResource;
9
+ constructor(http: HttpClient);
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharingResource = void 0;
4
+ const sharing_invites_resource_1 = require("./sharing-invites-resource");
5
+ const sharing_settings_resource_1 = require("./sharing-settings-resource");
6
+ const sharing_shares_resource_1 = require("./sharing-shares-resource");
7
+ class SharingResource {
8
+ constructor(http) {
9
+ this.invites = new sharing_invites_resource_1.SharingInvitesResource(http);
10
+ this.shares = new sharing_shares_resource_1.SharingSharesResource(http);
11
+ this.settings = new sharing_settings_resource_1.SharingSettingsResource(http);
12
+ }
13
+ }
14
+ exports.SharingResource = SharingResource;
@@ -0,0 +1,9 @@
1
+ import type { PatientSharingSettings, PatientSharingSettingsUpdate } from "../../../client/patient-sharing/types";
2
+ import { HttpClient } from "../../http/http-client";
3
+ import { RequestOptions } from "../../http/transmit";
4
+ export declare class SharingSettingsResource {
5
+ private readonly http;
6
+ constructor(http: HttpClient);
7
+ retrieve(options?: RequestOptions): Promise<PatientSharingSettings>;
8
+ update(settings: PatientSharingSettingsUpdate, options?: RequestOptions): Promise<PatientSharingSettings>;
9
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharingSettingsResource = void 0;
4
+ const SETTINGS_PATH = "v1/patient-sharing/settings";
5
+ class SharingSettingsResource {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ retrieve(options) {
10
+ return this.http.get(SETTINGS_PATH, options);
11
+ }
12
+ update(settings, options) {
13
+ return this.http.put(SETTINGS_PATH, settings, options);
14
+ }
15
+ }
16
+ exports.SharingSettingsResource = SharingSettingsResource;
@@ -0,0 +1,9 @@
1
+ import type { PatientSharingShares } from "../../../client/patient-sharing/types";
2
+ import { HttpClient } from "../../http/http-client";
3
+ import { RequestOptions } from "../../http/transmit";
4
+ export declare class SharingSharesResource {
5
+ private readonly http;
6
+ constructor(http: HttpClient);
7
+ list(options?: RequestOptions): Promise<PatientSharingShares>;
8
+ revoke(consentId: string, options?: RequestOptions): Promise<void>;
9
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharingSharesResource = void 0;
4
+ const url_1 = require("../../http/url");
5
+ const SHARES_PATH = "v1/patient-sharing/shares";
6
+ // An older server leaves out the groups it predates.
7
+ const withEveryGroup = (shares) => {
8
+ var _a, _b, _c;
9
+ return ({
10
+ ...shares,
11
+ practitioners: (_a = shares.practitioners) !== null && _a !== void 0 ? _a : [],
12
+ relatedPersons: (_b = shares.relatedPersons) !== null && _b !== void 0 ? _b : [],
13
+ received: (_c = shares.received) !== null && _c !== void 0 ? _c : [],
14
+ });
15
+ };
16
+ class SharingSharesResource {
17
+ constructor(http) {
18
+ this.http = http;
19
+ }
20
+ async list(options) {
21
+ return withEveryGroup(await this.http.get(SHARES_PATH, options));
22
+ }
23
+ revoke(consentId, options) {
24
+ return this.http.delete(`${SHARES_PATH}/${(0, url_1.pathSegment)(consentId)}`, options);
25
+ }
26
+ }
27
+ exports.SharingSharesResource = SharingSharesResource;
@@ -0,0 +1,14 @@
1
+ import { HttpClient, HttpMethod } from "../../http/http-client";
2
+ import { RequestOptions } from "../../http/transmit";
3
+ import { QueryParams } from "../../http/url";
4
+ export type SignalsGatewayRequest = {
5
+ method: HttpMethod;
6
+ path: readonly string[];
7
+ query?: QueryParams;
8
+ body?: unknown;
9
+ };
10
+ export declare class SignalsGatewayResource {
11
+ private readonly http;
12
+ constructor(http: HttpClient);
13
+ request<T = unknown>(request: SignalsGatewayRequest, options?: RequestOptions): Promise<T>;
14
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SignalsGatewayResource = void 0;
4
+ const ovok_errors_1 = require("../../errors/ovok-errors");
5
+ const url_1 = require("../../http/url");
6
+ const GATEWAY_PATH = "v1/signals/api";
7
+ const CONTROL_CHARACTER_RANGE_END = 0x1f;
8
+ const DELETE_CHARACTER_CODE = 0x7f;
9
+ class SignalsGatewayResource {
10
+ constructor(http) {
11
+ this.http = http;
12
+ }
13
+ request(request, options) {
14
+ var _a;
15
+ const path = pathFor(request.path);
16
+ const query = (0, url_1.toSearchQuery)((_a = request.query) !== null && _a !== void 0 ? _a : {});
17
+ return this.http.send({
18
+ method: request.method,
19
+ path: `${GATEWAY_PATH}/${path}${query}`,
20
+ body: request.body,
21
+ }, options);
22
+ }
23
+ }
24
+ exports.SignalsGatewayResource = SignalsGatewayResource;
25
+ const pathFor = (segments) => {
26
+ if (!Array.isArray(segments) ||
27
+ segments.length === 0 ||
28
+ !segments.every((segment) => isSafePathSegment(segment))) {
29
+ throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)("Signals gateway paths need non-empty, safe path segments."));
30
+ }
31
+ return segments.map(encodePathSegment).join("/");
32
+ };
33
+ const isSafePathSegment = (segment) => typeof segment === "string" &&
34
+ segment.length > 0 &&
35
+ segment !== "." &&
36
+ segment !== ".." &&
37
+ !segment.includes("/") &&
38
+ !segment.includes("\\") &&
39
+ !Array.from(segment).some(isControlCharacter);
40
+ const isControlCharacter = (character) => {
41
+ const code = character.charCodeAt(0);
42
+ return code <= CONTROL_CHARACTER_RANGE_END || code === DELETE_CHARACTER_CODE;
43
+ };
44
+ const encodePathSegment = (segment) => encodeURIComponent(segment).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
@@ -0,0 +1,13 @@
1
+ import type { EnableSignalsResponse } from "../../../client/signals/types";
2
+ import { HttpClient } from "../../http/http-client";
3
+ import { RequestOptions } from "../../http/transmit";
4
+ import { SignalsGatewayResource } from "./signals-gateway-resource";
5
+ import { UndeliverableResource } from "./undeliverable-resource";
6
+ export declare class SignalsResource {
7
+ private readonly http;
8
+ readonly gateway: SignalsGatewayResource;
9
+ readonly undeliverable: UndeliverableResource;
10
+ constructor(http: HttpClient);
11
+ /** Idempotent: retry after 409 or 503. Readings saved through Ovok reach Signals without a second submit. */
12
+ enable(patientId: string, options?: RequestOptions): Promise<EnableSignalsResponse>;
13
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SignalsResource = void 0;
4
+ const url_1 = require("../../http/url");
5
+ const signals_gateway_resource_1 = require("./signals-gateway-resource");
6
+ const undeliverable_resource_1 = require("./undeliverable-resource");
7
+ const enableSignalsPath = (patientId) => `fhir/Patient/${(0, url_1.pathSegment)(patientId)}/$enable-signals`;
8
+ class SignalsResource {
9
+ constructor(http) {
10
+ this.http = http;
11
+ this.gateway = new signals_gateway_resource_1.SignalsGatewayResource(http);
12
+ this.undeliverable = new undeliverable_resource_1.UndeliverableResource(http);
13
+ }
14
+ /** Idempotent: retry after 409 or 503. Readings saved through Ovok reach Signals without a second submit. */
15
+ enable(patientId, options) {
16
+ return this.http.post(enableSignalsPath(patientId), undefined, options);
17
+ }
18
+ }
19
+ exports.SignalsResource = SignalsResource;
@@ -0,0 +1,26 @@
1
+ import { HttpClient } from "../../http/http-client";
2
+ import { RequestOptions } from "../../http/transmit";
3
+ export type SignalsUndeliverableResident = {
4
+ patientId: string;
5
+ };
6
+ export type SignalsUndeliverable = {
7
+ count: number;
8
+ residents: SignalsUndeliverableResident[];
9
+ };
10
+ export type SignalsDeliveryRepair = {
11
+ patientIds?: string[];
12
+ };
13
+ export type SignalsDeliveryRepairResult = {
14
+ attempted: number;
15
+ repaired: number;
16
+ stillUndeliverable: number;
17
+ skipped: number;
18
+ notReached: number;
19
+ };
20
+ export declare class UndeliverableResource {
21
+ private readonly http;
22
+ constructor(http: HttpClient);
23
+ list(options?: RequestOptions): Promise<SignalsUndeliverable>;
24
+ /** Without `patientIds`, repairs the residents `list` shows. */
25
+ repair(request?: SignalsDeliveryRepair, options?: RequestOptions): Promise<SignalsDeliveryRepairResult>;
26
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UndeliverableResource = void 0;
4
+ const UNDELIVERABLE_PATH = "signals/config/undeliverable";
5
+ const REPAIR_PATH = `${UNDELIVERABLE_PATH}/repair`;
6
+ class UndeliverableResource {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ list(options) {
11
+ return this.http.get(UNDELIVERABLE_PATH, options);
12
+ }
13
+ /** Without `patientIds`, repairs the residents `list` shows. */
14
+ repair(request = {}, options) {
15
+ return this.http.post(REPAIR_PATH, request, options);
16
+ }
17
+ }
18
+ exports.UndeliverableResource = UndeliverableResource;
@@ -0,0 +1,13 @@
1
+ import { HttpClient } from "../../http/http-client";
2
+ import { RequestOptions } from "../../http/transmit";
3
+ /** Identical concurrent reads share one request, aborted only once every caller has aborted. */
4
+ export declare class LiveReads {
5
+ private readonly http;
6
+ private readonly inFlight;
7
+ constructor(http: HttpClient);
8
+ clear(): void;
9
+ get<T>(path: string, options?: RequestOptions): Promise<T>;
10
+ private share;
11
+ private start;
12
+ private forget;
13
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiveReads = void 0;
4
+ const SIGNAL_OPTION = "signal";
5
+ const ABORT_ERROR = "AbortError";
6
+ const ABORTED_MESSAGE = "The request was aborted.";
7
+ class SharedRead {
8
+ constructor(load, onDone) {
9
+ this.onDone = onDone;
10
+ this.controller = new AbortController();
11
+ this.subscribers = 0;
12
+ this.pending = true;
13
+ this.result = load(this.controller.signal).finally(() => this.finish());
14
+ this.result.catch(() => undefined);
15
+ }
16
+ join() {
17
+ this.subscribers += 1;
18
+ }
19
+ leave() {
20
+ this.subscribers -= 1;
21
+ const abandoned = this.pending && this.subscribers === 0;
22
+ if (abandoned) {
23
+ this.abort();
24
+ }
25
+ }
26
+ abort() {
27
+ this.finish();
28
+ this.controller.abort();
29
+ }
30
+ finish() {
31
+ if (!this.pending) {
32
+ return;
33
+ }
34
+ this.pending = false;
35
+ this.onDone();
36
+ }
37
+ }
38
+ /** Identical concurrent reads share one request, aborted only once every caller has aborted. */
39
+ class LiveReads {
40
+ constructor(http) {
41
+ this.http = http;
42
+ this.inFlight = new Map();
43
+ }
44
+ clear() {
45
+ const reads = [...this.inFlight.values()];
46
+ this.inFlight.clear();
47
+ reads.forEach((read) => read.abort());
48
+ }
49
+ get(path, options = {}) {
50
+ const shareable = Object.keys(options).every((key) => key === SIGNAL_OPTION);
51
+ return shareable ? this.share(path, options.signal) : this.http.get(path, options);
52
+ }
53
+ share(path, signal) {
54
+ var _a;
55
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
56
+ return Promise.reject(abortReason(signal));
57
+ }
58
+ return subscribe((_a = this.inFlight.get(path)) !== null && _a !== void 0 ? _a : this.start(path), signal);
59
+ }
60
+ start(path) {
61
+ const read = new SharedRead((signal) => this.http.get(path, { signal }), () => this.forget(path, read));
62
+ this.inFlight.set(path, read);
63
+ return read;
64
+ }
65
+ forget(path, read) {
66
+ if (this.inFlight.get(path) === read) {
67
+ this.inFlight.delete(path);
68
+ }
69
+ }
70
+ }
71
+ exports.LiveReads = LiveReads;
72
+ const subscribe = (read, signal) => new Promise((resolve, reject) => {
73
+ let subscribed = true;
74
+ const settle = (finish) => {
75
+ if (subscribed) {
76
+ subscribed = false;
77
+ signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
78
+ read.leave();
79
+ finish();
80
+ }
81
+ };
82
+ const onAbort = () => settle(() => reject(abortReason(signal)));
83
+ read.join();
84
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
85
+ read.result.then((value) => settle(() => resolve(value)), (error) => settle(() => reject(error)));
86
+ });
87
+ const abortReason = (signal) => { var _a; return (_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : Object.assign(new Error(ABORTED_MESSAGE), { name: ABORT_ERROR }); };
@@ -0,0 +1,13 @@
1
+ import type { SlimAlarmQuery, SlimAlarmsPage, SlimRecentAlarms } from "../../../client/notifications/types";
2
+ import type { SlimNotification } from "../../../client/slim/types";
3
+ import { HttpClient } from "../../http/http-client";
4
+ import { RequestOptions } from "../../http/transmit";
5
+ import { SlimRecentQuery } from "./slim-queries";
6
+ export declare class SlimAlarmsResource {
7
+ private readonly http;
8
+ constructor(http: HttpClient);
9
+ list(params?: SlimAlarmQuery, options?: RequestOptions): Promise<SlimAlarmsPage>;
10
+ recent(params?: SlimRecentQuery, options?: RequestOptions): Promise<SlimRecentAlarms>;
11
+ /** Can take about 12 s; the server makes it safe to repeat, so a 503 is retried. */
12
+ acknowledge(notificationId: string, options?: RequestOptions): Promise<SlimNotification>;
13
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlimAlarmsResource = void 0;
4
+ const query_string_1 = require("../../../client/query-string");
5
+ const url_1 = require("../../http/url");
6
+ const slim_paths_1 = require("./slim-paths");
7
+ const ALARMS_PATH = `${slim_paths_1.NOTIFICATIONS_PATH}/alarms`;
8
+ const RECENT_ALARMS_PATH = `${slim_paths_1.RECENT_NOTIFICATIONS_PATH}/alarms`;
9
+ class SlimAlarmsResource {
10
+ constructor(http) {
11
+ this.http = http;
12
+ }
13
+ list(params = {}, options) {
14
+ return this.http.get(`${ALARMS_PATH}${(0, query_string_1.toQueryString)(params)}`, options);
15
+ }
16
+ recent(params = {}, options) {
17
+ return this.http.get(`${RECENT_ALARMS_PATH}${(0, query_string_1.toQueryString)(params)}`, options);
18
+ }
19
+ /** Can take about 12 s; the server makes it safe to repeat, so a 503 is retried. */
20
+ acknowledge(notificationId, options) {
21
+ const path = `${slim_paths_1.NOTIFICATIONS_PATH}/${(0, url_1.pathSegment)(notificationId)}/ack`;
22
+ return this.http.send({ method: "PATCH", path, idempotent: true }, options);
23
+ }
24
+ }
25
+ exports.SlimAlarmsResource = SlimAlarmsResource;
@@ -0,0 +1,9 @@
1
+ import type { ChangeHistoryQuery, ChangeHistoryRow } from "../../../client/change-history/types";
2
+ import { HttpClient } from "../../http/http-client";
3
+ import { RequestOptions } from "../../http/transmit";
4
+ import { PagePromise } from "../../paging/page";
5
+ export declare class SlimChangeHistoryResource {
6
+ private readonly http;
7
+ constructor(http: HttpClient);
8
+ list(params?: ChangeHistoryQuery, options?: RequestOptions): PagePromise<ChangeHistoryRow>;
9
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlimChangeHistoryResource = void 0;
4
+ const url_1 = require("../../http/url");
5
+ const numbered_pages_1 = require("../../paging/numbered-pages");
6
+ const slim_paths_1 = require("./slim-paths");
7
+ const CHANGE_HISTORY_PATH = `${slim_paths_1.SLIM_PATH}/change-history`;
8
+ const TYPES_LIST_KEY = "types[]";
9
+ class SlimChangeHistoryResource {
10
+ constructor(http) {
11
+ this.http = http;
12
+ }
13
+ list(params = {}, options) {
14
+ return (0, numbered_pages_1.numberedPages)((page) => this.http.get(`${CHANGE_HISTORY_PATH}${changeHistoryQuery({ ...params, page })}`, options), params.page);
15
+ }
16
+ }
17
+ exports.SlimChangeHistoryResource = SlimChangeHistoryResource;
18
+ // The route reads `types[]` as a list; every other list repeats its own key.
19
+ const changeHistoryQuery = ({ types, ...rest }) => (0, url_1.toSearchQuery)({ ...rest, [TYPES_LIST_KEY]: types });
@@ -0,0 +1,17 @@
1
+ import type { SlimChildProjectInput, SlimProjectRelationshipsV2 } from "../../../client/slim/types";
2
+ import { HttpClient } from "../../http/http-client";
3
+ import { RequestOptions } from "../../http/transmit";
4
+ export type SlimChildProjectCreated = {
5
+ projectId: string;
6
+ success: true;
7
+ };
8
+ export type SlimChildProjectDeleted = {
9
+ success: true;
10
+ };
11
+ export declare class SlimChildProjectsResource {
12
+ private readonly http;
13
+ constructor(http: HttpClient);
14
+ list(options?: RequestOptions): Promise<SlimProjectRelationshipsV2>;
15
+ create(body: SlimChildProjectInput, options?: RequestOptions): Promise<SlimChildProjectCreated>;
16
+ delete(subProjectId: string, options?: RequestOptions): Promise<SlimChildProjectDeleted>;
17
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlimChildProjectsResource = void 0;
4
+ const url_1 = require("../../http/url");
5
+ const slim_paths_1 = require("./slim-paths");
6
+ const CHILD_PROJECTS_PATH = `${slim_paths_1.PROJECT_PATH}/child`;
7
+ const CHILD_PROJECTS_V2_PATH = `${slim_paths_1.SLIM_V2_PATH}/project/child`;
8
+ class SlimChildProjectsResource {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ list(options) {
13
+ return this.http.get(CHILD_PROJECTS_V2_PATH, options);
14
+ }
15
+ create(body, options) {
16
+ return this.http.post(CHILD_PROJECTS_PATH, body, options);
17
+ }
18
+ delete(subProjectId, options) {
19
+ return this.http.delete(`${CHILD_PROJECTS_PATH}/${(0, url_1.pathSegment)(subProjectId)}`, options);
20
+ }
21
+ }
22
+ exports.SlimChildProjectsResource = SlimChildProjectsResource;
@@ -0,0 +1,29 @@
1
+ import type { SlimAssignDevice, SlimCreateDevice, SlimDevice, SlimDeviceListItem, SlimDeviceListQuery, SlimDeviceTelemetry, SlimLiveQuery, SlimLiveTelemetry, SlimObservationIds, SlimUpdateDevice } from "../../../client/slim/types";
2
+ import type { UserSession } from "../../auth/user-session";
3
+ import { HttpClient } from "../../http/http-client";
4
+ import { RequestOptions } from "../../http/transmit";
5
+ import { PagePromise } from "../../paging/page";
6
+ export type SlimLiveDevice = Record<string, unknown>;
7
+ export type SlimDeviceObservationIds = Omit<SlimObservationIds, "batch">;
8
+ export type SlimObservationIdsByDevice = Record<string, SlimObservationIds>;
9
+ export declare class SlimDevicesResource {
10
+ private readonly http;
11
+ private readonly liveReads;
12
+ constructor(http: HttpClient, session?: UserSession | null);
13
+ list(params?: SlimDeviceListQuery, options?: RequestOptions): PagePromise<SlimDeviceListItem>;
14
+ retrieve(deviceId: string, options?: RequestOptions): Promise<SlimDevice>;
15
+ /** 409 when another customer holds the serial; 422 when this project already uses it. */
16
+ create(body: SlimCreateDevice, options?: RequestOptions): Promise<SlimDevice>;
17
+ /** Renaming moves the serial: live values return only after a reading under the new serial. */
18
+ update(deviceId: string, body: SlimUpdateDevice, options?: RequestOptions): Promise<SlimDevice>;
19
+ delete(deviceId: string, options?: RequestOptions): Promise<void>;
20
+ assignToProject(body: SlimAssignDevice, options?: RequestOptions): Promise<SlimDevice>;
21
+ live(params?: SlimLiveQuery, options?: RequestOptions): PagePromise<SlimLiveDevice>;
22
+ liveTelemetry(params?: SlimLiveQuery, options?: RequestOptions): Promise<SlimLiveTelemetry>;
23
+ telemetry(deviceId: string, options?: RequestOptions): Promise<SlimDeviceTelemetry>;
24
+ effectiveObservationIds(deviceId: string, options?: RequestOptions): Promise<SlimDeviceObservationIds>;
25
+ effectiveObservationIdsByDevice(options?: RequestOptions): Promise<SlimObservationIdsByDevice>;
26
+ lastObservationIds(deviceId: string, options?: RequestOptions): Promise<SlimObservationIds>;
27
+ lastObservationIdsByDevice(options?: RequestOptions): Promise<SlimObservationIdsByDevice>;
28
+ private readLive;
29
+ }