@ovok/core 0.4.59-dev.559 → 0.4.59-dev.561

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 (28) hide show
  1. package/dist/client/platform/methods.d.ts +20 -4
  2. package/dist/client/platform/methods.js +20 -4
  3. package/dist/client/wearables/methods.d.ts +10 -0
  4. package/dist/client/wearables/methods.js +10 -0
  5. package/dist/conformance/capability-requirements.js +1 -1
  6. package/dist/hooks/wearables-hooks.d.ts +8 -0
  7. package/dist/hooks/wearables-hooks.js +8 -0
  8. package/dist/next/index.d.ts +1 -1
  9. package/dist/next/outbox/guest-items.d.ts +9 -2
  10. package/dist/next/outbox/guest-items.js +11 -8
  11. package/dist/next/outbox/item-handovers.d.ts +23 -0
  12. package/dist/next/outbox/item-handovers.js +44 -0
  13. package/dist/next/outbox/outbox-items.d.ts +3 -0
  14. package/dist/next/outbox/outbox-items.js +10 -1
  15. package/dist/next/outbox/outbox-resource.d.ts +9 -2
  16. package/dist/next/outbox/outbox-resource.js +27 -21
  17. package/dist/next/outbox/outbox-snapshot.d.ts +1 -1
  18. package/dist/next/outbox/outbox-snapshot.js +2 -1
  19. package/dist/next/outbox/outbox-types.d.ts +12 -1
  20. package/dist/next/resources/measurements/measurements-resource.d.ts +8 -0
  21. package/dist/next/resources/measurements/measurements-resource.js +20 -0
  22. package/dist/next/resources/projects/project-members-resource.d.ts +1 -0
  23. package/dist/next/resources/projects/project-members-resource.js +1 -0
  24. package/dist/next/resources/projects/projects-resource.d.ts +5 -1
  25. package/dist/next/resources/wearables/wearable-providers-resource.d.ts +1 -0
  26. package/dist/next/resources/wearables/wearable-providers-resource.js +1 -0
  27. package/dist/next/resources/wearables/wearables-resource.d.ts +5 -1
  28. package/package.json +1 -1
@@ -8,7 +8,11 @@ export declare function listAdministeredProjects(this: OvokClient, params?: {
8
8
  page?: number;
9
9
  count?: number;
10
10
  }, requestOptions?: MedplumRequestOptions): Promise<OvokPage<OvokAdministeredProject>>;
11
- /** Lists the members of the current project, via `GET /v1/projects/me/members`. */
11
+ /**
12
+ * Lists the members of the current project, via `GET /v1/projects/me/members`.
13
+ *
14
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
15
+ */
12
16
  export declare function listProjectMembers(this: OvokClient, params?: {
13
17
  accessPolicyId?: string;
14
18
  profileId?: string;
@@ -16,11 +20,23 @@ export declare function listProjectMembers(this: OvokClient, params?: {
16
20
  page?: number;
17
21
  count?: number;
18
22
  }, requestOptions?: MedplumRequestOptions): Promise<OvokPage<OvokProjectMember>>;
19
- /** Invites a member to the current project, via `POST /v1/projects/me/members`. */
23
+ /**
24
+ * Invites a member to the current project, via `POST /v1/projects/me/members`.
25
+ *
26
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
27
+ */
20
28
  export declare function inviteProjectMember(this: OvokClient, body: OvokInviteProjectMember, requestOptions?: MedplumRequestOptions): Promise<OvokProjectMemberResponse>;
21
- /** Updates a project member, via `PATCH /v1/projects/me/members/{membershipId}`. */
29
+ /**
30
+ * Updates a project member, via `PATCH /v1/projects/me/members/{membershipId}`.
31
+ *
32
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
33
+ */
22
34
  export declare function updateProjectMember(this: OvokClient, membershipId: string, body: OvokUpdateProjectMember, requestOptions?: MedplumRequestOptions): Promise<OvokProjectMemberResponse>;
23
- /** Removes a project member, via `DELETE /v1/projects/me/members/{membershipId}`. */
35
+ /**
36
+ * Removes a project member, via `DELETE /v1/projects/me/members/{membershipId}`.
37
+ *
38
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
39
+ */
24
40
  export declare function removeProjectMember(this: OvokClient, membershipId: string, requestOptions?: MedplumRequestOptions): Promise<OvokRemoveProjectMemberResponse>;
25
41
  /** Reads the enabled features of the current project from `GET /v1/projects/me/features`. */
26
42
  export declare function getProjectFeatures(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<OvokProjectFeatures>;
@@ -30,19 +30,35 @@ async function getAccounts(requestOptions) {
30
30
  async function listAdministeredProjects(params = {}, requestOptions) {
31
31
  return this.get(`/v1/projects${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
32
32
  }
33
- /** Lists the members of the current project, via `GET /v1/projects/me/members`. */
33
+ /**
34
+ * Lists the members of the current project, via `GET /v1/projects/me/members`.
35
+ *
36
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
37
+ */
34
38
  async function listProjectMembers(params = {}, requestOptions) {
35
39
  return this.get(`/v1/projects/me/members${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
36
40
  }
37
- /** Invites a member to the current project, via `POST /v1/projects/me/members`. */
41
+ /**
42
+ * Invites a member to the current project, via `POST /v1/projects/me/members`.
43
+ *
44
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
45
+ */
38
46
  async function inviteProjectMember(body, requestOptions) {
39
47
  return this.post("/v1/projects/me/members", body, undefined, requestOptions);
40
48
  }
41
- /** Updates a project member, via `PATCH /v1/projects/me/members/{membershipId}`. */
49
+ /**
50
+ * Updates a project member, via `PATCH /v1/projects/me/members/{membershipId}`.
51
+ *
52
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
53
+ */
42
54
  async function updateProjectMember(membershipId, body, requestOptions) {
43
55
  return (await this.patch(`/v1/projects/me/members/${encodeURIComponent(membershipId)}`, body, ...(0, request_options_1.optionalArg)(requestOptions)));
44
56
  }
45
- /** Removes a project member, via `DELETE /v1/projects/me/members/{membershipId}`. */
57
+ /**
58
+ * Removes a project member, via `DELETE /v1/projects/me/members/{membershipId}`.
59
+ *
60
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
61
+ */
46
62
  async function removeProjectMember(membershipId, requestOptions) {
47
63
  return (await this.delete(`/v1/projects/me/members/${encodeURIComponent(membershipId)}`, ...(0, request_options_1.optionalArg)(requestOptions)));
48
64
  }
@@ -3,22 +3,32 @@ import { OvokClient } from "../ovok-client";
3
3
  import { CreateWearableProviderRequest, UpdateWearableProviderRequest, WearableConnectionAuthorization, WearableConnections, WearableProvider, WearableProviderSettings, WearableProviderSettingsList } from "./types";
4
4
  /**
5
5
  * Lists the project's wearable provider settings (`GET /v1/wearables/providers`).
6
+ *
7
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
6
8
  */
7
9
  export declare function listWearableProviders(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettingsList>;
8
10
  /**
9
11
  * Reads one provider's settings (`GET /v1/wearables/providers/{provider}`).
12
+ *
13
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
10
14
  */
11
15
  export declare function getWearableProvider(this: OvokClient, provider: WearableProvider, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettings>;
12
16
  /**
13
17
  * Configures a wearable provider (`POST /v1/wearables/providers`).
18
+ *
19
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
14
20
  */
15
21
  export declare function createWearableProvider(this: OvokClient, body: CreateWearableProviderRequest, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettings>;
16
22
  /**
17
23
  * Changes a provider's settings (`PATCH /v1/wearables/providers/{provider}`).
24
+ *
25
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
18
26
  */
19
27
  export declare function updateWearableProvider(this: OvokClient, provider: WearableProvider, body: UpdateWearableProviderRequest, requestOptions?: MedplumRequestOptions): Promise<WearableProviderSettings>;
20
28
  /**
21
29
  * Removes a provider's configuration (`DELETE /v1/wearables/providers/{provider}`).
30
+ *
31
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
22
32
  */
23
33
  export declare function deleteWearableProvider(this: OvokClient, provider: WearableProvider, requestOptions?: MedplumRequestOptions): Promise<void>;
24
34
  /**
@@ -19,18 +19,24 @@ const invalidateProviderSettings = (client, provider) => {
19
19
  };
20
20
  /**
21
21
  * Lists the project's wearable provider settings (`GET /v1/wearables/providers`).
22
+ *
23
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
22
24
  */
23
25
  function listWearableProviders(requestOptions) {
24
26
  return this.get("/v1/wearables/providers", ...(0, request_options_1.optionalArg)(requestOptions));
25
27
  }
26
28
  /**
27
29
  * Reads one provider's settings (`GET /v1/wearables/providers/{provider}`).
30
+ *
31
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
28
32
  */
29
33
  function getWearableProvider(provider, requestOptions) {
30
34
  return this.get(providerPath(provider), ...(0, request_options_1.optionalArg)(requestOptions));
31
35
  }
32
36
  /**
33
37
  * Configures a wearable provider (`POST /v1/wearables/providers`).
38
+ *
39
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
34
40
  */
35
41
  function createWearableProvider(body, requestOptions) {
36
42
  return this.post("/v1/wearables/providers", body, undefined, requestOptions).then((settings) => {
@@ -40,6 +46,8 @@ function createWearableProvider(body, requestOptions) {
40
46
  }
41
47
  /**
42
48
  * Changes a provider's settings (`PATCH /v1/wearables/providers/{provider}`).
49
+ *
50
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
43
51
  */
44
52
  async function updateWearableProvider(provider, body, requestOptions) {
45
53
  const settings = await this.patch(providerPath(provider), body, ...(0, request_options_1.optionalArg)(requestOptions));
@@ -48,6 +56,8 @@ async function updateWearableProvider(provider, body, requestOptions) {
48
56
  }
49
57
  /**
50
58
  * Removes a provider's configuration (`DELETE /v1/wearables/providers/{provider}`).
59
+ *
60
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
51
61
  */
52
62
  async function deleteWearableProvider(provider, requestOptions) {
53
63
  await this.delete(providerPath(provider), ...(0, request_options_1.optionalArg)(requestOptions));
@@ -26,7 +26,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
26
26
  description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
27
27
  software: {
28
28
  name: "@ovok/core",
29
- version: "0.4.59-dev.559+9428126",
29
+ version: "0.4.59-dev.561+d548a55",
30
30
  },
31
31
  fhirVersion: "4.0.1",
32
32
  format: ["json"],
@@ -2,6 +2,8 @@ import { CreateWearableProviderRequest, UpdateWearableProviderRequest, WearableC
2
2
  import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
3
  /**
4
4
  * Loads the wearable provider settings via `client.listWearableProviders`; reloads when providers change.
5
+ *
6
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
5
7
  */
6
8
  export declare const useWearableProviders: () => OvokRequestState<WearableProviderSettingsList>;
7
9
  /**
@@ -10,10 +12,14 @@ export declare const useWearableProviders: () => OvokRequestState<WearableProvid
10
12
  export declare const useWearableConnections: () => OvokRequestState<WearableConnections>;
11
13
  /**
12
14
  * Mutation that configures a wearable provider via `client.createWearableProvider`.
15
+ *
16
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
13
17
  */
14
18
  export declare const useCreateWearableProvider: () => OvokMutationState<CreateWearableProviderRequest, WearableProviderSettings>;
15
19
  /**
16
20
  * Mutation that changes a wearable provider's settings via `client.updateWearableProvider`.
21
+ *
22
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
17
23
  */
18
24
  export declare const useUpdateWearableProvider: () => OvokMutationState<{
19
25
  /** Provider to update. */
@@ -23,6 +29,8 @@ export declare const useUpdateWearableProvider: () => OvokMutationState<{
23
29
  }, WearableProviderSettings>;
24
30
  /**
25
31
  * Mutation that removes a wearable provider via `client.deleteWearableProvider`; its parameter is the provider.
32
+ *
33
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
26
34
  */
27
35
  export declare const useDeleteWearableProvider: () => OvokMutationState<WearableProvider, void>;
28
36
  /**
@@ -41,6 +41,8 @@ const wearable_invalidation_1 = require("./wearable-invalidation");
41
41
  const index_1 = require("./index");
42
42
  /**
43
43
  * Loads the wearable provider settings via `client.listWearableProviders`; reloads when providers change.
44
+ *
45
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
44
46
  */
45
47
  const useWearableProviders = () => {
46
48
  const client = (0, index_1.useClient)();
@@ -61,6 +63,8 @@ const useWearableConnections = () => {
61
63
  exports.useWearableConnections = useWearableConnections;
62
64
  /**
63
65
  * Mutation that configures a wearable provider via `client.createWearableProvider`.
66
+ *
67
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
64
68
  */
65
69
  const useCreateWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (client, body) => {
66
70
  const settings = await client.createWearableProvider(body);
@@ -70,6 +74,8 @@ const useCreateWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (
70
74
  exports.useCreateWearableProvider = useCreateWearableProvider;
71
75
  /**
72
76
  * Mutation that changes a wearable provider's settings via `client.updateWearableProvider`.
77
+ *
78
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
73
79
  */
74
80
  const useUpdateWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (client, { provider, body }) => {
75
81
  const settings = await client.updateWearableProvider(provider, body);
@@ -79,6 +85,8 @@ const useUpdateWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (
79
85
  exports.useUpdateWearableProvider = useUpdateWearableProvider;
80
86
  /**
81
87
  * Mutation that removes a wearable provider via `client.deleteWearableProvider`; its parameter is the provider.
88
+ *
89
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
82
90
  */
83
91
  const useDeleteWearableProvider = () => (0, api_hooks_1.useOvokMutation)(async (client, provider) => {
84
92
  await client.deleteWearableProvider(provider);
@@ -15,7 +15,7 @@ export type { IndexedDbOutboxOptions } from "./outbox/indexed-db-outbox-store";
15
15
  export type { OutboxStore } from "./outbox/outbox-store";
16
16
  export type { OutboxStoreCheck } from "./outbox/store-contract";
17
17
  export type { OutboxConnectivity, OutboxLifecycle } from "./outbox/outbox-triggers";
18
- export type { OutboxDeleteTarget, OutboxFailure, OutboxFlushResult, OutboxGroupProgress, OutboxItem, OutboxItemSummary, OutboxKind, OutboxSentItem, OutboxSnapshot, OutboxState, } from "./outbox/outbox-types";
18
+ export type { OutboxDeleteTarget, OutboxFailure, OutboxFlushResult, OutboxGroupProgress, OutboxHeldItem, OutboxItem, OutboxItemSummary, OutboxKind, OutboxSentItem, OutboxSnapshot, OutboxState, } from "./outbox/outbox-types";
19
19
  export type { OvokLogEntry, OvokLogger } from "./logging/ovok-logger";
20
20
  export type { OvokStorage } from "./storage/ovok-storage";
21
21
  export { OvokAuthenticationError, OvokConfigError, OvokConflictError, OvokConnectionError, OvokError, OvokNotFoundError, OvokPermissionError, OvokRateLimitError, OvokServiceError, OvokTimeoutError, OvokValidationError, } from "./errors/ovok-errors";
@@ -14,5 +14,12 @@ export declare const GUEST_PATIENT_ID = "guest";
14
14
  export declare const GUEST_SUBJECT = "Patient/guest";
15
15
  /** The account an owner's items are sent for; a guest's wait for `adopt`. */
16
16
  export declare const sendingOwner: (ownerKey: string | null) => string | null;
17
- /** Hands every guest item to `ownerKey`, its observations naming `patient`, a reference such as `Patient/1`; returns how many. */
18
- export declare const adoptGuestItems: (store: OutboxStore, ownerKey: string, patient: string) => Promise<number>;
17
+ /** The owner of the readings an account keeps on the device until it names who was measured; `adopt` never takes them. */
18
+ export declare const heldOwnerKey: (ownerKey: string) => string;
19
+ /** Hands the items of `fromOwner`, or only those in `ids`, to `toOwner`, their observations naming `patient`; returns how many. */
20
+ export declare const handOverItems: (store: OutboxStore, { fromOwner, toOwner, patient, ids }: {
21
+ fromOwner: string;
22
+ toOwner: string;
23
+ patient: string;
24
+ ids?: string[];
25
+ }) => Promise<number>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.adoptGuestItems = exports.sendingOwner = exports.GUEST_SUBJECT = exports.GUEST_PATIENT_ID = exports.GUEST_OWNER_KEY = void 0;
3
+ exports.handOverItems = exports.heldOwnerKey = exports.sendingOwner = exports.GUEST_SUBJECT = exports.GUEST_PATIENT_ID = exports.GUEST_OWNER_KEY = void 0;
4
4
  const entry_observation_1 = require("./entry-observation");
5
5
  /**
6
6
  * The owner of what is saved while nobody is signed in. A guest's items are never sent; `adopt` hands them to a patient.
@@ -55,15 +55,18 @@ const adoptedItem = (item, ownerKey, patient) => ({
55
55
  /** The account an owner's items are sent for; a guest's wait for `adopt`. */
56
56
  const sendingOwner = (ownerKey) => (ownerKey === exports.GUEST_OWNER_KEY ? null : ownerKey);
57
57
  exports.sendingOwner = sendingOwner;
58
- /** Hands every guest item to `ownerKey`, its observations naming `patient`, a reference such as `Patient/1`; returns how many. */
59
- const adoptGuestItems = async (store, ownerKey, patient) => {
60
- const guestItems = await store.summaries(exports.GUEST_OWNER_KEY);
61
- for (const { id } of guestItems) {
58
+ /** The owner of the readings an account keeps on the device until it names who was measured; `adopt` never takes them. */
59
+ const heldOwnerKey = (ownerKey) => `held:${ownerKey}`;
60
+ exports.heldOwnerKey = heldOwnerKey;
61
+ /** Hands the items of `fromOwner`, or only those in `ids`, to `toOwner`, their observations naming `patient`; returns how many. */
62
+ const handOverItems = async (store, { fromOwner, toOwner, patient, ids }) => {
63
+ const handed = (await store.summaries(fromOwner)).filter(({ id }) => ids === undefined || ids.includes(id));
64
+ for (const { id } of handed) {
62
65
  const item = await store.get(id);
63
66
  if (item) {
64
- await store.put(adoptedItem(item, ownerKey, patient));
67
+ await store.put(adoptedItem(item, toOwner, patient));
65
68
  }
66
69
  }
67
- return guestItems.length;
70
+ return handed.length;
68
71
  };
69
- exports.adoptGuestItems = adoptGuestItems;
72
+ exports.handOverItems = handOverItems;
@@ -0,0 +1,23 @@
1
+ import type { OutboxStore } from "./outbox-store";
2
+ import type { OutboxHeldItem, OutboxItemSummary } from "./outbox-types";
3
+ import type { ScopedLogger } from "../logging/ovok-logger";
4
+ type HandoverPorts = {
5
+ store: OutboxStore;
6
+ ownerKey: () => Promise<string | null>;
7
+ signedInProfile: () => Promise<string>;
8
+ ready: () => Promise<void>;
9
+ log: ScopedLogger;
10
+ /** Called after items changed hands, to send them and tell listeners. */
11
+ changed: () => void;
12
+ };
13
+ /** Moves the items of the guest and of the held readings to the signed-in account. */
14
+ export declare class ItemHandovers {
15
+ private readonly ports;
16
+ constructor(ports: HandoverPorts);
17
+ heldSummaries(): Promise<OutboxItemSummary[]>;
18
+ held(): Promise<OutboxHeldItem[]>;
19
+ adopt(patientId?: string): Promise<number>;
20
+ assign(patientId: string, ids?: string[]): Promise<number>;
21
+ private handOver;
22
+ }
23
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ItemHandovers = void 0;
4
+ const ovok_errors_1 = require("../errors/ovok-errors");
5
+ const entry_observation_1 = require("./entry-observation");
6
+ const guest_items_1 = require("./guest-items");
7
+ const outbox_queries_1 = require("./outbox-queries");
8
+ /** Moves the items of the guest and of the held readings to the signed-in account. */
9
+ class ItemHandovers {
10
+ constructor(ports) {
11
+ this.ports = ports;
12
+ }
13
+ async heldSummaries() {
14
+ const ownerKey = (0, guest_items_1.sendingOwner)(await this.ports.ownerKey());
15
+ return ownerKey === null ? [] : this.ports.store.summaries((0, guest_items_1.heldOwnerKey)(ownerKey));
16
+ }
17
+ async held() {
18
+ const summaries = (await this.heldSummaries()).sort(outbox_queries_1.newestFirst);
19
+ const items = await Promise.all(summaries.map(({ id }) => this.ports.store.get(id)));
20
+ return items.flatMap((item) => item ? [{ id: item.id, createdAt: item.createdAt, observations: item.entries.flatMap((entry) => { var _a; return (_a = (0, entry_observation_1.observationOf)(entry)) !== null && _a !== void 0 ? _a : []; }) }] : []);
21
+ }
22
+ async adopt(patientId) {
23
+ return this.handOver("adopted", "adopt a guest's readings", async (ownerKey) => (0, guest_items_1.handOverItems)(this.ports.store, {
24
+ fromOwner: guest_items_1.GUEST_OWNER_KEY,
25
+ toOwner: ownerKey,
26
+ patient: patientId ? `Patient/${patientId}` : await this.ports.signedInProfile(),
27
+ }));
28
+ }
29
+ async assign(patientId, ids) {
30
+ return this.handOver("assigned", "assign held readings", (ownerKey) => (0, guest_items_1.handOverItems)(this.ports.store, { fromOwner: (0, guest_items_1.heldOwnerKey)(ownerKey), toOwner: ownerKey, patient: `Patient/${patientId}`, ids }));
31
+ }
32
+ async handOver(event, purpose, move) {
33
+ await this.ports.ready();
34
+ const ownerKey = (0, guest_items_1.sendingOwner)(await this.ports.ownerKey());
35
+ if (ownerKey === null) {
36
+ throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)(`No user is signed in; sign in to ${purpose}.`));
37
+ }
38
+ const items = await move(ownerKey);
39
+ this.ports.log.info(`outbox.${event}`, { items });
40
+ this.ports.changed();
41
+ return items;
42
+ }
43
+ }
44
+ exports.ItemHandovers = ItemHandovers;
@@ -1,3 +1,4 @@
1
+ import type { OutboxStore } from "./outbox-store";
1
2
  import type { OutboxDeleteTarget, OutboxItem } from "./outbox-types";
2
3
  import type { BundleEntry, Observation } from "@medplum/fhirtypes";
3
4
  import { ObservationEntryOptions } from "../../client/offline";
@@ -15,3 +16,5 @@ export declare const recordedAtOf: (observation: Observation | undefined, fallba
15
16
  */
16
17
  export declare const draftsFor: (observations: Observation[], options: ObservationEntryOptions, ownerKey: string, now: number) => OutboxDraft[];
17
18
  export declare const deleteDraft: (target: OutboxDeleteTarget, subject: string, ownerKey: string, now: number) => OutboxDraft;
19
+ /** Puts a refused item back to pending, as if it had not been tried. */
20
+ export declare const resendItem: (store: OutboxStore, id: string) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteDraft = exports.draftsFor = exports.recordedAtOf = exports.measurementItemId = void 0;
3
+ exports.resendItem = exports.deleteDraft = exports.draftsFor = exports.recordedAtOf = exports.measurementItemId = void 0;
4
4
  const fhir_systems_1 = require("../../client/observation/fhir-systems");
5
5
  const observation_bundle_utils_1 = require("../../client/observation/observation-bundle-utils");
6
6
  const reading_group_1 = require("../../client/observation/reading-group");
@@ -87,3 +87,12 @@ const deleteDraft = (target, subject, ownerKey, now) => {
87
87
  };
88
88
  };
89
89
  exports.deleteDraft = deleteDraft;
90
+ /** Puts a refused item back to pending, as if it had not been tried. */
91
+ const resendItem = async (store, id) => {
92
+ const item = await store.get(id);
93
+ if (item) {
94
+ const { lastFailure: _failure, ...rest } = item;
95
+ await store.put({ ...rest, state: "pending", attempts: 0, nextAttemptAt: 0 });
96
+ }
97
+ };
98
+ exports.resendItem = resendItem;
@@ -1,7 +1,7 @@
1
1
  import type { OutboxTransport } from "./outbox-runner";
2
2
  import type { OutboxStore } from "./outbox-store";
3
3
  import type { OutboxConnectivity, OutboxLifecycle } from "./outbox-triggers";
4
- import type { OutboxDeleteTarget, OutboxFlushResult, OutboxItemSummary, OutboxSentItem, OutboxSnapshot } from "./outbox-types";
4
+ import type { OutboxDeleteTarget, OutboxFlushResult, OutboxHeldItem, OutboxItemSummary, OutboxSentItem, OutboxSnapshot } from "./outbox-types";
5
5
  import type { RequestOptions } from "../http/transmit";
6
6
  import type { OvokLogger } from "../logging/ovok-logger";
7
7
  import type { OvokStorage } from "../storage/ovok-storage";
@@ -36,6 +36,7 @@ export declare class OutboxResource {
36
36
  private readonly settings;
37
37
  private readonly store;
38
38
  private readonly runner;
39
+ private readonly handovers;
39
40
  private readonly ready;
40
41
  private readonly listeners;
41
42
  private readonly log;
@@ -54,6 +55,8 @@ export declare class OutboxResource {
54
55
  flush(options?: RequestOptions): Promise<OutboxFlushResult>;
55
56
  /** Puts refused items back to pending, the given ones or all of them, and returns how many. */
56
57
  resend(ids?: string[]): Promise<number>;
58
+ /** The signed-in account's held readings, newest first, for asking who was measured. */
59
+ held(): Promise<OutboxHeldItem[]>;
57
60
  /** Deletes an item that has not been sent; a reading discarded here is not saved. */
58
61
  discard(id: string): Promise<void>;
59
62
  /** The observations of the pending items, for showing readings that are not saved yet. */
@@ -65,12 +68,16 @@ export declare class OutboxResource {
65
68
  * profile by default, as the subject of its observations, then sends them. Returns how many items it handed over.
66
69
  */
67
70
  adopt(patientId?: string): Promise<number>;
71
+ /**
72
+ * Hands the signed-in account's held readings, all or only those in `ids`, to that account as items about the
73
+ * patient, then sends them. Returns how many items it handed over.
74
+ */
75
+ assign(patientId: string, ids?: string[]): Promise<number>;
68
76
  /** @internal Stores items for sending; a newer version of a series or segment replaces the stored one. */
69
77
  enqueue(ownerKey: string, drafts: OutboxDraft[]): Promise<void>;
70
78
  /** @internal Sends what is due now and reports what happened to each item. */
71
79
  flushReport(options?: RequestOptions): Promise<FlushReport>;
72
80
  private storeDraft;
73
- private resendOne;
74
81
  private storedSummaries;
75
82
  private importOldQueue;
76
83
  private wakeAfterReady;
@@ -5,6 +5,7 @@ const ovok_errors_1 = require("../errors/ovok-errors");
5
5
  const ovok_logger_1 = require("../logging/ovok-logger");
6
6
  const entry_observation_1 = require("./entry-observation");
7
7
  const guest_items_1 = require("./guest-items");
8
+ const item_handovers_1 = require("./item-handovers");
8
9
  const legacy_queue_import_1 = require("./legacy-queue-import");
9
10
  const memory_outbox_store_1 = require("./memory-outbox-store");
10
11
  const outbox_items_1 = require("./outbox-items");
@@ -41,6 +42,17 @@ class OutboxResource {
41
42
  changed: () => this.notify(),
42
43
  });
43
44
  this.ready = this.importOldQueue();
45
+ this.handovers = new item_handovers_1.ItemHandovers({
46
+ store: this.store,
47
+ ownerKey: settings.ownerKey,
48
+ signedInProfile: settings.signedInProfile,
49
+ ready: () => this.ready,
50
+ log: this.log,
51
+ changed: () => {
52
+ this.runner.wake(0);
53
+ this.notify();
54
+ },
55
+ });
44
56
  this.wakeAfterReady(STARTUP_DELAY_MS);
45
57
  [settings.connectivity, settings.lifecycle].forEach((trigger) => trigger.subscribe(() => this.wakeAfterReady(0)));
46
58
  settings.onSessionChange(() => {
@@ -50,7 +62,7 @@ class OutboxResource {
50
62
  }
51
63
  /** What the signed-in account has waiting and what the outbox is doing now. */
52
64
  async snapshot() {
53
- return (0, outbox_snapshot_1.buildSnapshot)(await this.storedSummaries(), this.runner.view());
65
+ return (0, outbox_snapshot_1.buildSnapshot)(await this.storedSummaries(), this.runner.view(), (await this.handovers.heldSummaries()).length);
54
66
  }
55
67
  /** The signed-in account's items in any state, newest first, without their entries. */
56
68
  async items() {
@@ -78,11 +90,15 @@ class OutboxResource {
78
90
  async resend(ids) {
79
91
  const refused = (await this.storedSummaries()).filter(({ id, state }) => state === "rejected" && (ids === undefined || ids.includes(id)));
80
92
  for (const { id } of refused) {
81
- await this.resendOne(id);
93
+ await (0, outbox_items_1.resendItem)(this.store, id);
82
94
  }
83
95
  this.wakeAfterReady(0);
84
96
  return refused.length;
85
97
  }
98
+ /** The signed-in account's held readings, newest first, for asking who was measured. */
99
+ held() {
100
+ return this.handovers.held();
101
+ }
86
102
  /** Deletes an item that has not been sent; a reading discarded here is not saved. */
87
103
  async discard(id) {
88
104
  await this.ready;
@@ -114,18 +130,15 @@ class OutboxResource {
114
130
  * Hands every item saved while nobody was signed in to the signed-in account, naming the patient, the signed-in
115
131
  * profile by default, as the subject of its observations, then sends them. Returns how many items it handed over.
116
132
  */
117
- async adopt(patientId) {
118
- await this.ready;
119
- const ownerKey = (0, guest_items_1.sendingOwner)(await this.settings.ownerKey());
120
- if (ownerKey === null) {
121
- throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)("No user is signed in; sign in to adopt a guest's readings."));
122
- }
123
- const patient = patientId ? `Patient/${patientId}` : await this.settings.signedInProfile();
124
- const adopted = await (0, guest_items_1.adoptGuestItems)(this.store, ownerKey, patient);
125
- this.log.info("outbox.adopted", { items: adopted });
126
- this.runner.wake(0);
127
- this.notify();
128
- return adopted;
133
+ adopt(patientId) {
134
+ return this.handovers.adopt(patientId);
135
+ }
136
+ /**
137
+ * Hands the signed-in account's held readings, all or only those in `ids`, to that account as items about the
138
+ * patient, then sends them. Returns how many items it handed over.
139
+ */
140
+ assign(patientId, ids) {
141
+ return this.handovers.assign(patientId, ids);
129
142
  }
130
143
  /** @internal Stores items for sending; a newer version of a series or segment replaces the stored one. */
131
144
  async enqueue(ownerKey, drafts) {
@@ -158,13 +171,6 @@ class OutboxResource {
158
171
  createdAt: (_a = existing === null || existing === void 0 ? void 0 : existing.createdAt) !== null && _a !== void 0 ? _a : this.now(),
159
172
  });
160
173
  }
161
- async resendOne(id) {
162
- const item = await this.store.get(id);
163
- if (item) {
164
- const { lastFailure: _failure, ...rest } = item;
165
- await this.store.put({ ...rest, state: "pending", attempts: 0, nextAttemptAt: 0 });
166
- }
167
- }
168
174
  async storedSummaries() {
169
175
  await this.ready;
170
176
  const ownerKey = await this.settings.ownerKey();
@@ -1,3 +1,3 @@
1
1
  import type { OutboxItemSummary, OutboxSnapshot } from "./outbox-types";
2
2
  import type { RunnerView } from "./runner-state";
3
- export declare const buildSnapshot: (stored: OutboxItemSummary[], state: RunnerView) => OutboxSnapshot;
3
+ export declare const buildSnapshot: (stored: OutboxItemSummary[], state: RunnerView, held: number) => OutboxSnapshot;
@@ -23,7 +23,7 @@ const groupProgress = (items) => {
23
23
  return [...byGroup].map(([id, members]) => progressOf(id, members));
24
24
  };
25
25
  const oldest = (items) => items.length === 0 ? null : items.reduce((first, { createdAt }) => Math.min(first, createdAt), Infinity);
26
- const buildSnapshot = (stored, state) => {
26
+ const buildSnapshot = (stored, state, held) => {
27
27
  const pending = stored.filter((item) => item.state === "pending");
28
28
  return {
29
29
  pending: pending.length,
@@ -35,6 +35,7 @@ const buildSnapshot = (stored, state) => {
35
35
  lastError: state.lastError,
36
36
  byKind: countByKind(pending),
37
37
  groups: groupProgress(stored),
38
+ held,
38
39
  };
39
40
  };
40
41
  exports.buildSnapshot = buildSnapshot;
@@ -1,4 +1,4 @@
1
- import type { BundleEntry, CodeableConcept } from "@medplum/fhirtypes";
1
+ import type { BundleEntry, CodeableConcept, Observation } from "@medplum/fhirtypes";
2
2
  /**
3
3
  * What an outbox item holds: a whole reading, a growing series, one piece of a long recording, or a deletion.
4
4
  *
@@ -111,6 +111,17 @@ export type OutboxSnapshot = {
111
111
  byKind: Record<OutboxKind, number>;
112
112
  /** Progress of each long recording that is not yet saved. */
113
113
  groups: OutboxGroupProgress[];
114
+ /** Readings kept on the device until `assign` names who was measured; they are never sent before that. */
115
+ held: number;
116
+ };
117
+ /**
118
+ * A reading kept on the device until `assign` names who was measured.
119
+ *
120
+ * @category outbox
121
+ */
122
+ export type OutboxHeldItem = Pick<OutboxItemSummary, "id" | "createdAt"> & {
123
+ /** The reading's observations, naming a placeholder subject. */
124
+ observations: Observation[];
114
125
  };
115
126
  /**
116
127
  * Counts from one flush.
@@ -114,6 +114,14 @@ export declare class MeasurementsResource {
114
114
  * the reading is kept for the guest and says queued.
115
115
  */
116
116
  saveObservations(observations: Observation[], options?: SaveObservationsOptions): Promise<SaveObservationsResult>;
117
+ /** Builds Observations from a measurement and keeps them on the device until `outbox.assign` names who was measured. */
118
+ hold(params: BuildObservationsParams, options?: SaveObservationsOptions): Promise<SaveObservationsResult>;
119
+ /**
120
+ * Keeps one reading, main observation first, for the signed-in account, which `outbox.assign` hands to a patient. The
121
+ * observations should name the guest as their subject, as `hold` builds them. A held reading is never sent before
122
+ * that, and says queued. It throws when nobody is signed in.
123
+ */
124
+ holdObservations(observations: Observation[], options?: SaveObservationsOptions): Promise<SaveObservationsResult>;
117
125
  /**
118
126
  * Many readings, each main observation first, in as few requests as fit. They go through the outbox: readings the
119
127
  * server accepts are in the response, the rest wait in the outbox and are sent when they can be, and a reading the
@@ -5,6 +5,7 @@ const observationsToMeasurements_1 = require("../../../client/observation/method
5
5
  const observation_bundle_utils_1 = require("../../../client/observation/observation-bundle-utils");
6
6
  const offline_measurement_queue_1 = require("../../../client/offline/offline-measurement-queue");
7
7
  const query_string_1 = require("../../../client/query-string");
8
+ const ovok_errors_1 = require("../../errors/ovok-errors");
8
9
  const url_1 = require("../../http/url");
9
10
  const guest_items_1 = require("../../outbox/guest-items");
10
11
  const outbox_items_1 = require("../../outbox/outbox-items");
@@ -65,6 +66,25 @@ class MeasurementsResource {
65
66
  ? { status: "saved", response }
66
67
  : { status: "queued", queueId: drafts[drafts.length - 1].id };
67
68
  }
69
+ /** Builds Observations from a measurement and keeps them on the device until `outbox.assign` names who was measured. */
70
+ async hold(params, options) {
71
+ return this.holdObservations((0, observation_builder_1.buildObservations)(params, guest_items_1.GUEST_SUBJECT), options);
72
+ }
73
+ /**
74
+ * Keeps one reading, main observation first, for the signed-in account, which `outbox.assign` hands to a patient. The
75
+ * observations should name the guest as their subject, as `hold` builds them. A held reading is never sent before
76
+ * that, and says queued. It throws when nobody is signed in.
77
+ */
78
+ async holdObservations(observations, options = {}) {
79
+ const { identifierSystems, replace } = options;
80
+ const ownerKey = await this.currentOwnerKey();
81
+ if (ownerKey === null || ownerKey === guest_items_1.GUEST_OWNER_KEY) {
82
+ throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)("No user is signed in; readings are held per account."));
83
+ }
84
+ const drafts = (0, outbox_items_1.draftsFor)(observations, { identifierSystems, replace }, (0, guest_items_1.heldOwnerKey)(ownerKey), Date.now());
85
+ await this.outbox.enqueue((0, guest_items_1.heldOwnerKey)(ownerKey), drafts);
86
+ return { status: "queued", queueId: drafts[drafts.length - 1].id };
87
+ }
68
88
  /**
69
89
  * Many readings, each main observation first, in as few requests as fit. They go through the outbox: readings the
70
90
  * server accepts are in the response, the rest wait in the outbox and are sent when they can be, and a reading the
@@ -22,6 +22,7 @@ export type ProjectMemberListQuery = {
22
22
  /**
23
23
  * Members of the current project.
24
24
  *
25
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
25
26
  * @category projects
26
27
  */
27
28
  export declare class ProjectMembersResource {
@@ -8,6 +8,7 @@ const memberPath = (membershipId) => `${MEMBERS_PATH}/${(0, url_1.pathSegment)(m
8
8
  /**
9
9
  * Members of the current project.
10
10
  *
11
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
11
12
  * @category projects
12
13
  */
13
14
  class ProjectMembersResource {
@@ -23,7 +23,11 @@ export type ProjectListQuery = {
23
23
  */
24
24
  export declare class ProjectsResource {
25
25
  private readonly http;
26
- /** Members of the current project. */
26
+ /**
27
+ * Members of the current project.
28
+ *
29
+ * @deprecated The route stops answering on 2026-12-01; manage project admins in the Ovok Console.
30
+ */
27
31
  readonly members: ProjectMembersResource;
28
32
  /** Features enabled for the current project. */
29
33
  readonly features: ProjectFeaturesResource;
@@ -4,6 +4,7 @@ import { RequestOptions } from "../../http/transmit";
4
4
  /**
5
5
  * Wearable provider settings.
6
6
  *
7
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
7
8
  * @category wearables
8
9
  */
9
10
  export declare class WearableProvidersResource {
@@ -7,6 +7,7 @@ const providerPath = (provider) => `${PROVIDERS_PATH}/${(0, url_1.pathSegment)(p
7
7
  /**
8
8
  * Wearable provider settings.
9
9
  *
10
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
10
11
  * @category wearables
11
12
  */
12
13
  class WearableProvidersResource {
@@ -7,7 +7,11 @@ import { WearableProvidersResource } from "./wearable-providers-resource";
7
7
  * @category wearables
8
8
  */
9
9
  export declare class WearablesResource {
10
- /** Supported wearable providers. */
10
+ /**
11
+ * Supported wearable providers.
12
+ *
13
+ * @deprecated The route stops answering on 2026-12-01; manage wearable providers in the Ovok Console.
14
+ */
11
15
  readonly providers: WearableProvidersResource;
12
16
  /** Wearable connections. */
13
17
  readonly connections: WearableConnectionsResource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.4.59-dev.559+9428126",
3
+ "version": "0.4.59-dev.561+d548a55",
4
4
  "private": false,
5
5
  "main": "dist/next/index.js",
6
6
  "types": "dist/next/index.d.ts",